diff options
-rw-r--r-- | xconsole.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -615,14 +615,22 @@ main(int argc, char *argv[]) Cardinal num_args; XtSetLanguageProc(NULL,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); + } + } + top = XtInitialize ("xconsole", "XConsole", options, XtNumber (options), &argc, argv); - if ((argc == 2) && - ((strcmp(argv[1], "-version") == 0) || - (strcmp(argv[1], "--version") == 0))) { - puts(PACKAGE_STRING); - exit(0); - } XtGetApplicationResources (top, (XtPointer)&app_resources, resources, XtNumber (resources), NULL, 0); |