ttyname(3)ttyname(3)Name
ttyname, isatty, ttyslot - find terminal name
Syntax
char *ttyname(filedes)isatty(filedes)ttyslot()Description
The subroutine returns a pointer to the null-terminated path name of
the terminal device associated with file descriptor filedes (this is a
system file descriptor and has nothing to do with the standard I/O FILE
typedef).
The subroutine returns 1 if filedes is associated with a terminal
device, 0 otherwise.
The subroutine returns the number of the entry in the file for the con‐
trol terminal of the current process.
Restrictions
The return value points to static data whose content is overwritten by
each call.
Diagnostics
The subroutine returns a null pointer (0) if filedes does not describe
a terminal device in directory
The subroutine returns 0 if is inaccessible or if it cannot determine
the control terminal.
Files
/dev/∗
/etc/ttys
See Alsoioctl(2), ttys(5)ttyname(3)