ttyname, isatty
Purpose
Gets the name of a terminal.
Library
Standard C Library (libc.a)
Syntax
char *ttyname (fildes) int isatty (fildes)
int fildes; int fildes;
Description
The ttyname subroutine gets the name of a terminal. It
returns a pointer to a string containing the null-
terminated path name of the terminal device associated
with file descriptor specified by the fildes parameter.
A NULL pointer is returned if the file descriptor does
not describe a terminal device in directory /dev.
The isatty subroutine determines if the device associated
with the file descriptor specified by the fildes param-
eter is a terminal. If the specified file descriptor is
associated with a terminal, the isatty subroutine returns
a value of 1. If the file descriptor is not associated
with a terminal, a value of 0 is returned.
The return value of ttyname points to static data whose
contents are overwritten by each call.
Files
/dev/*