OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / 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)