OSDN Git Service

fc30c6f409cff57bc634544f07ed11a7e442eabb
[linuxjm/LDP_man-pages.git] / draft / man3 / ttyname.3
1 .\" Copyright (c) 1995 Jim Van Zandt <jrv@vanzandt.mv.com>
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .\" Modified 2001-12-13, Martin Schulze <joey@infodrom.org>
24 .\" Added ttyname_r, aeb, 2002-07-20
25 .\"
26 .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
27 .\"       all rights reserved.
28 .\" Translated Mon Feb 10 1997 by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
29 .\" Updated Fri Dec 21 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
30 .\" Updated Fri Oct 16 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
31 .\"
32 .TH TTYNAME 3 2008-07-14 "Linux" "Linux Programmer's Manual"
33 .SH 名前
34 .\"O ttyname, ttyname_r \- return name of a terminal
35 ttyname, ttyname_r \- 端末名を返す
36 .SH 書式
37 .nf
38 .B #include <unistd.h>
39 .sp
40 .BI "char *ttyname(int " fd );
41
42 .BI "int ttyname_r(int " fd ", char *" buf ", size_t " buflen );
43 .fi
44 .SH 説明
45 .\"O The function
46 .\"O .BR ttyname ()
47 .\"O returns a pointer to the null-terminated pathname of the terminal device
48 .\"O that is open on the file descriptor \fIfd\fP, or NULL on error
49 .\"O (for example, if \fIfd\fP is not connected to a terminal).
50 .\"O The return value may point to static data, possibly overwritten by the
51 .\"O next call.
52 .BR ttyname ()
53 関数は、ファイルディスクリプタ \fIfd\fP がオープンしている端末デバイスの
54 NULL 終端されたパス名へのポインタを返す。
55 エラーが起きたならば NULL を返す
56 (たとえば、\fIfd\fP が端末を参照していないとき)。
57 返り値は静的データを指しているので、次の呼び出しで上書きされる可能性がある。
58 .\"O The function
59 .\"O .BR ttyname_r ()
60 .\"O stores this pathname in the buffer
61 .\"O .I buf
62 .\"O of length
63 .\"O .IR buflen .
64 .BR ttyname_r ()
65 関数は、このパス名を長さ
66 .I buflen
67 のバッファ
68 .I buf
69 に格納する。
70 .\"O .SH "RETURN VALUE"
71 .SH 返り値
72 .\"O The function
73 .\"O .BR ttyname ()
74 .\"O returns a pointer to a pathname on success.
75 .\"O On error, NULL is returned, and
76 .\"O .I errno
77 .\"O is set appropriately.
78 .BR ttyname ()
79 関数は、成功時はパス名へのポインタを返す。
80 エラー時は NULL を返し、
81 .I errno
82 が適切に設定される。
83 .\"O The function
84 .\"O .BR ttyname_r ()
85 .\"O returns 0 on success, and an error number upon error.
86 .BR ttyname_r ()
87 関数は、成功時には 0 を返し、エラー時にはエラー番号を返す。
88 .\"O .SH ERRORS
89 .SH エラー
90 .BR ttyname_r ():
91 .TP
92 .B EBADF
93 .\"O Bad file descriptor.
94 ファイルディスクリプタが不正。
95 .TP
96 .B ENOTTY
97 .\"O File descriptor does not refer to a terminal device.
98 ファイルディスクリプタが端末デバイスを示していない。
99 .TP
100 .B ERANGE
101 .\"O .I buflen
102 .\"O was too small to allow storing the pathname.
103 .I buflen
104 がパス名を格納するには短すぎる。
105 .SH 準拠
106 4.2BSD, POSIX.1-2001.
107 .SH 関連項目
108 .BR fstat (2),
109 .BR isatty (3)