summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-20 23:00:33 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-02 22:16:08 -0700
commit41692eb416df3bff1e5a10b8c71058248c5d9308 (patch)
tree234f1056800fe4dbddcb750adc137e2e63f86445
parent519488decdfe224c79e7f2f18e36d2ecae2166a2 (diff)
downloadxscope-41692eb416df3bff1e5a10b8c71058248c5d9308.tar.gz
Add -I command line flag to enter interactive mode at startup
Avoids having to try to time a ^C after the signal handler is set up but before any data is handled. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--man/xscope.man9
-rw-r--r--scope.c5
2 files changed, 12 insertions, 2 deletions
diff --git a/man/xscope.man b/man/xscope.man
index f6ae899..d97790a 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] [\fB-S\fP\fI<n>\fP] [\fB-t\fP]
+[\fB-D\fP\fI<debug-level>\fP] [-I] [\fB-S\fP\fI<n>\fP] [\fB-t\fP]
.SH DESCRIPTION
.I Xscope
sits in-between an X11 client and an X11 server and prints the contents
@@ -81,6 +81,10 @@ Print only raw data without decoding it.
Print debugging information at the specified level.
.PP
.TP 10
+.BI -I
+Enter interactive mode at startup.
+.PP
+.TP 10
.BI -S <n>
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.
@@ -91,7 +95,8 @@ Terminate \fIxscope\fP when all clients close.
.SH INTERACTIVE MODE
.PP
When \fBxscope\fP receives an interrupt signal (normally generated by
-Control-C) it enters an interactive mode in which it prompts for commands.
+Control-C) or is started with the -I flag, it enters an interactive mode
+in which it prompts for commands.
Available commands in this mode are:
.TP 10
.B audio, a
diff --git a/scope.c b/scope.c
index 96f0464..89049aa 100644
--- a/scope.c
+++ b/scope.c
@@ -666,6 +666,7 @@ Usage(void)
" [-a<n>] -- audio verbose output\n"
" [-q] -- quiet output\n"
" [-D<debug-level>]\n"
+ " [-I] -- start in interactive mode\n"
" [-S<n>] -- start/stop on SIGUSR1\n"
" [-t] -- terminate when all clients close\n");
exit(1);
@@ -715,6 +716,10 @@ ScanArgs(int argc, char **argv)
debug(1, (stderr, "debuglevel = %d\n", debuglevel));
break;
+ case 'I':
+ Interrupt = 1;
+ break;
+
case 'S':
HandleSIGUSR1 = 1;
ScopeEnabled = atoi(++*argv);