Changeset 2296 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-files.c
- Timestamp:
- Jul 23, 2009, 2:53:30 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-files.c
r2289 r2296 71 71 mr_free(command); 72 72 } else { 73 mr_asprintf(&tmp, "File '%s' not found; cannot calc checksum", 74 filename); 73 mr_asprintf(&tmp, "File '%s' not found; cannot calc checksum", filename); 75 74 log_it(tmp); 76 75 mr_free(tmp); … … 143 142 assert_string_is_neither_NULL_nor_zerolength(filename); 144 143 if (!does_file_exist(filename)) { 145 mr_asprintf(&tmp, 146 "%s does not exist, so I cannot found the number of lines in it", 147 filename); 144 mr_asprintf(&tmp, "%s does not exist, so I cannot found the number of lines in it", filename); 148 145 log_it(tmp); 149 146 mr_free(tmp); … … 358 355 return (NULL); // forget it :) 359 356 } 360 mr_asprintf(&command, 361 "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", 362 incoming); 357 mr_asprintf(&command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming); 363 358 strcpy(incoming, 364 359 call_program_and_get_last_line_of_output(command)); … … 459 454 && !strstr(err_log_lines[i], "% done"); i--); 460 455 if (i < 0) { 461 mr_asprintf(&command, 462 "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", 463 filename, '%'); 456 mr_asprintf(&command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%'); 464 457 strcpy(lastline, 465 458 call_program_and_get_last_line_of_output(command)); … … 512 505 513 506 if (!does_file_exist(filename)) { 514 mr_asprintf(&tmp, "Tring to get last line of nonexistent file (%s)", 515 filename); 507 mr_asprintf(&tmp, "Tring to get last line of nonexistent file (%s)", filename); 516 508 log_it(tmp); 517 509 mr_free(tmp); … … 630 622 time_remaining = 631 623 time_taken * 100 / (long) (percentage) - time_taken; 632 mr_asprintf(&tmp, 633 "%02d%% done %02d:%02d taken %02d:%02d remaining %-37s\r", 634 percentage, (int) (time_taken / 60), 635 (int) (time_taken % 60), 636 (int) (time_remaining / 60), 637 (int) (time_remaining % 60), curr_fname); 624 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); 638 625 log_to_screen(tmp); 639 626 mr_free(tmp); … … 758 745 759 746 mr_asprintf(&mountlist, "%s/mountlist.txt", tmpdir); 760 mr_asprintf(&command, 761 "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", 762 dev, tmpdir); 747 mr_asprintf(&command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir); 763 748 mr_free(mountlist); 764 749 … … 837 822 log_msg(4, "%s --> %ld K", fname, file_len_K); 838 823 } 839 mr_asprintf(&comment, 840 "After adding %s, scratchL+%ld now equals %ld", fname, 841 file_len_K, scratchL); 824 mr_asprintf(&comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL); 842 825 log_msg(4, comment); 843 826 mr_free(comment); … … 1060 1043 find_and_store_mondoarchives_home(g_mondo_home); 1061 1044 } 1062 mr_asprintf(&command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, 1063 bkpinfo->scratchdir); 1045 mr_asprintf(&command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir); 1064 1046 1065 1047 log_msg(4, "command = %s", command); … … 1071 1053 } 1072 1054 1073 mr_asprintf(&command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, 1074 bkpinfo->scratchdir); 1055 mr_asprintf(&command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir); 1075 1056 res = run_program_and_log_output(command, FALSE); 1076 1057 mr_free(command); … … 1099 1080 1100 1081 if (bkpinfo->postnuke_tarball[0]) { 1101 mr_asprintf(&command, "cp -f %s %s/post-nuke.tgz", 1102 bkpinfo->postnuke_tarball, bkpinfo->tmpdir); 1082 mr_asprintf(&command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir); 1103 1083 res = run_program_and_log_output(command, FALSE); 1104 1084 mr_free(command); … … 1150 1130 } 1151 1131 *(p++) = '\0'; 1152 mr_asprintf(&nfs_server_ipaddr, tmp);1153 mr_asprintf(&nfs_mount, p);1132 mr_asprintf(&nfs_server_ipaddr, "%s", tmp); 1133 mr_asprintf(&nfs_mount, "%s", p); 1154 1134 mr_free(tmp); 1155 1135 1156 1136 /* BERLIOS : there is a bug #67 here as it only considers the first NIC */ 1157 mr_asprintf(&command, 1158 "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1137 mr_asprintf(&command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1"); 1159 1138 mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1160 1139 mr_free(command); 1161 1140 1162 mr_asprintf(&command, 1163 "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2"); 1141 mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2"); 1164 1142 mr_asprintf(&nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command)); 1165 1143 mr_free(command); 1166 1144 1167 mr_asprintf(&command, 1168 "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1145 mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2"); 1169 1146 mr_asprintf(&nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command)); 1170 1147 mr_free(command); 1171 1148 1172 mr_asprintf(&command, 1173 "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2"); 1149 mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2"); 1174 1150 mr_asprintf(&nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command)); 1175 1151 mr_free(command); 1176 1152 1177 mr_asprintf(&command, 1178 "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'"); 1153 mr_asprintf(&command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'"); 1179 1154 mr_asprintf(&nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command)); 1180 1155 mr_free(command); … … 1195 1170 if (!strncmp(nfs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) { 1196 1171 log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", nfs_dev); 1197 mr_asprintf(&command, 1198 "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev); 1172 mr_asprintf(&command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev); 1199 1173 mr_asprintf(&mac_addr, "%s", call_program_and_get_last_line_of_output(command)); 1200 1174 mr_free(command); … … 1204 1178 mr_free(nfs_dev); 1205 1179 1206 mr_asprintf(&nfs_dev, call_program_and_get_last_line_of_output(command));1180 mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command)); 1207 1181 mr_free(command); 1208 1182 … … 1313 1287 mr_free(mds); 1314 1288 } else if (scratchLL > 4) { 1315 mr_asprintf(&tmp, 1316 "Your backup will occupy one meeeeellion media! (maybe %s)", 1317 number_to_text((int) (scratchLL + 1))); 1289 mr_asprintf(&tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1))); 1318 1290 } else { 1319 mr_asprintf(&tmp, "Your backup will occupy approximately %s media.", 1320 number_to_text((int) (scratchLL + 1))); 1291 mr_asprintf(&tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1))); 1321 1292 } 1322 1293 if (!bkpinfo->image_devs[0] && (scratchLL < 50)) {
Note:
See TracChangeset
for help on using the changeset viewer.