]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/ctermid.3
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man3 / ctermid.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" Modified Sat Jul 24 19:51:06 1993 by Rik Faith (faith@cs.unc.edu)
6 .TH ctermid 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 ctermid \- get controlling terminal name
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <stdio.h>
15 .\" POSIX also requires this function to be declared in <unistd.h>,
16 .\" and glibc does so if suitable feature test macros are defined.
17 .PP
18 .BI "char *ctermid(char *" "s" );
19 .fi
20 .PP
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
25 .PP
26 .BR ctermid ():
27 .nf
28 _POSIX_C_SOURCE
29 .fi
30 .SH DESCRIPTION
31 .BR ctermid ()
32 returns a string which is the pathname for the current
33 controlling terminal for this process.
34 If
35 .I s
36 is NULL,
37 a static buffer is used, otherwise
38 .I s
39 points to a buffer used to hold the terminal pathname.
40 The symbolic constant
41 .B L_ctermid
42 is the maximum number of characters in the returned pathname.
43 .SH RETURN VALUE
44 The pointer to the pathname.
45 .SH ATTRIBUTES
46 For an explanation of the terms used in this section, see
47 .BR attributes (7).
48 .ad l
49 .nh
50 .TS
51 allbox;
52 lbx lb lb
53 l l l.
54 Interface Attribute Value
55 T{
56 .BR ctermid ()
57 T} Thread safety MT-Safe
58 .TE
59 .hy
60 .ad
61 .sp 1
62 .SH STANDARDS
63 POSIX.1-2001, POSIX.1-2008, Svr4.
64 .SH BUGS
65 The returned pathname may not uniquely identify the controlling
66 terminal; it may, for example, be
67 .IR /dev/tty .
68 .PP
69 It is not assured that the program can open the terminal.
70 .\" in glibc 2.3.x, x >= 4, the glibc headers threw an error
71 .\" if ctermid() was given an argument; fixed in 2.4.
72 .SH SEE ALSO
73 .BR ttyname (3)