Changeset 2338 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-cli.c
- Timestamp:
- Aug 21, 2009, 1:47:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2334 r2338 100 100 bkpinfo->media_size[j] = 650; 101 101 } /* default */ 102 res = 103 retrieve_switches_from_command_line(argc, argv, flag_val, 104 flag_set); 102 res = retrieve_switches_from_command_line(argc, argv, flag_val, flag_set); 105 103 retval += res; 106 104 if (!retval) { … … 807 805 } 808 806 if (bkpinfo->include_paths != NULL) { 807 mr_strip_spaces(bkpinfo->include_paths); 809 808 log_msg(1, "include_paths is now '%s'", bkpinfo->include_paths); 810 809 } 811 810 if (bkpinfo->exclude_paths != NULL) { 811 mr_strip_spaces(bkpinfo->exclude_paths); 812 812 log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths); 813 813 } … … 815 815 } 816 816 817 if (g_kernel_version >= 2.6 && !flag_set['d'] 818 && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) { 819 fatal_error 820 ("If you are using the 2.6.x kernel, please specify the CD-R(W) device."); 817 if (g_kernel_version >= 2.6 && !flag_set['d'] && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) { 818 fatal_error("If you are using the 2.6.x kernel, please specify the CD-R(W) device."); 821 819 } 822 820 … … 825 823 if (flag_set['I']) { 826 824 retval++; 827 log_to_screen 828 ("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)"); 825 log_to_screen("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)"); 829 826 } 830 827 bkpinfo->make_filelist = FALSE; … … 833 830 834 831 if ((flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) { 835 if (!flag_set['r'] && g_kernel_version <= 2.5 836 && strstr(flag_val['d'], "/dev/")) { 837 fatal_error 838 ("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag."); 839 } 840 if (flag_set['r'] && g_kernel_version <= 2.5 841 && !strstr(flag_val['d'], "/dev/")) { 842 fatal_error 843 ("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag."); 832 if (!flag_set['r'] && g_kernel_version <= 2.5 && strstr(flag_val['d'], "/dev/")) { 833 fatal_error("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag."); 834 } 835 if (flag_set['r'] && g_kernel_version <= 2.5 && !strstr(flag_val['d'], "/dev/")) { 836 fatal_error("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag."); 844 837 } 845 838 if (g_kernel_version >= 2.6 && !strstr(flag_val['d'], "/dev/")) { 846 log_to_screen 847 ("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk..."); 848 } 849 850 if (system("which cdrecord > /dev/null 2> /dev/null") 851 && system("which dvdrecord > /dev/null 2> /dev/null")) { 852 fatal_error 853 ("Please install dvdrecord/cdrecord and try again."); 839 log_to_screen("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk..."); 840 } 841 842 if (system("which cdrecord > /dev/null 2> /dev/null") && system("which dvdrecord > /dev/null 2> /dev/null")) { 843 fatal_error("Please install dvdrecord/cdrecord and try again."); 854 844 } 855 845 if (flag_set['C']) { 856 846 bkpinfo->cdrw_speed = atoi(flag_val['C']); 857 847 if (bkpinfo->cdrw_speed < 1) { 858 fatal_error 859 ("You specified a silly speed for a CD-R[W] drive"); 848 fatal_error("You specified a silly speed for a CD-R[W] drive"); 860 849 } 861 850 if (!flag_set['L']) { 862 log_to_screen 863 ("You must use -L with -C. Therefore I am setting it for you."); 851 log_to_screen("You must use -L with -C. Therefore I am setting it for you."); 864 852 flag_set['L'] = 1; 865 853 flag_val['L'][0] = '\0'; … … 868 856 log_msg(3, "flag_val['c'] = %s", flag_val['c']); 869 857 log_msg(3, "flag_val['w'] = %s", flag_val['w']); 870 // log_msg(3, "flag_set['r'] = %i", flag_set['r'] );871 858 if (flag_set['c']) { 872 859 bkpinfo->cdrw_speed = atoi(flag_val['c']); … … 878 865 879 866 if (bkpinfo->cdrw_speed < 1) { 880 fatal_error 881 ("You specified a silly speed for a CD-R[W] drive"); 867 fatal_error("You specified a silly speed for a CD-R[W] drive"); 882 868 } 883 869 } … … 901 887 { 902 888 if (! flag_set['d']) { 903 fatal_error 904 ("You need to specify a device file with -d for bootable USB device usage"); 889 fatal_error("You need to specify a device file with -d for bootable USB device usage"); 905 890 } 906 891 if ((!flag_set['s']) && (! bkpinfo->restore_data)) { … … 912 897 { 913 898 if (flag_set['m']) { 914 fatal_error 915 ("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m."); 899 fatal_error("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m."); 916 900 } 917 901 if (!flag_set['d']) { … … 957 941 if (flag_set['s']) { 958 942 if (flag_set['t']) { 959 fatal_error 960 ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 943 fatal_error("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 961 944 } 962 945 if (process_the_s_switch(flag_val['s'])) { … … 1175 1158 log_msg(1, "Internal tape block size is now %ld bytes", itbs); 1176 1159 if (itbs % 512 != 0 || itbs < 256 || itbs > 1024L * 1024) { 1177 fatal_error 1178 ("Are you nuts? Silly, your internal tape block size is. Abort, I shall."); 1160 fatal_error("Are you nuts? Silly, your internal tape block size is. Abort, I shall."); 1179 1161 } 1180 1162 bkpinfo->internal_tape_block_size = itbs; … … 1185 1167 // bkpinfo->differential = atoi (flag_val['D']); 1186 1168 if ((bkpinfo->differential < 1) || (bkpinfo->differential > 9)) { 1187 fatal_error 1188 ("The D option should be between 1 and 9 inclusive"); 1169 fatal_error("The D option should be between 1 and 9 inclusive"); 1189 1170 } 1190 1171 } … … 1279 1260 retval++; 1280 1261 log_to_screen("Please specify the backup device/directory.\n"); 1281 fatal_error 1282 ("You didn't use -d to specify the backup device/directory."); 1262 fatal_error("You didn't use -d to specify the backup device/directory."); 1283 1263 } 1284 1264 … … 1365 1345 if (run_program_and_log_output("which lzop", 2)) { 1366 1346 retval++; 1367 log_to_screen 1368 ("Please install LZOP. You can't use '-L' until you do.\n"); 1347 log_to_screen("Please install LZOP. You can't use '-L' until you do.\n"); 1369 1348 } 1370 1349 } … … 1374 1353 if (run_program_and_log_output("which gzip", 2)) { 1375 1354 retval++; 1376 log_to_screen 1377 ("Please install gzip. You can't use '-G' until you do.\n"); 1355 log_to_screen("Please install gzip. You can't use '-G' until you do.\n"); 1356 } 1357 } 1358 1359 if ((flag_set['Y']) && (! bkpinfo->restore_data)) { 1360 bkpinfo->use_lzma = TRUE; 1361 if (run_program_and_log_output("which lzma", 2)) { 1362 retval++; 1363 log_to_screen("Please install lzma. You can't use '-Y' until you do.\n"); 1378 1364 } 1379 1365 } … … 1391 1377 if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) { 1392 1378 bkpinfo->make_cd_use_lilo = TRUE; 1393 log_to_screen 1394 ("Your kernel appears not to support vfat filesystems. I am therefore"); 1395 log_to_screen 1396 ("using LILO instead of SYSLINUX as the media boot loader."); 1379 log_to_screen("Your kernel appears not to support vfat filesystems. I am therefore"); 1380 log_to_screen("using LILO instead of SYSLINUX as the media boot loader."); 1397 1381 } 1398 1382 if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) { 1399 1383 bkpinfo->make_cd_use_lilo = TRUE; 1400 1384 #ifdef __IA32__ 1401 log_to_screen 1402 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as"); 1403 log_to_screen 1404 ("your boot loader. I shall therefore use LILO instead."); 1385 log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as"); 1386 log_to_screen("your boot loader. I shall therefore use LILO instead."); 1405 1387 #endif 1406 1388 #ifdef __IA64__ 1407 log_to_screen 1408 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI"); 1389 log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI"); 1409 1390 log_to_screen("environment correctly. Please install it."); 1410 1391 fatal_error("Aborting"); … … 1426 1407 1427 1408 if ((! bkpinfo->restore_data) && (flag_set['Z'])) { 1428 fatal_error 1429 ("The -Z switch is only valid in restore mode"); 1409 fatal_error("The -Z switch is only valid in restore mode"); 1430 1410 } 1431 1411 … … 1466 1446 * @return The number of problems with the command line (0 for success). 1467 1447 */ 1468 int 1469 retrieve_switches_from_command_line(int argc, char *argv[], 1470 char flag_val[128][MAX_STR_LEN], 1471 bool flag_set[128]) 1448 int retrieve_switches_from_command_line(int argc, char *argv[], char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 1472 1449 { 1473 1450 /*@ ints ** */ … … 1486 1463 flag_set[i] = FALSE; 1487 1464 } 1488 while ((opt = 1489 getopt(argc, argv, MONDO_OPTIONS)) 1490 != -1) { 1465 while ((opt = getopt(argc, argv, MONDO_OPTIONS)) != -1) { 1491 1466 if (opt == '?') { 1492 1467 bad_switches = TRUE;
Note:
See TracChangeset
for help on using the changeset viewer.