Changeset 2211 in MondoRescue for branches/2.2.9/mondo/src/common/newt-specific.c
- Timestamp:
- Jun 3, 2009, 7:10:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/newt-specific.c
r2136 r2211 19 19 20 20 #include "my-stuff.h" 21 #include "mr_mem.h" 21 22 #include "mondostructures.h" 22 23 #include "newt-specific.h" … … 263 264 char *tmp1 = NULL; 264 265 265 asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);266 mr_asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id); 266 267 run_program_and_log_output(tmp, TRUE); 267 268 if (strlen(tmp) > 0) { 268 asprintf(&tmp1,"kill `%s`", tmp);269 mr_asprintf(&tmp1,"kill `%s`", tmp); 269 270 run_program_and_log_output(tmp1, TRUE); 270 271 paranoid_free(tmp1); … … 386 387 run_program_and_log_output("umount " MNT_CDROM, FALSE); 387 388 if (g_selfmounted_isodir) { 388 asprintf(&command, "umount %s", g_selfmounted_isodir);389 mr_asprintf(&command, "umount %s", g_selfmounted_isodir); 389 390 run_program_and_log_output(command, 1); 390 391 paranoid_free(command); 391 asprintf(&command, "rmdir %s", g_selfmounted_isodir);392 mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir); 392 393 run_program_and_log_output(command, 1); 393 394 paranoid_free(command); … … 405 406 printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE); 406 407 if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) { 407 asprintf(&command, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir);408 mr_asprintf(&command, "rm -Rf %s %s", bkpinfo->tmpdir, bkpinfo->scratchdir); 408 409 system(command); 409 410 paranoid_free(command); … … 956 957 /*@ buffers ********************************************************** */ 957 958 char *timeline_str; 958 char *pcline_str ;959 char *taskprogress ;959 char *pcline_str = NULL; 960 char *taskprogress = NULL; 960 961 961 962 /*@ int ************************************************************** */ … … 965 966 966 967 malloc_string(timeline_str); 967 malloc_string(pcline_str);968 malloc_string(taskprogress);969 968 timeline_str[0] = '\0'; 970 969 // log_it("update_eval_call_form called"); … … 997 996 time_remaining % 60); 998 997 if (percentage < 3) { 999 sprintf(pcline_str, " Working");998 mr_asprintf(&pcline_str, " Working"); 1000 999 for (j = 0; j < g_mysterious_dot_counter; j++) { 1001 strcat(pcline_str, ".");1000 mr_strcat(pcline_str, "."); 1002 1001 } 1003 1002 for (; j < 27; j++) { 1004 strcat(pcline_str, " ");1003 mr_strcat(pcline_str, " "); 1005 1004 } 1006 sprintf(pcline_str + strlen(pcline_str), " %c", 1007 special_dot_char(g_mysterious_dot_counter)); 1005 mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter)); 1008 1006 } else { 1009 sprintf(pcline_str, " %3d%% done %3d%% to go",1007 mr_asprintf(&pcline_str, " %3d%% done %3d%% to go", 1010 1008 percentage, 100 - percentage); 1011 1009 } 1012 1010 if (g_text_mode) { 1013 sprintf(taskprogress, "TASK: [");1011 mr_asprintf(&taskprogress, "TASK: ["); 1014 1012 for (i = 0; i < percentage; i += 5) { 1015 strcat(taskprogress, "*");1013 mr_strcat(taskprogress, "*"); 1016 1014 } 1017 1015 for (; i < 100; i += 5) { 1018 strcat(taskprogress, ".");1016 mr_strcat(taskprogress, "."); 1019 1017 } 1020 1018 if (percentage >= 3) { 1021 sprintf(taskprogress + strlen(taskprogress), 1022 "] %3d%% done; %2ld:%02ld to go", percentage, 1019 mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, 1023 1020 time_remaining / 60, time_remaining % 60); 1024 1021 printf("---evalcall---1--- %s\n", … … 1027 1024 printf("---evalcall---E---\n"); 1028 1025 } 1026 paranoid_free(taskprogress); 1029 1027 } else { 1030 1028 newtScaleSet(g_isoform_scale, … … 1037 1035 } 1038 1036 } 1037 paranoid_free(pcline_str); 1039 1038 } 1040 1039 if (!g_text_mode) { … … 1043 1042 } 1044 1043 paranoid_free(timeline_str); 1045 paranoid_free(pcline_str);1046 paranoid_free(taskprogress);1047 1044 } 1048 1045 … … 1099 1096 char *percentline_str; 1100 1097 char *timeline_str; 1101 char *taskprogress ;1098 char *taskprogress = NULL; 1102 1099 char *tmp; 1103 1100 … … 1105 1102 percentline_str = malloc(MAX_NEWT_COMMENT_LEN); 1106 1103 timeline_str = malloc(MAX_NEWT_COMMENT_LEN); 1107 taskprogress = malloc(MAX_NEWT_COMMENT_LEN);1108 1104 malloc_string(tmp); 1109 1105 if (!g_text_mode) { … … 1159 1155 printf("---progress-form---3--- %s\n", blurb3); 1160 1156 printf("---progress-form---E---\n"); 1161 sprintf(taskprogress, "TASK: [");1157 mr_asprintf(&taskprogress, "TASK: ["); 1162 1158 for (i = 0; i < percentage; i += 5) { 1163 strcat(taskprogress, "*");1159 mr_strcat(taskprogress, "*"); 1164 1160 } 1165 1161 for (; i < 100; i += 5) { 1166 strcat(taskprogress, ".");1162 mr_strcat(taskprogress, "."); 1167 1163 } 1168 1164 if (percentage > 100) { 1169 1165 log_msg(2, "percentage = %d", percentage); 1170 1166 } 1171 sprintf(taskprogress + strlen(taskprogress), 1172 "] %3d%c", percentage, '%'); 1173 sprintf(taskprogress + strlen(taskprogress), 1174 " done; %2ld:%02ld to go", 1167 mr_strcat(taskprogress, "] %3d%c", percentage, '%'); 1168 mr_strcat(taskprogress, " done; %2ld:%02ld to go", 1175 1169 time_remaining / 60, time_remaining % 60); 1176 1170 printf("---progress-form---4--- %s\n", taskprogress); 1171 paranoid_free(taskprogress); 1177 1172 } else { 1178 1173 center_string(blurb1, 54); … … 1199 1194 paranoid_free(percentline_str); 1200 1195 paranoid_free(timeline_str); 1201 paranoid_free(taskprogress);1202 1196 paranoid_free(tmp); 1203 1197 } … … 1414 1408 } 1415 1409 1416 asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);1410 mr_asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir); 1417 1411 if (!(fout = fopen(tmp1, "a"))) { 1418 1412 log_msg(2, "Can't write to %s", tmp1); … … 1503 1497 char *filelist_entry_to_string(struct s_filelist_entry *flentry) { 1504 1498 static char comment[100]; 1505 char *tmp ;1499 char *tmp = NULL; 1506 1500 1507 1501 iamhere("entering"); 1508 malloc_string(tmp);1509 1502 assert(flentry != NULL); 1510 1503 if (flentry->severity == 0) { 1511 strcpy(tmp, "0 ");1504 mr_asprintf(&tmp, "0 "); 1512 1505 } else if (flentry->severity == 1) { 1513 strcpy(tmp, "low ");1506 mr_asprintf(&tmp, "low "); 1514 1507 } else if (flentry->severity == 2) { 1515 strcpy(tmp, "med "); 1516 } else { 1517 strcpy(tmp, "high"); 1518 } 1519 strcat(tmp, " "); 1520 strncat(tmp, flentry->filename, 100); 1521 tmp[98] = '\0'; 1522 strcpy(comment, tmp); 1508 mr_asprintf(&tmp, "med "); 1509 } else { 1510 mr_asprintf(&tmp, "high"); 1511 } 1512 mr_strcat(tmp, " "); 1513 mr_strcat(tmp, flentry->filename); 1514 strncpy(comment, tmp, 99); 1523 1515 paranoid_free(tmp); 1516 1524 1517 iamhere("leaving"); 1525 1518 return (comment);
Note:
See TracChangeset
for help on using the changeset viewer.