summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-28 12:21:08 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-01-28 12:21:08 -0800
commitc19461e94f457173b06efa634d9eb540271ea6ae (patch)
tree51202f3d85eec1dd6309de5e75e2d7cae33db066
parent9b8e87a0f7bbe5ae2772f2c8acc66e25880e80bf (diff)
Add -version option
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xconsole.man3
-rw-r--r--xconsole.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/man/xconsole.man b/man/xconsole.man
index 63e795f..07476c0 100644
--- a/man/xconsole.man
+++ b/man/xconsole.man
@@ -72,6 +72,9 @@ lines of message history instead of growing the text buffer without bound
(a
.I count
of zero \- the default \- is treated as placing no limit on the history).
+.TP 8
+.B \-version
+This option indicates that \fIxconsole\fP should print its version and exit.
.SH X DEFAULTS
This program uses the
.I Athena Text
diff --git a/xconsole.c b/xconsole.c
index 3a0020f..f3c2bab 100644
--- a/xconsole.c
+++ b/xconsole.c
@@ -617,6 +617,13 @@ main(int argc, char *argv[])
XtSetLanguageProc(NULL,NULL,NULL);
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);