From f30ef4e0f3e464f6304bdc85d28ebec0c2ba5e4f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 10 Feb 2023 11:51:01 -0800 Subject: Print which argument was unknown before giving usage message Signed-off-by: Alan Coopersmith --- xeyes.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3