diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-02-11 17:16:16 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-02-11 17:16:16 -0800 |
commit | 849b0d42f4cc0e54c56778626effe1e9f1ef238e (patch) | |
tree | 89cb371c86d3dcf3d1437b80e016c6a2a5ba0ea2 | |
parent | fca58c426ef4eef0c000bfa2758e82e1d1b170e2 (diff) |
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xset.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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) { |