From 120a83ea1daa575182044add2f0044832cb97570 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 23 Dec 2024 18:44:41 -0500 Subject: better error message for multiple filenames or args after filename --- uxd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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]); } -- cgit v1.2.3