Changeset 1086 in MondoRescue for trunk/mondo/src/common/libmondo-fork.c
- Timestamp:
- Feb 2, 2007, 11:21:27 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/src/common/libmondo-fork.c
r1081 r1086 75 75 /*@*********** End Variables ***************************************/ 76 76 77 log_msg(3, "Starting");77 mr_msg(3, "Starting"); 78 78 assert(bkpinfo != NULL); 79 79 assert_string_is_neither_NULL_nor_zerolength(basic_call); … … 90 90 91 91 resolve_naff_tokens(ultimate_call, tmp, MONDO_LOGFILE, "_ERR_"); 92 log_msg(4, "basic call = '%s'", basic_call);93 log_msg(4, "midway_call = '%s'", midway_call);94 log_msg(4, "tmp = '%s'", tmp);95 log_msg(4, "ultimate call = '%s'", ultimate_call);92 mr_msg(4, "basic call = '%s'", basic_call); 93 mr_msg(4, "midway_call = '%s'", midway_call); 94 mr_msg(4, "tmp = '%s'", tmp); 95 mr_msg(4, "ultimate call = '%s'", ultimate_call); 96 96 mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE); 97 97 98 98 log_to_screen 99 99 (_("Please be patient. Do not be alarmed by on-screen inactivity.")); 100 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",100 mr_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 101 101 what_i_am_doing); 102 102 if (bkpinfo->manual_cd_tray) { … … 113 113 } 114 114 #endif 115 log_msg(1, "command = '%s'", command);115 mr_msg(1, "command = '%s'", command); 116 116 retval += system(command); 117 117 if (!g_text_mode) { … … 119 119 } 120 120 if (retval) { 121 log_msg(2, "Basic call '%s' returned an error.", basic_call);121 mr_msg(2, "Basic call '%s' returned an error.", basic_call); 122 122 popup_and_OK(_("Press ENTER to continue.")); 123 123 popup_and_OK … … 127 127 /* if text mode then do the above & RETURN; if not text mode, do this... */ 128 128 else { 129 log_msg(3, "command = '%s'", command);129 mr_msg(3, "command = '%s'", command); 130 130 // yes_this_is_a_goto: 131 131 retval = … … 168 168 assert(program != NULL); 169 169 if (!program[0]) { 170 log_msg(2, "Warning - asked to run zerolength program");170 mr_msg(2, "Warning - asked to run zerolength program"); 171 171 return (1); 172 172 } … … 189 189 res = system(callstr); 190 190 if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) { 191 log_msg(0, "running: %s", callstr);192 log_msg(0,191 mr_msg(0, "running: %s", callstr); 192 mr_msg(0, 193 193 "--------------------------------start of output-----------------------------"); 194 194 } … … 219 219 if ((res == 0 && log_if_success) 220 220 || (res != 0 && log_if_failure)) { 221 log_msg(0, incoming);221 mr_msg(0, incoming); 222 222 } 223 223 } … … 227 227 unlink("/tmp/mondo-run-prog-thing.tmp"); 228 228 if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) { 229 log_msg(0,229 mr_msg(0, 230 230 "--------------------------------end of output------------------------------"); 231 231 if (res) { 232 log_msg(0, "...ran with res=%d", res);232 mr_msg(0, "...ran with res=%d", res); 233 233 } else { 234 log_msg(0, "...ran just fine. :-)");234 mr_msg(0, "...ran just fine. :-)"); 235 235 } 236 236 } 237 237 // else 238 // { log_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }238 // { mr_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); } 239 239 return (res); 240 240 } … … 275 275 open_evalcall_form(what_i_am_doing); 276 276 mr_asprintf(&tmp, "Executing %s", basic_call); 277 log_msg(2, tmp);277 mr_msg(2, tmp); 278 278 mr_free(tmp); 279 279 … … 292 292 log_to_screen(_("Waiting for external binary to start")); 293 293 for (i = 0; i < 60 && !does_file_exist(lockfile); sleep(1), i++) { 294 log_msg(3, "Waiting for lockfile %s to exist", lockfile);294 mr_msg(3, "Waiting for lockfile %s to exist", lockfile); 295 295 } 296 296 } … … 305 305 /* Log actual pclose errors. */ 306 306 if (errno) 307 log_msg(5, "pclose err: %d", errno);307 mr_msg(5, "pclose err: %d", errno); 308 308 /* Check if we have a valid status. If we do, extract the called program's exit code. */ 309 309 /* If we don't, highlight this fact by returning -1. */ … … 343 343 FILE *ftmp = NULL; 344 344 345 log_msg(5, "Opening.");345 mr_msg(5, "Opening."); 346 346 bufcap = 256L * 1024L; 347 347 buf = mr_malloc(bufcap); … … 367 367 mr_free(tmp); 368 368 369 log_msg(7,369 mr_msg(7, 370 370 "subslice #%ld --- I have read %ld of %ld bytes in from f_orig", 371 371 subsliceno, bytes_read_in, bytes_to_be_read); … … 377 377 mr_free(tmp); 378 378 379 log_msg(7, "Subslice #%d written OK", subsliceno);379 mr_msg(7, "Subslice #%d written OK", subsliceno); 380 380 subsliceno++; 381 381 } … … 393 393 fatal_error("Cannot read the introductory block"); 394 394 } 395 log_msg(5, "tmp is %s", tmp);395 mr_msg(5, "tmp is %s", tmp); 396 396 if (!strstr(tmp, PIMP_START_SZ)) { 397 397 fatal_error("Can't find intro blk"); … … 402 402 bytes_to_be_read = atol(tmp); 403 403 while (bytes_to_be_read > 0) { 404 log_msg(7, "subslice#%ld, bytes=%ld", subsliceno,404 mr_msg(7, "subslice#%ld, bytes=%ld", subsliceno, 405 405 bytes_to_be_read); 406 406 bytes_read_in = fread(buf, 1, bytes_to_be_read, fin); … … 414 414 } 415 415 if (atol(tmp) != subsliceno) { 416 log_msg(1, "Wanted subslice %ld but got %ld ('%s')",416 mr_msg(1, "Wanted subslice %ld but got %ld ('%s')", 417 417 subsliceno, atol(tmp), tmp); 418 418 } 419 log_msg(7, "Subslice #%ld read OK", subsliceno);419 mr_msg(7, "Subslice #%ld read OK", subsliceno); 420 420 subsliceno++; 421 421 if (fread(tmp, 1, 64L, fin) != 64L) { … … 426 426 } 427 427 428 // log_msg(4, "Written %ld of %ld bytes", bytes_written_out, bytes_read_in);428 // mr_msg(4, "Written %ld of %ld bytes", bytes_written_out, bytes_read_in); 429 429 430 430 if (direction == 'w') { … … 436 436 mr_free(tmp); 437 437 } else { 438 log_msg(1, "tmpA is %s", tmp);438 mr_msg(1, "tmpA is %s", tmp); 439 439 if (!strstr(tmp, PIMP_END_SZ)) { 440 440 if (fread(tmp, 1, 64L, fin) != 64L) { 441 441 fatal_error("Can't read the final block"); 442 442 } 443 log_msg(5, "tmpB is %s", tmp);443 mr_msg(5, "tmpB is %s", tmp); 444 444 if (!strstr(tmp, PIMP_END_SZ)) { 445 445 ftmp = fopen("/tmp/out.leftover", "w"); 446 446 bytes_read_in = fread(tmp, 1, 64L, fin); 447 log_msg(1, "bytes_read_in = %ld", bytes_read_in);447 mr_msg(1, "bytes_read_in = %ld", bytes_read_in); 448 448 // if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); } 449 449 fwrite(tmp, 1, bytes_read_in, ftmp); … … 455 455 /* BERLIOS : strange ??? 456 456 s-printf(tmp, "I am here - %llu", ftello(fin)); 457 log_msg(0, tmp);457 mr_msg(0, tmp); 458 458 */ 459 459 fread(tmp, 1, 512, fin); 460 log_msg(0, "tmp = '%s'", tmp);460 mr_msg(0, "tmp = '%s'", tmp); 461 461 fwrite(tmp, 1, 512, ftmp); 462 462 fclose(ftmp); … … 468 468 469 469 mr_free(buf); 470 log_msg(3, "Successfully copied %ld bytes", bytes_written_out);470 mr_msg(3, "Successfully copied %ld bytes", bytes_written_out); 471 471 return (retval); 472 472 } … … 521 521 mr_asprintf(&command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, tempfile, 522 522 tempfile); 523 log_msg(3, command);523 mr_msg(3, command); 524 524 open_evalcall_form(tt); 525 525 … … 537 537 pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE); 538 538 if (pcno < 0 || pcno > 100) { 539 log_msg(5, "Weird pc#");539 mr_msg(5, "Weird pc#"); 540 540 continue; 541 541 } … … 567 567 res = 999; 568 568 sz_command = (char *) info; 569 log_msg(4, "sz_command = '%s'", sz_command);569 mr_msg(4, "sz_command = '%s'", sz_command); 570 570 res = system(sz_command); 571 571 if (res > 256 && res != 4444) { 572 572 res = res / 256; 573 573 } 574 log_msg(4, "child res = %d", res);574 mr_msg(4, "child res = %d", res); 575 575 sz_command[0] = '\0'; 576 576 pthread_exit((void *) (&res)); … … 602 602 603 603 mr_asprintf(&command, "%s 2>> %s", cmd, MONDO_LOGFILE); 604 log_msg(3, "command = '%s'", command);604 mr_msg(3, "command = '%s'", command); 605 605 if ((res = 606 606 pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, … … 609 609 } 610 610 611 log_msg(8, "Parent running");611 mr_msg(8, "Parent running"); 612 612 open_evalcall_form(tt); 613 613 for (sleep(1); command[0] != '\0'; sleep(1)) { 614 614 pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE); 615 615 if (pcno <= 0 || pcno > 100) { 616 log_msg(8, "Weird pc#");616 mr_msg(8, "Weird pc#"); 617 617 continue; 618 618 } … … 639 639 res = 666; 640 640 } 641 log_msg(3, "Parent res = %d", res);641 mr_msg(3, "Parent res = %d", res); 642 642 return (res); 643 643 }
Note:
See TracChangeset
for help on using the changeset viewer.