Changeset 1200


Ignore:
Timestamp:
Feb 25, 2007, 1:28:17 AM (13 years ago)
Author:
bruno
Message:

Merge trunk emory management for mondo-rstr-compare.c and .h

Location:
branches/stable/mondo/src/mondorestore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/mondorestore/mondo-restore-EXT.h

    r1166 r1200  
    2929                         struct raidlist_itself *);
    3030extern void sort_mountlist_by_device(struct mountlist_itself *);
    31 extern void find_pathname_of_executable_preferably_in_RESTORING(char *,
    32                                                                 char *,
    33                                                                 char *);
    3431extern int interactive_mode(struct s_bkpinfo *, struct mountlist_itself *,
    3532                            struct raidlist_itself *);
  • branches/stable/mondo/src/mondorestore/mondo-restore.h

    r1166 r1200  
    1010int catchall_mode(struct s_bkpinfo *, struct mountlist_itself *,
    1111                  struct raidlist_itself *);
    12 void find_pathname_of_executable_preferably_in_RESTORING(char *, char *,
    13                                                          char *);
    1412int interactive_mode(struct s_bkpinfo *, struct mountlist_itself *,
    1513                     struct raidlist_itself *);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare-EXT.h

    r128 r1200  
    1 /* mondo-rstr-compare-EXT.h */
     1/*
     2 * $Id$
     3**/
    24
    35
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c

    r1125 r1200  
    88#include "../common/mondostructures.h"
    99#include "../common/libmondo.h"
    10 //#include "../../config.h"
    1110#include "mr_msg.h"
     11#include "mr_mem.h"
    1212#include "mr-externs.h"
    1313#include "mondo-rstr-compare.h"
     
    3333{
    3434
    35     FILE *fin;
    36     FILE *fout;
     35    FILE *fin = NULL;
     36    FILE *fout = NULL;
    3737
    3838  /** needs malloc *******/
    39     char *checksum_ptr;
    40     char *original_cksum_ptr;
    41     char *bigfile_fname_ptr;
    42     char *tmp_ptr;
    43     char *command_ptr;
    44 
    45     char *checksum, *original_cksum, *bigfile_fname, *tmp, *command;
    46 
    47     char *p;
    48     int i;
     39    char *checksum = NULL;
     40    char *original_cksum = NULL;
     41    char *bigfile_fname = NULL;
     42    char *tmp = NULL;
     43    char *command = NULL;
     44
     45    char *p = NULL;
     46    int i = 0;
     47    size_t n = 0;
    4948    int retval = 0;
    5049
    5150    struct s_filename_and_lstat_info biggiestruct;
    5251
    53     malloc_string(checksum);
    54     malloc_string(original_cksum);
    55     malloc_string(bigfile_fname);
    56     malloc_string(tmp);
    57     malloc_string(command);
    58     malloc_string(checksum_ptr);
    59     malloc_string(original_cksum_ptr);
    60     malloc_string(bigfile_fname_ptr);
    61     malloc_string(command_ptr);
    62     malloc_string(tmp_ptr);
    63 
    64   /*********************************************************************
    65    * allocate memory clear test                sab 16 feb 2003         *
    66    *********************************************************************/
    6752    assert(bkpinfo != NULL);
    68     memset(checksum_ptr, '\0', sizeof(checksum));
    69     memset(original_cksum_ptr, '\0', sizeof(original_cksum));
    70     memset(bigfile_fname_ptr, '\0', sizeof(bigfile_fname));
    71     memset(tmp_ptr, '\0', sizeof(tmp));
    72     memset(command_ptr, '\0', sizeof(command));
    73   /** end **/
    7453
    7554    if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
     
    7756            insist_on_this_cd_number(bkpinfo, (++g_current_media_number));
    7857        } else {
    79             sprintf(tmp_ptr,
    80                     "No CD's left. No biggiefiles left. No prob, Bob.");
    81             mr_msg(2, tmp_ptr);
     58            mr_msg(2, "No CD's left. No biggiefiles left. No problem.");
    8259            return (0);
    8360        }
    8461    }
    8562    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
    86         sprintf(tmp_ptr,
    87                 "Cannot open bigfile %ld (%s)'s info file",
    88                 bigfileno + 1, bigfile_fname_ptr);
    89         log_to_screen(tmp_ptr);
     63        log_to_screen(_("Cannot open bigfile %ld (%s)'s info file"),
     64                bigfileno + 1, slice_fname(bigfileno, 0, ARCHIVES_PATH, ""));
    9065        return (1);
    9166    }
     
    9368    paranoid_fclose(fin);
    9469
    95     strcpy(checksum_ptr, biggiestruct.checksum);
    96     strcpy(bigfile_fname_ptr, biggiestruct.filename);
    97 
    98     mr_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);
    99     mr_msg(2, "biggiestruct.checksum = %s", biggiestruct.checksum);
    100 
    101     sprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr);
     70    mr_asprintf(&bigfile_fname, biggiestruct.filename);
     71    mr_msg(2, "biggiestruct.filename = %s", bigfile_fname);
     72    if (!biggiestruct.checksum[0]) {
     73        mr_msg(2, "Warning - %s has no checksum", bigfile_fname);
     74    } else {
     75        mr_asprintf(&checksum, biggiestruct.checksum);
     76        mr_msg(2, "biggiestruct.checksum = %s", checksum);
     77    }
    10278
    10379    if (!g_text_mode) {
    104         newtDrawRootText(0, 22, tmp_ptr);
     80        mr_asprintf(&tmp, _("Comparing %s"), bigfile_fname);
     81        newtDrawRootText(0, 22, tmp);
    10582        newtRefresh();
    106     }
    107     if (!checksum[0]) {
    108         mr_msg(2, "Warning - %s has no checksum", bigfile_fname_ptr);
    109     }
    110     if (!strncmp(bigfile_fname_ptr, "/dev/", 5)) {
    111         strcpy(original_cksum_ptr, "IGNORE");
    112     } else {
    113         sprintf(command_ptr,
    114                 "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
    115                 MNT_RESTORING, bigfile_fname_ptr);
    116     }
    117     mr_msg(2, command_ptr);
    118     paranoid_system
    119         ("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
    120     if (system(command_ptr)) {
     83        mr_free(tmp);
     84    }
     85
     86    if (!strncmp(bigfile_fname, "/dev/", 5)) {
     87        mr_msg(2, _("Ignoring device %s"), bigfile_fname);
     88        mr_free(bigfile_fname);
     89        return(0);
     90    }
     91    mr_asprintf(&command,
     92            "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
     93            MNT_RESTORING, bigfile_fname);
     94    mr_msg(2, command);
     95    if (system(command)) {
    12196        log_OS_error("Warning - command failed");
    122         original_cksum[0] = '\0';
     97        paranoid_system("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
     98        mr_free(command);
     99        mr_free(bigfile_fname);
    123100        return (1);
    124101    } else {
     102        mr_free(command);
    125103        if (!(fin = fopen("/tmp/md5sum.txt", "r"))) {
    126             mr_msg(2,
    127                     "Unable to open /tmp/md5sum.txt; can't get live checksum");
    128             original_cksum[0] = '\0';
     104            mr_msg(2, "Unable to open /tmp/md5sum.txt; can't get live checksum");
     105            mr_free(bigfile_fname);
    129106            return (1);
    130107        } else {
    131             fgets(original_cksum_ptr, MAX_STR_LEN - 1, fin);
     108            mr_getline(&original_cksum, &n, fin);
    132109            paranoid_fclose(fin);
    133             for (i = strlen(original_cksum_ptr);
     110            for (i = strlen(original_cksum);
    134111                 i > 0 && original_cksum[i - 1] < 32; i--);
    135112            original_cksum[i] = '\0';
    136             p = (char *) strchr(original_cksum_ptr, ' ');
     113            p = (char *) strchr(original_cksum, ' ');
    137114            if (p) {
    138115                *p = '\0';
     
    140117        }
    141118    }
    142     sprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1,
    143             bigfile_fname_ptr);
    144     if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) {
    145         strcat(tmp_ptr, " ... OK");
    146     } else {
    147         strcat(tmp_ptr, "... changed");
     119    if (!strcmp(checksum, original_cksum) != 0) {
     120        mr_msg(1, "bigfile #%ld ('%s') ... OK", bigfileno + 1, bigfile_fname);
     121    } else {
     122        mr_msg(1, "bigfile #%ld ('%s') ... changed", bigfileno + 1, bigfile_fname);
    148123        retval++;
    149124    }
    150     mr_msg(1, tmp_ptr);
     125    mr_free(original_cksum);
     126    mr_free(checksum);
     127
    151128    if (retval) {
    152129        if (!(fout = fopen("/tmp/changed.txt", "a"))) {
    153130            fatal_error("Cannot openout changed.txt");
    154131        }
    155         fprintf(fout, "%s\n", bigfile_fname_ptr);
     132        fprintf(fout, "%s\n", bigfile_fname);
    156133        paranoid_fclose(fout);
    157134    }
    158 
    159     mr_free(original_cksum_ptr);
    160     mr_free(original_cksum);
    161     mr_free(bigfile_fname_ptr);
    162135    mr_free(bigfile_fname);
    163     mr_free(checksum_ptr);
    164     mr_free(checksum);
    165     mr_free(command_ptr);
    166     mr_free(command);
    167     mr_free(tmp_ptr);
    168     mr_free(tmp);
    169136
    170137    return (retval);
     
    184151{
    185152    int retval = 0;
    186     int res;
    187     long noof_biggiefiles, bigfileno = 0;
    188     char tmp[MAX_STR_LEN];
     153    int res = 0;
     154    long noof_biggiefiles = 0L, bigfileno = 0L;
     155    char *tmp = NULL;
    189156
    190157    assert(bkpinfo != NULL);
     
    202169    }
    203170    mvaddstr_and_log_it(g_currentY, 0,
    204                         "Comparing large files                                                  ");
    205     open_progress_form("Comparing large files",
    206                        "I am now comparing the large files",
    207                        "against the filesystem. Please wait.", "",
     171                        _
     172                        ("Comparing large files                                                  "));
     173    open_progress_form(_("Comparing large files"),
     174                       _("I am now comparing the large files"),
     175                       _("against the filesystem. Please wait."), "",
    208176                       noof_biggiefiles);
    209177    for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) {
    210         sprintf(tmp, "Comparing big file #%ld", bigfileno + 1);
     178        mr_asprintf(&tmp, "Comparing big file #%ld", bigfileno + 1);
    211179        mr_msg(1, tmp);
    212180        update_progress_form(tmp);
     181        mr_free(tmp);
     182
    213183        res = compare_a_biggiefile(bkpinfo, bigfileno);
    214184        retval += res;
     
    216186    }
    217187    close_progress_form();
     188    /* BERLIOS: useless ?
    218189    return (0);
     190    */
    219191    if (retval) {
    220         mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
    221     } else {
    222         mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     192        mvaddstr_and_log_it(g_currentY++, 74, _("Errors."));
     193    } else {
     194        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    223195    }
    224196    return (retval);
     
    241213{
    242214    int retval = 0;
    243     int res;
    244     long noof_lines;
    245     long archiver_errors;
    246     bool use_star;
    247 
    248   /***  needs malloc *********/
    249     char *command, *tmp, *filelist_name, *logfile, *archiver_exe,
    250         *compressor_exe;
    251 
    252     malloc_string(command);
    253     malloc_string(tmp);
    254     malloc_string(filelist_name);
    255     malloc_string(logfile);
    256     malloc_string(archiver_exe);
    257     malloc_string(compressor_exe);
     215    int res = 0;
     216    long noof_lines = 0L;
     217    long archiver_errors = 0L;
     218    bool use_star = FALSE;
     219
     220    char *command = NULL;
     221    char *tmp = NULL;
     222    char *filelist_name = NULL;
     223    char *logfile = NULL;
     224    char *archiver_exe = NULL;
     225    char *compressor_exe = NULL;
    258226
    259227    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    260228    assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
    261     sprintf(logfile, "/tmp/afio.log.%d", current_tarball_number);
    262     sprintf(filelist_name, MNT_CDROM "/archives/filelist.%d",
     229    mr_asprintf(&filelist_name, MNT_CDROM "/archives/filelist.%d",
    263230            current_tarball_number);
    264231
    265232    noof_lines = count_lines_in_file(filelist_name);
     233    mr_free(filelist_name);
    266234
    267235    if (strstr(tarball_fname, ".bz2")) {
    268         strcpy(compressor_exe, "bzip2");
     236        mr_asprintf(&compressor_exe, "bzip2");
    269237    } else if (strstr(tarball_fname, ".gz")) {
    270         strcpy(compressor_exe, "gzip");
     238        mr_asprintf(&compressor_exe, "gzip");
    271239    } else if (strstr(tarball_fname, ".lzo")) {
    272         strcpy(compressor_exe, "lzop");
    273     } else {
    274         compressor_exe[0] = '\0';
     240        mr_asprintf(&compressor_exe, "lzop");
     241    } else {
     242        compressor_exe = NULL;
    275243    }
    276244
    277245    if (use_star) {
    278         strcpy(archiver_exe, "star");
    279     } else {
    280         strcpy(archiver_exe, "afio");
    281     }
    282 
    283     if (compressor_exe[0]) {
    284         strcpy(tmp, compressor_exe);
    285         if (!find_home_of_exe(tmp)) {
     246        mr_asprintf(&archiver_exe, "star -bz");
     247    } else {
     248        mr_asprintf(&archiver_exe, "afio");
     249    }
     250
     251    if (compressor_exe != NULL) {
     252        if (!find_home_of_exe(compressor_exe)) {
    286253            fatal_error("(compare_a_tarball) Compression program missing");
    287254        }
    288         if (use_star)           // star
    289         {
    290             if (!strcmp(compressor_exe, "bzip2")) {
    291                 strcat(archiver_exe, " -bz");
    292             } else {
     255        if (use_star) {
     256            if (strcmp(compressor_exe, "bzip2")) {
    293257                fatal_error
    294258                    ("(compare_a_tarball) Please use only bzip2 with star");
    295259            }
    296         } else                  // afio
    297         {
    298             sprintf(compressor_exe, "-P %s -Z", tmp);
    299         }
    300     }
    301 // star -diff H=star -bz file=....
     260        } else {
     261            tmp = compressor_exe;
     262            mr_asprintf(&compressor_exe, "-P %s -Z", tmp);
     263            mr_free(tmp);
     264        }
     265    }
    302266
    303267#ifdef __FreeBSD__
     
    306270#define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
    307271#endif
     272
     273    mr_asprintf(&logfile, "/tmp/afio.log.%d", current_tarball_number);
    308274    if (use_star)               // doesn't use compressor_exe
    309275    {
    310         sprintf(command,
     276        mr_asprintf(&command,
    311277                "%s -diff H=star file=%s >> %s 2>> %s",
    312278                archiver_exe, tarball_fname, logfile, logfile);
    313279    } else {
    314         sprintf(command,
     280        mr_asprintf(&command,
    315281                "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s",
    316282                archiver_exe,
     
    319285    }
    320286#undef BUFSIZE
     287    mr_free(archiver_exe);
     288    mr_free(compressor_exe);
    321289
    322290    res = system(command);
     
    324292    if (res) {
    325293        log_OS_error(command);
    326         sprintf(tmp, "Warning - afio returned error = %d", res);
    327     }
     294    }
     295    mr_free(command);
     296
    328297    if (length_of_file(logfile) > 5) {
    329         sprintf(command,
     298        mr_asprintf(&command,
    330299                "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vx \"dev/.*\" >> /tmp/changed.txt",
    331300                logfile);
    332301        system(command);
     302        mr_free(command);
    333303        archiver_errors = count_lines_in_file(logfile);
    334304    } else {
    335305        archiver_errors = 0;
    336306    }
    337     sprintf(tmp, "%ld difference%c in fileset #%d          ",
    338             archiver_errors, (archiver_errors != 1) ? 's' : ' ',
    339             current_tarball_number);
    340307    if (archiver_errors) {
    341         sprintf(tmp,
    342                 "Differences found while processing fileset #%d       ",
     308        mr_msg(1, "Differences found while processing fileset #%d       ",
    343309                current_tarball_number);
    344         mr_msg(1, tmp);
    345310    }
    346311    unlink(logfile);
    347     mr_free(command);
    348     mr_free(tmp);
    349     mr_free(filelist_name);
    350312    mr_free(logfile);
    351     malloc_string(archiver_exe);
    352     malloc_string(compressor_exe);
    353313    return (retval);
    354314}
     
    367327{
    368328    int retval = 0;
    369     int res;
     329    int res = 0;
    370330    int current_tarball_number = 0;
    371331
    372   /**  needs malloc **********/
    373 
    374     char *tarball_fname, *progress_str, *tmp;
    375     long max_val;
    376 
    377     malloc_string(tarball_fname);
    378     malloc_string(progress_str);
     332    char *tarball_fname = NULL;
     333    char *progress_str = NULL;
     334    char *tmp = NULL;
     335    long max_val = 0L;
     336
     337    assert(bkpinfo != NULL);
     338    mvaddstr_and_log_it(g_currentY, 0, _("Comparing archives"));
    379339    malloc_string(tmp);
    380 
    381     assert(bkpinfo != NULL);
    382     mvaddstr_and_log_it(g_currentY, 0, "Comparing archives");
    383340    read_cfg_var(g_mondo_cfg_file, "last-filelist-number", tmp);
    384341
    385342    max_val = atol(tmp);
    386     sprintf(progress_str, "Comparing with %s #%d ",
    387             media_descriptor_string(bkpinfo->backup_media_type),
     343    mr_free(tmp);
     344
     345    mr_asprintf(&progress_str, _("Comparing with %s #%d "),
     346            bkpinfo->backup_media_string,
    388347            g_current_media_number);
    389348
    390     open_progress_form("Comparing files",
    391                        "Comparing tarballs against filesystem.",
    392                        "Please wait. This may take some time.",
     349    open_progress_form(_("Comparing files"),
     350                       _("Comparing tarballs against filesystem."),
     351                       _("Please wait. This may take some time."),
    393352                       progress_str, max_val);
    394353
     
    398357        insist_on_this_cd_number(bkpinfo, g_current_media_number);
    399358        update_progress_form(progress_str);
    400         sprintf(tarball_fname,
     359        mr_asprintf(&tarball_fname,
    401360                MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
    402361
    403362        if (!does_file_exist(tarball_fname)) {
    404             sprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo",
     363            mr_free(tarball_fname);
     364            mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.lzo",
    405365                    current_tarball_number);
    406366        }
    407367        if (!does_file_exist(tarball_fname)) {
    408             sprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.",
     368            mr_free(tarball_fname);
     369            mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.afio.",
    409370                    current_tarball_number);
    410371        }
    411372        if (!does_file_exist(tarball_fname)) {
    412             sprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2",
     373            mr_free(tarball_fname);
     374            mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.star.bz2",
    413375                    current_tarball_number);
    414376        }
    415377        if (!does_file_exist(tarball_fname)) {
    416             sprintf(tarball_fname, MNT_CDROM "/archives/%d.star.",
     378            mr_free(tarball_fname);
     379            mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%d.star.",
    417380                    current_tarball_number);
    418381        }
     
    423386                == 0) {
    424387                mr_msg(2, "OK, I think I'm done with tarballs...");
     388                mr_free(tarball_fname);
    425389                break;
    426390            }
    427391            mr_msg(2, "OK, I think it's time for another CD...");
    428392            g_current_media_number++;
    429             sprintf(progress_str, "Comparing with %s #%d ",
    430                     media_descriptor_string(bkpinfo->backup_media_type),
     393            mr_free(progress_str);
     394            mr_asprintf(&progress_str, _("Comparing with %s #%d "),
     395                    bkpinfo->backup_media_string,
    431396                    g_current_media_number);
    432397            log_to_screen(progress_str);
    433398        } else {
    434399            res = compare_a_tarball(tarball_fname, current_tarball_number);
    435 
    436400            g_current_progress++;
    437401            current_tarball_number++;
    438402        }
    439     }
     403        mr_free(tarball_fname);
     404    }
     405    mr_free(progress_str);
    440406    close_progress_form();
     407
    441408    if (retval) {
    442         mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
    443     } else {
    444         mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    445     }
    446     mr_free(tarball_fname);
    447     mr_free(progress_str);
    448     mr_free(tmp);
     409        mvaddstr_and_log_it(g_currentY++, 74, _("Errors."));
     410    } else {
     411        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
     412    }
    449413    return (retval);
    450414}
     
    469433{
    470434  /** needs malloc *********/
    471     char *tmp, *cwd, *new, *command;
     435    char *tmp = NULL;
     436    char *cwd = NULL;
     437    char *new = NULL;
     438    char *command = NULL;
    472439    int resA = 0;
    473440    int resB = 0;
    474     long noof_changed_files;
    475 
    476     malloc_string(tmp);
     441    long noof_changed_files = 0L;
     442
    477443    malloc_string(cwd);
    478444    malloc_string(new);
    479     malloc_string(command);
    480445
    481446    assert(bkpinfo != NULL);
     
    484449    chdir(bkpinfo->restore_path);
    485450    getcwd(new, MAX_STR_LEN - 1);
    486     sprintf(tmp, "new path is %s", new);
    487451    insist_on_this_cd_number(bkpinfo, g_current_media_number);
    488452    unlink("/tmp/changed.txt");
     
    493457    noof_changed_files = count_lines_in_file("/tmp/changed.txt");
    494458    if (noof_changed_files) {
    495         sprintf(tmp, "%ld files do not match the backup            ",
     459        log_to_screen(_("%ld files do not match the backup            "),
    496460                noof_changed_files);
    497         //      mvaddstr_and_log_it( g_currentY++, 0, tmp );
    498         log_to_screen(tmp);
    499         sprintf(command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);
     461        mr_asprintf(&command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);
    500462        paranoid_system(command);
    501     } else {
    502         sprintf(tmp, "All files match the backup                     ");
     463        mr_free(command);
     464    } else {
     465        mr_asprintf(&tmp, _("All files match the backup                     "));
    503466        mvaddstr_and_log_it(g_currentY++, 0, tmp);
    504467        log_to_screen(tmp);
    505     }
    506 
    507     mr_free(tmp);
     468        mr_free(tmp);
     469    }
     470
    508471    mr_free(cwd);
    509472    mr_free(new);
    510     mr_free(command);
    511473
    512474    return (resA + resB);
     
    516478 *END_COMPARE_TO_CD                                                       *
    517479 **************************************************************************/
    518 
    519 
    520480
    521481
     
    535495{
    536496    int retval = 0;
    537     long q;
    538     char *tmp;
    539 
    540     malloc_string(tmp);
     497    long q = 0L;
     498    char *tmp = NULL;
    541499
    542500  /**************************************************************************
     
    550508    while (get_cfg_file_from_archive(bkpinfo)) {
    551509        if (!ask_me_yes_or_no
    552             ("Failed to find config file/archives. Choose another source?"))
     510            (_
     511             ("Failed to find config file/archives. Choose another source?")))
    553512        {
    554513            fatal_error("Unable to find config file/archives. Aborting.");
     
    559518    read_cfg_file_into_bkpinfo(g_mondo_cfg_file, bkpinfo);
    560519    g_current_media_number = 1;
    561     mvaddstr_and_log_it(1, 30, "Comparing Automatically");
     520    mvaddstr_and_log_it(1, 30, _("Comparing Automatically"));
    562521    iamhere("Pre-MAD");
    563522    retval = mount_all_devices(mountlist, FALSE);
     
    578537        mvaddstr_and_log_it(g_currentY++,
    579538                            0,
    580                             "Warning - differences found during the compare phase");
     539                            _
     540                            ("Warning - differences found during the compare phase"));
    581541    }
    582542
     
    585545    if (count_lines_in_file("/tmp/changed.txt") > 0) {
    586546        mvaddstr_and_log_it(g_currentY++, 0,
    587                             "Differences found while files were being compared.");
     547                            _
     548                            ("Differences found while files were being compared."));
    588549        streamline_changes_file("/tmp/changed.files", "/tmp/changed.txt");
    589550        if (count_lines_in_file("/tmp/changed.files") <= 0) {
    590551            mvaddstr_and_log_it(g_currentY++, 0,
    591                                 "...but they were logfiles and temporary files. Your archives are fine.");
    592             log_to_screen
    593                 ("The differences were logfiles and temporary files. Your archives are fine.");
     552                                _
     553                                ("...but they were logfiles and temporary files. Your archives are fine."));
     554            log_to_screen(_
     555                          ("The differences were logfiles and temporary files. Your archives are fine."));
    594556        } else {
    595557            q = count_lines_in_file("/tmp/changed.files");
    596             sprintf(tmp, "%ld significant difference%s found.", q,
     558            mr_asprintf(&tmp, _("%ld significant difference%s found."), q,
    597559                    (q != 1) ? "s" : "");
    598560            mvaddstr_and_log_it(g_currentY++, 0, tmp);
    599561            log_to_screen(tmp);
    600 
    601             strcpy(tmp,
    602                    "Type 'less /tmp/changed.files' for a list of non-matching files");
     562            mr_free(tmp);
     563
     564            mr_asprintf(&tmp,
     565                   _("Type 'less /tmp/changed.files' for a list of non-matching files"));
    603566            mvaddstr_and_log_it(g_currentY++, 0, tmp);
    604567            log_to_screen(tmp);
     568            mr_free(tmp);
    605569
    606570            mr_msg(2, "calling popup_changelist_from_file()");
     
    610574    } else {
    611575        log_to_screen
    612             ("No significant differences were found. Your backup is perfect.");
     576            (_
     577             ("No significant differences were found. Your backup is perfect."));
    613578    }
    614579    kill_petris();
    615     mr_free(tmp);
    616580    return (retval);
    617581}
     
    620584 *END_COMPARE_MODE                                                        *
    621585 **************************************************************************/
     586
    622587
    623588/**
     
    633598    int res;
    634599
     600    char *dir = NULL;
     601    char *command = NULL;
     602
     603    assert(bkpinfo != NULL);
    635604  /** needs malloc **/
    636     char *dir, *command;
    637 
    638     assert(bkpinfo != NULL);
    639605    malloc_string(dir);
    640     malloc_string(command);
    641606    getcwd(dir, MAX_STR_LEN);
    642607    chdir(bkpinfo->restore_path);
    643608
    644     sprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
     609    mr_asprintf(&command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
    645610            bkpinfo->restore_path);
    646611    run_program_and_log_output(command, FALSE);
     612    mr_free(command);
     613
    647614    mvaddstr_and_log_it(g_currentY,
    648                         0, "Verifying archives against filesystem");
     615                        0, _("Verifying archives against filesystem"));
    649616
    650617    if (bkpinfo->disaster_recovery
     
    666633    }
    667634
    668     mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     635    mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    669636    mr_free(dir);
    670     mr_free(command);
    671637    return (res);
    672638}
     
    690656int compare_to_tape(struct s_bkpinfo *bkpinfo)
    691657{
    692     int res;
    693     char *dir, *command;
     658    int res = 0;
     659    char *dir = NULL;
     660    char *command = NULL;
    694661
    695662    assert(bkpinfo != NULL);
    696663    malloc_string(dir);
    697     malloc_string(command);
    698664
    699665    getcwd(dir, MAX_STR_LEN);
    700666    chdir(bkpinfo->restore_path);
    701     sprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
     667    mr_asprintf(&command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp",
    702668            bkpinfo->restore_path);
    703669    run_program_and_log_output(command, FALSE);
     670    mr_free(command);
     671
    704672    mvaddstr_and_log_it(g_currentY,
    705                         0, "Verifying archives against filesystem");
     673                        0, _("Verifying archives against filesystem"));
    706674    res = verify_tape_backups(bkpinfo);
    707675    chdir(dir);
    708676    if (res) {
    709         mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
    710     } else {
    711         mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     677        mvaddstr_and_log_it(g_currentY++, 74, _("Failed."));
     678    } else {
     679        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    712680    }
    713681    mr_free(dir);
    714     mr_free(command);
    715682    return (res);
    716683}
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.h

    r128 r1200  
    1 /* mondo-rstr-compare.h
     1/*
    22 * $Id$
    3  */
     3**/
    44
    55
  • branches/stable/mondo/src/mondorestore/mondo-rstr-newt.h

    r1168 r1200  
    1 /***************************************************************************
    2                           mondo-rstr-newt.h  -  description
    3                              -------------------
    4     begin                : Sat Apr 20 2002
    5     copyright            : (C) 2002 by Stan Benoit
    6     email                : troff@nakedsoul.org
    7     cvsid                : $Id$
    8  ***************************************************************************/
    9 
    10 /***************************************************************************
    11  *                                                                         *
    12  *   This program is free software; you can redistribute it and/or modify  *
    13  *   it under the terms of the GNU General Public License as published by  *
    14  *   the Free Software Foundation; either version 2 of the License, or     *
    15  *   (at your option) any later version.                                   *
    16  *                                                                         *
    17  ***************************************************************************/
    18 
     1/*
     2 * $Id$
     3**/
    194
    205#include "my-stuff.h"
     
    2712#endif /*__FreeBSD__*/
    2813
    29 #define NO_FLAWS_DETECTED "No flaws detected in mountlist at this time. Hit 'OK' to proceed."
     14#define NO_FLAWS_DETECTED _("No flaws detected in mountlist at this time. Hit 'OK' to proceed.")
    3015
    3116
     
    4631extern long get_phys_size_of_drive(char *);
    4732extern bool is_this_device_mounted(char *);
     33extern void mr_strip_spaces(char *);
    4834extern void initialize_raidrec(struct raid_device_record *);
    4935extern int make_list_of_drives(struct mountlist_itself *,
     
    7258    g_current_progress, g_currentY;
    7359extern bool g_ISO_restore_mode;
    74 
    75 
    76 /* my global variables */
    77 
    78 //extern newtComponent g_progressForm, g_blurb1, g_blurb2, g_blurb3, g_label,
    79 //  g_timeline, g_percentline, g_scale;
    80 //extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN], g_blurb_str_1[MAX_STR_LEN] =
    81 //  "", g_blurb_str_2[MAX_STR_LEN] = "", g_blurb_str_3[MAX_STR_LEN] = "";
    82 //newtComponent g_isoform_main =
    83 //  NULL, g_isoform_header, g_isoform_scale, g_isoform_timeline,
    84 //  g_isoform_pcline;
    85 //long g_isoform_starttime;
    86 //int g_isoform_old_progress = -1;
    87 //char g_isoform_header_str[MAX_STR_LEN];
    88 //int g_mysterious_dot_counter;
    89 
    90 
    91 
    92 
    9360
    9461/* my subroutines */
     
    195162char *strip_path(char *);
    196163
    197 
    198 
    199 
    200164/* -------------------------------------------------------------------- */
    201165
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools-EXT.h

    r1103 r1200  
    1 /* mondo-rstr-tools-EXT.h
     1/*
    22 * $Id: mondo-rstr-tools-EXT.h
    3  */
     3**/
    44
    55extern void free_MR_global_filenames(void);
     
    2626extern void set_signals(int on);
    2727extern void setup_MR_global_filenames(struct s_bkpinfo *bkpinfo);
    28 //extern void setup_signals(int);
    2928extern void terminate_daemon(int);
    3029extern void termination_in_progress(int);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.h

    r1103 r1200  
    1 /* mondo-rstr-tools.h
     1/*
    22 * $Id: mondo-rstr-tools.h
    3  */
     3**/
    44
    55void free_global_filenames(void);
     
    2626void set_signals(int on);
    2727void setup_global_filenames(struct s_bkpinfo *bkpinfo);
    28 //void setup_signals(int);
    2928void twenty_seconds_til_yikes(void);
    3029int run_raw_mbr(bool offer_to_hack_scripts, char *bd);
  • branches/stable/mondo/src/mondorestore/mondoprep.h

    r684 r1200  
    1 /***************************************************************************
    2                           mondoprep.h  -  description
    3                              -------------------
    4     begin                : Sat Apr 20 2002
    5     copyright            : (C) 2002 by Stan Benoit
    6     email                : troff@nakedsoul.org
    7     cvsid                : $Id$
    8  ***************************************************************************/
    9 
    10 /***************************************************************************
    11  *                                                                         *
    12  *   This program is free software; you can redistribute it and/or modify  *
    13  *   it under the terms of the GNU General Public License as published by  *
    14  *   the Free Software Foundation; either version 2 of the License, or     *
    15  *   (at your option) any later version.                                   *
    16  *                                                                         *
    17  ***************************************************************************/
     1/*
     2 * $Id$
     3**/
    184
    195
     
    2814extern bool ask_me_yes_or_no(char *);
    2915extern long get_phys_size_of_drive(char *);
    30 //extern void log_to_screen (char *);
    3116extern void update_progress_form(char *);
    3217extern void open_progress_form(char *, char *, char *, char *, long);
     
    4126extern off_t length_of_file(char *);
    4227extern long noof_lines_that_match_wildcard(char *, char *);
    43 //extern char *slice_fname (long, long, bool, char *);
    4428extern char *last_line_of_file(char *);
    4529extern void log_file_end_to_screen(char *, char *);
  • branches/stable/mondo/src/mondorestore/mr-externs.h

    r1168 r1200  
    7171extern int read_header_block_from_stream(long long *, char *, int *);
    7272extern void save_filelist(struct s_node *, char *);
     73extern void mr_strip_spaces(char *);
    7374extern int strcmp_inc_numbers(char *, char *);
    7475extern char *slice_fname(long, long, char *, char *);
Note: See TracChangeset for help on using the changeset viewer.