From d4004feaeed42483a6da5927ebbc1890e107355f Mon Sep 17 00:00:00 2001 From: jkh Date: Sat, 16 Dec 1995 10:07:10 +0000 Subject: Map ^C and ^\ (INTR and QUIT) to ^Q so that you can actually send these guys to a watched process. Useful if you're monitoring someone who's started doing something you'd really like them to stop immediately. :) Suggested by: Phillip White --- usr.sbin/watch/watch.8 | 2 +- usr.sbin/watch/watch.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'usr.sbin/watch') diff --git a/usr.sbin/watch/watch.8 b/usr.sbin/watch/watch.8 index 9632c5a1..57d1449 100644 --- a/usr.sbin/watch/watch.8 +++ b/usr.sbin/watch/watch.8 @@ -55,7 +55,7 @@ Names may be preceded by "/dev/". While running in interactive mode, all user input is discarded except for: .Pp .Bl -tag -width "XXXX" -compact -.It Sy "" +.It Sy "" Exit .Nm watch . .It Sy "" diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index 620d7961..20c93cf 100644 --- a/usr.sbin/watch/watch.c +++ b/usr.sbin/watch/watch.c @@ -88,13 +88,19 @@ void set_tty() { struct sgttyb sgn; + struct tchars tc; + ioctl(std_in, TIOCGETP, &sgo); + ioctl(std_in, TIOCGETC, &tc); /* bcopy(&sgn, &sgo, sizeof(struct sgttyb)); */ sgn = sgo; sgn.sg_flags |= CBREAK; sgn.sg_flags &= ~ECHO; ospeed = sgo.sg_ospeed; + tc.t_intrc = 17; /* ^Q */ + tc.t_quitc = 17; /* ^Q */ ioctl(std_in, TIOCSETP, &sgn); + ioctl(std_in, TIOCSETC, &tc); } void -- cgit v1.1