aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-12-23 18:44:41 -0500
committerB. Watson <urchlay@slackware.uk>2024-12-23 18:44:41 -0500
commit120a83ea1daa575182044add2f0044832cb97570 (patch)
tree4b826263f870f32155c312b77c1eead8bc83d0a4
parent5fe25b7592fca2fd1db907d5db953f39ab86ff21 (diff)
downloaduxd-120a83ea1daa575182044add2f0044832cb97570.tar.gz
better error message for multiple filenames or args after filename
-rw-r--r--uxd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/uxd.c b/uxd.c
index 9926386..316cb19 100644
--- a/uxd.c
+++ b/uxd.c
@@ -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]);
}