OSDN Git Service

bc9e0c92e3413803808db014c9020b9fd16c210e
[linuxjm/LDP_man-pages.git] / original / man3 / ctermid.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified Sat Jul 24 19:51:06 1993 by Rik Faith (faith@cs.unc.edu)
26 .TH CTERMID 3  2013-07-04 "GNU" "Linux Programmer's Manual"
27 .SH NAME
28 ctermid \- get controlling terminal name
29 .SH SYNOPSIS
30 .nf
31 .B #include <stdio.h>
32 .\" POSIX also requires this function to be declared in <unistd.h>,
33 .\" and glibc does so if suitable feature test macros are defined.
34 .sp
35 .BI "char *ctermid(char *" "s" );
36 .fi
37 .sp
38 .in -4n
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
41 .in
42 .sp
43 .BR ctermid ():
44 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
45 .\" From <unistd.h>: _XOPEN_SOURCE
46 .SH DESCRIPTION
47 .BR ctermid ()
48 returns a string which is the pathname for the current
49 controlling terminal for this process.
50 If
51 .I s
52 is NULL,
53 a static buffer is used, otherwise
54 .I s
55 points to a buffer used to hold the terminal pathname.
56 The symbolic constant
57 .B L_ctermid
58 is the maximum number of characters in the returned pathname.
59 .SH RETURN VALUE
60 The pointer to the pathname.
61 .SH ATTRIBUTES
62 .SS Multithreading (see pthreads(7))
63 The
64 .BR ctermid ()
65 function is thread-safe with exceptions.
66 It is not thread-safe if called with a NULL parameter.
67 .SH CONFORMING TO
68 Svr4, POSIX.1-2001.
69 .SH BUGS
70 The path returned may not uniquely identify the controlling
71 terminal; it may, for example, be
72 .IR /dev/tty .
73 .PP
74 It is not assured that the program can open the terminal.
75 .\" in glibc 2.3.x, x >= 4, the glibc headers threw an error
76 .\" if ctermid() was given an argument; fixed in 2.4.
77 .SH SEE ALSO
78 .BR ttyname (3)
79 .SH COLOPHON
80 This page is part of release 3.67 of the Linux
81 .I man-pages
82 project.
83 A description of the project,
84 information about reporting bugs,
85 and the latest version of this page,
86 can be found at
87 \%http://www.kernel.org/doc/man\-pages/.