V7/usr/man/man3/ttyname.3
.TH TTYNAME 3
.SH NAME
ttyname, isatty, ttyslot \- find name of a terminal
.SH SYNOPSIS
.B char *ttyname(fildes)
.PP
.B isatty(fildes)
.PP
.B ttyslot()
.SH DESCRIPTION
.I Ttyname
returns a pointer to the null-terminated path name
of the terminal device associated with file descriptor
.IR fildes .
.PP
.I Isatty
returns 1 if
.I fildes
is associated with a terminal device, 0 otherwise.
.PP
.I Ttyslot
returns the number of the entry in the
.IR ttys (5)
file for the control terminal of the
current process.
.SH FILES
/dev/*
.br
/etc/ttys
.SH SEE ALSO
ioctl(2), ttys(5)
.SH DIAGNOSTICS
.I Ttyname
returns a null pointer (0) if
.I fildes
does not describe a terminal device in directory `/dev'.
.PP
.I Ttyslot
returns 0 if `/etc/ttys' is inaccessible or if
it cannot determine the control terminal.
.SH BUGS
The return value points to static data
whose content is overwritten by each call.