aboutsummaryrefslogblamecommitdiff
path: root/ja_JP.eucJP/man/man3/ttyname.3
blob: 1067d66c9ca6a6a3be7d05a26951759d463c05c2 (plain) (tree)
































                                                                              
             














































































                                                                     
.\" Copyright (c) 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)ttyname.3	8.1 (Berkeley) 6/4/93
.\"
.\" $FreeBSD$
.Dd June 4, 1993
.Dt TTYNAME 3
.Os
.Sh 名称
.Nm ttyname ,
.Nm isatty ,
.Nm ttyslot
.Nd ファイル記述子からそれに結合されている端末 ( tty ) の名前を取得
.Sh 書式
.Fd #include <unistd.h>
.Ft char *
.Fn ttyname "int fd"
.Ft int
.Fn isatty "int fd"
.Ft int
.Fn ttyslot void
.Sh 解説
これらの関数は、端末タイプデバイスに関するシステムファイル記述子を
操作します。これらの記述子は標準の
.Tn I/O 
.Dv FILE 
typedef とは関係を持っておらず、
.Pa /dev
ディレクトリ中にあって
.Pa /dev/tty Ns Em xx
という名前を持ち、
それについては初期設定ファイル
.Pa /etc/ttys
の中にエントリが存在するような特別デバイスファイルを参照します( 
.Xr ttys 5
参照 )。
.Pp
.Fn isatty
関数は、ファイル記述子
.Fa fd
が有効な端末タイプデバイスを参照しているかどうかを判断します。
.Pp
.Fn ttyname
関数は、
.Fn isatty
が真であるファイル記述子に関連するデバイス名を取得します。
.Pp
.Fn ttyslot
関数は、
.Xr ttys 5
ファイルエントリから現在のプロセスの制御端末番号を取ってきます。
.Sh 戻り値
.Fn ttyname
関数は、デバイスが見つかって
.Fn isatty
が真である場合は、null で終端された名前を返します。それ以外の場合は、
.Dv NULL
ポインタを返します。
.Pp
.Fn ttyslot
関数は、デバイスファイルが見つかればそのユニット番号を
返します。見つからない場合は、値ゼロを返します。
.Sh ファイル
.Bl -tag -width /etc/ttys -compact
.It Pa /dev/\(**
.It Pa /etc/ttys
.El
.Sh 参照
.Xr ioctl 2 ,
.Xr ttys 5
.Sh 歴史
.Fn isatty ,
.Fn ttyname ,
および
.Fn ttyslot
関数は、
.At v7
に現れました。
.Sh バグ
.Fn ttyname
関数は、その結果を内部静的オブジェクトの中に残し、その
オブジェクトへのポインタを返します。それ以後に
.Fn ttyname
を呼び出すと、その同じオブジェクトは修正されます。