Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3334@localhost: bruno | 2009-08-08 12:17:37 +0200

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2321 r2323  
    276276char *tmp1 = NULL;
    277277
    278     mr_asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);
     278    mr_asprintf(tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);
    279279    run_program_and_log_output(tmp, TRUE);
    280280    if (strlen(tmp) > 0) {
    281         mr_asprintf(&tmp1,"kill `%s`", tmp);
     281        mr_asprintf(tmp1,"kill `%s`", tmp);
    282282        run_program_and_log_output(tmp1, TRUE);
    283283        mr_free(tmp1);
     
    334334        chdir("/");
    335335        if (g_selfmounted_isodir) {
    336             mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
     336            mr_asprintf(command, "umount %s", g_selfmounted_isodir);
    337337            run_program_and_log_output(command, 5);
    338338            mr_free(command);
    339             mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     339            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    340340            run_program_and_log_output(command, 5);
    341341            mr_free(command);
     
    386386        run_program_and_log_output("umount " MNT_CDROM, FALSE);
    387387        if (g_selfmounted_isodir) {
    388             mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
     388            mr_asprintf(command, "umount %s", g_selfmounted_isodir);
    389389            run_program_and_log_output(command, 1);
    390390            mr_free(command);
    391391
    392             mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     392            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    393393            run_program_and_log_output(command, 1);
    394394            mr_free(command);
     
    409409            if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
    410410                log_msg(8,"erasing tempdir");
    411                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
     411                mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir);
    412412                system(command);
    413413                mr_free(command);
     
    418418            if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) {
    419419                log_msg(8,"erasing scratchdir");
    420                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
     420                mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir);
    421421                system(command);
    422422                mr_free(command);
     
    754754                /* take default if ENTER was typed */
    755755                mr_free(output);
    756                 mr_asprintf(&output, "%s", input);
     756                mr_asprintf(output, "%s", input);
    757757            }
    758758            if (output[strlen(output) - 1] == '\n')
     
    761761        }
    762762
    763         mr_asprintf(&blurb, "%s", b);
     763        mr_asprintf(blurb, "%s", b);
    764764        text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0);
    765765        type_here =
     
    782782
    783783        if (b_res == b_1) {
    784             mr_asprintf(&output, "%s", newtEntryGetValue(type_here));
     784            mr_asprintf(output, "%s", newtEntryGetValue(type_here));
    785785        }
    786786        newtPopHelpLine();
     
    982982            || percentage > g_isoform_old_progress) {
    983983            g_isoform_old_progress = percentage;
    984             mr_asprintf(&timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     984            mr_asprintf(timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
    985985            if (percentage < 3) {
    986                 mr_asprintf(&pcline_str, " Working");
     986                mr_asprintf(pcline_str, " Working");
    987987                for (j = 0; j < g_mysterious_dot_counter; j++) {
    988988                    mr_strcat(pcline_str, ".");
     
    993993                mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter));
    994994            } else {
    995                 mr_asprintf(&pcline_str, " %3d%% done              %3d%% to go", percentage, 100 - percentage);
     995                mr_asprintf(pcline_str, " %3d%% done              %3d%% to go", percentage, 100 - percentage);
    996996            }
    997997            if (g_text_mode) {
    998                 mr_asprintf(&taskprogress, "TASK:  [");
     998                mr_asprintf(taskprogress, "TASK:  [");
    999999                for (i = 0; i < percentage; i += 5) {
    10001000                    mr_strcat(taskprogress, "*");
     
    11171117            printf("---progress-form---3--- %s\n", blurb3);
    11181118            printf("---progress-form---E---\n");
    1119             mr_asprintf(&taskprogress, "TASK:  [");
     1119            mr_asprintf(taskprogress, "TASK:  [");
    11201120            for (i = 0; i < percentage; i += 5) {
    11211121                mr_strcat(taskprogress, "*");
     
    11311131            paranoid_free(taskprogress);
    11321132        } else {
    1133             mr_asprintf(&timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
    1134             mr_asprintf(&percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
     1133            mr_asprintf(timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     1134            mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
    11351135
    11361136            center_string(blurb1, 54);
     
    13591359        }
    13601360
    1361         mr_asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
     1361        mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
    13621362        if (!(fout = fopen(tmp1, "a"))) {
    13631363            log_msg(2, "Can't write to %s", tmp1);
     
    14531453        assert(flentry != NULL);
    14541454        if (flentry->severity == 0) {
    1455             mr_asprintf(&tmp, "0   ");
     1455            mr_asprintf(tmp, "0   ");
    14561456        } else if (flentry->severity == 1) {
    1457             mr_asprintf(&tmp, "low ");
     1457            mr_asprintf(tmp, "low ");
    14581458        } else if (flentry->severity == 2) {
    1459             mr_asprintf(&tmp, "med ");
    1460         } else {
    1461             mr_asprintf(&tmp, "high");
     1459            mr_asprintf(tmp, "med ");
     1460        } else {
     1461            mr_asprintf(tmp, "high");
    14621462        }
    14631463        mr_strcat(tmp, "  ");
     
    15401540                                   keylist[i]);
    15411541        }
    1542         mr_asprintf(&differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
     1542        mr_asprintf(differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
    15431543        newtPushHelpLine(differ_sz);
    15441544        mr_free(differ_sz);
     
    15461546        bClose = newtCompactButton(10, 15, " Close  ");
    15471547        bSelect = newtCompactButton(30, 15, " Select ");
    1548         mr_asprintf(&tmp, "%-10s               %-20s", "Priority", "Filename");
     1548        mr_asprintf(tmp, "%-10s               %-20s", "Priority", "Filename");
    15491549        headerMsg = newtLabel(2, 1, tmp);
    15501550        mr_free(tmp);
     
    15711571                    if (filelist->entries > 0) {
    15721572                        severity_of_difference(filelist->el[currline].  filename, reason);
    1573                         mr_asprintf(&tmp, "%s --- %s", filelist->el[currline].filename, reason);
     1573                        mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason);
    15741574
    15751575                        popup_and_OK(tmp);
Note: See TracChangeset for help on using the changeset viewer.