Changeset 1086 in MondoRescue for trunk/mondo/src/common/libmondo-fork.c


Ignore:
Timestamp:
Feb 2, 2007, 11:21:27 PM (17 years ago)
Author:
Bruno Cornec
Message:

log_msg => mr_msg in trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/common/libmondo-fork.c

    r1081 r1086  
    7575/*@***********   End Variables ***************************************/
    7676
    77     log_msg(3, "Starting");
     77    mr_msg(3, "Starting");
    7878    assert(bkpinfo != NULL);
    7979    assert_string_is_neither_NULL_nor_zerolength(basic_call);
     
    9090
    9191    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);
    9696    mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
    9797
    9898    log_to_screen
    9999        (_("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'",
    101101            what_i_am_doing);
    102102    if (bkpinfo->manual_cd_tray) {
     
    113113        }
    114114#endif
    115         log_msg(1, "command = '%s'", command);
     115        mr_msg(1, "command = '%s'", command);
    116116        retval += system(command);
    117117        if (!g_text_mode) {
     
    119119        }
    120120        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);
    122122            popup_and_OK(_("Press ENTER to continue."));
    123123            popup_and_OK
     
    127127    /* if text mode then do the above & RETURN; if not text mode, do this... */
    128128    else {
    129         log_msg(3, "command = '%s'", command);
     129        mr_msg(3, "command = '%s'", command);
    130130//      yes_this_is_a_goto:
    131131        retval =
     
    168168    assert(program != NULL);
    169169    if (!program[0]) {
    170         log_msg(2, "Warning - asked to run zerolength program");
     170        mr_msg(2, "Warning - asked to run zerolength program");
    171171        return (1);
    172172    }
     
    189189    res = system(callstr);
    190190    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,
    193193                "--------------------------------start of output-----------------------------");
    194194    }
     
    219219            if ((res == 0 && log_if_success)
    220220                || (res != 0 && log_if_failure)) {
    221                 log_msg(0, incoming);
     221                mr_msg(0, incoming);
    222222            }
    223223        }
     
    227227    unlink("/tmp/mondo-run-prog-thing.tmp");
    228228    if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) {
    229         log_msg(0,
     229        mr_msg(0,
    230230                "--------------------------------end of output------------------------------");
    231231        if (res) {
    232             log_msg(0, "...ran with res=%d", res);
     232            mr_msg(0, "...ran with res=%d", res);
    233233        } else {
    234             log_msg(0, "...ran just fine. :-)");
     234            mr_msg(0, "...ran just fine. :-)");
    235235        }
    236236    }
    237237//  else
    238 //    { log_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }
     238//    { mr_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }
    239239    return (res);
    240240}
     
    275275    open_evalcall_form(what_i_am_doing);
    276276    mr_asprintf(&tmp, "Executing %s", basic_call);
    277     log_msg(2, tmp);
     277    mr_msg(2, tmp);
    278278    mr_free(tmp);
    279279
     
    292292        log_to_screen(_("Waiting for external binary to start"));
    293293        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);
    295295        }
    296296    }
     
    305305    /* Log actual pclose errors. */
    306306    if (errno)
    307         log_msg(5, "pclose err: %d", errno);
     307        mr_msg(5, "pclose err: %d", errno);
    308308    /* Check if we have a valid status. If we do, extract the called program's exit code. */
    309309    /* If we don't, highlight this fact by returning -1. */
     
    343343    FILE *ftmp = NULL;
    344344
    345     log_msg(5, "Opening.");
     345    mr_msg(5, "Opening.");
    346346    bufcap = 256L * 1024L;
    347347    buf = mr_malloc(bufcap);
     
    367367            mr_free(tmp);
    368368
    369             log_msg(7,
     369            mr_msg(7,
    370370                    "subslice #%ld --- I have read %ld of %ld bytes in from f_orig",
    371371                    subsliceno, bytes_read_in, bytes_to_be_read);
     
    377377            mr_free(tmp);
    378378
    379             log_msg(7, "Subslice #%d written OK", subsliceno);
     379            mr_msg(7, "Subslice #%d written OK", subsliceno);
    380380            subsliceno++;
    381381        }
     
    393393            fatal_error("Cannot read the introductory block");
    394394        }
    395         log_msg(5, "tmp is %s", tmp);
     395        mr_msg(5, "tmp is %s", tmp);
    396396        if (!strstr(tmp, PIMP_START_SZ)) {
    397397            fatal_error("Can't find intro blk");
     
    402402        bytes_to_be_read = atol(tmp);
    403403        while (bytes_to_be_read > 0) {
    404             log_msg(7, "subslice#%ld, bytes=%ld", subsliceno,
     404            mr_msg(7, "subslice#%ld, bytes=%ld", subsliceno,
    405405                    bytes_to_be_read);
    406406            bytes_read_in = fread(buf, 1, bytes_to_be_read, fin);
     
    414414            }
    415415            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')",
    417417                        subsliceno, atol(tmp), tmp);
    418418            }
    419             log_msg(7, "Subslice #%ld read OK", subsliceno);
     419            mr_msg(7, "Subslice #%ld read OK", subsliceno);
    420420            subsliceno++;
    421421            if (fread(tmp, 1, 64L, fin) != 64L) {
     
    426426    }
    427427
    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);
    429429
    430430    if (direction == 'w') {
     
    436436        mr_free(tmp);
    437437    } else {
    438         log_msg(1, "tmpA is %s", tmp);
     438        mr_msg(1, "tmpA is %s", tmp);
    439439        if (!strstr(tmp, PIMP_END_SZ)) {
    440440            if (fread(tmp, 1, 64L, fin) != 64L) {
    441441                fatal_error("Can't read the final block");
    442442            }
    443             log_msg(5, "tmpB is %s", tmp);
     443            mr_msg(5, "tmpB is %s", tmp);
    444444            if (!strstr(tmp, PIMP_END_SZ)) {
    445445                ftmp = fopen("/tmp/out.leftover", "w");
    446446                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);
    448448//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    449449                fwrite(tmp, 1, bytes_read_in, ftmp);
     
    455455                /* BERLIOS : strange ???
    456456                s-printf(tmp, "I am here - %llu", ftello(fin));
    457                 log_msg(0, tmp);
     457                mr_msg(0, tmp);
    458458                */
    459459                fread(tmp, 1, 512, fin);
    460                 log_msg(0, "tmp = '%s'", tmp);
     460                mr_msg(0, "tmp = '%s'", tmp);
    461461                fwrite(tmp, 1, 512, ftmp);
    462462                fclose(ftmp);
     
    468468
    469469    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);
    471471    return (retval);
    472472}
     
    521521    mr_asprintf(&command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, tempfile,
    522522            tempfile);
    523     log_msg(3, command);
     523    mr_msg(3, command);
    524524    open_evalcall_form(tt);
    525525
     
    537537        pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
    538538        if (pcno < 0 || pcno > 100) {
    539             log_msg(5, "Weird pc#");
     539            mr_msg(5, "Weird pc#");
    540540            continue;
    541541        }
     
    567567    res = 999;
    568568    sz_command = (char *) info;
    569     log_msg(4, "sz_command = '%s'", sz_command);
     569    mr_msg(4, "sz_command = '%s'", sz_command);
    570570    res = system(sz_command);
    571571    if (res > 256 && res != 4444) {
    572572        res = res / 256;
    573573    }
    574     log_msg(4, "child res = %d", res);
     574    mr_msg(4, "child res = %d", res);
    575575    sz_command[0] = '\0';
    576576    pthread_exit((void *) (&res));
     
    602602
    603603    mr_asprintf(&command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    604     log_msg(3, "command = '%s'", command);
     604    mr_msg(3, "command = '%s'", command);
    605605    if ((res =
    606606         pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit,
     
    609609    }
    610610
    611     log_msg(8, "Parent running");
     611    mr_msg(8, "Parent running");
    612612    open_evalcall_form(tt);
    613613    for (sleep(1); command[0] != '\0'; sleep(1)) {
    614614        pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
    615615        if (pcno <= 0 || pcno > 100) {
    616             log_msg(8, "Weird pc#");
     616            mr_msg(8, "Weird pc#");
    617617            continue;
    618618        }
     
    639639        res = 666;
    640640    }
    641     log_msg(3, "Parent res = %d", res);
     641    mr_msg(3, "Parent res = %d", res);
    642642    return (res);
    643643}
Note: See TracChangeset for help on using the changeset viewer.