From 9079fc7a7138aaaae6a4bc99e97c8eb073875a93 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 11 Feb 2023 10:40:16 -0800 Subject: Print which argument(s) was unknown before giving usage message Signed-off-by: Alan Coopersmith --- xfd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xfd.c b/xfd.c index 5eae374..8108d19 100644 --- a/xfd.c +++ b/xfd.c @@ -194,6 +194,15 @@ main(int argc, char *argv[]) xfd_options, XtNumber(xfd_options), &argc, argv, NULL, NULL, 0); + 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 (); + } + #ifdef USE_GETTEXT { const char *domaindir; @@ -214,7 +223,6 @@ main(int argc, char *argv[]) Resources[3].default_addr = gettext(DEF_START_FORMAT); Resources[4].default_addr = gettext(DEF_NOCHAR_FORMAT); - if (argc != 1) usage (); XtAppAddActions (xtcontext, xfd_actions, XtNumber (xfd_actions)); XtOverrideTranslations (toplevel, XtParseTranslationTable ("WM_PROTOCOLS: Quit()")); -- cgit v1.2.3