Changeset 89 in MondoRescue for trunk/mondo/mondo


Ignore:
Timestamp:
Oct 27, 2005, 10:45:34 PM (18 years ago)
Author:
bcornec
Message:

merge r87:88 of the 2.04_berlios branch
indent some files

Location:
trunk/mondo/mondo
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/X-specific.h

    r59 r89  
    6464    struct Event {
    6565        enum EventType { None, Show, Hide, New, SetProgress, SetTotal,
    66                 SetText, InsLine, PopupWithButtons, InfoMsg, ErrorMsg,
    67                 GetInfo } type;
     66            SetText, InsLine, PopupWithButtons, InfoMsg, ErrorMsg,
     67            GetInfo
     68        } type;
    6869        QWidget *data;
    6970// union {
  • trunk/mondo/mondo/common/libmondo-archive.c

    r87 r89  
    12141214
    12151215    asprintf(&command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir,
    1216                 bkpinfo->nfs_remote_dir, bkpinfo->prefix);
     1216            bkpinfo->nfs_remote_dir, bkpinfo->prefix);
    12171217    paranoid_system(command);
    12181218    paranoid_free(command);
     
    33793379    log_msg(2, tmp);
    33803380    /* BERLIOS: center_string is now broken
    3381     center_string(tmp, 80);
    3382     */
     3381       center_string(tmp, 80);
     3382     */
    33833383#ifndef _XWIN
    33843384    if (!g_text_mode) {
  • trunk/mondo/mondo/common/libmondo-devices.c

    r87 r89  
    21032103            }
    21042104            // check whether already mounted - we better remove
    2105                         // surrounding spaces and trailing '/' for this
    2106             strip_spaces (bkpinfo->nfs_mount);
     2105            // surrounding spaces and trailing '/' for this
     2106            strip_spaces(bkpinfo->nfs_mount);
    21072107            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    2108               bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
     2108                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
    21092109            sprintf(command, "mount | grep \"%s \" | cut -d' ' -f3",
    2110                    bkpinfo->nfs_mount);
     2110                    bkpinfo->nfs_mount);
    21112111            strcpy(bkpinfo->isodir,
    21122112                   call_program_and_get_last_line_of_output(command));
     
    21222122        }
    21232123        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
    2124           sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d", (int)(random()%32768));
    2125           sprintf(command, "mkdir -p %s", bkpinfo->isodir);
    2126           run_program_and_log_output(command, 5);
    2127           sprintf(tmp, "mount %s -t nfs %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    2128           run_program_and_log_output(tmp, 5);
    2129           malloc_string(g_selfmounted_isodir);
    2130           strcpy(g_selfmounted_isodir, bkpinfo->isodir);
     2124            sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d",
     2125                    (int) (random() % 32768));
     2126            sprintf(command, "mkdir -p %s", bkpinfo->isodir);
     2127            run_program_and_log_output(command, 5);
     2128            sprintf(tmp, "mount %s -t nfs %s", bkpinfo->nfs_mount,
     2129                    bkpinfo->isodir);
     2130            run_program_and_log_output(tmp, 5);
     2131            malloc_string(g_selfmounted_isodir);
     2132            strcpy(g_selfmounted_isodir, bkpinfo->isodir);
    21312133        }
    21322134        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    21442146        strcpy(bkpinfo->nfs_remote_dir, tmp);
    21452147        // check whether writable - we better remove surrounding spaces for this
    2146         strip_spaces (bkpinfo->nfs_remote_dir);
    2147         sprintf (command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
    2148                       bkpinfo->nfs_remote_dir);
    2149         while (run_program_and_log_output (command, FALSE)) {
    2150           strcpy(tmp, bkpinfo->nfs_remote_dir);
    2151           asprintf (&prompt,
    2152                 "Directory '%s' under mountpoint '%s' does not exist or is not writable. You can fix this or change the directory and retry or cancel the backup.",
    2153                 bkpinfo->nfs_remote_dir, bkpinfo->isodir);
    2154           if(!popup_and_get_string ("Directory", prompt, tmp, MAX_STR_LEN)) {
    2155             log_to_screen("User has chosen not to backup the PC");
    2156             finish(1);
    2157           }
    2158           strcpy(bkpinfo->nfs_remote_dir, tmp);
    2159           // check whether writable - we better remove surrounding spaces for this */
    2160           strip_spaces (bkpinfo->nfs_remote_dir);
    2161           asprintf (&command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
    2162                         bkpinfo->nfs_remote_dir);
     2148        strip_spaces(bkpinfo->nfs_remote_dir);
     2149        sprintf(command, "echo hi > %s/%s/.dummy.txt", bkpinfo->isodir,
     2150                bkpinfo->nfs_remote_dir);
     2151        while (run_program_and_log_output(command, FALSE)) {
     2152            strcpy(tmp, bkpinfo->nfs_remote_dir);
     2153            asprintf(&prompt,
     2154                     "Directory '%s' under mountpoint '%s' does not exist or is not writable. You can fix this or change the directory and retry or cancel the backup.",
     2155                     bkpinfo->nfs_remote_dir, bkpinfo->isodir);
     2156            if (!popup_and_get_string
     2157                ("Directory", prompt, tmp, MAX_STR_LEN)) {
     2158                log_to_screen("User has chosen not to backup the PC");
     2159                finish(1);
     2160            }
     2161            strcpy(bkpinfo->nfs_remote_dir, tmp);
     2162            // check whether writable - we better remove surrounding spaces for this */
     2163            strip_spaces(bkpinfo->nfs_remote_dir);
     2164            asprintf(&command, "echo hi > %s/%s/.dummy.txt",
     2165                     bkpinfo->isodir, bkpinfo->nfs_remote_dir);
    21632166        }
    21642167        for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
     
    29082911    }
    29092912#endif
    2910     log_msg(1, "Using %s",fdisk);
     2913    log_msg(1, "Using %s", fdisk);
    29112914    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    29122915    strcpy(tmp, call_program_and_get_last_line_of_output(command));
  • trunk/mondo/mondo/common/libmondo-fork.c

    r68 r89  
    477477    res = pclose(fin);
    478478    /* Log actual pclose errors. */
    479     if (errno) log_msg(5, "pclose err: %d", errno);
     479    if (errno)
     480        log_msg(5, "pclose err: %d", errno);
    480481    /* Check if we have a valid status. If we do, extract the called program's exit code. */
    481482    /* If we don't, highlight this fact by returning -1. */
    482483    if (WIFEXITED(res)) {
    483       retval = WEXITSTATUS(res);
     484        retval = WEXITSTATUS(res);
    484485    } else {
    485       retval = -1;
     486        retval = -1;
    486487    }
    487488    close_evalcall_form();
     
    681682 */
    682683int dynamically_create_pipes_and_copy_from_them_to_output_file(char
    683                                                                *input_device,
    684                                                                char
     684                                                               *input_device, char
    685685                                                               *output_fname)
    686686{
  • trunk/mondo/mondo/common/libmondo-string.c

    r87 r89  
    4343    assert(partno >= 0);
    4444
    45     p = strcpy(partition, drive);
     45    asprintf(&partition, "%s", drive);
     46    p = partition;
    4647    /* is this a devfs device path? */
    4748    c = strrchr(partition, '/');
    4849    if (c && strncmp(c, "/disc", 5) == 0) {
    4950        /* yup it's devfs, return the "part" path */
     51        /* format /dev/.../disc */
    5052        strcpy(c + 1, "part");
    51         p = c + 5;
    5253    } else {
    5354        p += strlen(p);
    5455        if (isdigit(p[-1])) {
    55             *p++ =
     56            p = partition;
    5657#ifdef BSD
    57                 's';
     58            asprintf(&partition, "%ss", p);
    5859#else
    59                 'p';
     60            /* format /dev/cciss/c0d0 */
     61            asprintf(&partition, "%sp", p);
    6062#endif
     63            paranoid_free(p);
    6164        }
    6265    }
    63     sprintf(p, "%d", partno);
     66    p = partition;
     67    asprintf(&partition, "%s%d", p, partno);
     68    paranoid_free(p);
    6469    return (partition);
    6570}
     
    658663    numA = atol(stringA + start_of_numbers_in_A);
    659664    numB = atol(stringB + start_of_numbers_in_B);
    660     /*
    661        sprintf(tmp,"Comparing %s and %s --> %ld,%ld\n",stringA,stringB,numA,numB);
    662        log_to_screen(tmp);
    663      */
    664665    return ((int) (numA - numB));
    665666}
     
    882883        sev = 2;
    883884        asprintf(&reason,
    884                 "/var's contents will change regularly, inevitably.");
     885                 "/var's contents will change regularly, inevitably.");
    885886    }
    886887    if (!strncmp(filename, "/home", 5)) {
    887888        sev = 2;
    888889        asprintf(&reason,
    889                 "It's in your /home partiton. Therefore, it is important.");
     890                 "It's in your /home partiton. Therefore, it is important.");
    890891    }
    891892    if (!strncmp(filename, "/usr/", 5)) {
    892893        sev = 3;
    893894        asprintf(&reason,
    894                 "You may have installed/removed software during the backup.");
     895                 "You may have installed/removed software during the backup.");
    895896    }
    896897    if (!strncmp(filename, "/etc/", 5)) {
    897898        sev = 3;
    898899        asprintf(&reason,
    899                 "Do not edit config files while backing up your PC.");
     900                 "Do not edit config files while backing up your PC.");
    900901    }
    901902    if (!strcmp(filename, "/etc/adjtime")
     
    906907    if (!strncmp(filename, "/root/", 6)) {
    907908        sev = 3;
    908         asprintf(&reason, "Were you compiling/editing something in /root?");
     909        asprintf(&reason,
     910                 "Were you compiling/editing something in /root?");
    909911    }
    910912    if (!strncmp(filename, "/root/.", 7)) {
     
    923925        sev = 1;
    924926        asprintf(&reason,
    925                 "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
     927                 "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
    926928    }
    927929    if (!strncmp(filename, "/var/log/", 9)
     
    930932        sev = 1;
    931933        asprintf(&reason,
    932                 "Log files change frequently as the computer runs. Fret not.");
     934                 "Log files change frequently as the computer runs. Fret not.");
    933935    }
    934936    if (!strncmp(filename, "/var/spool", 10)) {
    935937        sev = 1;
    936938        asprintf(&reason,
    937                 "Background processes or printers were active. This does not affect the integrity of your backup.");
     939                 "Background processes or printers were active. This does not affect the integrity of your backup.");
    938940    }
    939941    if (!strncmp(filename, "/var/spool/mail", 10)) {
     
    944946        sev = 1;
    945947        asprintf(&reason,
    946                 "Backup copy of another file which was modified recently.");
     948                 "Backup copy of another file which was modified recently.");
    947949    }
    948950    if (strstr(filename, "cache")) {
    949951        sev = 1;
    950952        asprintf(&reason,
    951                 "Part of a cache of data. Caches change from time to time. Don't worry.");
     953                 "Part of a cache of data. Caches change from time to time. Don't worry.");
    952954    }
    953955    if (!strncmp(filename, "/var/run/", 9)
     
    957959        sev = 1;
    958960        asprintf(&reason,
    959                 "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
     961                 "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
    960962    }
    961963    paranoid_free(filename);
     
    964966        sev = 3;
    965967        asprintf(&reason,
    966             "Changed since backup. Consider running a differential backup in a day or two.");
     968                 "Changed since backup. Consider running a differential backup in a day or two.");
    967969    }
    968970
     
    10241026        asprintf(&tmp, "%lld", g_tape_posK);
    10251027        asprintf(&outstr, "Volume %d: %s kilobytes archived so far",
    1026                 g_current_media_number, commarize(tmp));
     1028                 g_current_media_number, commarize(tmp));
    10271029        paranoid_free(tmp);
    10281030        return (outstr);
     
    10401042                   bkpinfo->media_size[g_current_media_number]);
    10411043        asprintf(&prepstr, "%s %d: [",
    1042                 media_descriptor_string(bkpinfo->backup_media_type),
    1043                 g_current_media_number);
     1044                 media_descriptor_string(bkpinfo->backup_media_type),
     1045                 g_current_media_number);
    10441046    }
    10451047    if (percentage > 100) {
    10461048        percentage = 100;
    10471049    }
    1048     j = trunc(percentage/5);
    1049     tmp1 = (char *)malloc((j + 1) * sizeof(char));
    1050     for (i = 0, p = tmp1 ; i < j ; i++, p++) {
    1051             *p = '*';
     1050    j = trunc(percentage / 5);
     1051    tmp1 = (char *) malloc((j + 1) * sizeof(char));
     1052    for (i = 0, p = tmp1; i < j; i++, p++) {
     1053        *p = '*';
    10521054    }
    10531055    *p = '\0';
    10541056
    1055     tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
    1056     for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) {
    1057             *p = '.';
     1057    tmp2 = (char *) malloc((20 - j + 1) * sizeof(char));
     1058    for (i = 0, p = tmp2; i < 20 - j; i++, p++) {
     1059        *p = '.';
    10581060    }
    10591061    *p = '\0';
     
    10631065     * like this it creates a huge number. Memory pb somewhere */
    10641066    /*
    1065     log_it("percentage: %d", percentage);
    1066     asprintf(&outstr, "%s%s%s] %3d%% used", prepstr, tmp1, tmp2, percentage);
    1067     */
    1068     asprintf(&outstr, "%s%s%s] %3d percent used", prepstr, tmp1, tmp2, percentage);
     1067       log_it("percentage: %d", percentage);
     1068       asprintf(&outstr, "%s%s%s] %3d%% used", prepstr, tmp1, tmp2, percentage);
     1069     */
     1070    asprintf(&outstr, "%s%s%s] %3d percent used", prepstr, tmp1, tmp2,
     1071             percentage);
    10691072    paranoid_free(prepstr);
    10701073    paranoid_free(tmp1);
  • trunk/mondo/mondo/common/libmondo-tools.c

    r87 r89  
    562562                    extra_cdrom_params, bkpinfo->media_device);
    563563        }
    564         if (getenv ("SUDO_COMMAND")) {
    565           fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - please see the growisofs manpage for details.");
     564        if (getenv("SUDO_COMMAND")) {
     565            fatal_error
     566                ("Can't write DVDs as sudo because growisofs doesn't support this - please see the growisofs manpage for details.");
    566567        }
    567568        log_msg(2, "call_make_iso (DVD res) is ... %s",
     
    712713            }
    713714        }
    714         store_nfs_config (bkpinfo);
     715        store_nfs_config(bkpinfo);
    715716    }
    716717
  • trunk/mondo/mondo/common/my-stuff.h

    r87 r89  
    214214/**
    215215 * @c growisofs command to generate a bootable DVD using LILO, except for the directory to image.
    216      */// -b images/mindi-boot.2880.img
     216         */// -b images/mindi-boot.2880.img
    217217#define MONDO_GROWISOFS_REGULAR_ELILO     "growisofs -use-the-force-luke -no-emul-boot -b images/mindi-boot.2880.img -c boot.cat -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ -v"
    218218
    219219/**
    220220 * @c growisofs command to generate a bootable DVD using LILO, except for the directory to image.
    221      */// -b images/mindi-boot.2880.img
     221         */// -b images/mindi-boot.2880.img
    222222#define MONDO_GROWISOFS_REGULAR_LILO     "growisofs -no-emul-boot -b isolinux.bin -c boot.cat -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ -v"
    223223
  • trunk/mondo/mondo/common/newt-specific.c

    r87 r89  
    6262 */
    6363    char **err_log_lines = NULL,    ///< The list of log lines to show on the screen.
    64         *g_blurb_str_1, ///< The string for line 1 of the blurb in the progress form
    65         *g_blurb_str_2, ///< The string for line 2 of the blurb in the progress form
    66         *g_blurb_str_3; ///< The string for line 3 (updated continuously) of the blurb in the progress form
     64        *g_blurb_str_1,         ///< The string for line 1 of the blurb in the progress form
     65        *g_blurb_str_2,         ///< The string for line 2 of the blurb in the progress form
     66        *g_blurb_str_3;         ///< The string for line 3 (updated continuously) of the blurb in the progress form
    6767    newtComponent g_isoform_main = NULL,    ///< The evalcall form component itself
    6868        g_isoform_header = NULL,    ///< The component for the evalcall form title
     
    8686    bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
    8787    char *g_erase_tmpdir_and_scratchdir;    ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo.
    88 char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
     88    char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
    8989
    9090/* @} - end of globalGroup */
     
    300300
    301301        if (g_selfmounted_isodir) {
    302           asprintf(&command, "umount %s", g_selfmounted_isodir);
    303           run_program_and_log_output(command, 5);
    304           asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    305           run_program_and_log_output(command, 5);
     302            asprintf(&command, "umount %s", g_selfmounted_isodir);
     303            run_program_and_log_output(command, 5);
     304            asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     305            run_program_and_log_output(command, 5);
    306306        }
    307307
     
    316316            ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null");
    317317        if (!strstr(g_version, "cvs") && !strstr(g_version, "svn")) {
    318             printf
    319                 ("Please try the latest SVN version ");
     318            printf("Please try the latest SVN version ");
    320319            printf
    321320                ("to see if that fixes the problem.\nPlease don't bother the mailing list with");
     
    358357    void
    359358     finish(int signal) {
    360             char *command;
    361             malloc_string(command);
    362        
    363             /*  if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */
     359        char *command;
     360        malloc_string(command);
     361
     362        /*  if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */
    364363
    365364        /* newtPopHelpLine(); */
     
    374373        }
    375374        if (g_selfmounted_isodir) {
    376           asprintf(&command, "umount %s", g_selfmounted_isodir);
    377           run_program_and_log_output(command, 1);
    378           asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    379           run_program_and_log_output(command, 1);
     375            asprintf(&command, "umount %s", g_selfmounted_isodir);
     376            run_program_and_log_output(command, 1);
     377            asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     378            run_program_and_log_output(command, 1);
    380379        }
    381380//  iamhere("foo");
     
    793792                printf("%s (%s or %s) --> ", p, button1, button2);
    794793            }
    795             for (asprintf(&tmp,"");
     794            for (asprintf(&tmp, "");
    796795                 strcmp(tmp, button1) && (strlen(button2) == 0
    797796                                          || strcmp(tmp, button2));) {
     
    945944            percentage = 1;
    946945        } else {
    947             percentage = (int)trunc(num) ;
     946            percentage = (int) trunc(num);
    948947        }
    949948
     
    965964            g_isoform_old_progress = percentage;
    966965            asprintf(&timeline_str,
    967                     "%2ld:%02ld taken            %2ld:%02ld remaining",
    968                     time_taken / 60, time_taken % 60, time_remaining / 60,
    969                     time_remaining % 60);
     966                     "%2ld:%02ld taken            %2ld:%02ld remaining",
     967                     time_taken / 60, time_taken % 60, time_remaining / 60,
     968                     time_remaining % 60);
    970969            if (percentage < 3) {
    971                 tmp1 = (char *)malloc(g_mysterious_dot_counter * sizeof(char));
    972                 for (i = 0, p = tmp1 ; i < g_mysterious_dot_counter - 1 ; i++, p++) {
    973                         *p = '.';
     970                tmp1 =
     971                    (char *) malloc(g_mysterious_dot_counter *
     972                                    sizeof(char));
     973                for (i = 0, p = tmp1; i < g_mysterious_dot_counter - 1;
     974                     i++, p++) {
     975                    *p = '.';
    974976                }
    975977                *p = '\0';
    976978
    977979                /* BERLIOS: 27 should be a parameter */
    978                 tmp2 = (char *)malloc(27-g_mysterious_dot_counter * sizeof(char));
    979                 for (i = 0, p = tmp2 ; i < 27 - g_mysterious_dot_counter - 1 ; i++, p++) {
    980                         *p = ' ';
     980                tmp2 =
     981                    (char *) malloc(27 -
     982                                    g_mysterious_dot_counter *
     983                                    sizeof(char));
     984                for (i = 0, p = tmp2;
     985                     i < 27 - g_mysterious_dot_counter - 1; i++, p++) {
     986                    *p = ' ';
    981987                }
    982988                *p = '\0';
    983989
    984                 asprintf(&pcline_str, " Working%s%s %c", tmp1, tmp2, special_dot_char(g_mysterious_dot_counter));
     990                asprintf(&pcline_str, " Working%s%s %c", tmp1, tmp2,
     991                         special_dot_char(g_mysterious_dot_counter));
    985992                paranoid_free(tmp1);
    986993                paranoid_free(tmp2);
    987994            } else {
    988                 asprintf(&pcline_str, " %3d%% done              %3d%% to go",
    989                         percentage, 100 - percentage);
     995                asprintf(&pcline_str,
     996                         " %3d%% done              %3d%% to go",
     997                         percentage, 100 - percentage);
    990998            }
    991999            if (g_text_mode) {
    992                 j = trunc(percentage/5);
    993                 tmp1 = (char *)malloc((j + 1) * sizeof(char));
    994                 for (i = 0, p = tmp1 ; i < j ; i++, p++) {
    995                         *p = '*';
     1000                j = trunc(percentage / 5);
     1001                tmp1 = (char *) malloc((j + 1) * sizeof(char));
     1002                for (i = 0, p = tmp1; i < j; i++, p++) {
     1003                    *p = '*';
    9961004                }
    9971005                *p = '\0';
    9981006
    999                 tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
    1000                 for (i = 0, p = tmp2 ; i < 20 - j ; i++, p++) {
    1001                         *p = '.';
     1007                tmp2 = (char *) malloc((20 - j + 1) * sizeof(char));
     1008                for (i = 0, p = tmp2; i < 20 - j; i++, p++) {
     1009                    *p = '.';
    10021010                }
    10031011                *p = '\0';
    10041012
    10051013                if (percentage >= 3) {
    1006                     asprintf(&taskprogress, "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60);
     1014                    asprintf(&taskprogress,
     1015                             "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go",
     1016                             tmp1, tmp2, percentage, time_remaining / 60,
     1017                             time_remaining % 60);
    10071018                    printf("---evalcall---1--- %s\r\n",
    10081019                           g_isoform_header_str);
     
    10911102            if (g_current_progress > g_maximum_progress) {
    10921103                asprintf(&tmp,
    1093                         "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld",
    1094                         blurb1, blurb2, blurb3, g_current_progress,
    1095                         g_maximum_progress);
     1104                         "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld",
     1105                         blurb1, blurb2, blurb3, g_current_progress,
     1106                         g_maximum_progress);
    10961107                log_msg(0, tmp);
    10971108                paranoid_free(tmp);
     
    11181129        //g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;
    11191130        asprintf(&timeline_str,
    1120                 "%2ld:%02ld taken               %2ld:%02ld remaining  ",
    1121                 time_taken / 60, time_taken % 60, time_remaining / 60,
    1122                 time_remaining % 60);
    1123         asprintf(&percentline_str, " %3d%% done                 %3d%% to go",
    1124                 percentage, 100 - percentage);
     1131                 "%2ld:%02ld taken               %2ld:%02ld remaining  ",
     1132                 time_taken / 60, time_taken % 60, time_remaining / 60,
     1133                 time_remaining % 60);
     1134        asprintf(&percentline_str,
     1135                 " %3d%% done                 %3d%% to go", percentage,
     1136                 100 - percentage);
    11251137
    11261138        if (g_text_mode) {
     
    11301142            printf("---progress-form---E---\n");
    11311143
    1132             j = trunc(percentage/5);
    1133             tmp1 = (char *)malloc((j + 1) * sizeof(char));
    1134             for (i = 0, p = tmp1 ; i < j ; i++, p++) {
    1135                     *p = '*';
     1144            j = trunc(percentage / 5);
     1145            tmp1 = (char *) malloc((j + 1) * sizeof(char));
     1146            for (i = 0, p = tmp1; i < j; i++, p++) {
     1147                *p = '*';
    11361148            }
    11371149            *p = '\0';
    11381150
    1139             tmp2 = (char *)malloc((20 - j + 1) * sizeof(char));
    1140             for (i = 0, p = tmp2 ; i <  20 - j ; i++, p++) {
    1141                     *p = '.';
     1151            tmp2 = (char *) malloc((20 - j + 1) * sizeof(char));
     1152            for (i = 0, p = tmp2; i < 20 - j; i++, p++) {
     1153                *p = '.';
    11421154            }
    11431155            *p = '\0';
     
    11461158                log_msg(2, "percentage = %d", percentage);
    11471159            }
    1148             asprintf(&taskprogress, "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go", tmp1, tmp2, percentage, time_remaining / 60, time_remaining % 60);
     1160            asprintf(&taskprogress,
     1161                     "TASK:  [%s%s] %3d%% done; %2ld:%02ld to go", tmp1,
     1162                     tmp2, percentage, time_remaining / 60,
     1163                     time_remaining % 60);
    11491164
    11501165            printf("---progress-form---4--- %s\r\n", taskprogress);
     
    12331248        if (restoring) {
    12341249            asprintf(&title_sz,
    1235                   "Please choose the backup media from which you want to read data.");
     1250                    "Please choose the backup media from which you want to read data.");
    12361251            asprintf(&minimsg_sz, "Read from:");
    12371252        } else {
    12381253            asprintf(&title_sz,
    1239                   "Please choose the backup media to which you want to archive data.");
     1254                    "Please choose the backup media to which you want to archive data.");
    12401255            asprintf(&minimsg_sz, "Backup to:");
    12411256        }
     
    15241539        }
    15251540        asprintf(&differ_sz,
    1526                 "  %d files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.",
    1527                 i);
     1541                 "  %d files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.",
     1542                 i);
    15281543        newtPushHelpLine(differ_sz);
    15291544        paranoid_free(differ_sz);
     
    15311546        bClose = newtCompactButton(10, 15, " Close  ");
    15321547        bSelect = newtCompactButton(30, 15, " Select ");
    1533         asprintf(&tmp, "%-10s               %-20s", "Priority", "Filename");
     1548        asprintf(&tmp, "%-10s               %-20s", "Priority",
     1549                 "Filename");
    15341550        headerMsg = newtLabel(2, 1, tmp);
    15351551        paranoid_free(tmp);
     
    15561572                                               filename, reason);
    15571573                        asprintf(&tmp, "%s --- %s",
    1558                                 filelist->el[currline].filename, reason);
     1574                                 filelist->el[currline].filename, reason);
    15591575                        popup_and_OK(tmp);
    15601576                        paranoid_free(tmp);
  • trunk/mondo/mondo/mondorestore/mondo-prep.c

    r86 r89  
    18031803            MONDO_LOGFILE);
    18041804
     1805    /* BERLIOS: shoould not be called each time */
     1806    part_table_fmt = which_partition_format(drive);
    18051807    output[0] = '\0';
    18061808    /* make it a primary/extended/logical */
     
    18081810        sprintf(output + strlen(output), "n\np\n%d\n", partno);
    18091811    } else {
    1810         if (partno == 5) {
    1811             part_table_fmt = which_partition_format(drive);
     1812        /* MBR needs an extended partition if more than 4 partitions */
     1813        if (strcmp(part_table_fmt,"MBR") == 0) {
     1814            if (partno == 5) {
     1815                if (prev_partno >= 4) {
     1816                    log_to_screen("You need to leave at least one partition free, for 'extended/logical'");
     1817                    paranoid_free(program);
     1818                    paranoid_free(partition_name);
     1819                    paranoid_free(tmp);
     1820                    paranoid_free(logfile);
     1821                    paranoid_free(output);
     1822                    return (1);
     1823                } else {
     1824                    sprintf(output + strlen(output), "n\ne\n%d\n\n\n", prev_partno + 1);
     1825                }
     1826            }
     1827            strcat(output + strlen(output), "n\nl\n");
     1828        } else {
    18121829            /* GPT allows more than 4 primary partitions */
    1813             if ((prev_partno >= 4) && (strcmp(part_table_fmt, "MBR") == 0)) {
    1814                 log_to_screen
    1815                     ("You need to leave at least one partition free, for 'extended/logical'");
    1816                 paranoid_free(program);
    1817                 paranoid_free(partition_name);
    1818                 paranoid_free(tmp);
    1819                 paranoid_free(logfile);
    1820                 paranoid_free(output);
    1821                 return (1);
    1822             } else {
    1823                 sprintf(output + strlen(output), "n\ne\n%d\n\n\n",
    1824                         prev_partno + 1);
    1825             }
    1826         }
    1827         strcat(output + strlen(output), "n\nl\n");
     1830            sprintf(output + strlen(output), "n\np\n%d\n", partno);
     1831        }
    18281832    }
    18291833    strcat(output + strlen(output), "\n");  /*start block (ENTER for next free blk */
Note: See TracChangeset for help on using the changeset viewer.