diff options
author | B. Watson <urchlay@slackware.uk> | 2024-12-23 18:44:41 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-12-23 18:44:41 -0500 |
commit | 120a83ea1daa575182044add2f0044832cb97570 (patch) | |
tree | 4b826263f870f32155c312b77c1eead8bc83d0a4 | |
parent | 5fe25b7592fca2fd1db907d5db953f39ab86ff21 (diff) | |
download | uxd-120a83ea1daa575182044add2f0044832cb97570.tar.gz |
better error message for multiple filenames or args after filename
-rw-r--r-- | uxd.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -355,7 +355,13 @@ void parse_args(int argc, char **argv) { } else { /* filename (if present) must come after all -options, and there can only be one filename. */ - if(my_optind < (argc - 1)) usage(); + if(my_optind < (argc - 1)) { + if(argv[my_optind + 1][0] == '-') + fprintf(stderr, "%s: filename must come after all options.\n", self); + else + fprintf(stderr, "%s: only one filename allowed.\n", self); + exit(1); + } open_input(argv[my_optind]); } |