Changeset 1207 for trunk


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

trunk in parity with stable

File:
1 edited

Legend:

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

    r1106 r1207  
    1 /***************************************************************************
     1/*
    22 * $Id$
    33*/
     4#include "mr_mem.h"
     5#include "mr_msg.h"
     6#include "mr_str.h"
     7
    48
    59/**
     
    1519
    1620#include "mondo-rstr-newt.h"
    17 #include "mr_mem.h"
     21
     22//static char cvsid[] = "$Id$";
    1823
    1924/**
     
    201206        mr_free(device_str);
    202207        mr_asprintf(&device_str, device_here);
    203         strip_spaces(device_str);
     208        mr_strip_spaces(device_str);
    204209
    205210        mr_free(format_str);
    206211        mr_asprintf(&format_str, format_here);
    207         strip_spaces(format_str);
     212        mr_strip_spaces(format_str);
    208213
    209214        mr_free(mountpoint_str);
    210215        mr_asprintf(&mountpoint_str, mountpoint_here);
    211         strip_spaces(mountpoint_str);
     216        mr_strip_spaces(mountpoint_str);
    212217
    213218        mr_free(size_str);
    214219        mr_asprintf(&size_str, size_here);
    215         strip_spaces(size_str);
     220        mr_strip_spaces(size_str);
    216221
    217222        if (b_res == bOK) {
     
    232237    newtPopWindow();
    233238    if (b_res == bCancel) {
     239        mr_free(device_str);
     240        mr_free(format_str);
     241        mr_free(mountpoint_str);
     242        mr_free(size_str);
    234243        return;
    235244    }
     
    237246    for (i = strlen(drive_to_add); isdigit(drive_to_add[i - 1]); i--);
    238247    num_to_add = atoi(drive_to_add + i);
    239     drive_to_add[i] = '\0';
    240248    mr_free(drive_to_add);
    241249
     
    282290        ("Add variable", _("Enter the name of the variable to add"),
    283291         sz_out)) {
     292        mr_strip_spaces(sz_out);
    284293        items = raidrec->additional_vars.entries;
    285294        for (i = 0;
     
    322331    int noof_partitions = 0;
    323332
    324     long total_size = 0;
    325     long plex_size = 0;
     333    long total_size = 0L;
     334    long plex_size = 0L;
    326335    long smallest_partition = 999999999;
    327336    long smallest_plex = 999999999;
    328     long sp = 0;
    329 
    330     char *tmp = NULL;
     337    long sp = 0L;
     338
    331339    char *devname = NULL;
    332340
     
    335343         && strcmp(raidlist->el[i].volname, basename(raid_device)); i++);
    336344    if (i == raidlist->entries) {
    337         mr_asprintf(&tmp,
    338                  "Cannot calc size of raid device %s - cannot find it in raidlist",
    339                  raid_device);
    340         log_it(tmp);
    341         mr_free(tmp);
     345        log_it("Cannot calc size of raid device %s - cannot find it in raidlist",
     346                raid_device);
    342347        return (0);             // Isn't this more sensible than 999999999? If the raid dev !exists,
    343348        // then it has no size, right?
     
    400405    }
    401406
    402     mr_asprintf(&tmp, "I have calculated %s's real size to be %ld",
    403              raid_device, (long) smallest_plex);
    404     log_it(tmp);
    405     mr_free(tmp);
     407    log_it("I have calculated %s's real size to be %ld", raid_device,
     408            (long) smallest_plex);
    406409    return (smallest_plex);
    407410#else
     
    420423    long sp = 0;
    421424
    422     /** buffers ***********************************************************/
    423     char *tmp = NULL;
    424 
    425425    assert(mountlist != NULL);
    426426    assert(raidlist != NULL);
     
    431431         && strcmp(raidlist->el[i].raid_device, raid_device); i++);
    432432    if (i == raidlist->entries) {
    433         mr_asprintf(&tmp,
    434                  "Cannot calc size of raid device %s - cannot find it in raidlist",
    435                  raid_device);
    436         log_it(tmp);
    437         mr_free(tmp);
     433        log_it("Cannot calc size of raid device %s - cannot find it in raidlist",
     434                raid_device);
    438435        return (999999999);
    439436    }
     
    458455        total_size = smallest_partition * (noof_partitions - 1);
    459456    }
    460     mr_asprintf(&tmp, "I have calculated %s's real size to be %ld",
    461              raid_device, (long) total_size);
    462     log_it(tmp);
    463     mr_free(tmp);
     457    log_it("I have calculated %s's real size to be %ld", raid_device,
     458            (long) total_size);
    464459    return (total_size);
    465460#endif
     
    498493    }
    499494    for (out = 999; out == 999;) {
    500         res = popup_and_get_string("Specify RAID level", prompt, tmp);
     495        res = popup_and_get_string(_("Specify RAID level"), prompt, tmp);
    501496        if (!res) {
     497            mr_free(tmp);
     498            mr_free(prompt);
    502499            return;
    503500        }
     501        mr_strip_spaces(tmp);
    504502        /* BERLIOS: Useless ???
    505503        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
     
    516514        } else if (!strcmp(tmp, "raid5")) {
    517515            out = 5;
     516        } else {
     517            continue;
    518518        }
    519519        log_it(tmp);
    520520        mr_free(tmp);
     521
    521522        if (is_this_raid_personality_registered(out)) {
    522523            log_it
     
    524525        } else {
    525526            if (ask_me_yes_or_no
    526                 ("You have chosen a RAID personality which is not registered with the kernel. Make another selection?"))
     527                (_("You have chosen a RAID personality which is not registered with the kernel. Make another selection?")))
    527528            {
    528529                out = 999;
     
    556557         out != -1 && out != 0 && out != 1 && out != 4 && out != 5
    557558         && out != 10;) {
    558         res =
    559             popup_and_get_string(_("Specify RAID level"), prompt, tmp);
     559        res = popup_and_get_string(_("Specify RAID level"), prompt, tmp);
    560560        if (!res) {
    561561            return;
    562562        }
     563        mr_strip_spaces(tmp);
    563564        /* BERLIOS: Useless ???
    564565        if (tmp[0] == '[' && tmp[strlen(tmp) - 1] == ']') {
     
    887888
    888889    /** long **************************************************************/
    889     long i = 0;
     890    long i = 0L;
    890891
    891892    /** structures *******************************************************/
     
    897898
    898899    /** bool *************************************************************/
    899     /*  void*dummyptr; */
    900     bool dummybool;
    901     static bool warned_already;
     900    bool dummybool = FALSE;
     901    static bool warned_already = FALSE;
    902902
    903903    assert(filelist != NULL);
     
    943943            lines_in_flist_window = ARBITRARY_MAXIMUM;
    944944        }
    945 /* do an elementary sort */
     945        /* do an elementary sort */
    946946        for (i = 1; i < lines_in_flist_window; i++) {
    947947            if (strcmp
     
    960960            }
    961961        }
    962 /* write list to screen */
     962        /* write list to screen */
    963963        newtListboxClear(listbox);
    964964        for (i = 0; i < lines_in_flist_window; i++) {
     
    967967                     (g_is_path_expanded[i] ? '+' : '-'),
    968968                     strip_path(g_strings_of_flist_window[i]));
    969             // BERLIOS: this is dangerous now  => Memory leak
    970969            if (strlen(tmp) > 71) {
    971970                tmp[70] = '\0';
     
    10601059
    10611060    /** ???? **************************************************************/
    1062     void *curr_choice;
     1061    void *curr_choice = NULL;
    10631062    void *keylist[ARBITRARY_MAXIMUM];
    10641063
    10651064    /** bool **************************************************************/
    1066     bool dummybool;
    1067 
    1068 /*  struct s_node *node; */
     1065    bool dummybool = FALSE;
     1066
    10691067
    10701068    assert(filelist != NULL);
     
    11631161        return (0);
    11641162    } else {
    1165 /*    popup_and_OK("You pushed 'cancel'. I shall now abort."); */
    11661163        return (1);
    11671164    }
     
    12301227    mr_asprintf(&size_str, "%lld", mountlist->el[currline].size / 1024);
    12311228
    1232     newtOpenWindow(20, 5, 48, 10, "Edit entry");
     1229    newtOpenWindow(20, 5, 48, 10, _("Edit entry"));
    12331230    label0 = newtLabel(2, 1, _("Device:"));
    12341231    label1 = newtLabel(2, 2, _("Mountpoint:"));
     
    12691266    for (b_res = NULL; b_res != bOK && b_res != bCancel;) {
    12701267        b_res = newtRunForm(myForm);
    1271 
    12721268        mr_free(device_str);
    12731269        mr_asprintf(&device_str, device_here);
    1274         strip_spaces(device_str);
     1270        mr_strip_spaces(device_str);
    12751271
    12761272        mr_free(mountpoint_str);
    12771273        mr_asprintf(&mountpoint_str, mountpoint_here);
    1278         strip_spaces(mountpoint_str);
     1274        mr_strip_spaces(mountpoint_str);
    12791275
    12801276        mr_free(format_str);
    12811277        mr_asprintf(&format_str, format_here);
    1282         mr_free(format_here);
    1283         strip_spaces(format_str);
     1278        mr_strip_spaces(format_str);
     1279
    12841280        if (b_res == bOK && strstr(device_str, RAID_DEVICE_STUB)
    12851281            && strstr(device_used_to_be, RAID_DEVICE_STUB)
     
    12971293        mr_free(mountpt_used_to_be);
    12981294
     1295        mr_free(size_str);
    12991296        if (!strstr(mountlist->el[currline].device, RAID_DEVICE_STUB)
    13001297            && strcmp(mountlist->el[currline].mountpoint, "image")) {
    13011298            mr_asprintf(&size_str, size_here);
    1302             strip_spaces(size_str);
     1299            mr_strip_spaces(size_str);
    13031300        } else {
    13041301            mr_asprintf(&size_str, "%ld",
     
    13081305            newtLabelSetText(sizeComp, size_str);
    13091306        }
    1310         mr_free(size_here);
    13111307
    13121308        /* do not let user click RAID button if user has changed device_str */
     
    13391335        }
    13401336    }
    1341     mr_free(device_here);
    1342     mr_free(mountpoint_here);
    1343 
    13441337    newtFormDestroy(myForm);
    13451338    newtPopHelpLine();
     
    14151408                 struct vinum_plex *raidrec, char *temp)
    14161409{
    1417     int i;
     1410    int i = 0;
    14181411    bool found = FALSE;
    14191412
     
    14881481
    14891482    /** buffers ***********************************************************/
    1490     char *title_of_editraidForm_window;
     1483    char *title_of_editraidForm_window = NULL;
    14911484
    14921485    /** newt **************************************************************/
     
    15711564                mr_free(raidlevel);
    15721565                newtListboxAppendEntry(plexesListbox, entry, keylist[i]);
     1566                /* BERLIOS : hope it's not necessary anymore */
    15731567                mr_free(entry);
    15741568            }
     
    17331727        calculate_raid_device_size(mountlist, raidlist,
    17341728                                   raidrec->raid_device);
    1735     mr_free((void*) bkp_raidrec);
     1729    mr_free(bkp_raidrec);
    17361730#endif
    17371731}
     1732
     1733
    17381734#ifdef __FreeBSD__
    1739 
    17401735
    17411736/**
     
    17781773
    17791774    void *keylist[ARBITRARY_MAXIMUM];
    1780     void *curr_choice_a, *curr_choice_u;
    1781     int currline_a, currline_u;
    1782     int i;
     1775    void *curr_choice_a = NULL, *curr_choice_u = NULL;
     1776    int currline_a = 0, currline_u = 0;
     1777    int i = 0;
    17831778
    17841779    struct mountlist_itself *unallocparts = NULL;
     
    18001795        switch (raidrec->raidlevel) {
    18011796        case -1:
    1802             mr_asprintf(&tmp, "concat");
     1797            mr_asprintf(&tmp, _("concat"));
    18031798            break;
    18041799        case 0:
    1805             mr_asprintf(&tmp, "striped");
     1800            mr_asprintf(&tmp, _("striped"));
    18061801            break;
    18071802        case 5:
    1808             mr_asprintf(&tmp, "raid5");
     1803            mr_asprintf(&tmp, _("raid5"));
    18091804            break;
    18101805        default:
     
    18321827        bDelete = newtCompactButton(42, 16, _("Delete"));
    18331828
    1834 
    1835         //  plexesListbox = newtListbox (2, 7, 9, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
    18361829        unallocListbox =
    18371830            newtListbox(2, 7, 7, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    20262019    assert(raidlist != NULL);
    20272020
     2021    mr_asprintf(&flaws_str_A, "xxxxxxxxx");
     2022    mr_asprintf(&flaws_str_B, "xxxxxxxxx");
     2023    mr_asprintf(&flaws_str_C, "xxxxxxxxx");
    20282024    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    20292025        log_to_screen(_("Arbitrary limits suck, man!"));
     
    20432039            _("Format"), _("Size (MB)"));
    20442040    headerMsg = newtLabel(2, 1, tmp);
    2045     flawsLabelA = newtLabel(2, 13, "x");
    2046     flawsLabelB = newtLabel(2, 14, "x");
    2047     flawsLabelC = newtLabel(2, 15, "x");
     2041    flawsLabelA = newtLabel(2, 13, flaws_str_A);
     2042    flawsLabelB = newtLabel(2, 14, flaws_str_B);
     2043    flawsLabelC = newtLabel(2, 15, flaws_str_C);
     2044    mr_free(flaws_str_A);
     2045    mr_free(flaws_str_B);
     2046    mr_free(flaws_str_C);
     2047
    20482048    partitionsListbox =
    20492049        newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    21232123        return (0);
    21242124    } else {
    2125         /* popup_and_OK("You pushed 'cancel'. I shall now abort."); */
    21262125        return (1);
    21272126    }
     
    22632262
    22642263  /** bool **************************************************************/
    2265     bool done;
     2264    bool done = FALSE;
    22662265
    22672266    assert(disklist != NULL);
     
    23642363        if (popup_and_get_string
    23652364            (_("ISO Mode - format"),
    2366              _
    2367              ("What is the disk format of the device? (Hit ENTER if you don't know.)"),
     2365             _("What is the disk format of the device? (Hit ENTER if you don't know.)"),
    23682366             isodir_format)) {
    23692367            if (popup_and_get_string
    23702368                (_("ISO Mode - path"),
    2371                  _
    2372                  ("At what path on this device can the ISO files be found?"),
     2369                 _("At what path on this device can the ISO files be found?"),
    23732370                 isodir_path)) {
    23742371                // Same pb:
     
    25322529
    25332530    newtListboxClear(listbox);
    2534 //  sort_mountlist_by_device (mountlist);
    25352531    for (i = 0; i < ARBITRARY_MAXIMUM; i++) {
    25362532        keylist[i] = (void *) i;
     
    26692665                                                   char *new_dev)
    26702666{
    2671     /** buffers ********************************************************/
    2672     char *tmp;
    26732667
    26742668    /** int ************************************************************/
     
    26822676    pos = which_raid_device_is_using_this_partition(raidlist, old_dev);
    26832677    if (pos < 0) {
    2684         mr_asprintf(&tmp, "No need to rejig %s in raidlist: it's not listed.",
     2678        log_it("No need to rejig %s in raidlist: it's not listed.",
    26852679                old_dev);
    2686         log_it(tmp);
    2687         mr_free(tmp);
    26882680    } else {
    26892681        if ((j =
     
    27172709#endif
    27182710        else {
    2719             mr_asprintf(&tmp,
    2720                     "%s is supposed to be listed in this raid dev but it's not...",
     2711            log_it("%s is supposed to be listed in this raid dev but it's not...",
    27212712                    old_dev);
    2722             log_it(tmp);
    2723             mr_free(tmp);
    27242713        }
    27252714    }
     
    28292818    newtPushHelpLine(help_text);
    28302819    mr_free(help_text);
     2820
    28312821    for (b_res = (newtComponent) 12345; b_res != bOK && b_res != bCancel;) {
    28322822        headerMsg = newtLabel(1, 1, header_text);
     
    28502840        b_res = newtRunForm(myForm);
    28512841        if (b_res == bOK || b_res == bCancel) { /* do nothing */
    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.
     2842            // That's OK. At the end of this subroutine (after this do/while loop),
     2843            // we'll throw away the changes if Cancel was pushed.
    28542844        } else {
    28552845            curr_choice = newtListboxGetCurrent(partitionsListbox);
     
    28952885                    mr_free(tmp);
    28962886                    mr_free(sz_res);
     2887
    28972888                    redraw_disklist(disklist, keylist, partitionsListbox);
    28982889                }
     
    29142905               sizeof(struct list_of_disks));
    29152906    }
    2916     mr_free((void*) bkp_raidrec);
    2917     mr_free((void*) bkp_disklist);
    2918     mr_free((void*) bkp_raidlist);
    2919     mr_free((void*) unallocated_raid_partitions);
     2907    mr_free(bkp_raidrec);
     2908    mr_free(bkp_disklist);
     2909    mr_free(bkp_raidlist);
     2910    mr_free(unallocated_raid_partitions);
    29202911}
    29212912#endif
Note: See TracChangeset for help on using the changeset viewer.