summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-19 22:29:41 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-22 20:05:59 -0700
commita248f83ea89f5d4df35fcdc1e07ef147f72c9cf6 (patch)
treef00ee67583d38af1e3974fb93215c62a73c2f843
parent13c3f1338ef1ed233cd3e400a6b6bd5f499be592 (diff)
Add -V option to print version and exit
Can't use -v, as that's already in use for verbosity level Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--man/xscope.man6
-rw-r--r--scope.c5
2 files changed, 10 insertions, 1 deletions
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));