ctermid(3) — Subroutines
OSF
NAME
ctermid - Generates the pathname for the controlling terminal
LIBRARY
Standard I/O Package (libc.a)
SYNOPSIS
#include <stdio.h>
char ∗ctermid (
char ∗s );
PARAMETERS
sIf the s parameter is a null pointer, the string is stored in an internal static area and the address is returned. The next call to the ctermid() function overwrites the contents of the internal static area. If the s parameter is not a null pointer, it points to a character array of at least L_ctermid bytes. L_ctermid is defined in the stdio.h header file, and has a value greater than 0 (zero). The pathname is placed in this array and the value of the s parameter is returned.
DESCRIPTION
The ctermid() function generates the pathname of the controlling terminal for the current process and stores it in a string.
The ctermid() function differs from the ttyname() function in that the ttyname() function is supplied a file descriptor and returns the actual name of the terminal associated with that file descriptor, while the ctermid() function returns a string (/dev/tty) that refers to the terminal if used as a filename. Thus, the ttyname() function is useful only if the process already has at least one file open to a terminal.
NOTES
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, the ctermid() function returns the address of the generated pathname. Otherwise, an empty string is returned. Access to a pathname returned by the ctermid() function is not guaranteed.
The ctermid_r() function, the reentrant version of the ctermid() function, always returns null if the argument passed is null.
RELATED INFORMATION
Functions: ttyname(3)