Changeset 2009 in MondoRescue


Ignore:
Timestamp:
Aug 11, 2008, 3:05:15 AM (16 years ago)
Author:
Bruno Cornec
Message:

Commit ald modifs in trunk - just in case

Location:
trunk/mondo/src
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/mondoarchive/mondo-cli.c

    r1188 r2009  
    140140{
    141141    int j;
    142     char *tmp;
    143     char *p;
    144     char *q;
    145     char *comment;
     142    char *tmp = NULL;
     143    char *p = NULL;
     144    char *q = NULL;
    146145
    147146    assert(bkpinfo != NULL);
     
    159158        mr_free(tmp);
    160159
    161         mr_asprintf(&comment, "media_size[%d] = %ld", j,
     160        mr_msg(3, "media_size[%d] = %ld", j,
    162161                bkpinfo->media_size[j]);
    163         mr_msg(3, comment);
    164         mr_free(comment);
    165162    }
    166163    for (; j <= MAX_NOOF_MEDIA; j++) {
     
    201198    char *tmp = NULL;
    202199    char *tmp1 = NULL;
     200    char *tmp2 = NULL;
    203201    char *psz = NULL;
    204202    char *p = NULL;
     
    398396        mr_free(tmp); // allocation from find_tape_device_and_size
    399397
    400         mr_asprintf(&tmp,
     398        mr_asprintf(&tmp2,
    401399                _("You didn't specify a tape streamer device. I'm assuming %s"),
    402400                flag_val['d']);
    403         log_to_screen(tmp);
    404         mr_free(tmp);
     401        log_to_screen(tmp2);
     402        mr_free(tmp2);
    405403        percent = 0;
    406404    }
     
    481479            mr_allocstr(bkpinfo->nfs_remote_dir,"/");
    482480        }
    483         mr_asprintf(&tmp, "mount | grep -E '^%s .*$' | cut -d' ' -f3",
     481        mr_asprintf(&tmp2, "mount | grep -E '^%s .*$' | cut -d' ' -f3",
    484482                bkpinfo->nfs_mount);
    485483        mr_free(bkpinfo->isodir);
    486         bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp);
    487         mr_free(tmp);
     484        bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp2);
     485        mr_free(tmp2);
    488486
    489487        if (strlen(bkpinfo->isodir) < 3) {
     
    642640            if (!does_file_exist(bkpinfo->kernel_path)) {
    643641                retval++;
    644                 mr_asprintf(&tmp,
     642                mr_asprintf(&tmp2,
    645643                    _("You specified kernel '%s', which does not exist\n"),
    646644                    bkpinfo->kernel_path);
    647                 log_to_screen(tmp);
    648                 mr_free(tmp);
     645                log_to_screen(tmp2);
     646                mr_free(tmp2);
    649647            }
    650648        } else {
     
    660658        if (flag_set['i']) {
    661659            mr_allocstr(bkpinfo->isodir,flag_val['d']);
    662             mr_asprintf(&tmp, "ls -l %s", bkpinfo->isodir);
    663             if (run_program_and_log_output(tmp, FALSE)) {
     660            mr_asprintf(&tmp2, "ls -l %s", bkpinfo->isodir);
     661            if (run_program_and_log_output(tmp2, FALSE)) {
    664662                fatal_error
    665663                    ("output folder does not exist - please create it");
    666664            }
    667             mr_free(tmp);
     665            mr_free(tmp2);
    668666        } else if (flag_set['n']) {
    669667            mr_allocstr(bkpinfo->nfs_remote_dir,flag_val['d']);
     
    674672
    675673    if (flag_set['n']) {
    676         mr_asprintf(&tmp, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
     674        mr_asprintf(&tmp2, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
    677675                bkpinfo->nfs_remote_dir);
    678         if (run_program_and_log_output(tmp, FALSE)) {
     676        if (run_program_and_log_output(tmp2, FALSE)) {
    679677            retval++;
    680             mr_free(tmp);
    681             mr_asprintf(&tmp,
     678            mr_free(tmp2);
     679            mr_asprintf(&tmp2,
    682680                    _("Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n"),
    683681                    bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
    684             log_to_screen(tmp);
    685         }
    686         mr_free(tmp);
     682            log_to_screen(tmp2);
     683        }
     684        mr_free(tmp2);
    687685    }
    688686
     
    730728        mr_free(bkpinfo->tmpdir);
    731729        bkpinfo->tmpdir = tmp;
    732         mr_asprintf(&tmp, "touch %s/.foo.dat", flag_val['T']);
    733         if (run_program_and_log_output(tmp, 1)) {
     730        mr_asprintf(&tmp2, "touch %s/.foo.dat", flag_val['T']);
     731        if (run_program_and_log_output(tmp2, 1)) {
    734732            retval++;
    735733            log_to_screen
     
    737735            fatal_error("I cannot write to the tempdir you specified.");
    738736        }
    739         mr_free(tmp);
    740 
    741         mr_asprintf(&tmp, "ln -sf %s/.foo.dat %s/.bar.dat", flag_val['T'],
     737        mr_free(tmp2);
     738
     739        mr_asprintf(&tmp2, "ln -sf %s/.foo.dat %s/.bar.dat", flag_val['T'],
    742740                flag_val['T']);
    743         if (run_program_and_log_output(tmp, 1)) {
     741        if (run_program_and_log_output(tmp2, 1)) {
    744742            retval++;
    745743            log_to_screen
     
    747745            fatal_error("I cannot write to the tempdir you specified.");
    748746        }
    749         mr_free(tmp);
     747        mr_free(tmp2);
    750748    }
    751749
     
    788786        mr_allocstr(bkpinfo->boot_device,tmp);
    789787    }
     788
    790789    if (flag_set['Q']) {
    791         if (tmp == NULL) {
    792             printf("-f option required when using -Q\n");
    793             finish(-1);
    794         }
    795         i = which_boot_loader(tmp);
    796         mr_msg(3, "boot loader is %c, residing at %s", i, tmp);
    797         printf(_("boot loader is %c, residing at %s\n"), i, tmp);
    798         mr_free(tmp);
     790        if (bkpinfo->boot_device == NULL) {
     791            fatal_error("-f option required when using -Q\n");
     792        }
     793        i = which_boot_loader(bkpinfo->boot_device);
     794        mr_msg(3, "boot loader is %c, residing at %s", i, bkpinfo->boot_device);
     795        log_to_screen(_("boot loader is %c, residing at %s\n"), i, tmp);
    799796        finish(0);
    800797    }
    801     mr_free(tmp);
    802798
    803799    if (flag_set['P']) {
     
    880876    return (retval);
    881877}
    882 
    883878
    884879
     
    901896    /*@ ints ** */
    902897    int opt = 0;
    903     char *tmp;
     898    char *tmp = NULL;
    904899    int i = 0;
    905     int len;
     900    int len = 0;
    906901
    907902    /*@ bools *** */
     
    965960
    966961
    967 
    968 
    969962/**
    970963 * Print a not-so-helpful help message and exit.
    971964 */
    972 void help_screen()
     965void help_screen(void)
    973966{
    974967    mr_msg(1, "Type 'man mondo-archive' for more information\n");
     
    983976void terminate_daemon(int sig)
    984977{
    985     char *tmp;
    986     char *tmp2;
     978    char *tmp = NULL;
     979    char *tmp2 = NULL;
    987980
    988981    switch (sig) {
  • trunk/mondo/src/mondorestore/Makefile.am

    r1084 r2009  
    1 ## $Id$
    21##
    32## $Id$
     
    54## Process with Automake to generate Makefile.in
    65##
    7 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include
     6AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/src/include -I${top_builddir}/src/common
    87
    98## Headers
     
    1413## The program
    1514sbin_PROGRAMS         = mondorestore
    16 mondorestore_SOURCES  = mondo-prep.c mondo-restore.c mondo-rstr-newt.c \
     15mondorestore_SOURCES  = mondo-prep.c mondorestore.c mondo-rstr-newt.c \
    1716                        mondo-rstr-compare.c mondo-rstr-tools.c
    1817mondorestore_LDADD    = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@
  • trunk/mondo/src/mondorestore/mondo-prep.c

    r1106 r2009  
    1010
    1111#include "my-stuff.h"
    12 #include "../common/mondostructures.h"
     12#include "mondostructures.h"
    1313#include "mondoprep.h"
    14 #include "../common/libmondo.h"
     14#include "libmondo.h"
    1515#include "mondo-rstr-tools-EXT.h"
    1616
     
    2020#include <unistd.h>
    2121#include "mr_mem.h"
     22#include "mr_msg.h"
    2223
    2324
     
    5253void wipe_MBRs_and_reboot_if_necessary(struct mountlist_itself *mountlist)
    5354{
    54     char *command;
    55     int lino;
    56     FILE *fout;
    57     char *buf;
     55    char *command = NULL;
     56    int lino = 0;
     57    int res = 0;
     58    FILE *fout = NULL;
     59    char *buf = NULL;
    5860    struct list_of_disks *drivelist = NULL;
    59 // If LVMs are present and a zero-and-reboot wasn't recently undertaken
    60 // then zero & insist on reboot.
     61
     62    // If LVMs are present and a zero-and-reboot wasn't recently undertaken
     63    // then zero & insist on reboot.
    6164    if (does_file_exist("/tmp/i-want-my-lvm"))  // FIXME - cheating :)
    6265    {
     
    6770                     "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"",
    6871                     drivelist->el[lino].device, MONDO_WAS_HERE);
    69             if (!run_program_and_log_output(command, 1)) {
     72            res = run_program_and_log_output(command, 1);
     73            mr_free(command);
     74            if (!res) {
    7075                mr_msg(1, "Found MONDO_WAS_HERE marker on drive#%d (%s)",
    7176                        lino, drivelist->el[lino].device);
    72                 mr_free(command);
    7377                break;
    7478            }
    75             mr_free(command);
    7679        }
    7780
    7881        if (lino == drivelist->entries) {
    79 // zero & reboot
     82            // zero & reboot
    8083            log_to_screen
    8184                (_
     
    120123int fput_string_one_char_at_a_time(FILE * fout, char *str)
    121124{
    122     int i, j;
    123     FILE *fq;
     125    int i = 0, j = 0;
     126    FILE *fq = NULL;
    124127
    125128    if (ferror(fout)) {
     
    159162                          bool vacuum_pack)
    160163{
    161     /** char **************************************************/
    162164    char *tmp = NULL;
    163165    char *tmp1 = NULL;
     
    178180    int i = 0;
    179181    int lvmversion = 1;
    180     long extents;
     182    long extents = 0L;
    181183    fpos_t orig_pos;
    182184    size_t n = 0;
     
    184186
    185187    /** pointers **********************************************/
    186     FILE *fin;
     188    FILE *fin = NULL;
    187189
    188190    /** end *****************************************************/
     
    257259            continue;
    258260        }
    259         if (res && strstr(command, "create") && vacuum_pack) {
    260             sleep(2);
    261             sync();
    262             sync();
    263             sync();
    264         }
    265261        if ((p = strstr(incoming, "vgcreate"))) {
    266262            // include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
     
    271267                } else {
    272268                    fgetpos(fin, &orig_pos);
    273                     mr_asprintf(&tmp1, "%s%s", incoming, tmp);
    274                     mr_free(incoming);
    275                     incoming = tmp1;
     269                    mr_strcat(incoming, tmp);
    276270                }
    277271            }
     
    287281            *q = '\0';
    288282            mr_msg(1, "Deleting old entries at /dev/%s", tmp1);
    289             mr_asprintf(&tmp, "rm -Rf /dev/%s", tmp1);
     283            mr_asprintf(&command, "rm -Rf /dev/%s", tmp1);
    290284            mr_free(tmp1);
    291285
    292             run_program_and_log_output(tmp, 1);
    293             mr_free(tmp);
     286            run_program_and_log_output(command, 1);
     287            mr_free(command);
    294288
    295289            run_program_and_log_output(vgscan_sz, 1);
     
    300294        }
    301295        for (p = incoming + 1; *p == ' '; p++);
    302         mr_allocstr(command,p);
     296        mr_asprintf(&command,p);
    303297        for (p = command; *p != '\0'; p++);
    304         for (; *(p - 1) < 32; p--);
     298        for (; (*(p - 1) < 32) && (p > command) ; p--);
    305299        *p = '\0';
    306300
     
    319313            if (strstr(command, "lvm lvcreate"))
    320314                lvmversion = 2;
    321             /* BERLIOS : this tmp may be uninitialized ?
    322             log_it("%s... so I'll get creative.", tmp);
    323             */
    324315            if (lvmversion == 2) {
    325316                tmp = call_program_and_get_last_line_of_output
    326                         ("tail -n5 " MONDO_LOGFILE
    327                         " | grep Insufficient | tail -n1");
     317                        ("tail -n5 " MONDO_LOGFILE " | grep Insufficient | tail -n1");
    328318            } else {
    329319                tmp = call_program_and_get_last_line_of_output
    330                        ("tail -n5 " MONDO_LOGFILE
    331                         " | grep lvcreate | tail -n1");
     320                       ("tail -n5 " MONDO_LOGFILE " | grep lvcreate | tail -n1");
    332321            }
    333322            for (p = tmp; *p != '\0' && !isdigit(*p); p++);
     
    373362                mr_msg(0, "%s --> %d", command, res);
    374363                if (!res) {
    375                     mr_msg(5, "YAY! This time, it succeeded.");
     364                    mr_msg(5, "Yep! This time, it succeeded.");
    376365                }
    377366            }
     
    429418    int j = 0;
    430419    char *incoming = NULL;
    431     char *tmp = NULL;
    432420    char *p = NULL;
    433421    size_t n = 0;
     
    465453                 mr_getline(&incoming, &n, fin));
    466454            if (!feof(fin)) {
    467                 mr_asprintf(&tmp, "Investigating %s",
     455                log_it("Investigating %s",
    468456                        old_mountlist->el[lino].device);
    469                 log_it(tmp);
    470                 mr_free(tmp);
    471 
    472457                for (mr_getline(&incoming, &n, fin); !feof(fin)
    473458                     && !strstr(incoming, "raiddev");
     
    476461                        && !strchr(incoming, '#')) {
    477462                        for (p = incoming + strlen(incoming);
    478                              *(p - 1) <= 32; p--);
     463                             (*(p - 1) <= 32) && (p >= incoming) ; p--);
    479464                        *p = '\0';
    480                         for (p--; p > incoming && *(p - 1) > 32; p--);
    481                         mr_asprintf(&tmp, "Extrapolating %s", p);
    482                         log_it(tmp);
    483                         mr_free(tmp);
    484 
     465                        for (p--; (p >= incoming) && (*(p - 1) > 32); p--);
     466                        log_it("Extrapolating %s", p);
    485467                        for (j = 0;
    486468                             j < new_mountlist->entries
     
    500482                            new_mountlist->entries++;
    501483                        } else {
    502                             mr_asprintf(&tmp,
    503                                     "Not adding %s to mountlist: it's already there", p);
    504                             log_it(tmp);
    505                             mr_free(tmp);
     484                            log_it("Not adding %s to mountlist: it's already there", p);
    506485                        }
    507486                    }
     
    509488            }
    510489            mr_free(incoming);
     490
    511491            paranoid_fclose(fin);
    512492        } else {
     
    534514 * @return 0 for success, nonzero for failure.
    535515 */
    536 int create_raid_device_via_mdadm(struct raidlist_itself *raidlist,
    537                                  char *device)
     516int create_raid_device_via_mdadm(struct raidlist_itself *raidlist, char *device)
    538517{
    539518  /** int **************************************************************/
     
    567546  mr_asprintf(&devices, raidlist->el[i].data_disks.el[0].device);
    568547  for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    569     mr_asprintf(&strtmp, "%s", devices);
    570     mr_free(devices);
    571     mr_asprintf(&devices, "%s %s", strtmp,
    572          raidlist->el[i].data_disks.el[j].device);
    573     mr_free(strtmp);
     548    mr_strcat(devices, " %s", raidlist->el[i].data_disks.el[j].device);
    574549  }
    575550  for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    576     mr_asprintf(&strtmp, "%s", devices);
    577     mr_free(devices);
    578     mr_asprintf(&devices, "%s %s", strtmp,
    579          raidlist->el[i].spare_disks.el[j].device);
    580     mr_free(strtmp);
     551    mr_strcat(devices, " %s", raidlist->el[i].spare_disks.el[j].device);
    581552  }
    582553  // translate RAID level
     
    597568       raidlist->el[i].raid_device, level,
    598569       raidlist->el[i].data_disks.entries);
     570  mr_free(level);
    599571  if (raidlist->el[i].parity != -1) {
    600     asprintf(&strtmp, "%s", program);
    601     mr_free(program);
    602572    switch(raidlist->el[i].parity) {
    603573    case 0:
    604       mr_asprintf(&program, "%s --parity=%s", strtmp, "la");
     574      mr_strcat(program, " --parity=%s", "la");
    605575      break;
    606576    case 1:
    607       mr_asprintf(&program, "%s --parity=%s", strtmp, "ra");
     577      mr_strcat(program, " --parity=%s", "ra");
    608578      break;
    609579    case 2:
    610       mr_asprintf(&program, "%s --parity=%s", strtmp, "ls");
     580      mr_strcat(program, " --parity=%s", "ls");
    611581      break;
    612582    case 3:
    613       mr_asprintf(&program, "%s --parity=%s", strtmp, "rs");
     583      mr_strcat(program, " --parity=%s", "rs");
    614584      break;
    615585    default:
     
    617587      break;
    618588    }
    619     mr_free(strtmp);
    620589  }
    621590  if (raidlist->el[i].chunk_size != -1) {
    622     mr_asprintf(&strtmp, "%s", program);
    623     mr_free(program);
    624     mr_asprintf(&program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
    625     mr_free(strtmp);
     591        mr_strcat(program, " --chunk=%d", raidlist->el[i].chunk_size);
    626592  }
    627593  if (raidlist->el[i].spare_disks.entries > 0) {
    628     mr_asprintf(&strtmp, "%s", program);
    629     mr_free(program);
    630     mr_asprintf(&program, "%s --spare-devices=%d", strtmp,
    631          raidlist->el[i].spare_disks.entries);
    632     mr_free(strtmp);
     594        mr_strcat(program, " --spare-devices=%d", raidlist->el[i].spare_disks.entries);
    633595  }
    634   mr_asprintf(&strtmp, "%s", program);
    635   mr_free(program);
    636   mr_asprintf(&program, "%s %s", strtmp, devices);
    637   mr_free(strtmp);
     596    mr_strcat(program, " %s", devices);
    638597  res = run_program_and_log_output(program, 1);
    639598  // free memory
    640599  mr_free(devices);
    641   mr_free(level);
    642600  mr_free(program);
    643601  // return to calling instance
    644   return res;
     602  return(res);
    645603}
    646604
     
    656614 * @return 0 for success, nonzero for failure.
    657615 */
    658 int format_device(char *device, char *format,
    659                   struct raidlist_itself *raidlist)
     616int format_device(char *device, char *format, struct raidlist_itself *raidlist)
    660617{
    661618    /** int **************************************************************/
     
    673630    char *line = NULL;
    674631    char *status = NULL;
    675     FILE *pin;
    676     FILE *fin;
     632    FILE *pin = NULL;
     633    FILE *fin = NULL;
    677634    size_t n = 0;
    678635    size_t n1 = 0;
     
    685642
    686643    if (strstr(format, "raid")) {   // do not form RAID disks; do it to /dev/md* instead
    687         mr_asprintf(&tmp, "Not formatting %s (it is a RAID disk)", device);
    688         log_it(tmp);
    689         mr_free(tmp);
     644        log_it("Not formatting %s (it is a RAID disk)", device);
    690645        return (0);
    691646    }
     
    700655                "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it",
    701656                device, format);
    702         log_it(tmp);
    703         mr_free(tmp);
    704657        return (0);
    705658    }
    706659    if (is_this_device_mounted(device)) {
    707         mr_asprintf(&tmp, _("%s is mounted - cannot format it       "), device);
    708         log_to_screen(tmp);
    709         mr_free(tmp);
     660        log_to_screen(_("%s is mounted - cannot format it       "), device);
    710661        return (1);
    711662    }
     
    734685
    735686        if (vinum_started_yet) {
    736             mr_asprintf(&tmp,
    737                     _
    738                     ("Initializing Vinum device %s (this may take a *long* time)"),
     687            log_to_screen(_("Initializing Vinum device %s (this may take a *long* time)"),
    739688                    device);
    740             log_to_screen(tmp);
    741             mr_free(tmp);
    742689
    743690            /* format raid partition */
     
    785732            }
    786733            mr_free(line);
     734
    787735            fclose(fin);
    788736            unlink("/tmp/plexes");
     
    790738        }
    791739#else
    792         mr_asprintf(&tmp, _("Initializing RAID device %s"), device);
    793         log_to_screen(tmp);
    794         mr_free(tmp);
    795 
    796 // Shouldn't be necessary.
     740        log_to_screen(_("Initializing RAID device %s"), device);
     741
     742        // Shouldn't be necessary.
    797743        log_to_screen(_("Stopping %s"), device);
    798744        stop_raid_device(device);
    799745        sync();
    800746        sleep(1);
    801         /* BERLIOS: This code is wrong as program has not been initialized
    802         if (g_fprep) {
    803             fprintf(g_fprep, "%s\n", program);
    804         }
    805         */
    806747
    807748        mr_msg(1, "Making %s", device);
    808749        // use mkraid if it exists, otherwise use mdadm
    809         if (run_program_and_log_output("which mkraid", FALSE)) {
    810             res = create_raid_device_via_mdadm(raidlist, device);
    811             mr_msg(1, "Creating RAID device %s via mdadm returned %d",
    812                     device, res);
     750        if (run_program_and_log_output("which mkraid", FALSE)) {
     751            res = create_raid_device_via_mdadm(raidlist, device);
     752            mr_msg(1, "Creating RAID device %s via mdadm returned %d", device, res);
    813753        } else {
    814754            mr_asprintf(&program, "mkraid --really-force %s", device);
     
    830770        newtResume();
    831771    }
    832 //#ifndef __FreeBSD__
    833 //#endif
    834772
    835773    if (!strcmp(format, "lvm")) {
     
    849787    mr_free(tmp);
    850788
    851     mr_asprintf(&tmp, "Formatting %s as %s", device, format);
     789    mr_asprintf(&tmp, _("Formatting %s as %s"), device, format);
    852790    update_progress_form(tmp);
    853791
    854792    res = run_program_and_log_output(program, FALSE);
    855793    if (res && strstr(program, "kludge")) {
     794        mr_free(tmp);
     795        mr_asprintf(&tmp, _("Kludge failed; using regular mkfs.%s to format %s"), format, device);
     796        mr_free(program);
    856797#ifdef __FreeBSD__
    857         mr_free(program);
    858798        mr_asprintf(&program, "newfs_msdos -F 32 %s", device);
    859799#else
     
    861801        /* For EFI partitions take fat16
    862802         * as we want to make small ones */
    863         mr_free(program);
    864803        mr_asprintf(&program, "mkfs -t %s -F 16 %s", format, device);
    865804#else
    866         mr_free(program);
    867805        mr_asprintf(&program, "mkfs -t %s -F 32 %s", format, device);
    868806#endif
     
    877815    retval += res;
    878816    if (retval) {
    879         mr_asprintf(&tmp1, "%s%s",tmp, _("...failed"));
     817        mr_strcat(tmp, _("...failed"));
    880818    } else {
    881         mr_asprintf(&tmp1, "%s%s",tmp, _("...OK"));
    882     }
     819        mr_strcat(tmp, _("...OK"));
     820    }
     821    log_to_screen(tmp);
    883822    mr_free(tmp);
    884823
    885     log_to_screen(tmp1);
    886     mr_free(tmp1);
    887824    sync();
    888825    sleep(1);
     
    902839    /** int **************************************************************/
    903840    int retval = 0;
    904     int lino;
    905     int res;
    906 //  int i;
    907 //  struct list_of_disks *drivelist;
     841    int lino = 0;
     842    int res = 0;
    908843
    909844    /** long *************************************************************/
    910     long progress_step;
     845    long progress_step = 0L;
    911846
    912847    /** bools ************************************************************/
    913     bool do_it;
     848    bool do_it = FALSE;
    914849
    915850    /** buffers **********************************************************/
    916     char *tmp;
     851    char *tmp = NULL;
    917852
    918853    /** pointers *********************************************************/
    919     struct mountlist_line *me;  // mountlist entry
     854    struct mountlist_line *me = NULL;   // mountlist entry
    920855    /** end **************************************************************/
    921856
    922857    assert(mountlist != NULL);
    923     mr_asprintf(&tmp, "format_everything (mountlist, interactively = %s",
     858    log_it("format_everything (mountlist, interactively = %s",
    924859            (interactively) ? "true" : "false");
    925     log_it(tmp);
    926     mr_free(tmp);
    927 
    928860    mvaddstr_and_log_it(g_currentY, 0, _("Formatting partitions     "));
    929861    open_progress_form(_("Formatting partitions"),
     
    935867        (mountlist->entries >
    936868         0) ? g_maximum_progress / mountlist->entries : 1;
    937 // start soft-raids now (because LVM might depend on them)
    938 // ...and for simplicity's sake, let's format them at the same time :)
     869    // start soft-raids now (because LVM might depend on them)
     870    // ...and for simplicity's sake, let's format them at the same time :)
    939871    mr_msg(1, "Stopping all RAID devices");
    940872    stop_all_raid_devices(mountlist);
     
    968900    sync();
    969901    sleep(2);
    970 // This last step is probably necessary
    971 //  log_to_screen("Re-starting software RAIDs...");
    972 //  start_all_raid_devices(mountlist);
    973 //  system("sync"); system("sync"); system("sync");
    974 //  sleep(5);
    975 // do LVMs now
     902    // This last step is probably necessary
     903    //  log_to_screen("Re-starting software RAIDs...");
     904    //  start_all_raid_devices(mountlist);
     905    //  system("sync"); system("sync"); system("sync");
     906    //  sleep(5);
     907    // do LVMs now
    976908    mr_msg(1, "Creating LVMs");
    977909    if (does_file_exist("/tmp/i-want-my-lvm")) {
     
    995927        sleep(3);
    996928    }
    997 // do regulars at last
     929    // do regulars at last
    998930    sleep(2);                   // woo!
    999931    mr_msg(1, "Formatting regulars");
     
    1001933        me = &mountlist->el[lino];  // the current mountlist entry
    1002934        if (!strcmp(me->mountpoint, "image")) {
    1003             mr_asprintf(&tmp, "Not formatting %s - it's an image", me->device);
    1004             log_it(tmp);
    1005             mr_free(tmp);
     935            log_it("Not formatting %s - it's an image", me->device);
    1006936        } else if (!strcmp(me->format, "raid")) {
    1007             mr_asprintf(&tmp, "Not formatting %s - it's a raid-let",
    1008                     me->device);
    1009             log_it(tmp);
    1010             mr_free(tmp);
     937            log_it("Not formatting %s - it's a raid-let", me->device);
    1011938            continue;
    1012939        } else if (!strcmp(me->format, "lvm")) {
    1013             mr_asprintf(&tmp, "Not formatting %s - it's an LVM", me->device);
    1014             log_it(tmp);
    1015             mr_free(tmp);
     940            log_it("Not formatting %s - it's an LVM", me->device);
    1016941            continue;
    1017942        } else if (!strncmp(me->device, "/dev/md", 7)) {
    1018             mr_asprintf(&tmp, "Already formatted %s - it's a soft-RAID dev",
    1019                     me->device);
    1020             log_it(tmp);
    1021             mr_free(tmp);
     943            log_it("Already formatted %s - it's a soft-RAID dev", me->device);
    1022944            continue;
    1023945        } else if (!does_file_exist(me->device)
    1024946                   && strncmp(me->device, "/dev/hd", 7)
    1025947                   && strncmp(me->device, "/dev/sd", 7)) {
    1026             mr_asprintf(&tmp,
    1027                     "Not formatting %s yet - doesn't exist - probably an LVM",
    1028                     me->device);
    1029             log_it(tmp);
    1030             mr_free(tmp);
     948            log_it("Not formatting %s yet - doesn't exist - probably an LVM", me->device);
    1031949            continue;
    1032950        } else {
     
    1066984    }
    1067985
    1068     mr_asprintf(&tmp, "format_everything () - %s",
     986    log_it("format_everything () - %s",
    1069987            (retval) ? "failed!" : "finished successfully");
    1070     log_it(tmp);
    1071     mr_free(tmp);
    1072988
    1073989    if (g_partition_table_locked_up > 0) {
     
    11201036{
    11211037    /** int **************************************************************/
    1122     int current_devno;
    1123     int previous_devno;
     1038    int current_devno = 0;
     1039    int previous_devno = 0;
    11241040    int retval = 0;
    1125     int res;
    1126 
    1127     /** buffers **********************************************************/
    1128     char *tmp;
     1041    int res = 0;
    11291042
    11301043    /** end **************************************************************/
     
    11331046
    11341047    if (devno_we_must_allow_for >= 5) {
    1135         mr_asprintf(&tmp, "Making dummy primary %s%d", drivename, 1);
    1136         log_it(tmp);
    1137         mr_free(tmp);
    1138 
     1048        log_it("Making dummy primary %s%d", drivename, 1);
    11391049        g_maximum_progress++;
    11401050        res =
     
    11491059    }
    11501060    for (; current_devno < devno_we_must_allow_for; current_devno++) {
    1151         mr_asprintf(&tmp, "Creating dummy partition %s%d", drivename,
    1152                 current_devno);
    1153         log_it(tmp);
    1154         mr_free(tmp);
    1155 
     1061        log_it("Creating dummy partition %s%d", drivename, current_devno);
    11561062        g_maximum_progress++;
    11571063        res =
     
    12931199{
    12941200    static struct disklabel loclab;
    1295     struct partition *dp;
    1296     char *lnamebuf;
     1201    struct partition *dp = NULL;
     1202    char *lnamebuf = NULL;
    12971203    int f;
    12981204    u_int secsize, u;
     
    13761282                         char *drivename, struct disklabel *ret)
    13771283{
    1378     char *subdev_str;
    1379     char *command;
    1380     struct disklabel *lp;
     1284    char *subdev_str = NULL;
     1285    char *command = NULL;
     1286    struct disklabel *lp = NULL;
    13811287    int i, lo = 0;
    13821288    int retval = 0;
    1383     char c;
    1384     FILE *ftmp;
     1289    char c = ' ';
     1290    FILE *ftmp = NULL;
    13851291
    13861292    lp = get_virgin_disklabel(drivename);
     
    14931399    assert_string_is_neither_NULL_nor_zerolength(drivename);
    14941400
    1495     mr_asprintf(&tmp, "Partitioning drive %s", drivename);
    1496     log_it(tmp);
    1497     mr_free(tmp);
     1401    log_it("Partitioning drive %s", drivename);
    14981402
    14991403#if __FreeBSD__
     
    15231427            // then see if the user has picked 'dangerously-dedicated' mode.
    15241428            // If so, then we just call label_drive_or_slice() and return.
    1525             char c;
    1526             char *command;
     1429            char c = ' ';
     1430            char *command = NULL;
    15271431
    15281432            if (current_devno == 1) {
     
    15931497            file = open(drivename, O_WRONLY);
    15941498            if (!file) {
    1595                 mr_asprintf(&tmp,
    1596                         _("Warning - unable to open %s for wiping it's partition table"),
    1597                         drivename);
    1598                 log_to_screen(tmp);
    1599                 mr_free(tmp);
     1499                log_to_screen(_("Warning - unable to open %s for wiping it's partition table"), drivename);
    16001500            }
    16011501
    16021502            for (i = 0; i < 512; i++) {
    16031503                if (!write(file, "\0", 1)) {
    1604                     mr_asprintf(&tmp, _("Warning - unable to write to %s"),
    1605                             drivename);
    1606                     log_to_screen(tmp);
    1607                     mr_free(tmp);
     1504                    log_to_screen(_("Warning - unable to write to %s"), drivename);
    16081505                }
    16091506            }
     
    16251522        if (!fbsd_part) {
    16261523#endif
    1627 
     1524            mr_free(format);
    16281525            mr_asprintf(&format, mountlist->el[lino].format);
    16291526            partsize = mountlist->el[lino].size;
     
    16331530#endif
    16341531
     1532#ifndef __IA64__
    16351533        if (current_devno == 5 && previous_devno == 4) {
    16361534            log_to_screen
     
    16411539            return (1);
    16421540        }
     1541#endif
    16431542
    16441543        retval +=
     
    17161615
    17171616    /** buffers **********************************************************/
    1718     char *program;
    1719     char *partition_name;
    1720     char *tmp;
    1721     char *output;
     1617    char *program = NULL;
     1618    char *partition_name = NULL;
     1619    char *tmp = NULL;
     1620    char *output = NULL;
    17221621
    17231622    /** pointers **********************************************************/
    1724     char *p;
    1725     char *part_table_fmt;
    1726     FILE *fout;
     1623    char *p = NULL;
     1624    char *part_table_fmt = NULL;
     1625    FILE *fout = NULL;
    17271626
    17281627    /** end ***************************************************************/
     
    17351634
    17361635    if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    1737         mr_asprintf(&tmp, "Not partitioning %s - it is a virtual drive", drive);
    1738         log_it(tmp);
    1739         mr_free(tmp);
     1636        log_it("Not partitioning %s - it is a virtual drive", drive);
    17401637        return (0);
    17411638    }
     
    17521649
    17531650    if (is_this_device_mounted(partition_name)) {
    1754         mr_asprintf(&tmp, _("%s is mounted, and should not be partitioned"),
     1651        log_to_screen("%s is mounted, and should not be partitioned",
    17551652                partition_name);
    17561653        mr_free(partition_name);
    1757 
    1758         log_to_screen(tmp);
    1759         mr_free(tmp);
    17601654        return (1);
    17611655    }
    17621656
    17631657    p = (char *) strrchr(partition_name, '/');
    1764     mr_asprintf(&program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE,
    1765             MONDO_LOGFILE);
    17661658
    17671659    /* BERLIOS: should not be called each time */
     
    17791671                         ("You need to leave at least one partition free, for 'extended/logical'"));
    17801672                    mr_free(partition_name);
    1781                     mr_free(program);
    1782 
    1783                     mr_free(output);
    17841673                    return (1);
    17851674                } else {
     
    17871676                }
    17881677            }
    1789             mr_asprintf(&tmp,"%sn\nl\n",output);
    1790             mr_free(output);
    1791             output = tmp;
     1678            mr_strcat(output, "n\nl\n");
    17921679        } else {
    17931680            /* GPT allows more than 4 primary partitions */
     
    17971684    mr_free(part_table_fmt);
    17981685    /*start block (ENTER for next free blk */
    1799     mr_asprintf(&tmp,"%s\n",output);
    1800     mr_free(output);
    1801     output = tmp;
    1802 
     1686    mr_strcat(output, "\n");   
    18031687    if (partsize > 0) {
    18041688        if (!strcmp(format, "7")) {
     
    18061690            partsize += 512;
    18071691        }
    1808         mr_asprintf(&tmp,"%s+%lldK", output,  (long long) (partsize));
    1809         mr_free(output);
    1810         output = tmp;
    1811     }
    1812     mr_asprintf(&tmp,"%s\n",output);
    1813     mr_free(output);
    1814     output = tmp;
     1692        mr_strcat(output, "+%lldK", (long long) (partsize));
     1693    }
     1694    mr_strcat(output, "\n");
    18151695#if 0
    18161696/*
    18171697#endif
    1818     mr_asprintf(&tmp,"PARTSIZE = +%ld",(long)partsize);
    1819     log_it(tmp);
    1820     mr_free(tmp);
    1821 
     1698    log_it("PARTSIZE = +%ld",(long)partsize);
    18221699    log_it("---fdisk command---");
    18231700    log_it(output);
     
    18601737        }
    18611738    } else {
    1862         mr_asprintf(&tmp,"%sw\n\n",output);
    1863         mr_free(output);
    1864         output = tmp;
     1739        mr_strcat(output, "w\n\n");
     1740        mr_asprintf(&program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE,
     1741            MONDO_LOGFILE);
    18651742
    18661743        if (g_fprep) {
     
    18741751            paranoid_pclose(fout);
    18751752        }
     1753        mr_free(program);
     1754
    18761755        if (!does_partition_exist(drive, partno) && partsize > 0) {
    18771756            log_it("Vaccum-packing");
     
    18811760                                 format, -1);
    18821761            if (res) {
    1883                 mr_asprintf(&tmp, "Failed to vacuum-pack %s", partition_name);
    1884                 log_it(tmp);
    1885                 mr_free(tmp);
    1886 
     1762                log_it("Failed to vacuum-pack %s", partition_name);
    18871763                retval++;
    18881764            } else {
     
    18951771                                   partsize);
    18961772            if (retval) {
    1897                 mr_asprintf(&tmp, "Partitioned %s but failed to set its type",
     1773                log_it("Partitioned %s but failed to set its type",
    18981774                        partition_name);
    1899                 log_it(tmp);
    1900                 mr_free(tmp);
    19011775            } else {
    19021776                if (partsize > 0) {
    1903                     mr_asprintf(&tmp, "Partition %s created+configured OK",
     1777                    log_to_screen(_("Partition %s created+configured OK"),
    19041778                            partition_name);
    1905                     log_to_screen(tmp);
    1906                     mr_free(tmp);
    19071779                } else {
    19081780                    log_it("Returning from a successful vacuum-pack");
     
    19231795    log_it("partition_device() --- leaving");
    19241796    mr_free(partition_name);
    1925     mr_free(program);
    19261797    mr_free(output);
    19271798    return (retval);
     
    19391810{
    19401811    /** int ************************************************************/
    1941     int lino;
     1812    int lino = 0;
    19421813    int retval = 0;
    1943     int i;
    1944     int res;
     1814    int i = 0;
     1815    int res = 0;
    19451816
    19461817    /** buffer *********************************************************/
    1947     struct list_of_disks *drivelist;
    1948     /*  struct mountlist_itself new_mtlist, *mountlist; */
     1818    struct list_of_disks *drivelist = NULL;
    19491819
    19501820    /** end ************************************************************/
     
    19551825    log_it("partition_everything() --- starting");
    19561826    mvaddstr_and_log_it(g_currentY, 0, "Partitioning hard drives      ");
    1957     /*  mountlist=orig_mtlist; */
    19581827    if (mountlist_contains_raid_devices(mountlist)) {
    19591828        /*      mountlist=&new_mtlist; */
     
    19771846    stop_all_raid_devices(mountlist);
    19781847    mr_msg(0, "Done.");
    1979 
    1980 /* 
    1981     if (does_file_exist("/tmp/i-want-my-lvm"))
    1982       {
    1983         wipe_MBRs_and_reboot_if_necessary(mountlist); // i.e. if it wasn't done recently
    1984       }
    1985 */
    19861848
    19871849    open_progress_form(_("Partitioning devices"),
     
    20101872    system("clear");
    20111873    newtResume();
    2012     mr_free((void*) drivelist);
     1874    mr_free(drivelist);
    20131875    return (retval);
    20141876}
    2015 
    2016 
    2017 
    2018 
    20191877
    20201878
     
    20761934        mr_asprintf(&partcode, "8e");
    20771935    } else if (format[0] == '\0') { /* LVM physical partition */
    2078         mr_asprintf(&partcode, "%s", "");
     1936        mr_asprintf(&partcode, "");
    20791937    } else if (strlen(format) >= 1 && strlen(format) <= 2) {
    20801938        mr_asprintf(&partcode, format);
     
    20981956    mr_msg(1, tmp);
    20991957    mr_free(tmp);
     1958
    21001959    if (partcode[0] != '\0' && strcmp(partcode, "83")) {    /* no need to set type if 83: 83 is default */
    21011960
     
    21191978            fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    21201979            mr_free(tmp);
     1980
    21211981            tmp1 = last_line_of_file(FDISK_LOG);
    21221982            mr_msg(5, "B - last line = '%s'",tmp1);
     
    21702030{
    21712031    /** int *************************************************************/
    2172     int res;
     2032    int res = 0;
    21732033    int retval = 0;
    21742034
    21752035    /** buffers *********************************************************/
    2176     char *program;
     2036    char *program = NULL;
    21772037
    21782038    /** end *************************************************************/
     
    21872047    mr_asprintf(&program, "vinum start -f %s", raid_device);
    21882048#else
    2189     mr_asprintf(&program, "raidstart %s", raid_device);
     2049    // use raidstart if it exists, otherwise use mdadm
     2050    if (run_program_and_log_output("which raidstart", FALSE)) {
     2051        // BERLIOS: Not sure it's sufficient
     2052        mr_asprintf(&program, "mdadm -A %s", raid_device);
     2053    } else {
     2054        mr_asprintf(&program, "raidstart %s", raid_device);
     2055    }
    21902056#endif
    21912057    mr_msg(1, "program = %s", program);
     
    22142080{
    22152081    /** int *************************************************************/
    2216     int res;
     2082    int res = 0;
    22172083    int retval = 0;
    22182084
    22192085    /** buffers *********************************************************/
    2220     char *program;
     2086    char *program = NULL;
    22212087
    22222088    /** end *************************************************************/
     
    22552121int start_all_raid_devices(struct mountlist_itself *mountlist)
    22562122{
    2257     int i;
     2123    int i = 0;
    22582124    int retval = 0;
    2259     int res;
     2125    int res = 0;
    22602126
    22612127    for (i = 0; i < mountlist->entries; i++) {
     
    23662232    /** int *************************************************************/
    23672233    int res = 0;
    2368 
    2369     /** buffers *********************************************************/
    2370     char *tmp;
    23712234
    23722235    /** end ***************************************************************/
     
    24022265        mr_asprintf(&program, "mkfs -t %s -c", format); // -c checks for bad blocks
    24032266#endif
    2404         mr_asprintf(&tmp, "Unknown format (%s) - assuming '%s' will do", format,
     2267        log_it("Unknown format (%s) - assuming '%s' will do", format,
    24052268                program);
    2406         log_it(tmp);
    2407         mr_free(tmp);
    24082269        res = 0;
    24092270    }
     
    24232284{
    24242285    /** long ************************************************************/
    2425     long original_size_of_drive;
     2286    long original_size_of_drive = 0L;
    24262287
    24272288    /** int *************************************************************/
    2428     int partno;
    2429 
    2430     /** buffers *********************************************************/
    2431     char *tmp;
     2289    int partno = 0;
    24322290
    24332291    /** end *************************************************************/
     
    24422300             strlen(drive_name)) == 0) {
    24432301            original_size_of_drive += mountlist->el[partno].size;
    2444         } else {
    2445             mr_asprintf(&tmp, "Skipping %s", mountlist->el[partno].device);
    2446 //                      log_to_screen(tmp);
    2447             mr_free(tmp);
    24482302        }
    24492303    }
     
    24682322                                                     char *drive_name)
    24692323{
    2470     /**buffers **********************************************************/
    2471     char *tmp;
    2472 
    24732324    /** int *************************************************************/
    2474     int partno, lastpart;
     2325    int partno = 0, lastpart = 0;
    24752326               /** remove driveno, noof_drives stan benoit apr 2002**/
    24762327
     
    24782329    float factor;
    24792330    float new_size;
    2480 //  float newcylinderno;
    24812331
    24822332    /** long *************************************************************/
    2483     long newsizL;
    2484     long current_size_of_drive = 0;
    2485     long original_size_of_drive = 0;
    2486     long final_size;            /* all in Megabytes */
    2487     struct mountlist_reference *drivemntlist;
     2333    long newsizL = 0L;
     2334    long current_size_of_drive = 0L;
     2335    long original_size_of_drive = 0L;
     2336    long final_size = 0L;           /* all in Megabytes */
     2337    struct mountlist_reference *drivemntlist = NULL;
    24882338
    24892339    /** structures *******************************************************/
     
    25072357        return;
    25082358    }
    2509     mr_asprintf(&tmp, _("Expanding entries to suit drive %s (%ld MB)"),
    2510             drive_name, current_size_of_drive);
    2511     log_to_screen(tmp);
    2512     mr_free(tmp);
     2359    log_to_screen("Expanding entries to suit drive %s (%ld MB)", drive_name,
     2360            current_size_of_drive);
    25132361
    25142362    drivemntlist = mr_malloc(sizeof(struct mountlist_reference));
     
    25242372
    25252373    if (original_size_of_drive <= 0) {
    2526         mr_asprintf(&tmp, _("Cannot resize %s's entries. Drive not found."),
     2374        log_to_screen(_("Cannot resize %s's entries. Drive not found."),
    25272375                drive_name);
    2528         log_to_screen(tmp);
    2529         mr_free(tmp);
    25302376        return;
    25312377    }
    25322378    factor =
    25332379        (float) (current_size_of_drive) / (float) (original_size_of_drive);
    2534     mr_asprintf(&tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f",
     2380    log_to_screen(_("Disk %s was %ld MB; is now %ld MB; factor = %f"),
    25352381            drive_name, original_size_of_drive, current_size_of_drive,
    25362382            factor);
    2537     log_to_screen(tmp);
    2538     mr_free(tmp);
    25392383
    25402384    lastpart = drivemntlist->entries - 1;
     
    25552399            newsizL = (long) new_size;
    25562400        }
    2557         mr_asprintf(&tmp, _("Changing %s from %lld KB to %ld KB"),
     2401        log_to_screen(_("Changing %s from %lld KB to %ld KB"),
    25582402                drivemntlist->el[partno]->device,
    25592403                drivemntlist->el[partno]->size, newsizL);
    2560         log_to_screen(tmp);
    2561         mr_free(tmp);
    25622404        drivemntlist->el[partno]->size = newsizL;
    25632405    }
    25642406    final_size = get_phys_size_of_drive(drive_name);
    2565     mr_asprintf(&tmp, _("final_size = %ld MB"), final_size);
    2566     log_to_screen(tmp);
    2567     mr_free(tmp);
     2407    log_to_screen(_("final_size = %ld MB"), final_size);
    25682408}
    25692409
     
    25792419{
    25802420    /** buffers *********************************************************/
    2581     struct list_of_disks *drivelist;
     2421    struct list_of_disks *drivelist = NULL;
    25822422
    25832423    /** int *************************************************************/
    2584     int driveno;
     2424    int driveno = 0;
    25852425
    25862426    /** end *************************************************************/
     
    25922432            ("resize_mountlist_prop...() - warning - mountlist fname is blank");
    25932433        log_it("That does NOT affect the functioning of this subroutine.");
    2594         log_it("--- Hugo, 2002/11/20");
    25952434    }
    25962435    iamhere("Resizing mountlist");
     
    26042443    }
    26052444    log_to_screen(_("Mountlist adjusted to suit current hard drive(s)"));
    2606     mr_free((void*) drivelist);
     2445    mr_free(drivelist);
    26072446}
    26082447
     
    26192458                                struct mountlist_reference *drivemntlist)
    26202459{
    2621     int partno;
    2622     char *tmp_drive_name, *c;
     2460    int partno = 0;
     2461    char *tmp_drive_name = NULL, *c = NULL;
    26232462
    26242463    assert(mountlist != NULL);
     
    26282467    mr_msg(1, "Creating list of partitions for drive %s", drive_name);
    26292468
    2630     mr_asprintf(&tmp_drive_name,drive_name);
    2631     if (!tmp_drive_name)
    2632         fatal_error("Out of memory");
     2469    mr_asprintf(&tmp_drive_name, drive_name);
    26332470
    26342471    /* devfs devices? */
  • trunk/mondo/src/mondorestore/mondo-restore-EXT.h

    r783 r2009  
    1313extern char *g_isodir_format;
    1414
    15 extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS;
    1615extern char *g_biggielist_txt;
    1716extern char *g_filelist_full;
  • trunk/mondo/src/mondorestore/mondo-rstr-compare.c

    r1086 r2009  
    44*/
    55
     6#include <pthread.h>
    67#include "my-stuff.h"
    78#include "../common/mondostructures.h"
    89#include "../common/libmondo.h"
     10#include "mr_msg.h"
     11#include "mr_mem.h"
    912#include "mr-externs.h"
    1013#include "mondo-rstr-compare.h"
    1114#include "mondo-restore-EXT.h"
    1215#include "mondo-rstr-tools-EXT.h"
    13 #ifndef S_SPLINT_S
    14 #include <pthread.h>
    15 #endif
    16 #include "mr_mem.h"
     16
     17//static char cvsid[] = "$Id$";
    1718
    1819void popup_changelist_from_file(char *);
     
    3233{
    3334
    34     FILE *fin;
    35     FILE *fout;
     35    FILE *fin = NULL;
     36    FILE *fout = NULL;
    3637
    3738  /** needs malloc *******/
     
    6263    }
    6364    if (!(fin = fopen(tmp1, "r"))) {
    64         mr_asprintf(&tmp, _("Cannot open bigfile %ld (%s)'s info file"),
    65                 bigfileno + 1, tmp);
    66         log_to_screen(tmp);
    67         mr_free(tmp);
     65        log_to_screen(_("Cannot open bigfile %ld (%s)'s info file"),
     66                bigfileno + 1, tmp1);
    6867        mr_free(tmp1);
    6968        return (1);
     
    7473    paranoid_fclose(fin);
    7574
    76     mr_asprintf(&checksum, biggiestruct.checksum);
    7775    mr_asprintf(&bigfile_fname, biggiestruct.filename);
    78 
    7976    mr_msg(2, "biggiestruct.filename = %s", bigfile_fname);
    80     mr_msg(2, "biggiestruct.checksum = %s", checksum);
     77    if (!biggiestruct.checksum[0]) {
     78        mr_msg(2, "Warning - %s has no checksum", bigfile_fname);
     79    } else {
     80        mr_asprintf(&checksum, biggiestruct.checksum);
     81        mr_msg(2, "biggiestruct.checksum = %s", checksum);
     82    }
    8183
    8284    if (!g_text_mode) {
     
    8688        mr_free(tmp);
    8789    }
    88     /* BERLIOS: Useless ?
    89     if (!checksum[0]) {
    90         mr_msg(2, "Warning - %s has no checksum", bigfile_fname_ptr);
    91     } */
     90
    9291    if (!strncmp(bigfile_fname, "/dev/", 5)) {
    9392        mr_msg(2, _("Ignoring device %s"), bigfile_fname);
     93        mr_free(bigfile_fname);
    9494        return(0);
    95     } else {
    96         mr_asprintf(&command,
    97                 "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
    98                 MNT_RESTORING, bigfile_fname);
    99     }
     95    }
     96    mr_asprintf(&command,
     97            "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors.txt",
     98            MNT_RESTORING, bigfile_fname);
    10099    mr_msg(2, command);
    101     paranoid_system("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
    102100    if (system(command)) {
    103101        log_OS_error("Warning - command failed");
     102        paranoid_system("cat /tmp/errors >> /tmp/mondo-restore.log 2> /dev/null");
    104103        mr_free(command);
    105104        mr_free(bigfile_fname);
     
    157156{
    158157    int retval = 0;
    159     int res;
    160     long noof_biggiefiles, bigfileno = 0;
    161     char *tmp;
     158    int res = 0;
     159    long noof_biggiefiles = 0L, bigfileno = 0L;
     160    char *tmp = NULL;
    162161
    163162    assert(bkpinfo != NULL);
     
    186185        update_progress_form(tmp);
    187186        mr_free(tmp);
     187
    188188        res = compare_a_biggiefile(bkpinfo, bigfileno);
    189189        retval += res;
     
    218218{
    219219    int retval = 0;
    220     int res;
    221     long noof_lines;
    222     long archiver_errors;
    223     bool use_star;
    224 
    225   /***  needs malloc *********/
     220    int res = 0;
     221    long noof_lines = 0L;
     222    long archiver_errors = 0L;
     223    bool use_star = FALSE;
     224
    226225    char *command = NULL;
    227226    char *tmp = NULL;
     
    242241        mr_asprintf(&compressor_exe, "bzip2");
    243242    } else if (strstr(tarball_fname, ".gz")) {
    244         strcpy(compressor_exe, "gzip");
    245     } else if (strstr(tarball_fname, ".gz")) {
    246         strcpy(compressor_exe, "gzip");
     243        mr_asprintf(&compressor_exe, "gzip");
    247244    } else if (strstr(tarball_fname, ".lzo")) {
    248245        mr_asprintf(&compressor_exe, "lzop");
     
    275272        }
    276273    }
    277 // star -diff H=star -bz file=....
    278274
    279275#ifdef __FreeBSD__
     
    317313        archiver_errors = 0;
    318314    }
    319 
    320315    if (archiver_errors) {
    321         mr_asprintf(&tmp,
    322                 "Differences found while processing fileset #%d       ",
     316        mr_msg(1, "Differences found while processing fileset #%d       ",
    323317                current_tarball_number);
    324         mr_msg(1, tmp);
    325         mr_free(tmp);
    326318    }
    327319    unlink(logfile);
     
    343335{
    344336    int retval = 0;
    345     int res;
     337    int res = 0;
    346338    int current_tarball_number = 0;
    347 
    348   /**  needs malloc **********/
    349339
    350340    char *tarball_fname = NULL;
    351341    char *progress_str = NULL;
    352342    char *tmp = NULL;
    353     long max_val;
     343    long max_val = 0L;
    354344
    355345    assert(bkpinfo != NULL);
     
    415405        } else {
    416406            res = compare_a_tarball(tarball_fname, current_tarball_number);
    417             mr_free(tarball_fname);
    418 
    419407            g_current_progress++;
    420408            current_tarball_number++;
    421409        }
     410        mr_free(tarball_fname);
    422411    }
    423412    mr_free(progress_str);
     
    457446    int resA = 0;
    458447    int resB = 0;
    459     long noof_changed_files;
     448    long noof_changed_files = 0L;
    460449
    461450    malloc_string(cwd);
     
    475464    noof_changed_files = count_lines_in_file("/tmp/changed.txt");
    476465    if (noof_changed_files) {
    477         mr_asprintf(&tmp, _("%ld files do not match the backup            "),
     466        log_to_screen(_("%ld files do not match the backup            "),
    478467                noof_changed_files);
    479         //      mvaddstr_and_log_it( g_currentY++, 0, tmp );
    480         log_to_screen(tmp);
    481         mr_free(tmp);
    482 
    483468        mr_asprintf(&command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);
    484469        paranoid_system(command);
     
    517502{
    518503    int retval = 0;
    519     long q;
    520     char *tmp;
     504    long q = 0L;
     505    char *tmp = NULL;
    521506
    522507  /**************************************************************************
     
    633618    run_program_and_log_output(command, FALSE);
    634619    mr_free(command);
     620
    635621    mvaddstr_and_log_it(g_currentY,
    636622                        0, _("Verifying archives against filesystem"));
     
    680666int compare_to_tape(struct s_bkpinfo *bkpinfo)
    681667{
    682     int res;
     668    int res = 0;
    683669    char *dir = NULL;
    684670    char *command = NULL;
  • trunk/mondo/src/mondorestore/mondo-rstr-newt.h

    r1106 r2009  
    44
    55#include "my-stuff.h"
    6 #include "../common/mondostructures.h"
    7 #include "../common/libmondo.h"
     6#include "mr_str.h"
     7
     8#include "mondostructures.h"
     9#include "libmondo.h"
    810#ifdef   __FreeBSD__
    911#define  raid_device_record             vinum_volume
     
    2931extern long get_phys_size_of_drive(char *);
    3032extern bool is_this_device_mounted(char *);
    31 extern void strip_spaces(char *);
     33extern void mr_strip_spaces(char *);
    3234extern void initialize_raidrec(struct raid_device_record *);
    3335extern int make_list_of_drives(struct mountlist_itself *,
  • trunk/mondo/src/mondorestore/mondoprep.h

    r688 r2009  
    4242int start_all_raid_devices(struct mountlist_itself *);
    4343int stop_all_raid_devices(struct mountlist_itself *);
    44 int format_everything(struct mountlist_itself *, bool,
    45                       struct raidlist_itself *);
     44int format_everything(struct mountlist_itself *, bool, struct raidlist_itself *);
    4645int partition_device(FILE *, const char *, int, int, const char *,
    4746                     long long);
  • trunk/mondo/src/mondorestore/mondorestore.c

    r1176 r2009  
    1515
    1616#include "my-stuff.h"
    17 #include "../common/mondostructures.h"
    18 #include "../common/libmondo.h"
     17#include "mr_mem.h"
     18#include "mr_msg.h"
     19#include "mr_str.h"
     20
     21#include "mondostructures.h"
     22#include "libmondo.h"
    1923#include "mr-externs.h"
    2024#include "mondo-restore.h"
     
    2428#include <pthread.h>
    2529#endif
    26 #include "mr_mem.h"
    2730
    2831extern void twenty_seconds_til_yikes(void);
     
    4144 **************************************************************************/
    4245extern char *g_tmpfs_mountpt;   // declared in libmondo-tools.c
    43 extern struct s_bkpinfo *g_bkpinfo_DONTUSETHIS; // used by finish() to free
    44                                                 // up global bkpinfo struct
    4546extern bool g_text_mode;
    4647extern FILE *g_fprep;
     
    429430                    }
    430431
    431                     fmt_errs =
    432                         format_everything(mountlist, FALSE, raidlist);
     432                    fmt_errs = format_everything(mountlist, FALSE, raidlist);
    433433                    if (!fmt_errs) {
    434434                        log_to_screen
     
    510510            if (filelist) {
    511511              gotos_suck:
    512 // (NB: %s is where your filesystem is mounted now, by default)", MNT_RESTORING);
     512                // (NB: MNT_RESTORING is where your filesystem is mounted now, by default)
    513513                if (popup_and_get_string
    514514                    (_("Restore path"), _("Restore files to where?"), bkpinfo->restore_path)) {
     
    558558    }
    559559
    560 //  run_program_and_log_output("cp -af /etc/lvm " MNT_RESTORING "/etc/", 1);
    561560    protect_against_braindead_sysadmins();
    562561    retval += unmount_all_devices(mountlist);
     
    585584            mvaddstr_and_log_it(g_currentY++, 74, _("Failed."));
    586585        } else {
    587             mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     586            mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    588587        }
    589588        retval += res;
     
    597596                            ("Warning - errors occurred during the restore phase."));
    598597    }
     598    iamhere("Leaving interactive_mode()");
    599599    return(retval);
    600600}
     
    619619         struct raidlist_itself *raidlist, bool nuke_me_please)
    620620{
    621     char c;
     621    char c = ' ';
    622622    int retval = 0;
    623623
     
    647647        paranoid_system("umount " MNT_CDROM);
    648648    }
    649 //  if (! already_mounted)
    650 //    {
    651649    if (system("umount /tmp/isodir 2> /dev/null")) {
    652650        log_to_screen
     
    654652             ("WARNING - unable to unmount device where the ISO files are stored."));
    655653    }
    656 //    }
    657654    return (retval);
    658655}
     
    661658 *END_ISO_MODE                                                            *
    662659 **************************************************************************/
    663 
    664 
    665660static void call_me_after_the_nuke(int retval) {
    666661
     
    670665    if (retval) {
    671666        log_to_screen(_("Errors occurred during the nuke phase."));
    672         log_to_screen(_("Please visit our website at http://www.mondorescue.org for more information."));
     667        log_to_screen(_("Please visit our website at http://www.mondores
     668cue.org for more information."));
    673669    } else {
    674670#ifdef __FreeBSD__
    675         tmp1 = call_program_and_get_last_line_of_output("cat /tmp/cmdline");
     671    tmp1 = call_program_and_get_last_line_of_output("cat /tmp/cmdline");
    676672#else
    677         tmp1 = call_program_and_get_last_line_of_output("cat /proc/cmdline");
     673    tmp1 = call_program_and_get_last_line_of_output("cat /proc/cmdline");
    678674#endif
    679675        if ((strstr(tmp1,"restore") == NULL) ||
    680             (strstr(tmp1,"RESTORE") == NULL)) {
    681                 /* -H option */
    682                 mr_asprintf(&tmp,
    683                     _
    684                     (" Mondo has restored your system. Please remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information."));
    685                 popup_and_OK(tmp);
    686                 mr_free(tmp);
     676        (strstr(tmp1,"RESTORE") == NULL)) {
     677            /* -H option */
     678            mr_asprintf(&tmp,
     679                _
     680                (" Mondo has restored your system. Please remove the backup media and reboot.\n\nPlease visit our website at http://www.
     681mondorescue.org for more information."));
     682            popup_and_OK(tmp);
     683            mr_free(tmp);
    687684        }
    688685        mr_free(tmp1);
    689686
    690687        log_to_screen(_
    691              ("Mondo has restored your system. Please remove the backup media and reboot."));
     688            ("Mondo has restored your system. Please remove the backup media and reboot."));
    692689        log_to_screen(_
    693              ("Thank you for using Mondo Rescue."));
     690            ("Thank you for using Mondo Rescue."));
    694691        log_to_screen(_
    695              ("Please visit our website at http://www.mondorescue.org for more information."));
     692            ("Please visit our website at http://www.mondorescue.org for more information."));
    696693    }
    697694    g_I_have_just_nuked = TRUE;
     
    750747            mr_free(tmp);
    751748            retval = interactive_mode(bkpinfo, mountlist, raidlist);
    752             goto after_the_nuke;
     749            call_me_after_the_nuke(retval);
     750            return(retval);
    753751        } else {
    754752            mr_free(tmp);
     
    812810            retval = interactive_mode(bkpinfo, mountlist, raidlist);
    813811            call_me_after_the_nuke(retval);
     812            return(retval);
    814813        } else
    815814            if (!ask_me_yes_or_no
    816815                (_("Would you like to try to proceed anyway?"))) {
    817         }
    818         return(retval);
     816                return(retval);
     817        }
    819818    }
    820819    retval = mount_all_devices(mountlist, TRUE);
     
    834833    }
    835834    protect_against_braindead_sysadmins();
    836 //  run_program_and_log_output("cp -af /etc/lvm " MNT_RESTORING "/etc/", 1);
    837835    retval += unmount_all_devices(mountlist);
    838836    mvaddstr_and_log_it(g_currentY,
     
    855853    retval += res;
    856854
    857   after_the_nuke:
    858     if (retval) {
    859         log_to_screen("Errors occurred during the nuke phase.");
    860     } else if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "RESTORE"))    // Bruno's thing
    861     {
    862         log_to_screen
    863             ("PC was restored successfully. Thank you for using Mondo Rescue.");
    864         log_to_screen
    865             ("Please visit our website at http://www.mondorescue.org for more information.");
    866     } else {
    867         strcpy(tmp,"Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
    868         if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "restore") == NULL) {
    869             popup_and_OK(tmp);
    870         }
    871         log_to_screen
    872           ("Mondo has restored your system. Please wait for the command prompt.");
    873         log_to_screen
    874             ("Then remove the backup media and reboot.");
    875         log_to_screen
    876             ("Please visit our website at http://www.mondorescue.org for more information.");
    877     }
    878     g_I_have_just_nuked = TRUE;
    879 /*
    880   if (!boot_loader_installed && !does_file_exist(DO_MBR_PLEASE))
    881     {
    882       log_to_screen("PLEASE RUN 'mondorestore --mbr' NOW TO INITIALIZE YOUR BOOT SECTOR");
    883       write_one_liner_data_file(DO_MBR_PLEASE, "mondorestore --mbr");
    884     }
    885 */
     855    call_me_after_the_nuke(retval);
    886856    return (retval);
    887857}
     858
    888859/**************************************************************************
    889860 *END_NUKE_MODE                                                           *
     
    996967    FILE *fout = NULL;
    997968    FILE *fbzip2 = NULL;
     969
    998970    char *checksum = NULL;
    999     char *outfile_fname = NULL;
    1000     char *tmp = NULL;
     971    char *outfile_fname = NULL;
     972    char *tmp = NULL;
    1001973    char *tmp0 = NULL;
    1002974    char *tmp1 = NULL;
    1003975    char *tmp2 = NULL;
    1004976    char *tmp3 = NULL;
    1005     char *bzip2_command = NULL;
     977    char *bzip2_command = NULL;
    1006978    char *bigblk = NULL;
    1007979    char *pathname_of_last_file_restored = NULL;
    1008980    int finished = FALSE;
    1009     long sliceno;
     981    long sliceno = 0L;
    1010982    long siz;
    1011983    long siz1;
     
    1018990    int res = 0;
    1019991    int old_loglevel;
    1020     char *sz_msg;
     992    char *sz_msg = NULL;
    1021993    struct s_node *node = NULL;
    1022994
     
    10461018
    10471019    if (!checksum[0]) {
    1048         mr_asprintf(&tmp, "Warning - bigfile %ld does not have a checksum",
     1020        mr_msg(3, "Warning - bigfile %ld does not have a checksum",
    10491021                bigfileno + 1);
    1050         mr_msg(3, tmp);
    1051         mr_free(tmp);
    1052         /* BERLIOS : Useless ???
    1053         p = checksum;
    1054         */
    10551022    }
    10561023    mr_free(checksum);
     
    10901057
    10911058    if (biggiestruct.use_ntfsprog)  // if it's an NTFS device
    1092 //  if (!strncmp ( biggiestruct.filename, "/dev/", 5))
    10931059    {
    10941060        g_loglevel = 4;
     
    11121078                feed_outfrom_ntfsprog(biggiestruct.filename,
    11131079                                      ntfsprog_fifo);
    1114 //          mr_msg(3, "CHILD - fip - exiting");
    11151080            exit(res);
    11161081            break;
     
    11201085                    (long int) (pid));
    11211086        }
    1122         // BERLIOS: Is it the right place ??
    1123         mr_free(ntfsprog_fifo);
    11241087    } else {
    11251088        use_ntfsprog_hack = FALSE;
     
    11311094    }
    11321095
    1133     mr_asprintf(&tmp, "Reassembling big file %ld (%s)", bigfileno + 1,
     1096    mr_msg(2, "Reassembling big file %ld (%s)", bigfileno + 1,
    11341097            outfile_fname);
    1135     mr_msg(2, tmp);
    1136     mr_free(tmp);
    11371098
    11381099    /*
     
    11461107    mr_msg(3, "file_to_openout = %s", file_to_openout);
    11471108    if (!(fout = fopen(file_to_openout, "w"))) {
    1148         log_to_screen(_("Cannot openout outfile_fname - hard disk full?"));
     1109        log_to_screen(_("Cannot openout file_to_openout - hard disk full?"));
    11491110        return (pathname_of_last_file_restored);
    11501111    }
     1112    mr_free(ntfsprog_fifo);
    11511113    mr_msg(3, "Opened out to %s", outfile_fname);   // CD/DVD --> mondorestore --> ntfsclone --> hard disk itself
    11521114
     
    11641126                    g_current_media_number);
    11651127            g_current_media_number++;
    1166             mr_asprintf(&tmp3,
    1167                     "Asking for %s #%d so that I may read slice #%ld\n",
    1168                     bkpinfo->backup_media_string,
     1128            mr_msg(2, "Asking for %s #%d so that I may read slice #%ld\n",
     1129                    media_descriptor_string(bkpinfo->backup_media_type),
    11691130                    g_current_media_number, sliceno);
    1170             mr_msg(2, tmp3);
    1171             mr_free(tmp3);
    1172 
    1173             mr_asprintf(&tmp3, _("Restoring from %s #%d"),
     1131            log_to_screen(_("Restoring from %s #%d"),
    11741132                    bkpinfo->backup_media_string,
    11751133                    g_current_media_number);
    1176             log_to_screen(tmp3);
    1177             mr_free(tmp3);
    1178 
    11791134            insist_on_this_cd_number(bkpinfo, g_current_media_number);
    11801135            log_to_screen(_("Continuing to restore."));
     
    11941149                        mr_asprintf(&bzip2_command, "bzip2 -dc %s 2>> %s",tmp2, MONDO_LOGFILE);
    11951150                } else if (does_file_exist(tmp)) {
    1196                         mr_asprintf(&bzip2_command, "%s", "");
     1151                        mr_asprintf(&bzip2_command, "");
    11971152                } else {
    11981153                    log_to_screen(_("OK, that's pretty fsck0red..."));
     
    12041159                mr_asprintf(&bzip2_command, "cat %s 2>> %s", tmp, MONDO_LOGFILE);
    12051160            }
    1206             mr_asprintf(&tmp3, "Working on %s #%d, file #%ld, slice #%ld ",
     1161            mr_asprintf(&tmp3, "Working on %s #%d, file #%ld, slice #%ld",
    12071162                    bkpinfo->backup_media_string,
    12081163                    g_current_media_number, bigfileno + 1, sliceno);
     
    12161171
    12171172            if (!(fbzip2 = popen(bzip2_command, "r"))) {
     1173                mr_free(bzip2_command);
    12181174                fatal_error("Can't run popen command");
    12191175            }
     
    12241180                if (siz > 0) {
    12251181                    siz1 = fwrite(bigblk, 1, siz, fout);
    1226                     mr_asprintf(&sz_msg, "Read %ld from fbzip2; written %ld to fout", siz, siz1);
    1227                     log_it(sz_msg);
    1228                     mr_free(sz_msg);
    12291182                }
    12301183            }
    12311184            paranoid_pclose(fbzip2);
    1232 
    12331185
    12341186            sliceno++;
     
    12881240                                     int use_ntfsprog)
    12891241{
    1290     FILE *pout;
    1291     FILE *fin;
     1242    FILE *pout = NULL;
     1243    FILE *fin = NULL;
    12921244
    12931245  /** mallocs ********/
     
    13001252    char *pathname_of_last_file_restored = NULL;
    13011253
    1302     struct s_node *node;
    1303 
    1304     int old_loglevel;
     1254    struct s_node *node = NULL;
     1255
     1256    int old_loglevel = 0;
    13051257    long current_slice_number = 0;
    13061258    int retval = 0;
    13071259    int res = 0;
    13081260    int ctrl_chr = '\0';
    1309     long long slice_siz;
     1261    long long slice_siz = 0L;
    13101262    bool dummy_restore = FALSE;
    13111263    bool use_ntfsprog_hack = FALSE;
    13121264    pid_t pid;
    13131265    struct s_filename_and_lstat_info biggiestruct;
    1314     struct utimbuf the_utime_buf, *ubuf;
     1266    struct utimbuf the_utime_buf, *ubuf = NULL;
    13151267    ubuf = &the_utime_buf;
    13161268
     
    13801332                    outfile_fname, ntfsprog_fifo);
    13811333            res = feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo);
    1382 //          mr_msg(3, "CHILD - fip - exiting");
    13831334            exit(res);
    13841335            break;
     
    13881339                    (long int) (pid));
    13891340        }
    1390         mr_free(ntfsprog_fifo);
    13911341    } else {
    13921342        if (!strncmp(orig_bf_fname, "/dev/", 5))    // non-NTFS partition
     
    14041354            make_hole_for_file(outfile_fname);
    14051355        }
    1406         mr_asprintf(&tmp1, "Reassembling big file %ld (%s)",
     1356        mr_msg(2, "Reassembling big file %ld (%s)",
    14071357                biggiefile_number + 1, orig_bf_fname);
    1408         mr_msg(2, tmp1);
    1409         mr_free(tmp1);
    14101358    }
    14111359
     
    14211369                file_to_openout, MONDO_LOGFILE);
    14221370    }
    1423     mr_asprintf(&tmp1, "Pipe command = '%s'", command);
    1424     mr_msg(3, tmp1);
    1425     mr_free(tmp1);
     1371    mr_msg(3, "Pipe command = '%s'", command);
     1372    mr_free(outfile_fname);
     1373    mr_free(ntfsprog_fifo);
    14261374
    14271375    /* restore biggiefile, one slice at a time */
     
    14451393            newtRefresh();
    14461394        }
    1447         strip_spaces(tmp1);
     1395        mr_strip_spaces(tmp1);
    14481396        update_progress_form(tmp1);
    14491397        mr_free(tmp1);
     
    15061454    }
    15071455
    1508     mr_free(outfile_fname);
    15091456    g_loglevel = old_loglevel;
    15101457    return (pathname_of_last_file_restored);
     
    15331480{
    15341481    int retval = 0;
    1535     int res;
    1536     char *p;
     1482    int res = 0;
     1483    char *p = NULL;
    15371484
    15381485  /** malloc **/
    1539     char *command;
     1486    char *command = NULL;
    15401487    char *tmp = NULL;
    1541     char *filelist_name;
     1488    char *filelist_name = NULL;
    15421489    char *filelist_subset_fname = NULL;
    15431490    char *executable = NULL;
    15441491    char *temp_log = NULL;
    15451492    long matches = 0;
    1546     bool use_star;
     1493    bool use_star = FALSE;
    15471494    char *xattr_fname = NULL;
    15481495    char *acl_fname = NULL;
     
    15671514        retval = 0;
    15681515        mr_msg(5, "Leaving");
     1516        mr_free(filelist_name);
    15691517        return (retval);
    15701518    }
     
    15731521        mr_msg(3, "length_of_file(%s) = %llu", tarball_fname,
    15741522                length_of_file(tarball_fname));
    1575         mr_asprintf(&tmp, "Unable to restore fileset #%ld (CD I/O error)",
     1523        log_to_screen(_("Unable to restore fileset #%ld (CD I/O error)"),
    15761524                current_tarball_number);
    1577         log_to_screen(tmp);
    1578         mr_free(tmp);
    15791525        retval = 1;
    15801526        mr_msg(5, "Leaving");
     1527        mr_free(filelist_name);
    15811528        return (retval);
    15821529    }
     
    15901537                                             use_star))
    15911538            <= 0) {
    1592             mr_asprintf(&tmp, "Skipping fileset %ld", current_tarball_number);
    1593             mr_msg(1, tmp);
    1594             mr_free(tmp);
     1539            mr_msg(1, "Skipping fileset %ld", current_tarball_number);
    15951540        } else {
    15961541            mr_msg(3, "Saved fileset %ld's subset to %s",
    15971542                    current_tarball_number, filelist_subset_fname);
    15981543        }
    1599         mr_asprintf(&tmp, "Tarball #%ld --- %ld matches",
     1544        log_to_screen("Tarball #%ld --- %ld matches",
    16001545                current_tarball_number, matches);
    1601         log_to_screen(tmp);
    1602         mr_free(tmp);
    1603     } else {
    1604         filelist_subset_fname = NULL;
    16051546    }
    16061547    mr_free(filelist_name);
     
    16161557        }
    16171558        if (strstr(tarball_fname, ".bz2")) {
    1618             mr_asprintf(&executable, "bzip2");
     1559            mr_asprintf(&executable, "-P bzip2 -Z");
    16191560        } else if (strstr(tarball_fname, ".gz")) {
    1620             strcpy(executable, "gzip");
    1621         } else if (strstr(tarball_fname, ".gz")) {
    1622             strcpy(executable, "gzip");
     1561            mr_asprintf(&executable, "-P gzip -Z");
    16231562        } else if (strstr(tarball_fname, ".lzo")) {
    1624             mr_asprintf(&executable, "lzop");
    1625         } else {
    1626             executable = NULL;
     1563            mr_asprintf(&executable, "-P lzop -Z");
    16271564        }
    16281565
     
    16331570                    (_
    16341571                     ("(compare_a_tarball) Compression program not found - oh no!"));
     1572                mr_free(tmp);
     1573                mr_free(executable);
     1574                mr_free(acl_fname);
     1575                mr_free(xattr_fname);
     1576                mr_free(filelist_subset_fname);
    16351577                paranoid_MR_finish(1);
    16361578            }
    1637             mr_free(tmp);
    1638 
    1639             mr_asprintf(&tmp, executable);
    1640             mr_asprintf(&executable, "-P %s -Z", tmp);
    16411579            mr_free(tmp);
    16421580        }
     
    16471585#endif
    16481586
    1649         mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768),
    1650             (int) (random() % 32768));
    1651 
    16521587        if (use_star) {
     1588            mr_sprintf(&command,
     1589                    "star -x -force-remove -U " STAR_ACL_SZ
     1590                    " errctl= file=%s", tarball_fname);
    16531591            if (strstr(tarball_fname, ".bz2")) {
    1654                 mr_asprintf(&tmp, " -bz");
    1655             } else {
    1656                 mr_asprintf(&tmp, "%s", "");
    1657             }
    1658             mr_asprintf(&command,
    1659                     "star -x -force-remove -U " STAR_ACL_SZ
    1660                     " errctl= file=%s %s 2>> %s >> %s", tarball_fname, tmp, temp_log, temp_log);
    1661             mr_free(tmp);
     1592                mr_strcat(command, " -bz");
     1593            }
    16621594        } else {
    16631595            if (filelist_subset_fname != NULL) {
    16641596                mr_asprintf(&command,
    1665                         "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s 2>> %s >> %s",
     1597                        "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s",
    16661598                        TAPE_BLOCK_SIZE,
    16671599                        BUFSIZE, executable, filelist_subset_fname,
    1668 //             files_to_restore_this_time_fname,
    1669                         tarball_fname, temp_log, temp_log);
     1600                        tarball_fname);
    16701601            } else {
    16711602                mr_asprintf(&command,
    1672                         "afio -i -b %ld -c %ld -M 8m %s %s 2>> %s >> %s",
     1603                        "afio -i -b %ld -c %ld -M 8m %s %s",
    16731604                        TAPE_BLOCK_SIZE,
    1674                         BUFSIZE, executable, tarball_fname, temp_log, temp_log);
     1605                        BUFSIZE, executable, tarball_fname);
    16751606            }
    16761607        }
     
    16781609
    16791610#undef BUFSIZE
     1611        mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768),
     1612            (int) (random() % 32768));
     1613
     1614        mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log);
    16801615        mr_msg(1, "command = '%s'", command);
    16811616        unlink(temp_log);
     
    17321667        unlink(xattr_fname);
    17331668        mr_free(xattr_fname);
     1669        unlink(acl_fname);
     1670        mr_free(acl_fname);
     1671        unlink(temp_log);
     1672        mr_free(temp_log);
    17341673    }
    17351674    if (does_file_exist("/PAUSE")) {
     
    17391678    }
    17401679    unlink(filelist_subset_fname);
    1741     unlink(acl_fname);
    1742     unlink(temp_log);
    1743 
    17441680    mr_free(filelist_subset_fname);
    1745     mr_free(acl_fname);
    1746     mr_free(temp_log);
    17471681    mr_msg(5, "Leaving");
    17481682    return (retval);
     
    17891723    long matches = 0;
    17901724    bool restore_this_fileset = FALSE;
    1791     bool use_star;
     1725    bool use_star = FALSE;
    17921726
    17931727    assert(bkpinfo != NULL);
     
    17951729    /* to do it with a file... */
    17961730    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    1797     mr_asprintf(&tmp,
    1798             "Restoring from fileset #%ld (%ld KB) on %s #%d",
     1731    mr_msg(2, "Restoring from fileset #%ld (%ld KB) on %s #%d",
    17991732            current_tarball_number, (long) size >> 10,
    18001733            bkpinfo->backup_media_string,
    18011734            g_current_media_number);
    1802     mr_msg(2, tmp);
    1803     mr_free(tmp);
    18041735    run_program_and_log_output("mkdir -p " MNT_RESTORING "/tmp", FALSE);
    18051736
     
    18371768        if (strstr(tarball_fname, ".star.")) {
    18381769            use_star = TRUE;
    1839             mr_asprintf(&command, "star -t file=%s %s > %s 2>> %s", afio_fname, executable, filelist_fname, MONDO_LOGFILE);
     1770            mr_asprintf(&command, "star -t file=%s %s", afio_fname, executable);
    18401771        } else {
    18411772            use_star = FALSE;
    1842             mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s > %s 2>> %s", TAPE_BLOCK_SIZE,
    1843                     executable, afio_fname, filelist_fname, MONDO_LOGFILE);
    1844         }
     1773            mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE,
     1774                    executable, afio_fname);
     1775        }
     1776        mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE);
    18451777        mr_msg(1, "command = %s", command);
    18461778        if (system(command)) {
     
    18481780        }
    18491781        mr_free(command);
     1782
    18501783        if ((matches =
    18511784             save_filelist_entries_in_common(filelist_fname, filelist,
     
    18571790                        current_tarball_number);
    18581791            }
    1859             mr_asprintf(&tmp, "Skipping fileset %ld", current_tarball_number);
    1860             mr_msg(2, tmp);
    1861             mr_free(tmp);
     1792            mr_msg(2, "Skipping fileset %ld", current_tarball_number);
    18621793            restore_this_fileset = FALSE;
    18631794        } else {
     
    18751806        // star
    18761807        if (filelist) {
    1877             mr_asprintf(&command, "star -x file=%s %s list=%s 2>> %s", afio_fname, executable,
    1878                     filelist_subset_fname,MONDO_LOGFILE);
     1808            mr_asprintf(&command, "star -x file=%s %s list=%s 2>> %s", afio_fname, executable, filelist_subset_fname, MONDO_LOGFILE);
    18791809        } else {
    1880             mr_asprintf(&command,"star -x file=%s %s 2>> %s", afio_fname, executable,MONDO_LOGFILE);
     1810            mr_asprintf(&command, "star -x file=%s %s 2>> %s", afio_fname, executable, MONDO_LOGFILE);
    18811811        }
    18821812    } else {
    18831813        // afio
    18841814        if (filelist) {
    1885             mr_asprintf(&command, "afio -i -M 8m -b %ld %s -w %s %s 2>> %s", TAPE_BLOCK_SIZE, executable, filelist_subset_fname,afio_fname,MONDO_LOGFILE);
     1815            mr_asprintf(&command, "afio -i -M 8m -b %ld %s -w %s %s 2>> %s", TAPE_BLOCK_SIZE, executable, filelist_subset_fname, afio_fname, MONDO_LOGFILE);
    18861816        } else {
    1887             mr_asprintf(&command, "afio -i -M 8m -b %ld %s %s 2>> %s", TAPE_BLOCK_SIZE, executable,afio_fname,MONDO_LOGFILE);
     1817            mr_asprintf(&command, "afio -i -M 8m -b %ld %s %s 2>> %s", TAPE_BLOCK_SIZE, executable, afio_fname, MONDO_LOGFILE);
    18881818        }
    18891819    }
     
    19921922        return (0);
    19931923    }
    1994     mr_asprintf(&tmp, "OK, there are %ld biggiefiles in the archives",
    1995             noof_biggiefiles);
    1996     mr_msg(2, tmp);
    1997     mr_free(tmp);
     1924    mr_msg(2, "OK, there are %ld biggiefiles in the archives", noof_biggiefiles);
    19981925
    19991926    open_progress_form(_("Reassembling large files"),
     
    20231950                insist_on_this_cd_number(bkpinfo,
    20241951                                         ++g_current_media_number);
    2025                 mr_asprintf(&tmp, _("Restoring from %s #%d"),
     1952                log_to_screen(_("Restoring from %s #%d"),
    20261953                        bkpinfo->backup_media_string,
    20271954                        g_current_media_number);
    2028                 log_to_screen(tmp);
    2029                 mr_free(tmp);
    2030 
    20311955                just_changed_cds = TRUE;
    20321956            } else {
     
    20511975            retval += res;
    20521976            bigfileno++;
    2053 
    2054         }
    2055         mr_free(tmp);
     1977        }
    20561978    }
    20571979
     
    20882010    return (retval);
    20892011}
     2012
    20902013/**************************************************************************
    20912014 *END_RESTORE_ALL_BIGGIFILES_FROM_CD                                      *
     
    21082031{
    21092032    int retval = 0;
    2110     int res;
    2111     int attempts;
     2033    int res = 0;
     2034    int attempts = 0;
    21122035    long current_tarball_number = 0;
    2113     long max_val;
     2036    long max_val = 0L;
    21142037  /**malloc ***/
    2115     char *tmp;
    2116     char *tmp1;
    2117     char *tarball_fname;
    2118     char *progress_str;
    2119     char *comment;
     2038    char *tmp = NULL;
     2039    char *tmp1 = NULL;
     2040    char *tarball_fname = NULL;
     2041    char *progress_str = NULL;
     2042    char *comment = NULL;
    21202043
    21212044    assert(bkpinfo != NULL);
     
    21442067        insist_on_this_cd_number(bkpinfo, g_current_media_number);
    21452068        update_progress_form(progress_str);
    2146 
    21472069        mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2",
    21482070                current_tarball_number);
     
    21782100                    (_
    21792101                     ("No tarballs. Strange. Maybe you only backed up freakin' big files?"));
     2102                mr_free(progress_str);
    21802103                return (0);
    21812104            }
     
    21842107                          "/archives/slice* > /dev/null 2> /dev/null") ==
    21852108                0) {
     2109                mr_free(tarball_fname);
     2110                mr_free(progress_str);
    21862111                break;
    21872112            }
    21882113            g_current_media_number++;
    21892114            mr_free(progress_str);
     2115
    21902116            mr_asprintf(&progress_str, _("Restoring from %s #%d"),
    21912117                    bkpinfo->backup_media_string,
     
    21992125                    bkpinfo->backup_media_string,
    22002126                    g_current_media_number);
    2201 //    mr_msg(3, "progress_str = %s", progress_str);
    22022127            for (res = 999, attempts = 0; attempts < 3 && res != 0;
    22032128                 attempts++) {
     
    22072132                                              filelist);
    22082133            }
     2134            mr_asprintf(&tmp, _("%s #%d, fileset #%ld - restore "),
     2135                    media_descriptor_string(bkpinfo->backup_media_type),
     2136                    g_current_media_number, current_tarball_number);
    22092137            if (res) {
    2210                 mr_asprintf(&tmp1, _("reported errors"));
     2138                mr_strcat(tmp, _("reported errors"));
    22112139            } else {
    2212                 mr_asprintf(&tmp1, _("succeeded"));
    2213             }
    2214             mr_asprintf(&tmp, _("%s #%d, fileset #%ld - restore %s"),
    2215                     bkpinfo->backup_media_string,
    2216                     g_current_media_number, current_tarball_number,tmp1);
    2217             mr_free(tmp1);
    2218            
     2140                mr_strcat(tmp, _("succeeded"));
     2141            }
    22192142            if (attempts > 1) {
    2220                 mr_asprintf(&tmp1, _(" (%d attempts) - review logs"), attempts);
    2221             }
    2222             mr_asprintf(&comment, "%s%s", tmp, tmp1);
     2143                mr_strcat(tmp, _(" (%d attempts) - review logs"), attempts);
     2144            }
     2145            if (attempts > 1) {
     2146                log_to_screen(tmp);
     2147            }
    22232148            mr_free(tmp);
    2224             mr_free(tmp1);
    2225             if (attempts > 1) {
    2226                 log_to_screen(comment);
    2227             }
    2228             mr_free(comment);
    22292149
    22302150            retval += res;
     
    22422162        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    22432163    }
    2244 
    22452164    return (retval);
    22462165}
     
    22622181                                    struct s_node *filelist)
    22632182{
    2264     long noof_biggiefiles;
    2265     long current_bigfile_number = 0;
    2266     long total_slices;
     2183    long noof_biggiefiles = 0L;
     2184    long current_bigfile_number = 0L;
     2185    long total_slices = 0L;
    22672186
    22682187    int retval = 0;
    22692188    int res = 0;
    2270     int ctrl_chr;
     2189    int ctrl_chr = 0;
    22712190
    22722191  /** malloc add ****/
     
    23022221                biggies_whose_EXATs_we_should_set);
    23032222    }
    2304 // get xattr and acl files if they're there
     2223    // get xattr and acl files if they're there
    23052224    res =
    23062225        read_header_block_from_stream(&biggie_size, biggie_fname,
     
    23132232
    23142233    noof_biggiefiles = atol(biggie_fname);
    2315     mr_asprintf(&tmp, "OK, there are %ld biggiefiles in the archives",
     2234    mr_msg(2, "OK, there are %ld biggiefiles in the archives",
    23162235            noof_biggiefiles);
    2317     mr_msg(2, tmp);
    2318     mr_free(tmp);
    2319 
    23202236    open_progress_form(_("Reassembling large files"),
    23212237                       _("I am now reassembling all the large files."),
     
    23632279    if (current_bigfile_number != noof_biggiefiles
    23642280        && noof_biggiefiles != 0) {
    2365         mr_asprintf(&tmp, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n",
     2281        mr_msg(1, "Warning - bigfileno=%ld but noof_biggiefiles=%ld\n",
    23662282                current_bigfile_number, noof_biggiefiles);
    23672283    } else {
    2368         mr_asprintf(&tmp,
    2369                 "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.",
     2284        mr_msg(1, "%ld biggiefiles in biggielist.txt; %ld biggiefiles processed today.",
    23702285                noof_biggiefiles, current_bigfile_number);
    23712286    }
    2372     mr_msg(1, tmp);
    2373     mr_free(tmp);
    23742287
    23752288    if (fbw) {
     
    24372350{
    24382351    int retval = 0;
    2439     int res;
     2352    int res = 0;
    24402353    long current_afioball_number = 0;
    2441     int ctrl_chr;
    2442     long max_val /*, total_noof_files */ ;
     2354    int ctrl_chr = 0;
     2355    long max_val = 0L /*, total_noof_files */ ;
    24432356
    24442357  /** malloc **/
     
    24492362    char *acl_fname = NULL;
    24502363
    2451     long long tmp_size;
     2364    long long tmp_size = 0L;
    24522365
    24532366    assert(bkpinfo != NULL);
     
    25152428        retval += res;
    25162429        if (res) {
    2517             mr_asprintf(&tmp, _("Fileset %ld - errors occurred"),
     2430            log_to_screen("Fileset %ld - errors occurred",
    25182431                    current_afioball_number);
    2519             log_to_screen(tmp);
    2520             mr_free(tmp);
    25212432        }
    25222433        res =
     
    26092520    mr_free(tmp);
    26102521
    2611     mvaddstr_and_log_it(g_currentY, 0,
    2612                         _("Preparing to read your archives"));
     2522    mvaddstr_and_log_it(g_currentY, 0, _("Preparing to read your archives"));
    26132523    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    26142524        mount_cdrom(bkpinfo);
     
    27852695void welcome_to_mondorestore()
    27862696{
    2787     mr_msg(0, "-------------- Mondo Restore v%s -------------",
    2788             PACKAGE_VERSION);
     2697    mr_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION);
    27892698    mr_msg(0,
    27902699            "DON'T PANIC! Mondorestore logs almost everything, so please ");
     
    28372746    bool run_postnuke = FALSE;
    28382747
    2839   /**************************************************************************
    2840    * hugo-                                                                  *
    2841    * busy stuff here - it needs some comments -stan                           *
    2842    *                                                                        *
    2843    **************************************************************************/
    2844 
    28452748#ifdef ENABLE_NLS
    28462749    setlocale(LC_ALL, "");
     
    28692772    mr_free(tmp);
    28702773
    2871     bkpinfo = g_bkpinfo_DONTUSETHIS = mr_malloc(sizeof(struct s_bkpinfo));
     2774    bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));
    28722775    mountlist = mr_malloc(sizeof(struct mountlist_itself));
    28732776    raidlist = mr_malloc(sizeof(struct raidlist_itself));
     
    29272830    run_program_and_log_output("rm -Rf /tmp/tmpfs/mondo.tmp.*", FALSE);
    29282831
    2929 /* Init GUI */
     2832    /* Init GUI */
    29302833    malloc_libmondo_global_strings();
    29312834    setup_newt_stuff();         /* call newtInit and setup screen log */
     
    29392842    iamhere("what time is it");
    29402843
    2941 /* Process command-line parameters */
     2844    /* Process command-line parameters */
    29422845    if (argc == 2 && strcmp(argv[1], "--edit-mountlist") == 0) {
    29432846#ifdef __FreeBSD__
     
    29982901        // BERLIOS: /usr/lib ???
    29992902        toggle_path_selection(filelist, "/usr/share", TRUE);
    3000 //      show_filelist(filelist);
    30012903        save_filelist(filelist, "/tmp/out.txt");
    3002 //      finish(0);
    3003 //      toggle_path_selection (filelist, "/root/stuff", TRUE);
    30042904        mr_asprintf(&a, argv[3]);
    30052905        mr_asprintf(&b, argv[4]);
     
    30732973                 ("Live mode doesn't support command-line parameters yet."));
    30742974            paranoid_MR_finish(1);
    3075 //    return(1);
    30762975        }
    30772976        mr_msg(1, "I am in normal, live mode.");
     
    32253124            if (!bkpinfo->please_dont_eject) {
    32263125                res = eject_device("/dev/cdrom");
    3227 /*
    3228               if (res)
    3229         {
    3230           log_to_screen( "WARNING - failed to eject CD-ROM disk" );
    3231         }
    3232 */
    32333126            }
    32343127            mvaddstr_and_log_it(g_currentY++,
     
    32393132    }
    32403133
    3241 // g_I_have_just_nuked is set true by nuke_mode() just before it returns
     3134    // g_I_have_just_nuked is set true by nuke_mode() just before it returns
    32423135    if (!system("which post-nuke > /dev/null 2> /dev/null")) {
    32433136      mr_msg(1, "post-nuke found; find out whether we should run it...");
     
    32623155      } else {
    32633156        mr_msg(1, "Re-mounted partitions for post-nuke stuff");
    3264         sprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path,
     3157        mr_asprintf(&tmp, "post-nuke %s %d", bkpinfo->restore_path,
    32653158            retval);
    32663159        mr_msg(2, "Calling '%s'", tmp);
     
    32683161          log_OS_error(tmp);
    32693162        }
     3163        mr_free(tmp);
    32703164        mr_msg(1, "post-nuke returned w/ res=%d", res);
    32713165      }
     
    32743168    }
    32753169
    3276 /* 
    3277   log_to_screen("If you are REALLY in a hurry, hit Ctrl-Alt-Del now.");
    3278   log_to_screen("Otherwise, please wait until the RAID disks are done.");
    3279   wait_until_software_raids_are_prepped("/proc/mdstat", 100);
    3280   log_to_screen("Thank you.");
    3281 */
    32823170    unlink("/tmp/mondo-run-prog.tmp");
    32833171    set_signals(FALSE);
     
    32893177        (_
    32903178         ("Restore log copied to /tmp/mondo-restore.log on your hard disk"));
    3291     mr_asprintf(&tmp,
    3292             _
    3293             ("Mondo-restore is exiting (retval=%d)                                      "),
    3294             retval);
    3295     log_to_screen(tmp);
    3296     mr_free(tmp);
     3179    log_to_screen(_("Mondo-restore is exiting (retval=%d)"), retval);
    32973180
    32983181    mr_asprintf(&tmp, "umount %s", bkpinfo->isodir);
  • trunk/mondo/src/mondorestore/mr-externs.h

    r688 r2009  
    2727extern int edit_mountlist(char *mountlist_fname, struct mountlist_itself *,
    2828                          struct raidlist_itself *);
    29 extern int format_everything(struct mountlist_itself *, bool,
    30                              struct raidlist_itself *);
     29extern int format_everything(struct mountlist_itself *, bool, struct raidlist_itself *);
    3130extern int format_device(char *, char *, struct raidlist_itself *);
    3231extern void finish(int);
     
    7271extern int read_header_block_from_stream(long long *, char *, int *);
    7372extern void save_filelist(struct s_node *, char *);
    74 extern void strip_spaces(char *);
     73extern void mr_strip_spaces(char *);
    7574extern int strcmp_inc_numbers(char *, char *);
    7675extern char *slice_fname(long, long, char *, char *);
     
    8685extern void resize_drive_proportionately_to_suit_new_drives(struct
    8786                                                            mountlist_itself
    88                                                             *mountlist, char
     87                                                            *mountlist,
     88                                                            char
    8989                                                            *drive_name);
    9090extern void resize_mountlist_proportionately_to_suit_new_drives(struct
Note: See TracChangeset for help on using the changeset viewer.