From 22f94a0a1616c9061c3282eded4ca7d9179cd0a5 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Wed, 7 Nov 2001 19:15:19 +0000 Subject: [PATCH] o When "-n" is used with watch, it disables the use of to change terminals being watched. This change makes watch pass the through to the terminal if it's not being intercepted-- previously, the keypress would simply be dropped. --- usr.sbin/watch/watch.8 | 4 +++- usr.sbin/watch/watch.c | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/usr.sbin/watch/watch.8 b/usr.sbin/watch/watch.8 index e01257ae9fe2..56b7343bf802 100644 --- a/usr.sbin/watch/watch.8 +++ b/usr.sbin/watch/watch.8 @@ -54,6 +54,7 @@ would be displayed, .Nm will exit. The reconnect flags are unaffected by this option. +When this flag is used, is passed through to the terminal. .It Fl W Allow write access to observed tty. .It Ar tty @@ -72,7 +73,8 @@ Exit .It Sy "" Clear screen. .It Sy "" -Change attached tty. +Change attached tty, unless this feature is disabled, in which case +control-X is passed to the terminal as with other control characters. .El .Sh RESTRICTIONS Only the superuser can run diff --git a/usr.sbin/watch/watch.c b/usr.sbin/watch/watch.c index 710adbfc209b..4d1c38d974db 100644 --- a/usr.sbin/watch/watch.c +++ b/usr.sbin/watch/watch.c @@ -371,12 +371,12 @@ main(ac, av) clear(); break; case CHR_SWITCH: - if (opt_no_switch) + if (!opt_no_switch) { + detach_snp(); + ask_dev(dev_name, MSG_CHANGE); + set_dev(dev_name); break; - detach_snp(); - ask_dev(dev_name, MSG_CHANGE); - set_dev(dev_name); - break; + } default: if (opt_write) { rv = write(snp_io, chb, nread);