summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-10 11:51:01 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-10 11:53:18 -0800
commitf30ef4e0f3e464f6304bdc85d28ebec0c2ba5e4f (patch)
tree0176d3a67ef3897012a165b6abbdebd39f0596c3
parente7a54da926969631340942c5f850dd196a0df97b (diff)
Print which argument was unknown before giving usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xeyes.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xeyes.c b/xeyes.c
index a13f0d5..c5484a0 100644
--- a/xeyes.c
+++ b/xeyes.c
@@ -131,8 +131,17 @@ main(int argc, char **argv)
toplevel = XtAppInitialize(&app_context, "XEyes",
options, XtNumber(options), &argc, argv,
NULL, arg, (Cardinal) 0);
- if (argc != 1)
+
+ if (argc != 1) {
+ 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);
usage(1);
+ }
wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
False);