ctermid(3S) ctermid(3S)NAME ctermid - generate filename for terminal SYNOPSIS #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, the contents of which are overwritten at the next call to ctermid, and the address of which is returned. Otherwise, s is assumed to point to a character array of at least l_ctermid elements; the pathname is placed in this ar- ray 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 must be handed a file descriptor and returns the ac- tual name of the terminal associated with that file descrip- tor, while ctermid returns a string (/dev/tty) that refers to the terminal if used as a filename. For this reason, ttyname is useful only if the process already has at least one file open to a terminal. SEE ALSO ttyname(3C). April, 1990 1