From 41692eb416df3bff1e5a10b8c71058248c5d9308 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 20 Jul 2012 23:00:33 -0700 Subject: 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 --- man/xscope.man | 9 +++++++-- scope.c | 5 +++++ 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\fP] [\fB-o\fP\fI\fP] [\fB-h\fP\fI\fP] [\fB-d\fP\fI\fP] [\fB-q\fP] [\fB-v\fP\fI\fP] [\fB-r\fP] -[\fB-D\fP\fI\fP] [\fB-S\fP\fI\fP] [\fB-t\fP] +[\fB-D\fP\fI\fP] [-I] [\fB-S\fP\fI\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 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] -- audio verbose output\n" " [-q] -- quiet output\n" " [-D]\n" + " [-I] -- start in interactive mode\n" " [-S] -- 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); -- cgit v1.2.1