summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-09 18:26:14 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-09 18:26:14 -0800
commit1293789eca465dfec7c5874b65cafb70c4f90125 (patch)
tree8bdee06af2d76c42cf9679e54a4c12891c9e755f
parent543f75af78446d6456fab89233ae1ab8eaf4c223 (diff)
Print which argument was unknown before giving usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xditview.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/xditview.c b/xditview.c
index 675706b..483a587 100644
--- a/xditview.c
+++ b/xditview.c
@@ -170,8 +170,16 @@ main(int argc, char **argv)
toplevel = XtAppInitialize(&xtcontext, "Xditview",
options, XtNumber(options),
&argc, argv, NULL, NULL, 0);
- if (argc > 2)
+ if (argc > 2) {
+ fputs("Unknown argument(s):", stderr);
+ for (int n = 1; n < argc; n++) {
+ if ((n < (argc -1)) || (argv[n][0] == '-')) {
+ fprintf(stderr, " %s", argv[n]);
+ }
+ }
+ fputs("\n\n", stderr);
Syntax(argv[0]);
+ }
XtAppAddActions(xtcontext, xditview_actions, XtNumber(xditview_actions));
XtOverrideTranslations