Changeset 3193 in MondoRescue for branches/3.2/mondo/src/mondoarchive/mondoarchive.c
- Timestamp:
- Sep 29, 2013, 9:31:34 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.2/mondo/src/mondoarchive/mondoarchive.c
r3185 r3193 10 10 #include "my-stuff.h" 11 11 #include "mr_mem.h" 12 #include "mr_str.h" 12 13 #include "../common/mondostructures.h" 13 14 #include "../common/libmondo.h" … … 32 33 33 34 /***************** global vars, used only by main.c ******************/ 34 long diffs ;35 long diffs = 0L; 35 36 36 37 extern t_bkptype g_backup_media_type; 37 38 extern int g_loglevel; 39 40 extern char *g_magicdev_command; 38 41 39 42 /** … … 74 77 char *tmp = NULL; 75 78 76 log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", 77 PACKAGE_VERSION); 79 log_msg(0, "Mondo Archive v%s --- http://www.mondorescue.org", PACKAGE_VERSION); 78 80 log_msg(0, "running %s binaries", get_architecture()); 79 81 tmp = get_uname_m(); 80 82 log_msg(0, "running on %s architecture", tmp); 81 83 mr_free(tmp); 82 log_msg(0, 83 "-----------------------------------------------------------"); 84 log_msg(0, 85 "NB: Mondo logs almost everything, so don't panic if you see"); 86 log_msg(0, 87 "some error messages. Please read them carefully before you"); 88 log_msg(0, 89 "decide to break out in a cold sweat. Despite (or perhaps"); 90 log_msg(0, 91 "because of) the wealth of messages. some users are inclined"); 92 log_msg(0, 93 "to stop reading this log. If Mondo stopped for some reason,"); 94 log_msg(0, 95 "chances are it's detailed here. More than likely there's a"); 96 log_msg(0, 97 "message at the very end of this log that will tell you what"); 98 log_msg(0, 99 "is wrong. Please read it! -Devteam"); 100 log_msg(0, 101 "-----------------------------------------------------------"); 84 log_msg(0, "-----------------------------------------------------------"); 85 log_msg(0, "NB: Mondo logs almost everything, so don't panic if you see"); 86 log_msg(0, "some error messages. Please read them carefully before you"); 87 log_msg(0, "decide to break out in a cold sweat. Despite (or perhaps"); 88 log_msg(0, "because of) the wealth of messages. some users are inclined"); 89 log_msg(0, "to stop reading this log. If Mondo stopped for some reason,"); 90 log_msg(0, "chances are it's detailed here. More than likely there's a"); 91 log_msg(0, "message at the very end of this log that will tell you what"); 92 log_msg(0, "is wrong. Please read it! -Devteam"); 93 log_msg(0, "-----------------------------------------------------------"); 102 94 103 95 log_msg(0, "Zero..."); … … 113 105 } 114 106 115 116 extern char *g_magicdev_command;117 107 118 108 /** … … 170 160 char *tmp = NULL; 171 161 char *tmp1 = NULL; 172 int res, retval; 162 int res = 0; 163 int i = 0; 164 int retval = 0; 173 165 char *say_at_end = NULL; 174 166 FILE *fin = NULL; … … 181 173 182 174 /* If -V, -v or --version then echo version no. and quit */ 183 if (argc == 2 184 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") 185 || !strcmp(argv[argc - 1], "--version"))) { 175 if (argc == 2 && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V") || !strcmp(argv[argc - 1], "--version"))) { 186 176 printf("mondoarchive v%s\nSee man page for help\n", PACKAGE_VERSION); 187 177 exit(0); … … 196 186 reset_bkpinfo(); 197 187 198 res = 0; 199 retval = 0; 200 diffs = 0; 188 /* Memory allocation is done in those functions */ 201 189 malloc_libmondo_global_strings(); 202 190 … … 208 196 mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH")); 209 197 setenv("PATH", tmp1, 1); 210 paranoid_free(tmp1);198 mr_free(tmp1); 211 199 212 200 /* Add the ARCH environment variable for ia64 purposes */ 213 201 mr_asprintf(tmp1,"%s",get_architecture()); 214 202 setenv("ARCH", tmp1, 1); 215 paranoid_free(tmp1);203 mr_free(tmp1); 216 204 217 205 /* Add MONDO_SHARE environment variable for mindi */ … … 255 243 g_text_mode = TRUE; 256 244 setup_newt_stuff(); 257 malloc_string(tmp); 258 turn_wildcard_chars_into_literal_chars(tmp, argv[2]); 259 printf("in=%s; out=%s\n", argv[2], tmp); 260 paranoid_free(tmp); 245 tmp1 = mr_stresc(argv[2], "[]*?", '\\'); 246 printf("in=%s; out=%s\n", argv[2], tmp1); 247 mr_free(tmp1); 261 248 finish(1); 262 249 } … … 311 298 printf("CD-ROM is at %s\n", tmp); 312 299 } 313 paranoid_free(tmp);300 mr_free(tmp); 314 301 finish(0); 315 302 } … … 325 312 printf("DVD is at %s\n", tmp); 326 313 } 327 paranoid_free(tmp);314 mr_free(tmp); 328 315 finish(0); 329 316 } … … 343 330 344 331 if (pre_param_configuration()) { 345 fatal_error 346 ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting..."); 347 } 348 349 /* Process command line, if there is one. If not, ask user for info. */ 332 fatal_error("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting..."); 333 } 334 335 /* Process command line, if there is one. If not, ask user for info. */ 350 336 if (argc == 1) { 351 337 g_text_mode = FALSE; … … 353 339 res = interactively_obtain_media_parameters_from_user(TRUE); /* yes, archiving */ 354 340 if (res) { 355 fatal_error 356 ("Syntax error. Please review the parameters you have supplied and try again."); 341 fatal_error("Syntax error. Please review the parameters you have supplied and try again."); 357 342 } 358 343 } else { 359 344 res = handle_incoming_parameters(argc, argv); 360 345 if (res) { 361 printf 362 ("Errors were detected in the command line you supplied.\n"); 346 printf("Errors were detected in the command line you supplied.\n"); 363 347 printf("Please review the log file - %s\n", MONDO_LOGFILE ); 364 348 log_msg(1, "Mondoarchive will now exit."); … … 370 354 /* Finish configuring global structures */ 371 355 if (post_param_configuration()) { 372 fatal_error 373 ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting..."); 374 } 375 376 log_to_screen 377 ("BusyBox's sources are available from http://www.busybox.net"); 356 fatal_error("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting..."); 357 } 378 358 379 359 /* If we're meant to backup then backup */ … … 392 372 res = verify_data(); 393 373 if (res < 0) { 394 mr_asprintf(tmp, "%d difference%c found.", -res, 395 (-res != 1) ? 's' : ' '); 374 mr_asprintf(tmp, "%d difference%c found.", -res, (-res != 1) ? 's' : ' '); 396 375 mr_asprintf(say_at_end, "%s", tmp); 397 376 log_to_screen(tmp); … … 430 409 if (say_at_end != NULL) { 431 410 log_to_screen(say_at_end); 432 paranoid_free(say_at_end);411 mr_free(say_at_end); 433 412 } 434 413 mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir); … … 437 416 if (bkpinfo->backup_media_type == usb) { 438 417 log_msg(1, "Unmounting USB device."); 418 if (bkpinfo->media_device == NULL) { 419 fatal_error("USB device set to NULL"); 420 } 439 421 mr_asprintf(tmp, "umount %s1", bkpinfo->media_device); 440 422 run_program_and_log_output(tmp, TRUE); … … 471 453 472 454 if (!g_text_mode) { 473 popup_and_OK 474 ("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt."); 455 popup_and_OK("Mondo Archive has finished its run. Please press ENTER to return to the shell prompt."); 475 456 log_to_screen("See %s for details of backup run.", MONDO_LOGFILE); 476 457 } else {
Note:
See TracChangeset
for help on using the changeset viewer.