Changeset 89 in MondoRescue for trunk/mondo/mondo/common/newt-specific.c
- Timestamp:
- Oct 27, 2005, 10:45:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/newt-specific.c
r87 r89 62 62 */ 63 63 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 form65 *g_blurb_str_2, ///< The string for line 2 of the blurb in the progress form66 *g_blurb_str_3; ///< The string for line 3 (updated continuously) of the blurb in the progress form64 *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 67 67 newtComponent g_isoform_main = NULL, ///< The evalcall form component itself 68 68 g_isoform_header = NULL, ///< The component for the evalcall form title … … 86 86 bool g_called_by_xmondo = FALSE; ///< @bug Unneeded w/current XMondo. 87 87 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. 89 89 90 90 /* @} - end of globalGroup */ … … 300 300 301 301 if (g_selfmounted_isodir) { 302 303 304 305 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); 306 306 } 307 307 … … 316 316 ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null"); 317 317 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 "); 320 319 printf 321 320 ("to see if that fixes the problem.\nPlease don't bother the mailing list with"); … … 358 357 void 359 358 finish(int signal) { 360 361 362 363 359 char *command; 360 malloc_string(command); 361 362 /* if (signal==0) { popup_and_OK("Please press <enter> to quit."); } */ 364 363 365 364 /* newtPopHelpLine(); */ … … 374 373 } 375 374 if (g_selfmounted_isodir) { 376 377 378 379 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); 380 379 } 381 380 // iamhere("foo"); … … 793 792 printf("%s (%s or %s) --> ", p, button1, button2); 794 793 } 795 for (asprintf(&tmp, "");794 for (asprintf(&tmp, ""); 796 795 strcmp(tmp, button1) && (strlen(button2) == 0 797 796 || strcmp(tmp, button2));) { … … 945 944 percentage = 1; 946 945 } else { 947 percentage = (int) trunc(num);946 percentage = (int) trunc(num); 948 947 } 949 948 … … 965 964 g_isoform_old_progress = percentage; 966 965 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); 970 969 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 = '.'; 974 976 } 975 977 *p = '\0'; 976 978 977 979 /* 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 = ' '; 981 987 } 982 988 *p = '\0'; 983 989 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)); 985 992 paranoid_free(tmp1); 986 993 paranoid_free(tmp2); 987 994 } 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); 990 998 } 991 999 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 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 = '*'; 996 1004 } 997 1005 *p = '\0'; 998 1006 999 tmp2 = (char *) malloc((20 - j + 1) * sizeof(char));1000 for (i = 0, p = tmp2 ; i < 20 - j; i++, p++) {1001 1007 tmp2 = (char *) malloc((20 - j + 1) * sizeof(char)); 1008 for (i = 0, p = tmp2; i < 20 - j; i++, p++) { 1009 *p = '.'; 1002 1010 } 1003 1011 *p = '\0'; 1004 1012 1005 1013 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); 1007 1018 printf("---evalcall---1--- %s\r\n", 1008 1019 g_isoform_header_str); … … 1091 1102 if (g_current_progress > g_maximum_progress) { 1092 1103 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); 1096 1107 log_msg(0, tmp); 1097 1108 paranoid_free(tmp); … … 1118 1129 //g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 1119 1130 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); 1125 1137 1126 1138 if (g_text_mode) { … … 1130 1142 printf("---progress-form---E---\n"); 1131 1143 1132 j = trunc(percentage /5);1133 tmp1 = (char *) malloc((j + 1) * sizeof(char));1134 for (i = 0, p = tmp1 ; i < j; i++, p++) {1135 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 = '*'; 1136 1148 } 1137 1149 *p = '\0'; 1138 1150 1139 tmp2 = (char *) malloc((20 - j + 1) * sizeof(char));1140 for (i = 0, p = tmp2 ; i < 20 - j; i++, p++) {1141 1151 tmp2 = (char *) malloc((20 - j + 1) * sizeof(char)); 1152 for (i = 0, p = tmp2; i < 20 - j; i++, p++) { 1153 *p = '.'; 1142 1154 } 1143 1155 *p = '\0'; … … 1146 1158 log_msg(2, "percentage = %d", percentage); 1147 1159 } 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); 1149 1164 1150 1165 printf("---progress-form---4--- %s\r\n", taskprogress); … … 1233 1248 if (restoring) { 1234 1249 asprintf(&title_sz, 1235 1250 "Please choose the backup media from which you want to read data."); 1236 1251 asprintf(&minimsg_sz, "Read from:"); 1237 1252 } else { 1238 1253 asprintf(&title_sz, 1239 1254 "Please choose the backup media to which you want to archive data."); 1240 1255 asprintf(&minimsg_sz, "Backup to:"); 1241 1256 } … … 1524 1539 } 1525 1540 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); 1528 1543 newtPushHelpLine(differ_sz); 1529 1544 paranoid_free(differ_sz); … … 1531 1546 bClose = newtCompactButton(10, 15, " Close "); 1532 1547 bSelect = newtCompactButton(30, 15, " Select "); 1533 asprintf(&tmp, "%-10s %-20s", "Priority", "Filename"); 1548 asprintf(&tmp, "%-10s %-20s", "Priority", 1549 "Filename"); 1534 1550 headerMsg = newtLabel(2, 1, tmp); 1535 1551 paranoid_free(tmp); … … 1556 1572 filename, reason); 1557 1573 asprintf(&tmp, "%s --- %s", 1558 filelist->el[currline].filename, reason);1574 filelist->el[currline].filename, reason); 1559 1575 popup_and_OK(tmp); 1560 1576 paranoid_free(tmp);
Note:
See TracChangeset
for help on using the changeset viewer.