summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-11 10:40:16 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-11 10:40:16 -0800
commit9079fc7a7138aaaae6a4bc99e97c8eb073875a93 (patch)
tree37826e5ea9029974326c44b44192af4daeea380f
parenta70254dac5e63fbe4f8aa89433189a613a509e1f (diff)
Print which argument(s) was unknown before giving usage message
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xfd.c10
1 files changed, 9 insertions, 1 deletions
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 ("<Message>WM_PROTOCOLS: Quit()"));