Allow selection of the affected terminal using redirection
of standard input or standard output, like mesg(1) does. Suggested by: sheldonh
This commit is contained in:
parent
eeb9251884
commit
adf721d1cb
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user