ctermid(3S) DG/UX R4.11MU05 ctermid(3S)
NAME
ctermid, ctermidr - generate file name for terminal
SYNOPSIS
#include <stdio.h>
char *ctermid(char *s);
char *ctermidr(char *s);
DESCRIPTION
ctermid and ctermidr generate the path name of the controlling
terminal for the current process, and store it in a string.
If s is a NULL pointer, ctermid stores the string in an internal
static area, the contents of which are overwritten at the next call
to ctermid, and the address of which is returned. If s is a NULL
pointer, ctermidr returns a NULL pointer. Otherwise, both functions
assume s points to a character array of at least Lctermid elements;
the path name is placed in this array and the value of s is returned.
The constant Lctermid is defined in the stdio.h header file.
Considerations for Threads Programming
+----------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+----------+-----------------------------+
|ctermid | N - - |
|ctermidr | Y N N |
+----------+-----------------------------+
REFERENCES
reentrant(3), ttyname(3C).
NOTES
The function ctermidr is only available in the shared library,
libc.so.
The difference between ctermid and ttyname(3C) as well as ctermidr
and ttynamer is that the ttyname functions must be handed a file
descriptor and return the actual name of the terminal associated with
that file descriptor, while ctermid functions return a string
(/dev/tty) that will refer to the terminal if used as a file name.
Thus the ttyname functions are useful only if the process already has
at least one file open to a terminal.
Licensed material--property of copyright holder(s)