diff options
Diffstat (limited to 'xbiff.c')
-rw-r--r-- | xbiff.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -68,7 +68,8 @@ static XtActionsRec xbiff_actions[] = { { "quit", quit }, }; -static void Usage (void) +static void _X_NORETURN _X_COLD +Usage (int exitval) { const char *help_message = "where options include:\n" @@ -81,11 +82,12 @@ static void Usage (void) " -fg color foreground color\n" " -rv reverse video\n" " -shape shape the window\n" +" -help print usage info and exit\n" " -version print version info and exit\n"; fprintf (stderr, "usage: %s [-options ...]\n", ProgramName); fprintf (stderr, "%s\n", help_message); - exit (1); + exit (exitval); } @@ -102,10 +104,13 @@ main (int argc, char **argv) /* Handle args that don't require opening a display */ for (int n = 1; n < argc; n++) { const char *argn = argv[n]; - /* accept single or double dash for -version */ + /* accept single or double dash for -help & -version */ if (argn[0] == '-' && argn[1] == '-') { argn++; } + if (strcmp(argn, "-help") == 0) { + Usage(0); + } if (strcmp(argn, "-version") == 0) { puts(PACKAGE_STRING); exit(0); @@ -114,7 +119,9 @@ main (int argc, char **argv) toplevel = XtAppInitialize(&xtcontext, "XBiff", options, XtNumber (options), &argc, argv, NULL, NULL, 0); - if (argc != 1) Usage (); + if (argc != 1) { + Usage(1); + } /* * This is a hack so that f.delete will do something useful in this |