summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-11 17:16:16 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-11 17:16:16 -0800
commit849b0d42f4cc0e54c56778626effe1e9f1ef238e (patch)
tree89cb371c86d3dcf3d1437b80e016c6a2a5ba0ea2
parentfca58c426ef4eef0c000bfa2758e82e1d1b170e2 (diff)
Add -help optionHEADmaster
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xset.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/xset.c b/xset.c
index 9c0cf26..36d4b7a 100644
--- a/xset.c
+++ b/xset.c
@@ -168,11 +168,21 @@ main(int argc, char *argv[])
if (++i >= argc)
usage("missing argument to -display");
disp = argv[i];
- } else if (strcmp(arg, "-version") == 0) {
- puts(PACKAGE_STRING);
- exit(EXIT_SUCCESS);
} else {
- hasargs = True;
+ /* accept single or double dash for -help & -version */
+ if (arg[0] == '-' && arg[1] == '-') {
+ arg++;
+ }
+
+ if (strcmp(arg, "-help") == 0) {
+ usage(NULL);
+ }
+ else if (strcmp(arg, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(EXIT_SUCCESS);
+ }
+ else
+ hasargs = True;
}
}
if (!hasargs) {