Changeset 2324 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-files.c
- Timestamp:
- Aug 18, 2009, 3:13:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-files.c
r2323 r2324 48 48 static char output[MAX_STR_LEN]; 49 49 char *command = NULL; 50 char *tmp = NULL;51 50 52 51 /*@ pointers **************************************************** */ … … 71 70 mr_free(command); 72 71 } else { 73 mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename); 74 log_it(tmp); 75 mr_free(tmp); 72 log_it("File '%s' not found; cannot calc checksum", filename); 76 73 } 77 74 if (p) { … … 129 126 char *command = NULL; 130 127 char incoming[MAX_STR_LEN]; 131 char *tmp = NULL;132 128 133 129 /*@ long ******************************************************** */ … … 142 138 assert_string_is_neither_NULL_nor_zerolength(filename); 143 139 if (!does_file_exist(filename)) { 144 mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename); 145 log_it(tmp); 146 mr_free(tmp); 140 log_it("%s does not exist, so I cannot found the number of lines in it", filename); 147 141 return (0); 148 142 } … … 251 245 fprintf(fout, "%s\n", incoming); 252 246 } else { 253 mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming); 254 log_it(tmp); 255 mr_free(tmp); 247 log_it("Excluding '%s'-nonexistent\n", incoming); 256 248 } 257 249 } … … 354 346 } 355 347 mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming); 356 strcpy(incoming, 357 call_program_and_get_last_line_of_output(command)); 348 strcpy(incoming, call_program_and_get_last_line_of_output(command)); 358 349 mr_free(command); 359 350 } … … 361 352 { 362 353 mr_asprintf(command, "dirname %s 2> /dev/null", incoming); 363 strcpy(incoming, 364 call_program_and_get_last_line_of_output(command)); 354 strcpy(incoming, call_program_and_get_last_line_of_output(command)); 365 355 mr_free(command); 366 356 } … … 453 443 if (i < 0) { 454 444 mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%'); 455 strcpy(lastline, 456 call_program_and_get_last_line_of_output(command)); 445 strcpy(lastline, call_program_and_get_last_line_of_output(command)); 457 446 mr_free(command); 458 447 if (!lastline[0]) { … … 495 484 static char output[MAX_STR_LEN]; 496 485 char *command = NULL; 497 char *tmp = NULL;498 486 499 487 /*@ pointers **************************************************** */ … … 503 491 504 492 if (!does_file_exist(filename)) { 505 mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename); 506 log_it(tmp); 507 mr_free(tmp); 493 log_it("Tring to get last line of nonexistent file (%s)", filename); 508 494 output[0] = '\0'; 509 495 return (output); … … 618 604 /* printf("%0d%% done \r",percentage); */ 619 605 } else { 620 time_remaining = 621 time_taken * 100 / (long) (percentage) - time_taken; 622 mr_asprintf(tmp, "%02d%% done %02d:%02d taken %02d:%02d remaining %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname); 623 log_to_screen(tmp); 624 mr_free(tmp); 606 time_remaining = time_taken * 100 / (long) (percentage) - time_taken; 607 log_to_screen("%02d%% done %02d:%02d taken %02d:%02d remaining %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname); 625 608 } 626 609 sync(); … … 820 803 log_msg(4, "%s --> %ld K", fname, file_len_K); 821 804 } 822 mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 823 log_msg(4, comment); 824 mr_free(comment); 805 log_msg(4, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 825 806 if (feof(fin)) { 826 807 break; … … 920 901 /*@ buffers *** */ 921 902 char *command = NULL; 922 char *errorstr = NULL;923 903 int res = 0; 924 904 … … 928 908 929 909 if (res) { 930 mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname); 931 log_to_screen(errorstr); 932 mr_free(errorstr); 910 log_to_screen("Please install '%s'. I cannot find it on your system.", fname); 933 911 log_to_screen("There may be hyperlink at http://www.mondorescue.com which"); 934 912 log_to_screen("will take you to the relevant (missing) package."); … … 1031 1009 char *command = NULL; 1032 1010 char tmp[MAX_STR_LEN]; 1033 char old_pwd[MAX_STR_LEN];1034 1011 int res = 0; 1035 1012 … … 1124 1101 p = strchr(tmp, ':'); 1125 1102 if (!p) { 1126 fatal_error 1127 ("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs"); 1103 fatal_error("NFS mount doesn't have a colon in it, e.g. 192.168.1.4:/home/nfs"); 1128 1104 } 1129 1105 *(p++) = '\0'; … … 1229 1205 1230 1206 1231 1232 1233 1234 1235 1207 /** 1236 1208 * Determine the approximate number of media that the backup will take up,
Note:
See TracChangeset
for help on using the changeset viewer.