From 017b3736489985999d8dcf4d9e473e1fd6dd3647 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 3 Jun 2014 23:58:54 -0700 Subject: Add -version option to print program version Signed-off-by: Alan Coopersmith --- man/xwininfo.man | 8 +++++++- xwininfo.c | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) 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 (); -- cgit v1.2.3