CTERMID(3S) DOMAIN/IX SYS5 CTERMID(3S)
NAME
ctermid - generate filename for terminal
USAGE
#include <stdio.h>
char *ctermid(s)
char *s;
DESCRIPTION
Ctermid generates the pathname of the controlling terminal
for the current process, and stores it in a string.
If s is a NULL pointer, the string is stored in an internal
static area, which is overwritten at the next call to cter-
mid. The address of the area is returned to the process.
Otherwise, s points to a character array of at least
L_ctermid elements; the pathname is placed in this array and
the value of s is returned. The constant L_ctermid is
defined in the <stdio.h> header file.
NOTES
The difference between ctermid and ttyname(3C) is that
ttyname takes a file descriptor argument and returns the
actual name of the terminal associated with that file
descriptor, while ctermid returns a string (/dev/tty) that
will refer to the terminal if it is used as a filename.
Thus, ttyname is useful only if the process already has at
least one file open to a terminal.
RELATED INFORMATION
ttyname(3C)
Printed 12/4/86 CTERMID-1