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():
16 _POSIX_C_SOURCE
17
19 ctermid() returns a string which is the pathname for the current con‐
20 trolling terminal for this process. If s is NULL, a static buffer is
21 used, otherwise s points to a buffer used to hold the terminal path‐
22 name. The symbolic constant L_ctermid is the maximum number of charac‐
23 ters in the returned pathname.
24
26 The pointer to the pathname.
27
29 For an explanation of the terms used in this section, see at‐
30 tributes(7).
31
32 ┌────────────────────────────────────────────┬───────────────┬─────────┐
33 │Interface │ Attribute │ Value │
34 ├────────────────────────────────────────────┼───────────────┼─────────┤
35 │ctermid() │ Thread safety │ MT-Safe │
36 └────────────────────────────────────────────┴───────────────┴─────────┘
37
39 POSIX.1-2001, POSIX.1-2008, Svr4.
40
42 The returned pathname may not uniquely identify the controlling termi‐
43 nal; it may, for example, be /dev/tty.
44
45 It is not assured that the program can open the terminal.
46
48 ttyname(3)
49
51 This page is part of release 5.12 of the Linux man-pages project. A
52 description of the project, information about reporting bugs, and the
53 latest version of this page, can be found at
54 https://www.kernel.org/doc/man-pages/.
55
56
57
58GNU 2021-03-22 CTERMID(3)