1ctermid(3) Library Functions Manual ctermid(3)
2
3
4
6 ctermid - get controlling terminal name
7
9 Standard C library (libc, -lc)
10
12 #include <stdio.h>
13
14 char *ctermid(char *s);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 ctermid():
19 _POSIX_C_SOURCE
20
22 ctermid() returns a string which is the pathname for the current con‐
23 trolling terminal for this process. If s is NULL, a static buffer is
24 used, otherwise s points to a buffer used to hold the terminal path‐
25 name. The symbolic constant L_ctermid is the maximum number of charac‐
26 ters in the returned pathname.
27
29 The pointer to the pathname.
30
32 For an explanation of the terms used in this section, see at‐
33 tributes(7).
34
35 ┌────────────────────────────────────────────┬───────────────┬─────────┐
36 │Interface │ Attribute │ Value │
37 ├────────────────────────────────────────────┼───────────────┼─────────┤
38 │ctermid() │ Thread safety │ MT-Safe │
39 └────────────────────────────────────────────┴───────────────┴─────────┘
40
42 POSIX.1-2008.
43
45 POSIX.1-2001, Svr4.
46
48 The returned pathname may not uniquely identify the controlling
49 terminal; it may, for example, be /dev/tty.
50
51 It is not assured that the program can open the terminal.
52
54 ttyname(3)
55
56
57
58Linux man-pages 6.05 2023-07-20 ctermid(3)