1CTERMID(3) Linux Programmer's Manual CTERMID(3)
2
3
4
6 ctermid - get controlling terminal name
7
9 #include <stdio.h>
10
11 char *ctermid(char *s);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 ctermid(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
16
18 ctermid() returns a string which is the pathname for the current con‐
19 trolling terminal for this process. If s is NULL, a static buffer is
20 used, otherwise s points to a buffer used to hold the terminal path‐
21 name. The symbolic constant L_ctermid is the maximum number of charac‐
22 ters in the returned pathname.
23
25 The pointer to the pathname.
26
28 Multithreading (see pthreads(7))
29 The ctermid() function is thread-safe with exceptions. It is not
30 thread-safe if called with a NULL parameter.
31
33 Svr4, POSIX.1-2001.
34
36 The path returned may not uniquely identify the controlling terminal;
37 it may, for example, be /dev/tty.
38
39 It is not assured that the program can open the terminal.
40
42 ttyname(3)
43
45 This page is part of release 3.53 of the Linux man-pages project. A
46 description of the project, and information about reporting bugs, can
47 be found at http://www.kernel.org/doc/man-pages/.
48
49
50
51GNU 2013-07-04 CTERMID(3)