From: Alan Coopersmith Date: Tue, 22 Jan 2013 07:13:03 +0000 (-0800) Subject: Add -version option to print version number X-Git-Tag: xdpyinfo-1.3.1~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b9a3d5459f61abf6285df81e4a75cb472e2a40c;p=platform%2Fupstream%2Fxdpyinfo.git Add -version option to print version number Signed-off-by: Alan Coopersmith --- diff --git a/man/xdpyinfo.man b/man/xdpyinfo.man index 6dfc789..86f2a02 100644 --- a/man/xdpyinfo.man +++ b/man/xdpyinfo.man @@ -30,6 +30,7 @@ xdpyinfo \- display information utility for X [\-display \fIdisplayname\fP] [\-queryExtensions] [\-ext \fIextension-name\fP] +[-version] .SH DESCRIPTION .PP .I Xdpyinfo @@ -49,6 +50,9 @@ Detailed information about a particular extension is displayed with the \fB\-ext\fP \fIextensionName\fP option. If \fIextensionName\fP is \fBall\fP, information about all extensions supported by both \fIxdpyinfo\fP and the server is displayed. +.PP +If \fB-version\fP is specified, xdpyinfo prints its version and exits, without +contacting the X server. .SH ENVIRONMENT .PP .TP 8 diff --git a/xdpyinfo.c b/xdpyinfo.c index 26bb0fb..655d672 100644 --- a/xdpyinfo.c +++ b/xdpyinfo.c @@ -1441,6 +1441,7 @@ usage(void) { fprintf (stderr, "usage: %s [options]\n%s", ProgramName, "-display displayname\tserver to query\n" + "-version\t\tprint program version and exit\n" "-queryExtensions\tprint info returned by XQueryExtension\n" "-ext all\t\tprint detailed info for all supported extensions\n" "-ext extension-name\tprint detailed info for extension-name if one of:\n "); @@ -1470,6 +1471,9 @@ main(int argc, char *argv[]) } else if (!strncmp("-ext", arg, len)) { if (++i >= argc) usage (); mark_extension_for_printing(argv[i]); + } else if (!strncmp("-version", arg, len)) { + printf("%s\n", PACKAGE_STRING); + exit (0); } else usage (); }