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
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 For an explanation of the terms used in this section, see
29 attributes(7).
30
31 ┌──────────┬───────────────┬─────────┐
32 │Interface │ Attribute │ Value │
33 ├──────────┼───────────────┼─────────┤
34 │ctermid() │ Thread safety │ MT-Safe │
35 └──────────┴───────────────┴─────────┘
37 POSIX.1-2001, POSIX.1-2008, Svr4.
38
40 The returned pathname may not uniquely identify the controlling termi‐
41 nal; it may, for example, be /dev/tty.
42
43 It is not assured that the program can open the terminal.
44
46 ttyname(3)
47
49 This page is part of release 5.07 of the Linux man-pages project. A
50 description of the project, information about reporting bugs, and the
51 latest version of this page, can be found at
52 https://www.kernel.org/doc/man-pages/.
53
54
55
56GNU 2019-03-06 CTERMID(3)