summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-04 15:10:45 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-02-04 15:10:45 -0800
commitd6c728b4d7c86fb486cd9f18c749f3b61ff8fb63 (patch)
tree6357f51c75db396147e833ecc00aa5b0bc1ec21a
parent73aecaafd3e4b80c57a2549e399b7f0b769bcf5e (diff)
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--main.c17
-rw-r--r--man/xman.man4
2 files changed, 21 insertions, 0 deletions
diff --git a/main.c b/main.c
index 691f4f9..64cf9ed 100644
--- a/main.c
+++ b/main.c
@@ -151,6 +151,23 @@ main(int argc, char **argv)
XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
+ /* Handle args that don't require opening a display */
+ for (int i = 1; i < argc; i++) {
+ const char *arg = argv[i];
+ /* accept single or double dash for -help & -version */
+ if (arg[0] == '-' && arg[1] == '-') {
+ arg++;
+ }
+ if (strcmp(arg, "-help") == 0) {
+ ArgError(0, NULL);
+ exit(0);
+ }
+ if (strcmp(arg, "-version") == 0) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
+ }
+
initial_widget = XtAppInitialize(&app_con, "Xman", xman_options,
XtNumber(xman_options), &argc, argv,
fallback_resources, NULL, ZERO);
diff --git a/man/xman.man b/man/xman.man
index d18e7f0..62baad9 100644
--- a/man/xman.man
+++ b/man/xman.man
@@ -40,6 +40,10 @@ Starts without the Top Menu with the three buttons in it.
Sets the size and location of the Top Menu with the three buttons in it.
.IP "\fB\-pagesize\fP \fIWxH+X+Y\fP"
Sets the size and location of all the Manual Pages.
+.IP "\fB\-help\fP"
+Print a usage message and exit.
+.IP "\fB\-version\fP"
+Print the program version and exit.
.SH "CUSTOMIZING XMAN"
.PP
.I Xman