.\" Copyright (c) 1995 Jim Van Zandt .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, .\" USA. .\" .\" Modified 2001-12-13, Martin Schulze .\" Added ttyname_r, aeb, 2002-07-20 .\" .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya .\" all rights reserved. .\" Translated Mon Feb 10 1997 by Hiroaki Nagoya .\" Updated Fri Dec 21 JST 2001 by Kentaro Shirakata .\" Updated Fri Oct 16 JST 2002 by Kentaro Shirakata .\" .TH TTYNAME 3 2008-07-14 "Linux" "Linux Programmer's Manual" .SH 名前 .\"O ttyname, ttyname_r \- return name of a terminal ttyname, ttyname_r \- 端末名を返す .SH 書式 .nf .B #include .sp .BI "char *ttyname(int " fd ); .BI "int ttyname_r(int " fd ", char *" buf ", size_t " buflen ); .fi .SH 説明 .\"O The function .\"O .BR ttyname () .\"O returns a pointer to the null-terminated pathname of the terminal device .\"O that is open on the file descriptor \fIfd\fP, or NULL on error .\"O (for example, if \fIfd\fP is not connected to a terminal). .\"O The return value may point to static data, possibly overwritten by the .\"O next call. .BR ttyname () 関数は、ファイルディスクリプタ \fIfd\fP がオープンしている端末デバイスの NULL 終端されたパス名へのポインタを返す。 エラーが起きたならば NULL を返す (たとえば、\fIfd\fP が端末を参照していないとき)。 返り値は静的データを指しているので、次の呼び出しで上書きされる可能性がある。 .\"O The function .\"O .BR ttyname_r () .\"O stores this pathname in the buffer .\"O .I buf .\"O of length .\"O .IR buflen . .BR ttyname_r () 関数は、このパス名を長さ .I buflen のバッファ .I buf に格納する。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O The function .\"O .BR ttyname () .\"O returns a pointer to a pathname on success. .\"O On error, NULL is returned, and .\"O .I errno .\"O is set appropriately. .BR ttyname () 関数は、成功時はパス名へのポインタを返す。 エラー時は NULL を返し、 .I errno が適切に設定される。 .\"O The function .\"O .BR ttyname_r () .\"O returns 0 on success, and an error number upon error. .BR ttyname_r () 関数は、成功時には 0 を返し、エラー時にはエラー番号を返す。 .\"O .SH ERRORS .SH エラー .BR ttyname_r (): .TP .B EBADF .\"O Bad file descriptor. ファイルディスクリプタが不正。 .TP .B ENOTTY .\"O File descriptor does not refer to a terminal device. ファイルディスクリプタが端末デバイスを示していない。 .TP .B ERANGE .\"O .I buflen .\"O was too small to allow storing the pathname. .I buflen がパス名を格納するには短すぎる。 .SH 準拠 4.2BSD, POSIX.1-2001. .SH 関連項目 .BR fstat (2), .BR isatty (3)