ttyname(3)
Name
ttyname, isatty, ttyslot − find terminal name
Syntax
char *ttyname(filedes)
isatty(filedes)
ttyslot()
Description
The ttyname 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 isatty subroutine returns 1 if filedes is associated with a terminal device, 0 otherwise.
The ttyslot subroutine returns the number of the entry in the ttys() file for the control terminal of the current process.
Restrictions
The return value points to static data whose content is overwritten by each call.
Diagnostics
The ttyname subroutine returns a null pointer (0) if filedes does not describe a terminal device in directory /dev.
The ttyslot subroutine returns 0 if /etc/ttys is inaccessible or if it cannot determine the control terminal.
Files
/dev/∗
/etc/ttys