summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xbiff.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/xbiff.c b/xbiff.c
index e833a2e..6e06b64 100644
--- a/xbiff.c
+++ b/xbiff.c
@@ -99,12 +99,21 @@ main (int argc, char **argv)
XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
+ /* 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 */
+ if (argn[0] == '-' && argn[1] == '-') {
+ argn++;
+ }
+ if (strcmp(argn, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
+ }
+
toplevel = XtAppInitialize(&xtcontext, "XBiff", options, XtNumber (options),
&argc, argv, NULL, NULL, 0);
- if (argc == 2 && strcmp(argv[1], "-version") == 0) {
- puts(PACKAGE_STRING);
- exit(0);
- }
if (argc != 1) Usage ();
/*