Ignore:
Timestamp:
Feb 8, 2007, 12:09:34 AM (17 years ago)
Author:
Bruno Cornec
Message:

log_msg => mr_msg for common files

File:
1 edited

Legend:

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

    r1080 r1107  
    102102/*@***********   End Variables ***************************************/
    103103
    104     log_msg(3, "Starting");
     104    mr_msg(3, "Starting");
    105105    assert(bkpinfo != NULL);
    106106    assert_string_is_neither_NULL_nor_zerolength(basic_call);
     
    122122    resolve_naff_tokens(tmp, midway_call, cd_number_str, "_CD#_");
    123123    resolve_naff_tokens(ultimate_call, tmp, MONDO_LOGFILE, "_ERR_");
    124     log_msg(4, "basic call = '%s'", basic_call);
    125     log_msg(4, "midway_call = '%s'", midway_call);
    126     log_msg(4, "tmp = '%s'", tmp);
    127     log_msg(4, "ultimate call = '%s'", ultimate_call);
     124    mr_msg(4, "basic call = '%s'", basic_call);
     125    mr_msg(4, "midway_call = '%s'", midway_call);
     126    mr_msg(4, "tmp = '%s'", tmp);
     127    mr_msg(4, "ultimate call = '%s'", ultimate_call);
    128128    sprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
    129129
    130130    log_to_screen
    131131        ("Please be patient. Do not be alarmed by on-screen inactivity.");
    132     log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
     132    mr_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
    133133            what_i_am_doing);
    134134    strcpy(tmp, command);
     
    150150        }
    151151#endif
    152         log_msg(1, "command = '%s'", command);
     152        mr_msg(1, "command = '%s'", command);
    153153        retval += system(command);
    154154        if (!g_text_mode) {
     
    156156        }
    157157        if (retval) {
    158             log_msg(2, "Basic call '%s' returned an error.", basic_call);
     158            mr_msg(2, "Basic call '%s' returned an error.", basic_call);
    159159            popup_and_OK("Press ENTER to continue.");
    160160            popup_and_OK
     
    164164    /* if text mode then do the above & RETURN; if not text mode, do this... */
    165165    else {
    166         log_msg(3, "command = '%s'", command);
     166        mr_msg(3, "command = '%s'", command);
    167167//      yes_this_is_a_goto:
    168168        retval =
     
    181181  if (bkpinfo->backup_media_type == dvd && !bkpinfo->please_dont_eject_when_restoring)
    182182    {
    183       log_msg(3, "Ejecting DVD device");
     183      mr_msg(3, "Ejecting DVD device");
    184184      eject_device(bkpinfo->media_device);
    185185    }
     
    220220    assert(program != NULL);
    221221    if (!program[0]) {
    222         log_msg(2, "Warning - asked to run zerolength program");
     222        mr_msg(2, "Warning - asked to run zerolength program");
    223223        return (1);
    224224    }
     
    256256    res = system(callstr);
    257257    if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) {
    258         log_msg(0, "running: %s", callstr);
    259         log_msg(0,
     258        mr_msg(0, "running: %s", callstr);
     259        mr_msg(0,
    260260                "--------------------------------start of output-----------------------------");
    261261    }
     
    284284            if ((res == 0 && log_if_success)
    285285                || (res != 0 && log_if_failure)) {
    286                 log_msg(0, incoming);
     286                mr_msg(0, incoming);
    287287            }
    288288        }
     
    291291    unlink("/tmp/mondo-run-prog-thing.tmp");
    292292    if ((res == 0 && log_if_success) || (res != 0 && log_if_failure)) {
    293         log_msg(0,
     293        mr_msg(0,
    294294                "--------------------------------end of output------------------------------");
    295295        if (res) {
    296             log_msg(0, "...ran with res=%d", res);
     296            mr_msg(0, "...ran with res=%d", res);
    297297        } else {
    298             log_msg(0, "...ran just fine. :-)");
     298            mr_msg(0, "...ran just fine. :-)");
    299299        }
    300300    }
    301301//  else
    302 //    { log_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }
     302//    { mr_msg (0, "-------------------------------ran w/ res=%d------------------------------", res); }
    303303    return (res);
    304304}
     
    340340    open_evalcall_form(what_i_am_doing);
    341341    sprintf(tmp, "Executing %s", basic_call);
    342     log_msg(2, tmp);
     342    mr_msg(2, tmp);
    343343    if (!(fin = popen(command, "r"))) {
    344344        log_OS_error("Unable to popen-in command");
     
    350350        log_to_screen("Waiting for external binary to start");
    351351        for (i = 0; i < 60 && !does_file_exist(lockfile); sleep(1), i++) {
    352             log_msg(3, "Waiting for lockfile %s to exist", lockfile);
     352            mr_msg(3, "Waiting for lockfile %s to exist", lockfile);
    353353        }
    354354    }
     
    375375    res = pclose(fin);
    376376    /* Log actual pclose errors. */
    377     if (errno) log_msg(5, "pclose err: %d", errno);
     377    if (errno) mr_msg(5, "pclose err: %d", errno);
    378378    /* Check if we have a valid status. If we do, extract the called program's exit code. */
    379379    /* If we don't, highlight this fact by returning -1. */
     
    413413    FILE *ftmp;
    414414
    415     log_msg(5, "Opening.");
     415    mr_msg(5, "Opening.");
    416416    malloc_string(tmp);
    417417    tmp[0] = '\0';
     
    435435                fatal_error("Cannot write introductory block");
    436436            }
    437             log_msg(7,
     437            mr_msg(7,
    438438                    "subslice #%ld --- I have read %ld of %ld bytes in from f_orig",
    439439                    subsliceno, bytes_read_in, bytes_to_be_read);
     
    443443                fatal_error("Cannot write post-thingy block");
    444444            }
    445             log_msg(7, "Subslice #%d written OK", subsliceno);
     445            mr_msg(7, "Subslice #%d written OK", subsliceno);
    446446            subsliceno++;
    447447        }
     
    456456            fatal_error("Cannot read the introductory block");
    457457        }
    458         log_msg(5, "tmp is %s", tmp);
     458        mr_msg(5, "tmp is %s", tmp);
    459459        if (!strstr(tmp, PIMP_START_SZ)) {
    460460            fatal_error("Can't find intro blk");
     
    465465        bytes_to_be_read = atol(tmp);
    466466        while (bytes_to_be_read > 0) {
    467             log_msg(7, "subslice#%ld, bytes=%ld", subsliceno,
     467            mr_msg(7, "subslice#%ld, bytes=%ld", subsliceno,
    468468                    bytes_to_be_read);
    469469            bytes_read_in = fread(buf, 1, bytes_to_be_read, fin);
     
    477477            }
    478478            if (atol(tmp) != subsliceno) {
    479                 log_msg(1, "Wanted subslice %ld but got %ld ('%s')",
     479                mr_msg(1, "Wanted subslice %ld but got %ld ('%s')",
    480480                        subsliceno, atol(tmp), tmp);
    481481            }
    482             log_msg(7, "Subslice #%ld read OK", subsliceno);
     482            mr_msg(7, "Subslice #%ld read OK", subsliceno);
    483483            subsliceno++;
    484484            if (fread(tmp, 1, 64, fin) != 64) {
     
    489489    }
    490490
    491 //  log_msg(4, "Written %ld of %ld bytes", bytes_written_out, bytes_read_in);
     491//  mr_msg(4, "Written %ld of %ld bytes", bytes_written_out, bytes_read_in);
    492492
    493493    if (direction == 'w') {
     
    497497        }
    498498    } else {
    499         log_msg(1, "tmpA is %s", tmp);
     499        mr_msg(1, "tmpA is %s", tmp);
    500500        if (!strstr(tmp, PIMP_END_SZ)) {
    501501            if (fread(tmp, 1, 64, fin) != 64) {
    502502                fatal_error("Can't read the final block");
    503503            }
    504             log_msg(5, "tmpB is %s", tmp);
     504            mr_msg(5, "tmpB is %s", tmp);
    505505            if (!strstr(tmp, PIMP_END_SZ)) {
    506506                ftmp = fopen("/tmp/out.leftover", "w");
    507507                bytes_read_in = fread(tmp, 1, 64, fin);
    508                 log_msg(1, "bytes_read_in = %ld", bytes_read_in);
     508                mr_msg(1, "bytes_read_in = %ld", bytes_read_in);
    509509//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    510510                fwrite(tmp, 1, bytes_read_in, ftmp);
    511511                sprintf(tmp, "I am here - %lld", (long long)ftello(fin));
    512 //    log_msg(0, tmp);
     512//    mr_msg(0, tmp);
    513513                fread(tmp, 1, 512, fin);
    514                 log_msg(0, "tmp = '%s'", tmp);
     514                mr_msg(0, "tmp = '%s'", tmp);
    515515                fwrite(tmp, 1, 512, ftmp);
    516516                fclose(ftmp);
     
    522522    mr_free(buf);
    523523    mr_free(tmp);
    524     log_msg(3, "Successfully copied %ld bytes", bytes_written_out);
     524    mr_msg(3, "Successfully copied %ld bytes", bytes_written_out);
    525525    return (retval);
    526526}
     
    588588    sprintf(command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile, tempfile,
    589589            tempfile);
    590     log_msg(3, command);
     590    mr_msg(3, command);
    591591    open_evalcall_form(title);
    592592    if (!(pin = popen(command, "r"))) {
     
    599599        pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
    600600        if (pcno < 0 || pcno > 100) {
    601             log_msg(5, "Weird pc#");
     601            mr_msg(5, "Weird pc#");
    602602            continue;
    603603        }
     
    634634    res = 999;
    635635    sz_command = (char *) info;
    636     log_msg(4, "sz_command = '%s'", sz_command);
     636    mr_msg(4, "sz_command = '%s'", sz_command);
    637637    res = system(sz_command);
    638638    if (res > 256 && res != 4444) {
    639639        res = res / 256;
    640640    }
    641     log_msg(4, "child res = %d", res);
     641    mr_msg(4, "child res = %d", res);
    642642    sz_command[0] = '\0';
    643643    pthread_exit((void *) (&res));
     
    675675    strcpy(title, tt);
    676676    sprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    677     log_msg(3, "command = '%s'", command);
     677    mr_msg(3, "command = '%s'", command);
    678678    if ((res =
    679679         pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit,
     
    682682    }
    683683
    684     log_msg(8, "Parent running");
     684    mr_msg(8, "Parent running");
    685685    open_evalcall_form(title);
    686686    for (sleep(1); command[0] != '\0'; sleep(1)) {
    687687        pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
    688688        if (pcno <= 0 || pcno > 100) {
    689             log_msg(8, "Weird pc#");
     689            mr_msg(8, "Weird pc#");
    690690            continue;
    691691        }
     
    711711        res = 666;
    712712    }
    713     log_msg(3, "Parent res = %d", res);
     713    mr_msg(3, "Parent res = %d", res);
    714714    mr_free(command);
    715715    mr_free(title);
Note: See TracChangeset for help on using the changeset viewer.