diff options
author | Roland Lutz <rlutz@hedmen.org> | 2017-06-07 19:41:35 +0200 |
---|---|---|
committer | Roland Lutz <rlutz@hedmen.org> | 2017-06-19 20:37:44 +0200 |
commit | 86af65cc32f2902e1f8b3bb5d8f2ce0412a94217 (patch) | |
tree | e923cd372d2360427948d1c3d9d5dafae1492866 | |
parent | 90381332e2063618431fa42cf5028870c5453cb4 (diff) | |
download | icestorm-86af65cc32f2902e1f8b3bb5d8f2ce0412a94217.tar.gz icestorm-86af65cc32f2902e1f8b3bb5d8f2ce0412a94217.tar.bz2 icestorm-86af65cc32f2902e1f8b3bb5d8f2ce0412a94217.zip |
iceprog: Check for non-applicable options
-rw-r--r-- | iceprog/iceprog.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c index 7886811..31b7a2f 100644 --- a/iceprog/iceprog.c +++ b/iceprog/iceprog.c @@ -433,7 +433,25 @@ int main(int argc, char **argv) errx(EXIT_FAILURE, "options `-b' and `-n' are mutually exclusive"); + if (bulk_erase && (read_mode || check_mode || prog_sram || test_mode)) + errx(EXIT_FAILURE, + "option `-b' only valid in programming mode"); + if (dont_erase && (read_mode || check_mode || prog_sram || test_mode)) + errx(EXIT_FAILURE, + "option `-n' only valid in programming mode"); + + if (rw_offset != 0 && prog_sram) + errx(EXIT_FAILURE, "option `-o' not supported in SRAM mode"); + if (rw_offset != 0 && test_mode) + errx(EXIT_FAILURE, "option `-o' not supported in test mode"); + if (optind + 1 == argc) { + if (test_mode) { + warnx("test mode doesn't take a file name"); + fprintf(stderr, "Try `%s --help' " + "for more information.\n", argv[0]); + return EXIT_FAILURE; + } filename = argv[optind]; } else if (optind != argc) { warnx("too many arguments"); |