.TH ttyname() "" "" "General Function (libc)"
.PC "Identify a terminal"
.B "#include <unistd.h>"
\fBchar *ttyname(\fIfd\^\fB)\fR
\fBint \fIfd\^\fB;\fR
.PP
Given a file descriptor
.I fd
attached to a terminal,
.B ttyname()
returns the complete pathname of the special file (normally found in
the directory
.BR /dev ).
.SH Files
\fB/dev/*\fR \(em Terminal special files
.br
\fB/etc/ttys\fR \(em Login terminals
.SH "See Also"
.Xr "ioctl()," ioctl
.Xr "isatty()," isatty
.Xr "libc," libc
.Xr "tty()," tty
.Xr "ttyslot()," ttyslot
.Xr "unistd.h" unistd.h
.br
\*(PX Standard, \(sc4.7.2
.SH Diagnostics
.B ttyname()
returns NULL if it cannot find a special file corresponding to
.IR fd .
.SH Notes
The string returned by
.B ttyname()
is kept in a static area, and is overwritten by each subsequent call.
