Changeset 1206


Ignore:
Timestamp:
Feb 26, 2007, 6:20:12 AM (12 years ago)
Author:
bruno
Message:

Merge trunk memory management for mondo-rstr-newt.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c

    r1168 r1206  
    1 /***************************************************************************
     1/*
    22 * $Id$
    33*/
     
    1616#ifdef __FreeBSD__
    1717#define OSSWAP(linux,fbsd) fbsd
    18 //#include <libgen.h>
    1918#else
    2019#define OSSWAP(linux,fbsd) linux
     
    6261{
    6362    /** buffers ***********************************************************/
    64     char tmp[MAX_STR_LEN];
     63    char *tmp = NULL;
    6564
    6665    /** newt **************************************************************/
     
    8786
    8887    newtPushHelpLine
    89         ("   Add one of the following unallocated RAID partitions to this RAID device.");
    90     sprintf(tmp, "%-26s %s", "Device", "Size");
     88        (_
     89         ("   Add one of the following unallocated RAID partitions to this RAID device."));
     90    mr_asprintf(&tmp, "%-26s %s", _("Device"), _("Size"));
    9191    headerMsg = newtLabel(1, 1, tmp);
     92    mr_free(tmp);
     93
    9294    partitionsListbox =
    9395        newtListbox(1, 2, 6, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    9597                             partitionsListbox);
    9698    i = 7;
    97     bOK = newtCompactButton(i, 9, "  OK  ");
    98     bCancel = newtCompactButton(i += 9, 9, "Cancel");
    99     newtOpenWindow(22, 6, 36, 10, "Unallocated RAID partitions");
     99    bOK = newtCompactButton(i, 9, _("  OK  "));
     100    bCancel = newtCompactButton(i += 9, 9, _("Cancel"));
     101    newtOpenWindow(22, 6, 36, 10, _("Unallocated RAID partitions"));
    100102    myForm = newtForm(NULL, NULL, 0);
    101103    newtFormAddComponents(myForm, headerMsg, partitionsListbox, bOK,
     
    127129
    128130
    129 
    130 
    131131/**
    132132 * Add an entry to @p mountlist.
     
    162162    newtComponent formatComp;
    163163
    164     /** buffers **********************************************************/
    165     char drive_to_add[MAX_STR_LEN];
    166     char mountpoint_str[MAX_STR_LEN];
    167     char size_str[MAX_STR_LEN];
    168     char device_str[MAX_STR_LEN];
    169     char format_str[MAX_STR_LEN];
    170 
    171     /** pointers *********************************************************/
    172     char *mountpoint_here;
    173     char *size_here;
    174     char *device_here;
    175     char *format_here;
     164    char *drive_to_add = NULL;
     165    char *mountpoint_str = NULL;
     166    char *size_str = NULL;
     167    char *device_str = NULL;
     168    char *format_str = NULL;
     169    char *mountpoint_here = NULL;
     170    char *size_here = NULL;
     171    char *device_here = NULL;
     172    char *format_here = NULL;
    176173
    177174    assert(mountlist != NULL);
     
    180177    assert(keylist != NULL);
    181178
    182     strcpy(device_str, "/dev/");
    183     strcpy(mountpoint_str, "/");
     179    mr_asprintf(&device_str, "/dev/");
     180    mr_asprintf(&mountpoint_str, "/");
    184181#ifdef __FreeBSD__
    185     strcpy(format_str, "ufs");
     182    mr_asprintf(&format_str, "ufs");
    186183#else
    187     strcpy(format_str, "ext2");
     184    mr_asprintf(&format_str, "ext2");
    188185#endif
    189     size_str[0] = '\0';
    190     /* sprintf(size_str,""); */
    191     newtOpenWindow(20, 5, 48, 10, "Add entry");
    192     label0 = newtLabel(2, 1, "Device:    ");
    193     label1 = newtLabel(2, 2, "Mountpoint:");
    194     label2 = newtLabel(2, 3, "Size (MB): ");
    195     label3 = newtLabel(2, 4, "Format:    ");
     186    newtOpenWindow(20, 5, 48, 10, _("Add entry"));
     187    label0 = newtLabel(2, 1, _("Device:    "));
     188    label1 = newtLabel(2, 2, _("Mountpoint:"));
     189    label2 = newtLabel(2, 3, _("Size (MB): "));
     190    label3 = newtLabel(2, 4, _("Format:    "));
    196191    deviceComp =
    197192        newtEntry(14, 1, device_str, 30, (void *) &device_here, 0);
    198193    mountpointComp =
    199194        newtEntry(14, 2, mountpoint_str, 30, (void *) &mountpoint_here, 0);
     195
    200196    formatComp =
    201197        newtEntry(14, 4, format_str, 15, (void *) &format_here, 0);
    202198    sizeComp = newtEntry(14, 3, size_str, 10, (void *) &size_here, 0);
    203     bOK = newtButton(5, 6, "  OK  ");
    204     bCancel = newtButton(17, 6, "Cancel");
     199    bOK = newtButton(5, 6, _("  OK  "));
     200    bCancel = newtButton(17, 6, _("Cancel"));
    205201    newtPushHelpLine
    206         ("To add an entry to the mountlist, please fill in these fields and then hit 'OK'");
     202        (_
     203         ("To add an entry to the mountlist, please fill in these fields and then hit 'OK'"));
    207204    myForm = newtForm(NULL, NULL, 0);
    208205    newtFormAddComponents(myForm, deviceComp, mountpointComp, sizeComp,
     
    211208    for (b_res = NULL; b_res != bOK && b_res != bCancel;) {
    212209        b_res = newtRunForm(myForm);
    213         strcpy(device_str, device_here);
    214         strcpy(mountpoint_str, mountpoint_here);
    215         strcpy(format_str, format_here);
    216         strcpy(size_str, size_here);
    217 //      log_it ("Originals = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str);
     210
     211        mr_free(device_str);
     212        mr_asprintf(&device_str, device_here);
    218213        mr_strip_spaces(device_str);
     214
     215        mr_free(format_str);
     216        mr_asprintf(&format_str, format_here);
     217        mr_strip_spaces(format_str);
     218
     219        mr_free(mountpoint_str);
     220        mr_asprintf(&mountpoint_str, mountpoint_here);
    219221        mr_strip_spaces(mountpoint_str);
    220         mr_strip_spaces(format_str);
     222
     223        mr_free(size_str);
     224        mr_asprintf(&size_str, size_here);
    221225        mr_strip_spaces(size_str);
    222 //      log_it ("Modified = %s,%s,%s,%s", device_str, mountpoint_str, format_str, size_str);
     226
    223227        if (b_res == bOK) {
    224228            if (device_str[strlen(device_str) - 1] == '/') {
    225                 popup_and_OK("You left the device nearly blank!");
     229                popup_and_OK(_("You left the device nearly blank!"));
    226230                b_res = NULL;
    227231            }
    228232            if (size_of_specific_device_in_mountlist(mountlist, device_str)
    229233                >= 0) {
    230                 popup_and_OK("Can't add this - you've got one already!");
     234                popup_and_OK(_
     235                             ("Can't add this - you've got one already!"));
    231236                b_res = NULL;
    232237            }
     
    237242    newtPopWindow();
    238243    if (b_res == bCancel) {
     244        mr_free(device_str);
     245        mr_free(format_str);
     246        mr_free(mountpoint_str);
     247        mr_free(size_str);
    239248        return;
    240249    }
    241     strcpy(drive_to_add, device_str);
     250    mr_asprintf(&drive_to_add, device_str);
    242251    for (i = strlen(drive_to_add); isdigit(drive_to_add[i - 1]); i--);
    243252    num_to_add = atoi(drive_to_add + i);
    244     drive_to_add[i] = '\0';
     253    mr_free(drive_to_add);
     254
    245255    currline = mountlist->entries;
    246256    strcpy(mountlist->el[currline].device, device_str);
    247257    strcpy(mountlist->el[currline].mountpoint, mountpoint_str);
     258    mr_free(mountpoint_str);
     259
    248260    strcpy(mountlist->el[currline].format, format_str);
     261    mr_free(format_str);
     262
    249263    mountlist->el[currline].size = atol(size_str) * 1024;
     264    mr_free(size_str);
     265
    250266    mountlist->entries++;
    251267    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
     
    253269                                    device_str);
    254270    }
     271    mr_free(device_str);
    255272    redraw_mountlist(mountlist, keylist, listbox);
    256273}
     
    267284
    268285    /** buffers ***********************************************************/
    269     char sz_out[MAX_STR_LEN];
     286    char *sz_out = NULL;
    270287
    271288    /** int ****************************************************************/
     
    275292    assert(raidrec != NULL);
    276293
    277     sz_out[0] = '\0';
     294    malloc_string(sz_out);
    278295    if (popup_and_get_string
    279         ("Add variable", "Enter the name of the variable to add", sz_out,
     296        ("Add variable", _("Enter the name of the variable to add"), sz_out,
    280297         MAX_STR_LEN)) {
    281298        mr_strip_spaces(sz_out);
     
    286303        if (i < items) {
    287304            popup_and_OK
    288                 ("No need to add that variable. It is already listed here.");
     305                (_
     306                 ("No need to add that variable. It is already listed here."));
    289307        } else {
    290308            strcpy(raidrec->additional_vars.el[items].label, sz_out);
     
    293311        }
    294312    }
     313    mr_free(sz_out);
    295314}
    296315#endif
     
    313332
    314333    /** structures ********************************************************/
    315     struct vinum_volume *raidrec;
    316 
    317     /** int ***************************************************************/
     334    struct vinum_volume *raidrec = NULL;
     335
    318336    int i = 0, j = 0;
    319337    int noof_partitions = 0;
    320338
    321     /** long **************************************************************/
    322     long total_size = 0;
    323     long plex_size = 0;
     339    long total_size = 0L;
     340    long plex_size = 0L;
    324341    long smallest_partition = 999999999;
    325342    long smallest_plex = 999999999;
    326     long sp = 0;
    327 
    328     /** buffers ***********************************************************/
    329     char tmp[MAX_STR_LEN];
    330 
    331 
    332 
     343    long sp = 0L;
     344
     345    char *devname = NULL;
    333346
    334347    for (i = 0;
     
    336349         && strcmp(raidlist->el[i].volname, basename(raid_device)); i++);
    337350    if (i == raidlist->entries) {
    338         sprintf(tmp,
    339                 "Cannot calc size of raid device %s - cannot find it in raidlist",
     351        log_it("Cannot calc size of raid device %s - cannot find it in raidlist",
    340352                raid_device);
    341         log_it(tmp);
    342353        return (0);             // Isn't this more sensible than 999999999? If the raid dev !exists,
    343354        // then it has no size, right?
     
    351362        int k = 0, l = 0;
    352363        for (k = 0; k < raidrec->plex[j].subdisks; ++k) {
    353             char devname[64];
    354             strcpy(devname, raidrec->plex[j].sd[k].which_device);
     364            mr_asprintf(&devname, raidrec->plex[j].sd[k].which_device);
    355365            for (l = 0; l < raidlist->disks.entries; ++l) {
    356366                if (!strcmp(devname, raidlist->disks.el[l].name)) {
     
    380390                }
    381391            }
     392            mr_free(devname);
    382393        }
    383394
     
    400411    }
    401412
    402     sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,
     413    log_it("I have calculated %s's real size to be %ld", raid_device,
    403414            (long) smallest_plex);
    404     log_it(tmp);
    405415    return (smallest_plex);
    406416#else
     
    408418
    409419    /** structures ********************************************************/
    410     struct raid_device_record *raidrec;
     420    struct raid_device_record *raidrec = NULL;
    411421
    412422    /** int ***************************************************************/
     
    419429    long sp = 0;
    420430
    421     /** buffers ***********************************************************/
    422     char tmp[MAX_STR_LEN];
    423 
    424431    assert(mountlist != NULL);
    425432    assert(raidlist != NULL);
     
    430437         && strcmp(raidlist->el[i].raid_device, raid_device); i++);
    431438    if (i == raidlist->entries) {
    432         sprintf(tmp,
    433                 "Cannot calc size of raid device %s - cannot find it in raidlist",
     439        log_it("Cannot calc size of raid device %s - cannot find it in raidlist",
    434440                raid_device);
    435         log_it(tmp);
    436441        return (999999999);
    437442    }
     
    456461        total_size = smallest_partition * (noof_partitions - 1);
    457462    }
    458     sprintf(tmp, "I have calculated %s's real size to be %ld", raid_device,
     463    log_it("I have calculated %s's real size to be %ld", raid_device,
    459464            (long) total_size);
    460     log_it(tmp);
    461465    return (total_size);
    462466#endif
    463467}
    464 
    465468
    466469
     
    481484
    482485    /** buffers ***********************************************************/
    483     char tmp[MAX_STR_LEN];
    484     char prompt[MAX_STR_LEN];
    485     char sz[MAX_STR_LEN];
    486 
    487     sprintf(prompt,
    488             "Please enter the RAID level you want. (concat, striped, raid5)");
     486    char *tmp = NULL;
     487    char *prompt = NULL;
     488    char *sz = NULL;
     489
     490    malloc_string(tmp);
     491    mr_asprintf(&prompt,
     492             _
     493             ("Please enter the RAID level you want. (concat, striped, raid5)"));
    489494    if (raidrec->raidlevel == -1) {
    490495        strcpy(tmp, "concat");
     
    492497        strcpy(tmp, "striped");
    493498    } else {
    494         sprintf(tmp, "raid%i", raidrec->raidlevel);
     499        strcpy(tmp, "raid%i", raidrec->raidlevel);
    495500    }
    496501    for (out = 999; out == 999;) {
    497         res = popup_and_get_string("Specify RAID level", prompt, tmp, 10);
     502        res = popup_and_get_string(_("Specify RAID level"), prompt, tmp, 10);
    498503        if (!res) {
     504            mr_free(tmp);
     505            mr_free(prompt);
    499506            return;
    500507        }
    501508        mr_strip_spaces(tmp);
     509        /* BERLIOS: Useless ??? */
    502510        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
    503             strcpy(sz, tmp);
     511            mr_asprintf(&sz, tmp);
    504512            strncpy(tmp, sz + 1, strlen(sz) - 2);
    505513            tmp[strlen(sz) - 2] = '\0';
     514            mr_free(sz);
    506515        }
    507516        if (!strcmp(tmp, "concat")) {
     
    511520        } else if (!strcmp(tmp, "raid5")) {
    512521            out = 5;
     522        } else {
     523            continue;
     524        }
     525        log_it(tmp);
     526
     527        if (is_this_raid_personality_registered(out)) {
     528            log_it
     529                ("Groovy. You've picked a RAID personality which is registered.");
     530        } else {
     531            if (ask_me_yes_or_no
     532                (_("You have chosen a RAID personality which is not registered with the kernel. Make another selection?")))
     533            {
     534                out = 999;
     535            }
     536        }
     537    }
     538    mr_free(prompt);
     539    mr_free(tmp);
     540    raidrec->raidlevel = out;
     541#else
     542    /** buffers ***********************************************************/
     543    char *tmp = NULL;
     544    char *personalities = NULL;
     545    char *prompt = NULL;
     546    char *sz = NULL;
     547    int out = 0, res = 0;
     548
     549    malloc_string(tmp);
     550    assert(raidrec != NULL);
     551    system
     552        ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
     553    mr_asprintf(&personalities,
     554           last_line_of_file("/tmp/raid-personalities.txt"));
     555    mr_asprintf(&prompt, _("Please enter the RAID level you want. %s"),
     556             personalities);
     557    mr_free(personalities);
     558
     559    if (raidrec->raid_level == -1) {
     560        strcpy(tmp, "linear");
     561    } else {
     562        sprintf(tmp, "%d", raidrec->raid_level);
     563    }
     564    for (out = 999;
     565         out != -1 && out != 0 && out != 1 && out != 4 && out != 5
     566         && out != 10;) {
     567        res = popup_and_get_string(_("Specify RAID level"), prompt, tmp, 10);
     568        if (!res) {
     569            return;
     570        }
     571        mr_strip_spaces(tmp);
     572        /* BERLIOS: Useless ??? */
     573        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
     574            mr_asprintf(&sz, tmp);
     575            strncpy(tmp, sz + 1, strlen(sz) - 2);
     576            tmp[strlen(sz) - 2] = '\0';
     577            mr_free(sz);
     578        }
     579        if (!strcmp(tmp, "linear")) {
     580            out = -1;
     581        } else if (!strncmp(tmp, "raid", 4)) {
     582            out = atoi(tmp + 4);
     583        } else {
     584            out = atoi(tmp);
    513585        }
    514586        log_it(tmp);
     
    518590        } else {
    519591            if (ask_me_yes_or_no
    520                 ("You have chosen a RAID personality which is not registered with the kernel. Make another selection?"))
     592                (_
     593                 ("You have chosen a RAID personality which is not registered with the kernel. Make another selection?")))
    521594            {
    522595                out = 999;
     
    524597        }
    525598    }
    526     raidrec->raidlevel = out;
    527 #else
    528     /** buffers ***********************************************************/
    529     char tmp[MAX_STR_LEN];
    530     char personalities[MAX_STR_LEN];
    531     char prompt[MAX_STR_LEN];
    532     char sz[MAX_STR_LEN];
    533     int out = 0, res = 0;
    534 
    535 
    536     assert(raidrec != NULL);
    537     system
    538         ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    539     strcpy(personalities,
    540            last_line_of_file("/tmp/raid-personalities.txt"));
    541     sprintf(prompt, "Please enter the RAID level you want. %s",
    542             personalities);
    543     if (raidrec->raid_level == -1) {
    544         strcpy(tmp, "linear");
    545     } else {
    546         sprintf(tmp, "%d", raidrec->raid_level);
    547     }
    548     for (out = 999;
    549          out != -1 && out != 0 && out != 1 && out != 4 && out != 5
    550          && out != 10;) {
    551         res = popup_and_get_string("Specify RAID level", prompt, tmp, 10);
    552         if (!res) {
    553             return;
    554         }
    555         mr_strip_spaces(tmp);
    556         if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
    557             strcpy(sz, tmp);
    558             strncpy(tmp, sz + 1, strlen(sz) - 2);
    559             tmp[strlen(sz) - 2] = '\0';
    560         }
    561         if (!strcmp(tmp, "linear")) {
    562             out = -1;
    563         } else if (!strncmp(tmp, "raid", 4)) {
    564             out = atoi(tmp + 4);
    565         } else {
    566             out = atoi(tmp);
    567         }
    568         log_it(tmp);
    569         if (is_this_raid_personality_registered(out)) {
    570             log_it
    571                 ("Groovy. You've picked a RAID personality which is registered.");
    572         } else {
    573             if (ask_me_yes_or_no
    574                 ("You have chosen a RAID personality which is not registered with the kernel. Make another selection?"))
    575             {
    576                 out = 999;
    577             }
    578         }
    579     }
     599    mr_free(tmp);
     600    mr_free(prompt);
    580601    raidrec->raid_level = out;
    581602#endif
    582603}
    583 
    584604
    585605
     
    602622    int pos = 0;
    603623
    604     /** buffers ***********************************************************/
    605     char tmp[MAX_STR_LEN];
    606 
    607624    assert(mountlist != NULL);
    608625    assert(raidlist != NULL);
     
    615632             pos++);
    616633        if (pos < mountlist->entries) {
    617             sprintf(tmp,
    618                     "Deleting partition %s cos it was part of a now-defunct RAID",
    619                     mountlist->el[pos].device);
    620             log_it(tmp);
     634            log_it("Deleting partition %s cos it was part of a now-defunct RAID",
     635                     mountlist->el[pos].device);
    621636            memcpy((void *) &mountlist->el[pos],
    622637                   (void *) &mountlist->el[mountlist->entries - 1],
     
    626641    }
    627642}
    628 
    629643
    630644
     
    646660
    647661    /** buffers ***********************************************************/
    648     char tmp[MAX_STR_LEN];
     662    char *tmp = NULL;
    649663
    650664    assert(disklist != NULL);
    651665    assert_string_is_neither_NULL_nor_zerolength(raid_device);
    652666
    653     sprintf(tmp, "Delete %s from RAID device %s - are you sure?",
    654             disklist->el[currline].device, raid_device);
     667    mr_asprintf(&tmp, _("Delete %s from RAID device %s - are you sure?"),
     668             disklist->el[currline].device, raid_device);
    655669    if (!ask_me_yes_or_no(tmp)) {
     670        mr_free(tmp);
    656671        return;
    657672    }
     673    mr_free(tmp);
    658674    for (pos = currline; pos < disklist->entries - 1; pos++) {
    659675        /* memcpy((void*)&disklist->el[pos], (void*)&disklist->el[pos+1], sizeof(struct s_disk)); */
     
    662678    disklist->entries--;
    663679}
    664 
    665680
    666681
     
    685700
    686701    /** buffers ***********************************************************/
    687     char tmp[MAX_STR_LEN];
    688     char device[MAX_STR_LEN];
    689 
     702    char *tmp = NULL;
     703    char *device = NULL;
    690704
    691705    assert(mountlist != NULL);
     
    699713                                                  device);
    700714    if (pos >= 0) {
    701         sprintf(tmp, "Cannot delete %s: it is in use by RAID device %s",
    702                 mountlist->el[currline].device,
    703                 raidlist->el[pos].OSSWAP(raid_device, volname));
     715        mr_asprintf(&tmp,
     716                 _("Cannot delete %s: it is in use by RAID device %s"),
     717                 mountlist->el[currline].device,
     718                 raidlist->el[pos].OSSWAP(raid_device, volname));
    704719        popup_and_OK(tmp);
     720        mr_free(tmp);
    705721        return;
    706722    }
    707     sprintf(tmp, "Delete %s - are you sure?",
    708             mountlist->el[currline].device);
     723    mr_asprintf(&tmp, _("Delete %s - are you sure?"),
     724             mountlist->el[currline].device);
    709725    if (!ask_me_yes_or_no(tmp)) {
     726        mr_free(tmp);
    710727        return;
    711728    }
     729    mr_free(tmp);
     730
    712731    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
    713         strcpy(device, mountlist->el[currline].device);
     732        mr_asprintf(&device, mountlist->el[currline].device);
    714733        delete_raidlist_entry(mountlist, raidlist, device);
    715734        for (currline = 0;
     
    717736             && strcmp(mountlist->el[currline].device, device);
    718737             currline++);
    719         if (currline == mountlist->entries) {
    720             log_it("Dev is gone. I can't delete it. Ho-hum");
    721             return;
    722         }
     738            if (currline == mountlist->entries) {
     739                log_it("Dev is gone. I can't delete it. Ho-hum");
     740                mr_free(device);
     741                return;
     742            }
     743        mr_free(device);
    723744    }
    724745    memcpy((void *) &mountlist->el[currline],
     
    750771
    751772    /** buffers ***********************************************************/
    752     char tmp[MAX_STR_LEN];
     773    char *tmp = NULL;
    753774
    754775    assert(mountlist != NULL);
     
    760781        return;
    761782    }
    762     sprintf(tmp, "Do you want me to delete %s's partitions, too?", device);
     783    mr_asprintf(&tmp,
     784             _("Do you want me to delete %s's partitions, too?"), device);
    763785    delete_partitions_too = ask_me_yes_or_no(tmp);
    764786    if (delete_partitions_too) {
     
    804826        items--;
    805827    }
     828    mr_free(tmp);
     829
    806830    raidlist->entries = items;
    807831}
     
    819843
    820844    /** buffers ************************************************************/
    821     char tmp[MAX_STR_LEN];
     845    char *tmp = NULL;
    822846
    823847    /** structures *********************************************************/
    824     struct additional_raid_variables *av;
     848    struct additional_raid_variables *av = NULL;
    825849
    826850    assert(raidrec != NULL);
    827851
    828852    av = &raidrec->additional_vars;
    829     sprintf(tmp, "Delete %s - are you sure?", av->el[lino].label);
     853    mr_asprintf(&tmp, _("Delete %s - are you sure?"), av->el[lino].label);
    830854    if (ask_me_yes_or_no(tmp)) {
    831855        if (!strcmp(av->el[lino].label, "persistent-superblock")
    832856            || !strcmp(av->el[lino].label, "chunk-size")) {
    833             sprintf(tmp, "%s must not be deleted. It would be bad.",
    834                     av->el[lino].label);
     857            mr_free(tmp);
     858            mr_asprintf(&tmp, _("%s must not be deleted. It would be bad."),
     859                     av->el[lino].label);
    835860            popup_and_OK(tmp);
    836861        } else {
     
    839864        }
    840865    }
     866    mr_free(tmp);
    841867}
    842868#endif
     
    861887
    862888    /** long **************************************************************/
    863     long i = 0;
     889    long i = 0L;
    864890
    865891    /** structures *******************************************************/
    866     struct s_node *node;
     892    struct s_node *node = NULL;
    867893
    868894    /** buffers **********************************************************/
    869895    static char current_filename[MAX_STR_LEN];
    870     char tmp[MAX_STR_LEN + 2];
     896    char *tmp = NULL;
    871897
    872898    /** bool *************************************************************/
    873     /*  void*dummyptr; */
    874     bool dummybool;
    875     static bool warned_already;
     899    bool dummybool = FALSE;
     900    static bool warned_already = FALSE;
    876901
    877902    assert(filelist != NULL);
    878903    assert(keylist != NULL);
    879904    assert(listbox != NULL);
    880 
    881905
    882906    if (depth == 0) {
     
    899923                if (!warned_already) {
    900924                    warned_already = TRUE;
    901                     sprintf(tmp,
    902                             "Too many lines. Displaying first %d entries only. Close a directory to see more.",
    903                             ARBITRARY_MAXIMUM);
     925                    mr_asprintf(&tmp,
     926                             _
     927                             ("Too many lines. Displaying first %d entries only. Close a directory to see more."),
     928                             ARBITRARY_MAXIMUM);
    904929                    popup_and_OK(tmp);
     930                    mr_free(tmp);
    905931                }
    906932            } else {
     
    916942            lines_in_flist_window = ARBITRARY_MAXIMUM;
    917943        }
    918 /* do an elementary sort */
     944        /* do an elementary sort */
    919945        for (i = 1; i < lines_in_flist_window; i++) {
    920946            if (strcmp
    921947                (g_strings_of_flist_window[i],
    922948                 g_strings_of_flist_window[i - 1]) < 0) {
    923                 strcpy(tmp, g_strings_of_flist_window[i]);
     949                mr_asprintf(&tmp, g_strings_of_flist_window[i]);
    924950                strcpy(g_strings_of_flist_window[i],
    925951                       g_strings_of_flist_window[i - 1]);
    926952                strcpy(g_strings_of_flist_window[i - 1], tmp);
     953                mr_free(tmp);
     954
    927955                dummybool = g_is_path_selected[i];
    928956                g_is_path_selected[i] = g_is_path_selected[i - 1];
     
    931959            }
    932960        }
    933 /* write list to screen */
     961        /* write list to screen */
    934962        newtListboxClear(listbox);
    935963        for (i = 0; i < lines_in_flist_window; i++) {
    936             sprintf(tmp, "%c%c %-80s", (g_is_path_selected[i] ? '*' : ' '),
    937                     (g_is_path_expanded[i] ? '+' : '-'),
    938                     strip_path(g_strings_of_flist_window[i]));
    939             tmp[70] = '\0';
     964            mr_asprintf(&tmp, "%c%c %-80s",
     965                     (g_is_path_selected[i] ? '*' : ' '),
     966                     (g_is_path_expanded[i] ? '+' : '-'),
     967                     strip_path(g_strings_of_flist_window[i]));
     968            if (strlen(tmp) > 71) {
     969                tmp[70] = '\0';
     970            }
    940971            keylist[i] = (void *) i;
    941972            newtListboxAppendEntry(listbox, tmp, keylist[i]);
     973            mr_free(tmp);
    942974        }
    943975        return (lines_in_flist_window);
     
    9771009        slashcount--;           /* Keep one slash 'cos Hugh does... */
    9781010
     1011    /* BERLIOS: tmpnopath and prev not defined !! How can this compile ?? */
    9791012    for (i = 0; i < slashcount; i++) {  /* Replace each dir with a space char */
    9801013        tmpnopath[i] = ' ';
     
    10251058
    10261059    /** ???? **************************************************************/
    1027     void *curr_choice;
     1060    void *curr_choice = NULL;
    10281061    void *keylist[ARBITRARY_MAXIMUM];
    10291062
    1030     /** buffers ***********************************************************/
    1031     char tmp[MAX_STR_LEN];
    1032 
    10331063    /** bool **************************************************************/
    1034     bool dummybool;
    1035 
    1036 /*  struct s_node *node; */
     1064    bool dummybool = FALSE;
     1065
    10371066
    10381067    assert(filelist != NULL);
    10391068
    1040     log_to_screen("Editing filelist");
     1069    log_to_screen(_("Editing filelist"));
    10411070    newtPushHelpLine
    1042         ("   Please edit the filelist to your satisfaction, then click OK or Cancel.");
     1071        (_
     1072         ("   Please edit the filelist to your satisfaction, then click OK or Cancel."));
    10431073    j = 4;
    1044     bLess = newtCompactButton(j, 17, " Less ");
    1045     bMore = newtCompactButton(j += 12, 17, " More ");
    1046     bToggle = newtCompactButton(j += 12, 17, "Toggle");
    1047     bRegex = newtCompactButton(j += 12, 17, "RegEx");
    1048     bCancel = newtCompactButton(j += 12, 17, "Cancel");
    1049     bOK = newtCompactButton(j += 12, 17, "  OK  ");
     1074    bLess = newtCompactButton(j, 17, _(" Less "));
     1075    bMore = newtCompactButton(j += 12, 17, _(" More "));
     1076    bToggle = newtCompactButton(j += 12, 17, _("Toggle"));
     1077    bRegex = newtCompactButton(j += 12, 17, _("RegEx"));
     1078    bCancel = newtCompactButton(j += 12, 17, _("Cancel"));
     1079    bOK = newtCompactButton(j += 12, 17, _("  OK  "));
    10501080    filelistListbox =
    10511081        newtListbox(2, 1, 15, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    10531083    lines_in_flist_window =
    10541084        redraw_filelist(filelist, keylist, filelistListbox);
    1055     newtOpenWindow(1, 3, 77, 18, "Editing filelist");
     1085    newtOpenWindow(1, 3, 77, 18, _("Editing filelist"));
    10561086    myForm = newtForm(NULL, NULL, 0);
    10571087    newtFormAddComponents(myForm, filelistListbox, bLess, bMore, bToggle,
     
    10621092            finished =
    10631093                ask_me_yes_or_no
    1064                 ("Are you happy with your file selection?");
     1094                (_("Are you happy with your file selection?"));
    10651095        } else if (b_res == bCancel) {
    10661096            finished = TRUE;
    10671097        } else if (b_res == bRegex) {
    1068             popup_and_OK("I haven't implemented this yet...");
     1098            popup_and_OK(_("I haven't implemented this yet..."));
    10691099        } else {
    10701100            curr_choice = newtListboxGetCurrent(filelistListbox);
     
    10771107                indexno = 0;
    10781108            }
    1079             sprintf(tmp, "You selected '%s'",
     1109            log_it("You selected '%s'",
    10801110                    g_strings_of_flist_window[indexno]);
    1081             log_it(tmp);
    10821111            if (b_res == bMore) {
    10831112                g_is_path_expanded[indexno] = TRUE;
     
    11311160        return (0);
    11321161    } else {
    1133 /*    popup_and_OK("You pushed 'cancel'. I shall now abort."); */
    11341162        return (1);
    11351163    }
     
    11701198    newtComponent b_raid = NULL;
    11711199
    1172   /** buffers ***********************************************************/
    1173     char device_str[MAX_STR_LEN];
    1174     char mountpoint_str[MAX_STR_LEN];
    1175     char size_str[MAX_STR_LEN];
    1176     char format_str[MAX_STR_LEN];
    1177     char tmp[MAX_STR_LEN];
    1178     char device_used_to_be[MAX_STR_LEN];
    1179     char mountpt_used_to_be[MAX_STR_LEN];
    1180 
    1181     /** pointers **********************************************************/
    1182     char *device_here;
    1183     char *mountpoint_here;
    1184     char *size_here;
    1185     char *format_here;
    1186 
    1187     /** int ***************************************************************/
     1200    char *device_str = NULL;
     1201    char *mountpoint_str = NULL;
     1202    char *size_str = NULL;
     1203    char *format_str = NULL;
     1204    char *tmp = NULL;
     1205    char *device_used_to_be = NULL;
     1206    char *mountpt_used_to_be = NULL;
     1207    char *device_here = NULL;
     1208    char *mountpoint_here = NULL;
     1209    char *size_here = NULL;
     1210    char *format_here = NULL;
     1211
    11881212    int j = 0;
    11891213
     
    11951219    memcpy((void *) &bkp_raidlist, (void *) raidlist,
    11961220           sizeof(struct raidlist_itself));
    1197     strcpy(device_str, mountlist->el[currline].device);
    1198     strcpy(device_used_to_be, mountlist->el[currline].device);
    1199     strcpy(mountpoint_str, mountlist->el[currline].mountpoint);
    1200     strcpy(mountpt_used_to_be, mountlist->el[currline].mountpoint);
    1201     strcpy(format_str, mountlist->el[currline].format);
    1202     sprintf(size_str, "%lld", mountlist->el[currline].size / 1024);
    1203     newtOpenWindow(20, 5, 48, 10, "Edit entry");
    1204     label0 = newtLabel(2, 1, "Device:");
    1205     label1 = newtLabel(2, 2, "Mountpoint:");
    1206     label2 = newtLabel(2, 3, "Size (MB): ");
    1207     label3 = newtLabel(2, 4, "Format:    ");
     1221    mr_asprintf(&device_str, mountlist->el[currline].device);
     1222    mr_asprintf(&device_used_to_be, mountlist->el[currline].device);
     1223    mr_asprintf(&mountpoint_str, mountlist->el[currline].mountpoint);
     1224    mr_asprintf(&mountpt_used_to_be, mountlist->el[currline].mountpoint);
     1225    mr_asprintf(&format_str, mountlist->el[currline].format);
     1226    mr_asprintf(&size_str, "%lld", mountlist->el[currline].size / 1024);
     1227
     1228    newtOpenWindow(20, 5, 48, 10, _("Edit entry"));
     1229    label0 = newtLabel(2, 1, _("Device:"));
     1230    label1 = newtLabel(2, 2, _("Mountpoint:"));
     1231    label2 = newtLabel(2, 3, _("Size (MB): "));
     1232    label3 = newtLabel(2, 4, _("Format:    "));
    12081233    deviceComp =
    12091234        newtEntry(14, 1, device_str, 30, (void *) &device_here, 0);
     1235    mr_free(device_str);
     1236
    12101237    mountpointComp =
    12111238        newtEntry(14, 2, mountpoint_str, 30, (void *) &mountpoint_here, 0);
     1239    mr_free(mountpoint_str);
     1240
    12121241    formatComp =
    12131242        newtEntry(14, 4, format_str, 15, (void *) &format_here, 0);
     1243    mr_free(format_str);
     1244
    12141245    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)
    12151246        || !strcmp(mountlist->el[currline].mountpoint, "image")) {
     
    12181249        sizeComp = newtEntry(14, 3, size_str, 10, (void *) &size_here, 0);
    12191250    }
    1220     bOK = newtButton(2, 6, "  OK  ");
    1221     bCancel = newtButton(14, 6, "Cancel");
     1251    mr_free(size_str);
     1252
     1253    bOK = newtButton(2, 6, _("  OK  "));
     1254    bCancel = newtButton(14, 6, _("Cancel"));
    12221255    if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
    12231256        b_raid = newtButton(26, 6, "RAID..");
    12241257    }
    12251258    newtPushHelpLine
    1226         ("       Edit this partition's mountpoint, size and format; then click 'OK'.");
     1259        (_
     1260         ("       Edit this partition's mountpoint, size and format; then click 'OK'."));
    12271261    myForm = newtForm(NULL, NULL, 0);
    12281262    newtFormAddComponents(myForm, deviceComp, mountpointComp, sizeComp,
     
    12311265    for (b_res = NULL; b_res != bOK && b_res != bCancel;) {
    12321266        b_res = newtRunForm(myForm);
    1233         strcpy(device_str, device_here);
     1267        mr_free(device_str);
     1268        mr_asprintf(&device_str, device_here);
    12341269        mr_strip_spaces(device_str);
    1235         strcpy(mountpoint_str, mountpoint_here);
     1270
     1271        mr_free(mountpoint_str);
     1272        mr_asprintf(&mountpoint_str, mountpoint_here);
    12361273        mr_strip_spaces(mountpoint_str);
    1237         strcpy(format_str, format_here);
     1274
     1275        mr_free(format_str);
     1276        mr_asprintf(&format_str, format_here);
    12381277        mr_strip_spaces(format_str);
     1278
    12391279        if (b_res == bOK && strstr(device_str, RAID_DEVICE_STUB)
    12401280            && strstr(device_used_to_be, RAID_DEVICE_STUB)
    12411281            && strcmp(device_str, device_used_to_be)) {
    1242             popup_and_OK("You can't change /dev/mdX to /dev/mdY.");
     1282            popup_and_OK(_("You can't change /dev/mdX to /dev/mdY."));
    12431283            b_res = NULL;
    12441284            continue;
    12451285        } else if (b_res == bOK && !strcmp(mountpoint_str, "image")
    12461286                   && strcmp(mountpt_used_to_be, "image")) {
    1247             popup_and_OK("You can't change a regular device to an image.");
     1287            popup_and_OK(_
     1288                         ("You can't change a regular device to an image."));
    12481289            b_res = NULL;
    12491290            continue;
    12501291        }
     1292        mr_free(mountpt_used_to_be);
     1293
     1294        mr_free(size_str);
    12511295        if (!strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)
    12521296            && strcmp(mountlist->el[currline].mountpoint, "image")) {
    1253             strcpy(size_str, size_here);
     1297            mr_asprintf(&size_str, size_here);
    12541298            mr_strip_spaces(size_str);
    12551299        } else {
    1256             sprintf(size_str, "%ld",
     1300            mr_asprintf(&size_str, "%ld",
    12571301                    calculate_raid_device_size(mountlist, raidlist,
    12581302                                               mountlist->el[currline].
     
    12601304            newtLabelSetText(sizeComp, size_str);
    12611305        }
     1306
    12621307        /* do not let user click RAID button if user has changed device_str */
    12631308        if (b_res == b_raid) {
     
    12681313                 */
    12691314                popup_and_OK
    1270                     ("You cannot edit the RAID settings until you have OK'd your change to the device node.");
     1315                    (_
     1316                     ("You cannot edit the RAID settings until you have OK'd your change to the device node."));
    12711317            } else {
    12721318                j = find_raid_device_in_raidlist(raidlist,
     
    12741320                                                 device);
    12751321                if (j < 0) {
    1276                     sprintf(tmp,
    1277                             "/etc/raidtab does not have an entry for %s; please delete it and add it again",
     1322                    mr_asprintf(&tmp,
     1323                            _
     1324                            ("/etc/raidtab does not have an entry for %s; please delete it and add it again"),
    12781325                            mountlist->el[currline].device);
    12791326                    popup_and_OK(tmp);
     1327                    mr_free(tmp);
    12801328                } else {
    1281                     log_it("edit_raidlist_entry - calling");
     1329                    log_it(_("edit_raidlist_entry - calling"));
    12821330                    edit_raidlist_entry(mountlist, raidlist,
    12831331                                        &raidlist->el[j], currline);
     
    12961344    strcpy(mountlist->el[currline].device, device_str);
    12971345    strcpy(mountlist->el[currline].mountpoint, mountpoint_str);
     1346    mr_free(mountpoint_str);
     1347
    12981348    strcpy(mountlist->el[currline].format, format_str);
     1349    mr_free(format_str);
     1350
    12991351    if (strcmp(mountlist->el[currline].mountpoint, "image")) {
    13001352        if (strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)) {
     
    13061358        }
    13071359    }
     1360    mr_free(size_str);
     1361
    13081362    newtListboxSetEntry(listbox, (long) keylist[currline],
    13091363                        mountlist_entry_to_string(mountlist, currline));
     
    13301384    else if (strcmp(device_used_to_be, device_str)) {
    13311385        popup_and_OK
    1332             ("You are renaming a RAID device as another RAID device. I don't like it but I'll allow it.");
     1386            (_
     1387             ("You are renaming a RAID device as another RAID device. I don't like it but I'll allow it."));
    13331388    }
    13341389#endif
    13351390    redraw_mountlist(mountlist, keylist, listbox);
     1391    mr_free(device_str);
     1392    mr_free(device_used_to_be);
    13361393}
    13371394
     
    13501407                 struct vinum_plex *raidrec, char *temp)
    13511408{
    1352     int i;
     1409    int i = 0;
    13531410    bool found = FALSE;
    13541411
     
    13921449}
    13931450
     1451
    13941452void
    13951453edit_raidlist_plex(struct mountlist_itself *mountlist,
     
    14221480
    14231481    /** buffers ***********************************************************/
    1424     char title_of_editraidForm_window[MAX_STR_LEN];
     1482    char *title_of_editraidForm_window = NULL;
    14251483
    14261484    /** newt **************************************************************/
     
    14361494
    14371495    void *keylist[10];
    1438     void *curr_choice;
     1496    void *curr_choice = NULL;
    14391497
    14401498    int currline2 = 0;
    1441 
    1442     log_it("Started edit_raidlist_entry");
     1499    char *pname = NULL;
     1500    char *raidlevel = NULL;
     1501    char *chunksize = NULL;
     1502    char *entry = NULL;
     1503    char *msg = NULL;
     1504    int i = 0;
     1505    char *headerstr = NULL;
     1506
     1507    log_it(_("Started edit_raidlist_entry"));
    14431508    memcpy((void *) &bkp_raidrec, (void *) raidrec,
    14441509           sizeof(struct vinum_volume));
    1445     sprintf(title_of_editraidForm_window, "Plexes on %s",
     1510    mr_asprintf(&title_of_editraidForm_window, _("Plexes on %s"),
    14461511            raidrec->volname);
    1447     newtPushHelpLine("   Please select a plex to edit");
     1512    newtPushHelpLine(_("   Please select a plex to edit"));
    14481513    newtOpenWindow(13, 5, 54, 15, title_of_editraidForm_window);
     1514    mr_free(title_of_editraidForm_window);
     1515
    14491516    for (;;) {
    1450         int i;
    1451         char headerstr[MAX_STR_LEN];
    1452         snprintf(headerstr, MAX_STR_LEN, "%-14s %-8s  %11s  %8s",
    1453                  "Plex", "Level", "Stripe Size", "Subdisks");
    1454 
    1455         bOK = newtCompactButton(2, 13, "  OK  ");
    1456         bCancel = newtCompactButton(12, 13, "Cancel");
    1457         bAdd = newtCompactButton(22, 13, " Add ");
    1458         bEdit = newtCompactButton(32, 13, " Edit ");
    1459         bDelete = newtCompactButton(42, 13, "Delete");
     1517        mr_asprintf(&headerstr, "%-14s %-8s  %11s  %8s", _("Plex"), _("Level",) _("Stripe Size"), _("Subdisks"));
     1518
     1519        bOK = newtCompactButton(2, 13, _("  OK  "));
     1520        bCancel = newtCompactButton(12, 13, _("Cancel"));
     1521        bAdd = newtCompactButton(22, 13, _(" Add "));
     1522        bEdit = newtCompactButton(32, 13, _(" Edit "));
     1523        bDelete = newtCompactButton(42, 13, _("Delete"));
    14601524
    14611525        plexesListbox =
    14621526            newtListbox(2, 3, 9, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
    14631527        plexesHeader = newtLabel(2, 2, headerstr);
     1528        mr_free(headerstr);
     1529
    14641530        editraidForm = newtForm(NULL, NULL, 0);
    14651531
     
    14681534            keylist[i] = (void *) i;
    14691535            if (i < raidrec->plexes) {
    1470                 char pname[64], entry[MAX_STR_LEN], raidlevel[64],
    1471                     chunksize[64];
    14721536                switch (raidrec->plex[i].raidlevel) {
    14731537                case -1:
    1474                     strcpy(raidlevel, "concat");
     1538                    mr_asprintf(&raidlevel, "concat");
    14751539                    break;
    14761540                case 0:
    1477                     strcpy(raidlevel, "striped");
     1541                    mr_asprintf(&raidlevel, "striped");
    14781542                    break;
    14791543                case 5:
    1480                     strcpy(raidlevel, "raid5");
     1544                    mr_asprintf(&raidlevel, "raid5");
    14811545                    break;
    14821546                default:
    1483                     sprintf(raidlevel, "raid%i",
     1547                    mr_asprintf(&raidlevel, "raid%i",
    14841548                            raidrec->plex[i].raidlevel);
    14851549                    break;
     
    14871551
    14881552                if (raidrec->plex[i].raidlevel == -1) {
    1489                     strcpy(chunksize, "N/A");
     1553                    mr_asprintf(&chunksize, "N/A");
    14901554                } else {
    1491                     sprintf(chunksize, "%dk", raidrec->plex[i].stripesize);
     1555                    mr_asprintf(&chunksize, "%dk", raidrec->plex[i].stripesize);
    14921556                }
    1493                 snprintf(pname, 64, "%s.p%i", raidrec->volname, i);
    1494                 snprintf(entry, MAX_STR_LEN, "%-14s %-8s  %11s  %8d",
     1557                mr_asprintf(&pname, "%s.p%i", raidrec->volname, i);
     1558                mr_asprintf(&entry, "%-14s %-8s  %11s  %8d",
    14951559                         pname, raidlevel, chunksize,
    14961560                         raidrec->plex[i].subdisks);
     1561                mr_free(pname);
     1562                mr_free(chunksize);
     1563                mr_free(raidlevel);
    14971564                newtListboxAppendEntry(plexesListbox, entry, keylist[i]);
     1565                /* BERLIOS : hope it's not necessary anymore */
     1566                mr_free(entry);
    14981567            }
    14991568        }
     
    15161585
    15171586        if (b_res == bDelete) {
    1518             char msg[MAX_STR_LEN];
    1519             sprintf(msg, "Are you sure you want to delete %s.p%i?",
     1587            mr_asprintf(&msg, _("Are you sure you want to delete %s.p%i?"),
    15201588                    raidrec->volname, currline2);
    15211589            if (ask_me_yes_or_no(msg)) {
    1522                 log_it("Deleting RAID plex");
     1590                log_it(_("Deleting RAID plex"));
    15231591                memcpy((void *) &raidrec->plex[currline2],
    15241592                       (void *) &raidrec->plex[raidrec->plexes - 1],
     
    15261594                raidrec->plexes--;
    15271595            }
     1596            mr_free(msg);
    15281597            continue;
    15291598        }
     
    15481617#else
    15491618    /** structures ********************************************************/
    1550     struct raid_device_record *bkp_raidrec;
     1619    struct raid_device_record *bkp_raidrec = NULL;
    15511620
    15521621
    15531622    /** buffers ***********************************************************/
    1554     char *title_of_editraidForm_window;
    1555     char *sz_raid_level;
    1556     char *sz_data_disks;
    1557     char *sz_spare_disks;
    1558     char *sz_parity_disks;
    1559     char *sz_failed_disks;
     1623    char *title_of_editraidForm_window = NULL;
     1624    char *sz_raid_level = NULL;
     1625    char *sz_data_disks = NULL;
     1626    char *sz_spare_disks = NULL;
     1627    char *sz_parity_disks = NULL;
     1628    char *sz_failed_disks = NULL;
    15601629
    15611630    /** newt **************************************************************/
     
    15751644    assert(raidrec != NULL);
    15761645
    1577     malloc_string(title_of_editraidForm_window);
    1578     malloc_string(sz_raid_level);
    1579     malloc_string(sz_data_disks);
    1580     malloc_string(sz_spare_disks);
    1581     malloc_string(sz_parity_disks);
    1582     malloc_string(sz_failed_disks);
    15831646    bkp_raidrec = mr_malloc(sizeof(struct raid_device_record));
    15841647
     
    15871650    memcpy((void *) bkp_raidrec, (void *) raidrec,
    15881651           sizeof(struct raid_device_record));
    1589     sprintf(title_of_editraidForm_window, "%s", raidrec->raid_device);
     1652    mr_asprintf(&title_of_editraidForm_window, _("Edit %s"), raidrec->raid_device);
    15901653    mr_msg(2, "Opening newt window");
    15911654    newtOpenWindow(20, 5, 40, 14, title_of_editraidForm_window);
     1655    mr_free(title_of_editraidForm_window);
     1656
    15921657    for (;;) {
    15931658        mr_msg(2, "Main loop");
    1594         sprintf(title_of_editraidForm_window, "Edit %s",
    1595                 raidrec->raid_device);
    1596         strcpy(sz_raid_level,
     1659        mr_asprintf(&sz_raid_level,
    15971660               turn_raid_level_number_to_string(raidrec->raid_level));
    1598         strcpy(sz_data_disks,
     1661        mr_asprintf(&sz_data_disks,
    15991662               number_of_disks_as_string(raidrec->data_disks.entries,
    1600                                          "data"));
    1601         strcpy(sz_spare_disks,
     1663                                         _("data")));
     1664        mr_asprintf(&sz_spare_disks,
    16021665               number_of_disks_as_string(raidrec->spare_disks.entries,
    1603                                          "spare"));
    1604         strcpy(sz_parity_disks,
     1666                                         _("spare")));
     1667        mr_asprintf(&sz_parity_disks,
    16051668               number_of_disks_as_string(raidrec->parity_disks.entries,
    1606                                          "parity"));
    1607         strcpy(sz_failed_disks,
     1669                                         _("parity")));
     1670        mr_asprintf(&sz_failed_disks,
    16081671               number_of_disks_as_string(raidrec->failed_disks.entries,
    1609                                          "failed"));
     1672                                         _("failed")));
    16101673        bSelectData = newtButton(1, 1, sz_data_disks);
    16111674        bSelectSpare = newtButton(20, 1, sz_spare_disks);
     
    16131676        bSelectFailed = newtButton(20, 5, sz_failed_disks);
    16141677        bChangeRaid = newtButton(1, 9, sz_raid_level);
    1615         bOK = newtButton(16 + (raidrec->raid_level == -1), 9, "  OK  ");
    1616         bCancel = newtButton(28, 9, "Cancel");
     1678        mr_free(sz_raid_level);
     1679        mr_free(sz_data_disks);
     1680        mr_free(sz_spare_disks);
     1681        mr_free(sz_parity_disks);
     1682        mr_free(sz_failed_disks);
     1683
     1684        bOK = newtButton(16 + (raidrec->raid_level == -1), 9, _("  OK  "));
     1685        bCancel = newtButton(28, 9, _("Cancel"));
    16171686        bAdditional =
    16181687            newtCompactButton(1, 13,
    1619                               "Additional settings and information");
     1688                              _("Additional settings and information"));
    16201689        newtPushHelpLine
    1621             ("  Edit the RAID device's settings to your heart's content, then hit OK/Cancel.");
     1690            (_
     1691             ("  Edit the RAID device's settings to your heart's content, then hit OK/Cancel."));
    16221692        editraidForm = newtForm(NULL, NULL, 0);
    16231693        newtFormAddComponents(editraidForm, bSelectData, bSelectParity,
     
    16281698            choose_raid_level(raidrec);
    16291699        } else if (b_res == bSelectData) {
    1630             select_raid_disks(mountlist, raidlist, raidrec, "data",
     1700            select_raid_disks(mountlist, raidlist, raidrec, _("data"),
    16311701                              &raidrec->data_disks);
    16321702        } else if (b_res == bSelectSpare) {
    1633             select_raid_disks(mountlist, raidlist, raidrec, "spare",
     1703            select_raid_disks(mountlist, raidlist, raidrec, _("spare"),
    16341704                              &raidrec->spare_disks);
    16351705        } else if (b_res == bSelectParity) {
    1636             select_raid_disks(mountlist, raidlist, raidrec, "parity",
     1706            select_raid_disks(mountlist, raidlist, raidrec, _("parity"),
    16371707                              &raidrec->parity_disks);
    16381708        } else if (b_res == bSelectFailed) {
    1639             select_raid_disks(mountlist, raidlist, raidrec, "failed",
     1709            select_raid_disks(mountlist, raidlist, raidrec, _("failed"),
    16401710                              &raidrec->failed_disks);
    16411711        } else if (b_res == bAdditional) {
     
    16561726        calculate_raid_device_size(mountlist, raidlist,
    16571727                                   raidrec->raid_device);
    1658     mr_free(title_of_editraidForm_window);
    1659     mr_free(sz_raid_level);
    1660     mr_free(sz_data_disks);
    1661     mr_free(sz_spare_disks);
    1662     mr_free(sz_parity_disks);
    1663     mr_free(sz_failed_disks);
    16641728    mr_free(bkp_raidrec);
    16651729#endif
    16661730}
     1731
    16671732
    16681733#ifdef __FreeBSD__
     
    16891754
    16901755    /** buffers ***********************************************************/
    1691     char title_of_editraidForm_window[MAX_STR_LEN];
     1756    char *title_of_editraidForm_window = NULL;
     1757    char *tmp = NULL;
     1758    char *entry = NULL;
    16921759
    16931760    /** newt **************************************************************/
     
    17051772
    17061773    void *keylist[ARBITRARY_MAXIMUM];
    1707     void *curr_choice_a, *curr_choice_u;
    1708     int currline_a, currline_u;
    1709 
    1710     struct mountlist_itself *unallocparts;
     1774    void *curr_choice_a = NULL, *curr_choice_u = NULL;
     1775    int currline_a = 0, currline_u = 0;
     1776    int i = 0;
     1777
     1778    struct mountlist_itself *unallocparts = NULL;
    17111779
    17121780    unallocparts = mr_malloc(sizeof(struct mountlist_itself));
     
    17151783    memcpy((void *) &bkp_raidrec, (void *) raidrec,
    17161784           sizeof(struct vinum_plex));
    1717     sprintf(title_of_editraidForm_window, "%s.p%i",
     1785    mr_asprintf(&title_of_editraidForm_window, "%s.p%i",
    17181786            raidlist->el[currline].volname, currline2);
    17191787    newtPushHelpLine
    1720         ("   Please select a subdisk to edit, or edit this plex's parameters");
     1788        (_
     1789         ("   Please select a subdisk to edit, or edit this plex's parameters"));
    17211790    newtOpenWindow(13, 3, 54, 18, title_of_editraidForm_window);
     1791    mr_free(title_of_editraidForm_window);
     1792
    17221793    for (;;) {
    1723         int i;
    1724         char headerstr[MAX_STR_LEN];
    1725         char tmp[64];
    1726         snprintf(headerstr, MAX_STR_LEN, "%-24s %s", "Subdisk", "Device");
    1727 
    1728 
    17291794        switch (raidrec->raidlevel) {
    17301795        case -1:
    1731             strcpy(tmp, "concat");
     1796            mr_asprintf(&tmp, _("concat"));
    17321797            break;
    17331798        case 0:
    1734             strcpy(tmp, "striped");
     1799            mr_asprintf(&tmp, _("striped"));
    17351800            break;
    17361801        case 5:
    1737             strcpy(tmp, "raid5");
     1802            mr_asprintf(&tmp, _("raid5"));
    17381803            break;
    17391804        default:
    1740             sprintf(tmp, "unknown (%i)", raidrec->raidlevel);
     1805            mr_asprintf(&tmp, _("unknown (%i)"), raidrec->raidlevel);
    17411806            break;
    17421807        }
    1743         bLevel = newtCompactButton(2, 2, " RAID level ");
     1808        bLevel = newtCompactButton(2, 2, _(" RAID level "));
    17441809        sLevel = newtLabel(19, 2, tmp);
     1810        mr_free(tmp);
    17451811
    17461812        if (raidrec->raidlevel >= 0) {
    1747             sprintf(tmp, "%ik", raidrec->stripesize);
    1748             bStripeSize = newtCompactButton(2, 4, " Stripe size ");
     1813            mr_asprintf(&tmp, "%ik", raidrec->stripesize);
     1814            bStripeSize = newtCompactButton(2, 4, _(" Stripe size "));
    17491815        } else {
    1750             strcpy(tmp, "N/A");
    1751             bStripeSize = newtLabel(2, 4, "Stripe size:");
     1816            mr_asprintf(&tmp, "N/A");
     1817            bStripeSize = newtLabel(2, 4, _("Stripe size:"));
    17521818        }
    17531819        sStripeSize = newtLabel(19, 4, tmp);
    1754 
    1755         bOK = newtCompactButton(2, 16, "  OK  ");
    1756         bCancel = newtCompactButton(12, 16, "Cancel");
    1757         bAdd = newtCompactButton(22, 16, " Add ");
    1758         bEdit = newtCompactButton(32, 16, " Edit ");
    1759         bDelete = newtCompactButton(42, 16, "Delete");
    1760 
    1761 
    1762         //  plexesListbox = newtListbox (2, 7, 9, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
    1763         //  plexesHeader  = newtLabel (2, 6, headerstr);
     1820        mr_free(tmp);
     1821
     1822        bOK = newtCompactButton(2, 16, _("  OK  "));
     1823        bCancel = newtCompactButton(12, 16, _("Cancel"));
     1824        bAdd = newtCompactButton(22, 16, _(" Add "));
     1825        bEdit = newtCompactButton(32, 16, _(" Edit "));
     1826        bDelete = newtCompactButton(42, 16, _("Delete"));
     1827
    17641828        unallocListbox =
    17651829            newtListbox(2, 7, 7, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    17771841                                                 raidlist);
    17781842        for (i = 0; i < ARBITRARY_MAXIMUM; ++i) {
    1779             char entry[MAX_STR_LEN];
    17801843            keylist[i] = (void *) i;
    17811844            if (i < raidrec->subdisks) {
    1782                 snprintf(entry, MAX_STR_LEN, "%-17s",
     1845                mr_asprintf(&entry, "%-17s",
    17831846                         find_dev_entry_for_raid_device_name(raidlist,
    17841847                                                             raidrec->
     
    17861849                                                             which_device));
    17871850                newtListboxAppendEntry(allocListbox, entry, keylist[i]);
     1851                mr_free(entry);
    17881852            }
    17891853            if (i < unallocparts->entries) {
    1790                 snprintf(entry, MAX_STR_LEN, "%-17s",
    1791                          unallocparts->el[i].device);
     1854                mr_asprintf(&entry, "%-17s", unallocparts->el[i].device);
    17921855                newtListboxAppendEntry(unallocListbox, entry, keylist[i]);
     1856                mr_free(entry);
    17931857            }
    17941858        }
     
    18401904            choose_raid_level(raidrec);
    18411905        } else if (b_res == bStripeSize) {
    1842             char tmp[64];
     1906            malloc_string(tmp);
    18431907            sprintf(tmp, "%i", raidrec->stripesize);
    18441908            if (popup_and_get_string
    1845                 ("Stripe size",
    1846                  "Please enter the stripe size in kilobytes.", tmp, 20)) {
     1909                (_("Stripe size"),
     1910                 _("Please enter the stripe size in kilobytes."), tmp, 20)) {
    18471911                raidrec->stripesize = atoi(tmp);
    18481912            }
     1913            mr_free(tmp);
    18491914        } else if ((b_res == bAlloc) || (b_res == unallocListbox)) {
    18501915            if (currline_u <= unallocparts->entries)
     
    18871952
    18881953    /** buffers ***********************************************************/
    1889     char header[MAX_STR_LEN];
    1890     char comment[MAX_STR_LEN];
    1891     char sz_out[MAX_STR_LEN];
     1954    char *header = NULL;
     1955    char *comment = NULL;
     1956    char *sz_out = NULL;
    18921957
    18931958    assert(raidrec != 0);
    18941959    assert(lino >= 0);
    18951960
     1961    malloc_string(sz_out);
    18961962    strcpy(sz_out, raidrec->additional_vars.el[lino].value);
    1897     sprintf(header, "Edit %s", raidrec->additional_vars.el[lino].label);
    1898     sprintf(comment, "Please set %s's value (currently '%s')",
     1963    mr_asprintf(&header, _("Edit %s"), raidrec->additional_vars.el[lino].label);
     1964    mr_asprintf(&comment, _("Please set %s's value (currently '%s')"),
    18991965            raidrec->additional_vars.el[lino].label, sz_out);
    19001966    if (popup_and_get_string(header, comment, sz_out, MAX_STR_LEN)) {
     
    19021968        strcpy(raidrec->additional_vars.el[lino].value, sz_out);
    19031969    }
    1904 }
    1905 
    1906 
    1907 /* I'm not racist against white people. I just don't like people who think Liberia is near Spain.       - Hugo, 09/01/2001 */
    1908 
     1970    mr_free(sz_out);
     1971    mr_free(header);
     1972    mr_free(comment);
     1973}
    19091974#endif
     1975
    19101976
    19111977/**
     
    19372003
    19382004    /** ???? *************************************************************/
    1939     void *curr_choice;
     2005    void *curr_choice = NULL;
    19402006    void *keylist[ARBITRARY_MAXIMUM];
    19412007
     
    19442010    int currline = 0;
    19452011    int finished = FALSE;
     2012    int res = 0;
    19462013
    19472014    /** buffers **********************************************************/
    1948     char tmp[MAX_STR_LEN];
    1949     char flaws_str_A[MAX_STR_LEN];
    1950     char flaws_str_B[MAX_STR_LEN];
    1951     char flaws_str_C[MAX_STR_LEN];
     2015    char *tmp = NULL;
     2016    char *flaws_str_A = NULL;
     2017    char *flaws_str_B = NULL;
     2018    char *flaws_str_C = NULL;
    19522019
    19532020    assert(mountlist != NULL);
    19542021    assert(raidlist != NULL);
    19552022
    1956     strcpy(flaws_str_A, "xxxxxxxxx");
    1957     strcpy(flaws_str_B, "xxxxxxxxx");
    1958     strcpy(flaws_str_C, "xxxxxxxxx");
     2023    mr_asprintf(&flaws_str_A, "xxxxxxxxx");
     2024    mr_asprintf(&flaws_str_B, "xxxxxxxxx");
     2025    mr_asprintf(&flaws_str_C, "xxxxxxxxx");
    19592026    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    1960         log_to_screen("Arbitrary limits suck, man!");
     2027        log_to_screen(_("Arbitrary limits suck, man!"));
    19612028        finish(1);
    19622029    }
    19632030    newtPushHelpLine
    1964         ("   Please edit the mountlist to your satisfaction, then click OK or Cancel.");
     2031        (_
     2032         ("   Please edit the mountlist to your satisfaction, then click OK or Cancel."));
    19652033    i = 4;
    1966     bAdd = newtCompactButton(i, 17, " Add ");
    1967     bEdit = newtCompactButton(i += 11, 17, " Edit ");
    1968     bDelete = newtCompactButton(i += 12, 17, "Delete");
    1969     bReload = newtCompactButton(i += 12, 17, "Reload");
    1970     bCancel = newtCompactButton(i += 12, 17, "Cancel");
    1971     bOK = newtCompactButton(i += 12, 17, "  OK  ");
    1972     sprintf(tmp, "%-24s %-24s %-8s  %s", "Device", "Mountpoint", "Format",
    1973             "Size (MB)");
     2034    bAdd = newtCompactButton(i, 17, _(" Add "));
     2035    bEdit = newtCompactButton(i += 11, 17, _(" Edit "));
     2036    bDelete = newtCompactButton(i += 12, 17, _("Delete"));
     2037    bReload = newtCompactButton(i += 12, 17, _("Reload"));
     2038    bCancel = newtCompactButton(i += 12, 17, _("Cancel"));
     2039    bOK = newtCompactButton(i += 12, 17, _("  OK  "));
     2040    mr_asprintf(&tmp, "%-24s %-24s %-8s  %s", _("Device"), _("Mountpoint"),
     2041            _("Format"), _("Size (MB)"));
    19742042    headerMsg = newtLabel(2, 1, tmp);
    19752043    flawsLabelA = newtLabel(2, 13, flaws_str_A);
    19762044    flawsLabelB = newtLabel(2, 14, flaws_str_B);
    19772045    flawsLabelC = newtLabel(2, 15, flaws_str_C);
     2046    mr_free(flaws_str_A);
     2047    mr_free(flaws_str_B);
     2048    mr_free(flaws_str_C);
     2049
    19782050    partitionsListbox =
    19792051        newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
    19802052    redraw_mountlist(mountlist, keylist, partitionsListbox);
    1981     newtOpenWindow(1, 3, 77, 18, "Editing mountlist");
     2053    newtOpenWindow(1, 3, 77, 18, _("Editing mountlist"));
    19822054    myForm = newtForm(NULL, NULL, 0);
    19832055    newtFormAddComponents(myForm, headerMsg, partitionsListbox,
    19842056                          flawsLabelA, flawsLabelB, flawsLabelC, bAdd,
    19852057                          bEdit, bDelete, bReload, bCancel, bOK, NULL);
     2058
     2059    malloc_string(flaws_str_A);
     2060    malloc_string(flaws_str_B);
     2061    malloc_string(flaws_str_C);
    19862062    while (!finished) {
    19872063        evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B,
     
    19902066        newtLabelSetText(flawsLabelB, flaws_str_B);
    19912067        newtLabelSetText(flawsLabelC, flaws_str_C);
     2068
    19922069        b_res = newtRunForm(myForm);
    19932070        if (b_res == bOK) {
     
    19962073                finished =
    19972074                    ask_me_yes_or_no
    1998                     ("Your mountlist might not work. Continue anyway?");
     2075                    (_("Your mountlist might not work. Continue anyway?"));
    19992076            } else {
    20002077                finished =
    20012078                    ask_me_yes_or_no
    2002                     ("Are you sure you want to save your mountlist and continue? (No changes will be made to your partition table at this time.)");
     2079                    (_
     2080                     ("Are you sure you want to save your mountlist and continue? (No changes will be made to your partition table at this time.)"));
    20032081            }
    20042082        } else if (b_res == bCancel) {
    20052083            finished = TRUE;
    20062084        } else if (b_res == bReload) {
    2007             if (ask_me_yes_or_no("Reload original mountlist?")) {
    2008 /*
    2009 This would be really dumb. RAIDTAB_FNAME is #define'd.   --- Hugo, 2003/04/24
    2010           if (!RAIDTAB_FNAME[0])
    2011         {
    2012                   strcpy(RAIDTAB_FNAME, "/etc/raidtab");
    2013           log_it("Warning - raidtab_fname is blank. Assuming %s", g_raidtab_fname);
    2014         }
    2015 */
     2085            if (ask_me_yes_or_no(_("Reload original mountlist?"))) {
    20162086                load_mountlist(mountlist, mountlist_fname);
    20172087                load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     
    20232093                 i < mountlist->entries && keylist[i] != curr_choice; i++);
    20242094            if (i == mountlist->entries && mountlist->entries > 0) {
    2025                 log_to_screen("I don't know what that button does!");
     2095                log_to_screen(_("I don't know what that button does!"));
    20262096            } else {
    20272097                currline = i;
     
    20412111                    } else {
    20422112                        popup_and_OK
    2043                             ("Please add an entry. Then press ENTER to edit it.");
     2113                            (_
     2114                             ("Please add an entry. Then press ENTER to edit it."));
    20442115                    }
    20452116                }
     
    20512122    newtPopHelpLine();
    20522123    if (b_res == bOK) {
    2053         log_it("You pushed 'OK'. I shall now continue.");
     2124        log_it(_("You pushed 'OK'. I shall now continue."));
    20542125        return (0);
    20552126    } else {
    2056         /* popup_and_OK("You pushed 'cancel'. I shall now abort."); */
    20572127        return (1);
    20582128    }
    20592129}
    2060 
    20612130
    20622131
     
    20722141{
    20732142    int res = 0;
    2074 //  char tmp[MAX_STR_LEN];
    20752143
    20762144    iamhere("entering eml");
     
    20862154    return (res);
    20872155}
    2088 
    2089 
    20902156
    20912157
     
    21142180
    21152181    /** ?? ***************************************************************/
    2116     void *keylist[ARBITRARY_MAXIMUM], *curr_choice;
     2182    void *keylist[ARBITRARY_MAXIMUM], *curr_choice = NULL;
    21172183
    21182184    /** buffers **********************************************************/
    2119     char title_of_window[MAX_STR_LEN];
     2185    char *title_of_window = NULL;
    21202186
    21212187    /** int **************************************************************/
     
    21282194    memcpy((void *) &bkp_raidrec, (void *) raidrec,
    21292195           sizeof(struct raid_device_record));
    2130     sprintf(title_of_window, "Additional variables");
     2196    mr_asprintf(&title_of_window, "Additional variables");
    21312197    newtPushHelpLine
    2132         ("  Edit the additional fields to your heart's content, then click OK or Cancel.");
    2133     headerMsg = newtLabel(1, 1, "Label                            Value");
     2198        (_
     2199         ("  Edit the additional fields to your heart's content, then click OK or Cancel."));
     2200    headerMsg =
     2201        newtLabel(1, 1, _("Label                            Value"));
    21342202    varsListbox =
    21352203        newtListbox(1, 2, 6, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
    21362204    i = 1;
    2137     bAdd = newtCompactButton(i, 9, " Add ");
    2138     bEdit = newtCompactButton(i += 8, 9, " Edit ");
    2139     bDelete = newtCompactButton(i += 9, 9, "Delete");
    2140     bOK = newtCompactButton(i += 9, 9, "  OK  ");
    2141     bCancel = newtCompactButton(i += 9, 9, "Cancel");
     2205    bAdd = newtCompactButton(i, 9, _(" Add "));
     2206    bEdit = newtCompactButton(i += 8, 9, _(" Edit "));
     2207    bDelete = newtCompactButton(i += 9, 9, _("Delete"));
     2208    bOK = newtCompactButton(i += 9, 9, _("  OK  "));
     2209    bCancel = newtCompactButton(i += 9, 9, _("Cancel"));
    21422210    newtOpenWindow(17, 7, 46, 10, title_of_window);
     2211    mr_free(title_of_window);
     2212
    21432213    myForm = newtForm(NULL, NULL, 0);
    21442214    newtFormAddComponents(myForm, headerMsg, varsListbox, bAdd, bEdit,
     
    21942264
    21952265  /** bool **************************************************************/
    2196     bool done;
     2266    bool done = FALSE;
    21972267
    21982268    assert(disklist != NULL);
     
    22122282
    22132283
    2214 
    22152284/**
    22162285 * Locate @p device in @p raidlist.
     
    22282297    int i = 0;
    22292298#ifdef __FreeBSD__
    2230     char vdev[64];
    2231 #else
    2232 // Linux
     2299    char *vdev = NULL;
    22332300#endif
    22342301
     
    22382305#ifdef __FreeBSD__
    22392306    for (i = 0; i < raidlist->entries; i++) {
    2240         sprintf(vdev, "/dev/vinum/%s", raidlist->el[i].volname);
    2241         if (!strcmp(device, vdev))
     2307        mr_asprintf(&vdev, "/dev/vinum/%s", raidlist->el[i].volname);
     2308        if (!strcmp(device, vdev)) {
     2309            mr_free(vdev);
    22422310            break;
     2311        }
     2312        mr_free(vdev);
    22432313    }
    22442314#else
     
    22602330 * @param isodir_device Where to put the device (e.g. /dev/hda4) the user enters.
    22612331 * @param isodir_format Where to put the format (e.g. ext2) the user enters.
    2262  * @param isodir_path Where to put the path (e.g. /root/images/mondo) the user enters.
     2332 * @param isodir_path Where to put the path (e.g. /var/cache/mondo) the user enters.
    22632333 * @param nuke_me_please Whether we're planning on nuking or not.
    22642334 * @return TRUE if OK was pressed, FALSE otherwise.
     
    22972367
    22982368    if (popup_and_get_string
    2299         ("ISO Mode - device", "On what device do the ISO files live?",
     2369        (_("ISO Mode - device"), _("On what device do the ISO files live?"),
    23002370         isodir_device, MAX_STR_LEN / 4)) {
    23012371        if (popup_and_get_string
    2302             ("ISO Mode - format",
    2303              "What is the disk format of the device? (Hit ENTER if you don't know.)",
     2372            (_("ISO Mode - format"),
     2373             _("What is the disk format of the device? (Hit ENTER if you don't know.)"),
    23042374             isodir_format, 16)) {
    23052375            if (popup_and_get_string
    2306                 ("ISO Mode - path",
    2307                  "At what path on this device can the ISO files be found?",
     2376                (_("ISO Mode - path"),
     2377                 _("At what path on this device can the ISO files be found?"),
    23082378                 isodir_path, MAX_STR_LEN / 4)) {
    23092379                mr_strip_spaces(isodir_device);
     
    23322402                            int currline, char *device)
    23332403{
    2334 
    23352404    /** structure *********************************************************/
    23362405    struct OSSWAP (raid_device_record, vinum_volume) * raidrec;
     
    23852454    raidrec->additional_vars.entries = items;
    23862455}
    2387 
    23882456#endif
     2457
    23892458
    23902459/**
     
    24032472
    24042473    newtPushHelpLine
    2405         ("This is where I nuke your hard drives. Mhahahahaha. No-one can stop Mojo Jojo!");
    2406     newtOpenWindow(24, 3, 32, 13, "Nuking");
    2407     b1 = newtButton(7, 1, "Slowly");
    2408     b2 = newtButton(7, 5, "Medium");
    2409     b3 = newtButton(7, 9, "Quickly");
     2474        (_
     2475         ("This is where I nuke your hard drives. Mhahahahaha. No-one can stop Mojo Jojo!"));
     2476    newtOpenWindow(24, 3, 32, 13, _("Nuking"));
     2477    b1 = newtButton(7, 1, _("Slowly"));
     2478    b2 = newtButton(7, 5, _("Medium"));
     2479    b3 = newtButton(7, 9, _("Quickly"));
    24102480    myForm = newtForm(NULL, NULL, 0);
    24112481    newtFormAddComponents(myForm, b1, b2, b3, NULL);
     
    24172487
    24182488
    2419 
    24202489/**
    24212490 * Redraw the disklist.
     
    24702539
    24712540    newtListboxClear(listbox);
    2472 //  sort_mountlist_by_device (mountlist);
    24732541    for (i = 0; i < ARBITRARY_MAXIMUM; i++) {
    24742542        keylist[i] = (void *) i;
     
    24802548    }
    24812549}
    2482 
    2483 
    24842550
    24852551
     
    25012567
    25022568    /** buffers **********************************************************/
    2503     char tmp[MAX_STR_LEN];
     2569    char *tmp = NULL;
    25042570
    25052571    assert(unallocated_raid_partitions != NULL);
     
    25122578    }
    25132579    for (i = 0; i < unallocated_raid_partitions->entries; i++) {
    2514         sprintf(tmp, "%-22s %8lld",
     2580        mr_asprintf(&tmp, "%-22s %8lld",
    25152581                unallocated_raid_partitions->el[i].device,
    25162582                unallocated_raid_partitions->el[i].size / 1024);
    25172583        newtListboxAppendEntry(listbox, tmp, keylist[i]);
    2518     }
    2519 }
     2584        mr_free(tmp);
     2585    }
     2586}
     2587
    25202588
    25212589#ifndef __FreeBSD__
     
    25352603
    25362604    /** buffers *********************************************************/
    2537     char tmp[MAX_STR_LEN];
     2605    char *tmp;
    25382606
    25392607    assert(additional_vars != NULL);
     
    25472615    }
    25482616    for (i = 0; i < additional_vars->entries; i++) {
    2549         sprintf(tmp, "%-32s %-8s", additional_vars->el[i].label,
     2617        mr_asprintf(&tmp, "%-32s %-8s", additional_vars->el[i].label,
    25502618                additional_vars->el[i].value);
    25512619        newtListboxAppendEntry(listbox, tmp, keylist[i]);
     2620        mr_free(tmp);
    25522621    }
    25532622}
     
    25932662#endif
    25942663
     2664
    25952665/**
    25962666 * Change all RAID devices to use @p new_dev instead of @p old_dev.
     
    26052675                                                   char *new_dev)
    26062676{
    2607     /** buffers ********************************************************/
    2608     char tmp[MAX_STR_LEN];
    26092677
    26102678    /** int ************************************************************/
     
    26182686    pos = which_raid_device_is_using_this_partition(raidlist, old_dev);
    26192687    if (pos < 0) {
    2620         sprintf(tmp, "No need to rejig %s in raidlist: it's not listed.",
     2688        log_it("No need to rejig %s in raidlist: it's not listed.",
    26212689                old_dev);
    2622         log_it(tmp);
    26232690    } else {
    26242691        if ((j =
     
    26522719#endif
    26532720        else {
    2654             sprintf(tmp,
    2655                     "%s is supposed to be listed in this raid dev but it's not...",
     2721            log_it("%s is supposed to be listed in this raid dev but it's not...",
    26562722                    old_dev);
    2657             log_it(tmp);
    26582723        }
    26592724    }
     
    26882753    res = read_variableINT_and_remove_from_raidvars(raidrec, "block-size");
    26892754}
     2755
    26902756
    26912757/**
     
    27052771                  struct list_of_disks *disklist)
    27062772{
    2707     void *curr_choice;
    2708 
    2709     /** ??? ***************************************************************/
     2773    void *curr_choice = NULL;
    27102774
    27112775    /** structures ********************************************************/
    2712     struct raidlist_itself *bkp_raidlist;
    2713     struct raid_device_record *bkp_raidrec;
    2714     struct list_of_disks *bkp_disklist;
    2715     struct mountlist_itself *unallocated_raid_partitions;
     2776    struct raidlist_itself *bkp_raidlist = NULL;
     2777    struct raid_device_record *bkp_raidrec = NULL;
     2778    struct list_of_disks *bkp_disklist = NULL;
     2779    struct mountlist_itself *unallocated_raid_partitions = NULL;
    27162780
    27172781    /** newt **************************************************************/
     
    27272791    /** buffers **********************************************************/
    27282792    void *keylist[ARBITRARY_MAXIMUM];
    2729     char *tmp;
    2730     char *help_text;
    2731     char *title_of_window;
    2732     char *sz_res;
    2733     char *header_text;
     2793    char *tmp = NULL;
     2794    char *help_text = NULL;
     2795    char *title_of_window = NULL;
     2796    char *sz_res = NULL;
     2797    char *header_text = NULL;
    27342798
    27352799  /** int **************************************************************/
     
    27442808
    27452809    iamhere("malloc'ing");
    2746     malloc_string(tmp);
    2747     malloc_string(help_text);
    2748     malloc_string(title_of_window);
    2749     malloc_string(sz_res);
    2750     malloc_string(header_text);
    27512810    bkp_raidrec = mr_malloc(sizeof(struct raid_device_record));
    27522811    bkp_disklist = mr_malloc(sizeof(struct list_of_disks));
     
    27622821
    27632822    iamhere("Post-malloc");
    2764     strcpy(help_text,
    2765            "   Edit this RAID device's list of partitions. Choose OK or Cancel when done.");
    2766     sprintf(header_text, "%-24s    %s", "Device", "Index");
    2767     sprintf(title_of_window, "%s contains...", raidrec->raid_device);
     2823    mr_asprintf(&help_text,
     2824           _
     2825           ("   Edit this RAID device's list of partitions. Choose OK or Cancel when done."));
     2826    mr_asprintf(&header_text, "%-24s    %s", _("Device"), _("Index"));
     2827    mr_asprintf(&title_of_window, _("%s contains..."), raidrec->raid_device);
    27682828    newtPushHelpLine(help_text);
     2829    mr_free(help_text);
     2830
    27692831    for (b_res = (newtComponent) 12345; b_res != bOK && b_res != bCancel;) {
    27702832        headerMsg = newtLabel(1, 1, header_text);
     
    27732835        redraw_disklist(disklist, keylist, partitionsListbox);
    27742836        i = 1;
    2775         bAdd = newtCompactButton(i, 9, " Add ");
    2776         bDelete = newtCompactButton(i += 8, 9, "Delete");
    2777         bOK = newtCompactButton(i += 9, 9, "  OK  ");
    2778         bCancel = newtCompactButton(i += 9, 9, "Cancel");
     2837        bAdd = newtCompactButton(i, 9, _(" Add "));
     2838        bDelete = newtCompactButton(i += 8, 9, _("Delete"));
     2839        bOK = newtCompactButton(i += 9, 9, _("  OK  "));
     2840        bCancel = newtCompactButton(i += 9, 9, _("Cancel"));
    27792841        newtOpenWindow(21, 7, 38, 10, title_of_window);
    27802842        myForm = newtForm(NULL, NULL, 0);
     
    27882850        b_res = newtRunForm(myForm);
    27892851        if (b_res == bOK || b_res == bCancel) { /* do nothing */
    2790 // That's OK. At the end of this subroutine (after this do/while loop),
    2791 // we'll throw away the changes if Cancel was pushed.
     2852            // That's OK. At the end of this subroutine (after this do/while loop),
     2853            // we'll throw away the changes if Cancel was pushed.
    27922854        } else {
    27932855            curr_choice = newtListboxGetCurrent(partitionsListbox);
     
    27952857                 i++);
    27962858            if (i == disklist->entries && disklist->entries > 0) {
    2797                 log_to_screen("I don't know what that button does!");
     2859                log_to_screen(_("I don't know what that button does!"));
    27982860            } else {
    27992861                currline = i;
    28002862                if (b_res == bAdd) {
    2801                     log_it("Making list of unallocated RAID slices");
     2863                    log_it(_("Making list of unallocated RAID slices"));
    28022864                    make_list_of_unallocated_raid_partitions
    28032865                        (unallocated_raid_partitions, mountlist_dontedit,
     
    28052867                    if (unallocated_raid_partitions->entries <= 0) {
    28062868                        popup_and_OK
    2807                             ("There are no unallocated partitions marked for RAID.");
     2869                            (_
     2870                             ("There are no unallocated partitions marked for RAID."));
    28082871                    } else {
    28092872                        log_it
    2810                             ("Done. The user may add one or more of the above to RAID device");
     2873                            (_
     2874                             ("Done. The user may add one or more of the above to RAID device"));
    28112875                        add_disklist_entry(disklist, raidrec->raid_device,
    28122876                                           unallocated_raid_partitions);
    2813                         log_it("I have finished adding a disklist entry.");
     2877                        log_it(_
     2878                               ("I have finished adding a disklist entry."));
    28142879                        redraw_disklist(disklist, keylist,
    28152880                                        partitionsListbox);
     
    28202885                    redraw_disklist(disklist, keylist, partitionsListbox);
    28212886                } else {
    2822                     sprintf(tmp, "%s's index is %d. What should it be?",
     2887                    mr_asprintf(&tmp, _("%s's index is %d. What should it be?"),
    28232888                            raidrec->raid_device,
    28242889                            disklist->el[currline].index);
     2890                    malloc_string(sz_res);
    28252891                    sprintf(sz_res, "%d", disklist->el[currline].index);
    2826                     if (popup_and_get_string("Set index", tmp, sz_res, 10)) {
     2892                    if (popup_and_get_string
     2893                        (_("Set index"), tmp, sz_res, 10)) {
    28272894                        disklist->el[currline].index = atoi(sz_res);
    28282895                    }
     2896                    mr_free(tmp);
     2897                    mr_free(sz_res);
     2898
    28292899                    redraw_disklist(disklist, keylist, partitionsListbox);
    28302900                }
     
    28342904        newtPopWindow();
    28352905    }
     2906    mr_free(title_of_window);
     2907    mr_free(header_text);
     2908
    28362909    newtPopHelpLine();
    28372910    if (b_res == bCancel) {
     
    28432916               sizeof(struct list_of_disks));
    28442917    }
    2845     mr_free(tmp);
    2846     mr_free(help_text);
    2847     mr_free(title_of_window);
    2848     mr_free(sz_res);
    2849     mr_free(header_text);
    28502918    mr_free(bkp_raidrec);
    28512919    mr_free(bkp_disklist);
     
    28562924
    28572925
    2858 
    28592926/**
    28602927 * Ask the user which restore mode (nuke, interactive, or compare) we should use.
     
    28672934  /** char *************************************************************/
    28682935    char output = '\0';
    2869     char tmp[MAX_STR_LEN];
     2936    char *tmp = NULL;
     2937    size_t n = 0;
    28702938
    28712939  /** newt *************************************************************/
     
    28812949        for (output = 'z'; !strchr("AICE", output); output = tmp[0]) {
    28822950            printf
    2883                 ("Which mode - (A)utomatic, (I)nteractive, \n(C)ompare only, or (E)xit to shell?\n--> ");
    2884             fgets(tmp, MAX_STR_LEN - 1, stdin);
    2885         }
     2951                (_
     2952                 ("Which mode - (A)utomatic, (I)nteractive, \n(C)ompare only, or (E)xit to shell?\n--> "));
     2953            mr_getline(&tmp, &n, stdin);
     2954        }
     2955        mr_free(tmp);
    28862956        return (output);
    28872957    }
    28882958
    28892959    newtPushHelpLine
    2890         ("   Do you want to 'nuke' your system, restore interactively, or just compare?");
    2891     newtOpenWindow(24, 3, 32, 17, "How should I restore?");
    2892     b1 = newtButton(7, 1, "Automatically");
    2893     b2 = newtButton(7, 5, "Interactively");
    2894     b3 = newtButton(7, 9, "Compare only!");
    2895     b4 = newtButton(7, 13, "Exit to shell");
     2960        (_
     2961         ("   Do you want to 'nuke' your system, restore interactively, or just compare?"));
     2962    newtOpenWindow(24, 3, 32, 17, _("How should I restore?"));
     2963    b1 = newtButton(7, 1, _("Automatically"));
     2964    b2 = newtButton(7, 5, _("Interactively"));
     2965    b3 = newtButton(7, 9, _("Compare only!"));
     2966    b4 = newtButton(7, 13, _("Exit to shell"));
    28962967    myForm = newtForm(NULL, NULL, 0);
    28972968    newtFormAddComponents(myForm, b1, b2, b3, b4, NULL);
Note: See TracChangeset for help on using the changeset viewer.