From e43205f548795c2cab5c1f92ca839b72d25f2a10 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 8 Feb 2023 16:27:13 -0800 Subject: Print which argument was unknown before giving usage message Signed-off-by: Alan Coopersmith --- oclock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3