[PATCH:xscope] Add -V option to print version and exit

Alan Coopersmith alan.coopersmith at oracle.com
Fri Oct 19 22:29:52 PDT 2012


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 man/xscope.man |    6 +++++-
 scope.c        |    5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/man/xscope.man b/man/xscope.man
index f90a2f2..0c1e177 100644
--- a/man/xscope.man
+++ b/man/xscope.man
@@ -6,7 +6,7 @@ xscope - X Window Protocol Viewer
 [\fB-i\fP\fI<in-port>\fP] [\fB-o\fP\fI<out-port>\fP]
 [\fB-h\fP\fI<server-host>\fP] [\fB-d\fP\fI<display-number>\fP]
 [\fB-q\fP] [\fB-v\fP\fI<n>\fP] [\fB-r\fP]
-[\fB-D\fP\fI<debug-level>\fP] [-I] [\fB-S\fP\fI<n>\fP] [\fB-t\fP]
+[\fB-D\fP\fI<debug-level>\fP] [\fB-I\fP] [\fB-S\fP\fI<n>\fP] [\fB-V\fP] [\fB-t\fP]
 .SH DESCRIPTION
 .I Xscope
 sits in-between an X11 client and an X11 server and prints the contents
@@ -95,6 +95,10 @@ Toggle output on or off when SIGUSR1 is received.  If \fIn\fP is 0,
 the initial state is off.  If \fIn\fP is 1, the initial state is on.
 .PP
 .TP 10
+.BI -V
+Print version information and exit.
+.PP
+.TP 10
 .B -t
 Terminate \fIxscope\fP when all clients close.
 .SH INTERACTIVE MODE
diff --git a/scope.c b/scope.c
index d3aa86f..1919569 100644
--- a/scope.c
+++ b/scope.c
@@ -670,6 +670,7 @@ Usage(void)
             "              [-D<debug-level>]\n"
             "              [-I]  -- start in interactive mode\n"
             "              [-S<n>] -- start/stop on SIGUSR1\n"
+            "              [-V]  -- output version information and exit\n"
             "              [-t]  -- terminate when all clients close\n");
     exit(1);
 }
@@ -727,6 +728,10 @@ ScanArgs(int argc, char **argv)
                 ScopeEnabled = atoi(++*argv);
                 break;
 
+            case 'V':          /* print version & exit */
+                printf("%s\n", PACKAGE_STRING);
+                exit(0);
+
             case 'q':          /* quiet mode */
                 XVerbose = 0;
                 debug(1, (stderr, "Verbose = %d\n", XVerbose));
-- 
1.7.9.2



More information about the xorg-devel mailing list