TTYNAME(3,L) AIX Technical Reference TTYNAME(3,L)
-------------------------------------------------------------------------------
ttyname, isatty, fullttyname
PURPOSE
Gets the name of a terminal.
LIBRARY
Standard C Library (libc.a)
SYNTAX
char *ttyname (fildes) char *fullttyname (fildes)
int fildes; int fildes;
int isatty (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.
If the Transparent Computing Facility is installed, the path name returned by
ttyname includes the name of the <LOCAL> file system of the cluster site where
the terminal is attached, if that site is not where ttyname is executing. For
example, if the program calling ttyname is on site prod and the terminal is on
site manu, the path name returned is /manu/dev/tty02. A NULL pointer is
returned if the file descriptor does not describe a terminal device in the
directory <LOCAL>/dev on any active cluster site.
The fullttyname subroutine is like ttyname, but the path name returned always
includes the name of the <LOCAL> file system of the cluster site where the
terminal is attached.
The isatty subroutine determines if the device associated with the file
descriptor specified by the fildes parameter 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.
Processed November 7, 1990 TTYNAME(3,L) 1
TTYNAME(3,L) AIX Technical Reference TTYNAME(3,L)
The return value of ttyname points to static data whose contents are
overwritten by each call.
FILE
/dev/*
ERROR CONDITIONS
The ttyname and isatty subroutines fail if one or more of the following are
true:
EBADF The fildes argument is not a valid file descriptor.
ENOTTY The fildes argument does not refer to a terminal device.
Processed November 7, 1990 TTYNAME(3,L) 2