TTYNAME(3C) SysV TTYNAME(3C)
NAME
ttyname, ttyname_r, isatty - find name of a terminal
SYNOPSIS
char *ttyname (fildes)
int fildes;
int ttyname_r (fildes, buffer, len)
int fildes;
char *buffer;
int len;
int isatty (fildes)
int fildes;
DESCRIPTION
ttyname returns a pointer to a string containing the null terminated
pathname of the terminal device associated with file descriptor fildes.
isatty returns 1 if fildes is associated with a terminal device, 0
otherwise.
ttyname_r function is the reentrant version of the ttyname function.
FILES
/dev/*
DIAGNOSTICS
ttyname returns a NULL pointer if fildes does not describe a terminal
device in directory /dev.
The ttyname_r function returns 0 (zero) if successful. Otherwise, -1 is
returned.
CAVEAT
The return value points to static data whose content is overwritten by
each call.