From 2dac23e9f496bd5dc0a82b65d5a5767f36b77fb3 Mon Sep 17 00:00:00 2001 From: jkh Date: Fri, 1 Mar 1996 18:21:41 +0000 Subject: Properly save and restore the terminal characters! --- usr.sbin/watch/watch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.sbin/watch') diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index 20c93cf..a145916 100644 --- a/usr.sbin/watch/watch.c +++ b/usr.sbin/watch/watch.c @@ -57,6 +57,7 @@ int std_in = 0, std_out = 1; int clear_ok = 0; struct sgttyb sgo; +struct tchars tco; char tbuf[1024], buf[1024]; @@ -91,9 +92,9 @@ set_tty() struct tchars tc; ioctl(std_in, TIOCGETP, &sgo); - ioctl(std_in, TIOCGETC, &tc); - /* bcopy(&sgn, &sgo, sizeof(struct sgttyb)); */ + ioctl(std_in, TIOCGETC, &tco); sgn = sgo; + tc = tco; sgn.sg_flags |= CBREAK; sgn.sg_flags &= ~ECHO; ospeed = sgo.sg_ospeed; @@ -107,6 +108,7 @@ void unset_tty() { ioctl(std_in, TIOCSETP, &sgo); + ioctl(std_in, TIOCSETC, &tco); } -- cgit v1.1