summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xstdcmap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xstdcmap.c b/xstdcmap.c
index 03b6e67..c440a8b 100644
--- a/xstdcmap.c
+++ b/xstdcmap.c
@@ -341,6 +341,22 @@ main(int argc, char *argv[])
else
program_name = *argv;
+ /* Handle args that don't require opening a display or initializing Xrm */
+ for (int n = 1; n < argc; n++) {
+ const char *argn = argv[n];
+ /* 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);
+ }
+ }
+
parse(argc, argv);
if (help) {