summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:58:54 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-06-03 23:58:54 -0700
commit017b3736489985999d8dcf4d9e473e1fd6dd3647 (patch)
tree3c016e7996e3a00fbfe2df9031bbeaac71005347
parentd41d834d8b2be86eb56802de12c2399c7ff0919f (diff)
Add -version option to print program version
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xwininfo.man8
-rw-r--r--xwininfo.c5
2 files changed, 12 insertions, 1 deletions
diff --git a/man/xwininfo.man b/man/xwininfo.man
index 6da7139..66418c6 100644
--- a/man/xwininfo.man
+++ b/man/xwininfo.man
@@ -32,7 +32,7 @@ xwininfo \- window information utility for X
[\-children] [\-tree] [\-stats] [\-bits] [\-events] [\-size] [\-wm] [\-shape]
[\-frame] [\-all]
[\-english] [\-metric]
-[\-display \fIdisplay\fP]
+[\-display \fIdisplay\fP] [\-version]
.SH DESCRIPTION
.PP
.I Xwininfo
@@ -154,6 +154,12 @@ This option is a quick way to ask for all information possible.
.TP 8
.B \-display \fIdisplay\fP
This option allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP.
+PP
+.TP 8
+.B \-version
+This option indicates that
+.I xwininfo
+should print its version information and exit.
.SH EXAMPLE
.PP
The following is a sample summary taken with no options specified:
diff --git a/xwininfo.c b/xwininfo.c
index 3f80b94..520719b 100644
--- a/xwininfo.c
+++ b/xwininfo.c
@@ -286,6 +286,7 @@ usage (void)
"usage: %s [-options ...]\n\n"
"where options include:\n"
" -help print this message\n"
+ " -version print version message\n"
" -display host:dpy X server to contact\n"
" -root use the root window\n"
" -id windowid use the window with the specified id\n"
@@ -537,6 +538,10 @@ main (int argc, char **argv)
tree = stats = bits = events = wm = size = shape = 1;
continue;
}
+ if (!strcmp(argv[i], "-version")) {
+ puts(PACKAGE_STRING);
+ exit(0);
+ }
fprintf (stderr, "%s: unrecognized argument %s\n\n",
program_name, argv[i]);
usage ();