The $y macro holds the
name of the controlling terminal device, if there is one. The
controlling terminal is determined by first calling
ttyname(3) with the
sendmail program's standard
error output as an argument. If ttyname(3)
returns the name of a terminal device (such as
/dev/ttypa), sendmail strips
everything up to and including the last /
character and stores the result into $y.
$y is intended for use in debugging
sendmail problems. It is not used internally by
sendmail. In determining whether it can write to
a user's terminal screen,
sendmail calls ttyname(3)
separately on its standard input, output, and error output without
updating $y.
Note that the device name in $y depends on the
implementation of ttyname(3). Under BSD Unix,
all terminals are in /dev, whereas under other
versions of Unix they can be in subdirectories such as
/dev/ttys. Also note that $y
is defined only if TTYNAME is defined (TTYNAME)
when sendmail is compiled.
$y is transient. If it is defined in the
configuration file or the command line, that definition will be
ignored by sendmail. Finally, note that
$y is set only when mail is being sent and,
therefore, is of most value in headers.