summaryrefslogtreecommitdiff
path: root/usr.bin/biff
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2002-07-24 15:48:17 +0000
committerRobert Drehmel <robert@FreeBSD.org>2002-07-24 15:48:17 +0000
commitadf721d1cb2c49e20e79d43e8d1339d8348661df (patch)
treef985be600741d9d74fa586f70396b6a23b183f96 /usr.bin/biff
parenteeb92518843ae67bfa76889db0cee7cfbd03cd82 (diff)
downloadsrc-test-adf721d1cb2c49e20e79d43e8d1339d8348661df.tar.gz
src-test-adf721d1cb2c49e20e79d43e8d1339d8348661df.zip
Allow selection of the affected terminal using redirection
of standard input or standard output, like mesg(1) does. Suggested by: sheldonh
Notes
Notes: svn path=/head/; revision=100614
Diffstat (limited to 'usr.bin/biff')
-rw-r--r--usr.bin/biff/biff.17
-rw-r--r--usr.bin/biff/biff.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/biff/biff.1 b/usr.bin/biff/biff.1
index 49d711d668df4..4a5ca9c300160 100644
--- a/usr.bin/biff/biff.1
+++ b/usr.bin/biff/biff.1
@@ -47,6 +47,13 @@ The
utility informs the system whether you want to be notified when mail arrives
during the current terminal session.
.Pp
+Affected is the first terminal associated with the standard input,
+standard output or standard error file descriptor, in that order.
+Thus, it is possible to use the redirection facilities of a shell to
+toggle the notification for other terminals than the one
+.Nm
+runs on.
+.Pp
The following options are available:
.Bl -tag -width indent
.It Cm n
diff --git a/usr.bin/biff/biff.c b/usr.bin/biff/biff.c
index 938914c58c13e..acfd10bda067a 100644
--- a/usr.bin/biff/biff.c
+++ b/usr.bin/biff/biff.c
@@ -74,7 +74,9 @@ main(argc, argv)
argc -= optind;
argv += optind;
- if ((name = ttyname(STDERR_FILENO)) == NULL)
+ if ((name = ttyname(STDIN_FILENO)) == NULL &&
+ (name = ttyname(STDOUT_FILENO)) == NULL &&
+ (name = ttyname(STDERR_FILENO)) == NULL)
err(2, "unknown tty");
if (stat(name, &sb))