summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-08 16:27:13 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-08 16:27:13 -0800
commite43205f548795c2cab5c1f92ca839b72d25f2a10 (patch)
treec261cea5a52e774e86667641fd343a656e0e1630
parenta2ca36a770cac1684dc5e39d9b777b1b02c69114 (diff)
Print which argument was unknown before giving usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--oclock.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/oclock.c b/oclock.c
index 24098a9..b9273ba 100644
--- a/oclock.c
+++ b/oclock.c
@@ -110,7 +110,14 @@ main(int argc, char *argv[])
toplevel = XtOpenApplication(&xtcontext, "Clock",
options, XtNumber(options), &argc, argv, NULL,
sessionShellWidgetClass, NULL, 0);
- if (argc != 1) usage();
+ if (argc != 1) {
+ fputs("Unknown argument(s):", stderr);
+ for (int n = 1; n < argc; n++) {
+ fprintf(stderr, " %s", argv[n]);
+ }
+ fputs("\n\n", stderr);
+ usage();
+ }
XtAddCallback(toplevel, XtNsaveCallback, save, NULL);
XtAddCallback(toplevel, XtNdieCallback, die, NULL);