OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man3 / popen.3
index 3706492..668477a 100644 (file)
 .\" Modified Sat May 18 20:37:44 1996 by Martin Schulze (joey@linux.de)
 .\" Modified 7 May 1998 by Joseph S. Myers (jsm28@cam.ac.uk)
 .\"
-.\" Japanese Version Copyright (c) 1997 Takashi Yoshino
-.\"       all rights reserved.
-.\" Translated 1997-01-21, Takashi Yoshino <tyoshino@eng.toyo.ac.jp>
-.\" Modified 2007-05-03, Akihiro MOTOKI
-.\" Modified 2008-11-09, Akihiro MOTOKI, LDP v3.13
+.\"*******************************************************************
 .\"
-.TH POPEN 3  2010-02-03 "GNU" "Linux Programmer's Manual"
-.\"O .SH NAME
-.\"O popen, pclose \- pipe stream to or from a process
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH POPEN 3 2010\-02\-03 GNU "Linux Programmer's Manual"
 .SH 名前
 popen, pclose \- プロセスとの入力/出力用のパイプ・ストリーム
-.\"O .SH SYNOPSIS
 .SH 書式
 .nf
-.B #include <stdio.h>
+\fB#include <stdio.h>\fP
 .sp
-.BI "FILE *popen(const char *" command ", const char *" type );
+\fBFILE *popen(const char *\fP\fIcommand\fP\fB, const char *\fP\fItype\fP\fB);\fP
 .sp
-.BI "int pclose(FILE *" stream );
+\fBint pclose(FILE *\fP\fIstream\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc 向けの機能検査マクロの要件
-.RB ( feature_test_macros (7)
-参照):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .ad l
 .in
 .sp
-.BR popen (),
-.BR pclose ():
+\fBpopen\fP(), \fBpclose\fP():
 .RS 4
 _POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE
 .RE
 .ad b
-.\"O .SH DESCRIPTION
 .SH 説明
-.\"O The
-.\"O .BR popen ()
-.\"O function opens a process by creating a pipe, forking, and invoking the
-.\"O shell.
-.\"O Since a pipe is by definition unidirectional, the
-.\"O .I type
-.\"O argument may specify only reading or writing, not both; the resulting
-.\"O stream is correspondingly read-only or write-only.
-.BR popen ()
-関数は、プロセスをオープンする。具体的には、
-パイプを生成し、フォークを行い、シェルを起動する。
-定義から分かるように、パイプは一方向なので、
-.I type
-引き数には読み込みか書き込みのどちらか一方だけを指定できる
-(両方は指定できない)。
-生成されるストリームは、この指定に対応して、読み取り専用または
-書き込み専用のいずれかとなる。
+\fBpopen\fP()  関数は、プロセスをオープンする。具体的には、 パイプを生成し、フォークを行い、シェルを起動する。
+定義から分かるように、パイプは一方向なので、 \fItype\fP 引き数には読み込みか書き込みのどちらか一方だけを指定できる (両方は指定できない)。
+生成されるストリームは、この指定に対応して、読み取り専用または 書き込み専用のいずれかとなる。
 .PP
-.\"O The
-.\"O .I command
-.\"O argument is a pointer to a null-terminated string containing a shell
-.\"O command line.
-.\"O This command is passed to
-.\"O .I /bin/sh
-.\"O using the
-.\"O .B \-c
-.\"O flag; interpretation, if any, is performed by the shell.
-.\"O The
-.\"O .I type
-.\"O argument is a pointer to a null-terminated string which must contain
-.\"O either the letter \(aqr\(aq for reading or the letter \(aqw\(aq for writing.
-.I command
-引き数は、シェルのコマンドラインを含む
-NULL 終端された文字列へのポインタである。
-このコマンドは
-.B \-c
-フラグを用いて
-.I /bin/sh
-に渡される。
-コマンドの解釈は (もし必要ならば) シェルによって行われる。
-.I type
-引き数は、NULL 終端された文字列へのポインタで、
-読み込みを示す文字 \(aqr\(aq か、書き込みを示す文字 \(aqw\(aq の
-どちらか一方を指定しなければならない。
-.\"O Since glibc 2.9,
-.\"O this argument can additionally include the letter \(aqe\(aq,
-.\"O which causes the close-on-exec flag
-.\"O .RB ( FD_CLOEXEC )
-.\"O to be set on the underlying file descriptor;
-.\"O see the description of the
-.\"O .B O_CLOEXEC
-.\"O flag in
-.\"O .BR open (2)
-.\"O for reasons why this may be useful.
-glibc 2.9 以降では、この引き数に文字 \(aqe\(aq を追加で指定できる。
-文字 \(aqe\(aq を指定すると、
-対応するファイルディスクリプタにおいて、
-close-on-exec フラグ
-.RB ( FD_CLOEXEC )
-がセットされる。
-これが役に立つ理由については、
-.BR open (2)
-の
-.B O_CLOEXEC
-フラグの説明を参照のこと。
+\fIcommand\fP 引き数は、シェルのコマンドラインを含む NULL 終端された文字列へのポインタである。 このコマンドは \fB\-c\fP フラグを用いて
+\fI/bin/sh\fP に渡される。 コマンドの解釈は (もし必要ならば) シェルによって行われる。 \fItype\fP 引き数は、NULL
+終端された文字列へのポインタで、 読み込みを示す文字 \(aqr\(aq か、書き込みを示す文字 \(aqw\(aq の
+どちらか一方を指定しなければならない。 glibc 2.9 以降では、この引き数に文字 \(aqe\(aq を追加で指定できる。 文字
+\(aqe\(aq を指定すると、 対応するファイルディスクリプタにおいて、 close\-on\-exec フラグ (\fBFD_CLOEXEC\fP)
+がセットされる。 これが役に立つ理由については、 \fBopen\fP(2)  の \fBO_CLOEXEC\fP フラグの説明を参照のこと。
 .PP
-.\"O The return value from
-.\"O .BR popen ()
-.\"O is a normal standard I/O stream in all respects save that it must be closed
-.\"O with
-.\"O .BR pclose ()
-.\"O rather than
-.\"O .BR fclose (3).
-.BR popen ()
-からの返り値は、通常の標準 I/O ストリームと同じであるが、
-.BR fclose (3)
-ではなく
-.BR pclose ()
-で閉じなくてはならないことだけが異なる。
-.\"O Writing to such a stream writes to the standard input of the command; the
-.\"O command's standard output is the same as that of the process that called
-.\"O .BR popen (),
-.\"O unless this is altered by the command itself.
-.\"O Conversely, reading from a
-.\"O "popened" stream reads the command's standard output, and the command's
-.\"O standard input is the same as that of the process that called
-.\"O .BR popen ().
-このストリームへ書き込んだ結果はコマンドの標準入力に書き込まれる。
-そして、コマンドの標準出力は、
-コマンドそのものが置き換わってしまわない限り、
-.BR popen ()
-を呼んだプロセスの標準出力と同じことになる。
-逆に、"popened"
-.RB ( popen ()
-によって開かれた) ストリームからの読み込みは、
-そのコマンドの標準出力を読み込むことになる。
-そして、そのコマンドの標準入力は
-.BR popen ()
-を呼んだプロセスの標準入力と同一である。
+\fBpopen\fP()  からの返り値は、通常の標準 I/O ストリームと同じであるが、 \fBfclose\fP(3)  ではなく \fBpclose\fP()
+で閉じなくてはならないことだけが異なる。 このストリームへ書き込んだ結果はコマンドの標準入力に書き込まれる。 そして、コマンドの標準出力は、
+コマンドそのものが置き換わってしまわない限り、 \fBpopen\fP()  を呼んだプロセスの標準出力と同じことになる。 逆に、"popened"
+(\fBpopen\fP()  によって開かれた) ストリームからの読み込みは、 そのコマンドの標準出力を読み込むことになる。
+そして、そのコマンドの標準入力は \fBpopen\fP()  を呼んだプロセスの標準入力と同一である。
 .PP
-.\"O Note that output
-.\"O .BR popen ()
-.\"O streams are fully buffered by default.
-デフォルトでは、
-.BR popen ()
-の出力ストリームは完全にバッファリングされることに注意しよう。
+デフォルトでは、 \fBpopen\fP()  の出力ストリームは完全にバッファリングされることに注意しよう。
 .PP
-.\"O The
-.\"O .BR pclose ()
-.\"O function waits for the associated process to terminate and returns the exit
-.\"O status of the command as returned by
-.\"O .BR wait4 (2).
-.BR pclose ()
-関数は、(パイプに) 関連づけられたプロセスが終了するのを待ち、
-.BR wait4 (2)
+\fBpclose\fP()  関数は、(パイプに) 関連づけられたプロセスが終了するのを待ち、 \fBwait4\fP(2)
 によって返されたコマンドの終了状態を返す。
-.\"O .SH "RETURN VALUE"
 .SH 返り値
-.\"O The
-.\"O .BR popen ()
-.\"O function returns NULL if the
-.\"O .BR fork (2)
-.\"O or
-.\"O .BR pipe (2)
-.\"O calls fail, or if it cannot allocate memory.
-.BR popen ()
-関数は、
-.BR fork (2)
-または
-.BR pipe (2)
-呼び出しが失敗した場合や、
-メモリ割り当てができなかった場合、 NULL を返す。
+\fBpopen\fP()  関数は、 \fBfork\fP(2)  または \fBpipe\fP(2)  呼び出しが失敗した場合や、 メモリ割り当てができなかった場合、
+NULL を返す。
 .PP
-.\"O The
-.\"O .BR pclose ()
-.\"O function returns \-1 if
-.\"O .\" These conditions actually give undefined results, so I commented
-.\"O .\" them out.
-.\"O .\" .I stream
-.\"O .\" is not associated with a "popen()ed" command, if
-.\"O .\".I stream
-.\"O .\" already "pclose()d", or if
-.\"O .BR wait4 (2)
-.\"O returns an error, or some other error is detected.
-.BR pclose ()
-関数は、
-.BR wait4 (2)
-がエラーを返したり、何か他のエラーが見つかった場合、
-\-1 を返す。
-.\"O .SH ERRORS
+.\" These conditions actually give undefined results, so I commented
+.\" them out.
+.\" .I stream
+.\" is not associated with a "popen()ed" command, if
+.\".I stream
+.\" already "pclose()d", or if
+\fBpclose\fP()  関数は、 \fBwait4\fP(2)  がエラーを返したり、何か他のエラーが見つかった場合、 \-1 を返す。
 .SH エラー
-.\"O The
-.\"O .BR popen ()
-.\"O function does not set
-.\"O .I errno
-.\"O if memory allocation fails.
-.\"O If the underlying
-.\"O .BR fork (2)
-.\"O or
-.\"O .BR pipe (2)
-.\"O fails,
-.\"O .I errno
-.\"O is set appropriately.
-.\"O If the
-.\"O .I type
-.\"O argument is invalid, and this condition is detected,
-.\"O .I errno
-.\"O is set to
-.\"O .BR EINVAL .
-.BR popen ()
-関数は、メモリアロケーションに失敗しても
-.I errno
-をセットしない。
-.BR popen ()
-が中で呼び出す
-.BR fork (2)
-や
-.BR pipe (2)
-が失敗した場合には、
-.I errno
-が適切にセットされる。
-引き数
-.I type
-が無効であり、この状態が検知された場合には、
-.I errno
-が
-.B EINVAL
-にセットされる。
+\fBpopen\fP()  関数は、メモリアロケーションに失敗しても \fIerrno\fP をセットしない。 \fBpopen\fP()  が中で呼び出す
+\fBfork\fP(2)  や \fBpipe\fP(2)  が失敗した場合には、 \fIerrno\fP が適切にセットされる。 引き数 \fItype\fP
+が無効であり、この状態が検知された場合には、 \fIerrno\fP が \fBEINVAL\fP にセットされる。
 .PP
-.\"O If
-.\"O .BR pclose ()
-.\"O cannot obtain the child status,
-.\"O .I errno
-.\"O is set to
-.\"O .BR ECHILD .
-.BR pclose ()
-が、子プロセスの状態を取得できなかった場合、
-.I errno
-が
-.B ECHILD
-にセットされる。
-.\"O .SH "CONFORMING TO"
+\fBpclose\fP()  が、子プロセスの状態を取得できなかった場合、 \fIerrno\fP が \fBECHILD\fP にセットされる。
 .SH 準拠
-POSIX.1-2001.
+POSIX.1\-2001.
 
-.\"O The \(aqe\(aq value for
-.\"O .I type
-.\"O is a Linux extension.
-.I type
-に指定できる \(aqe\(aq は Linux での拡張である。
-.\"O .SH BUGS
+\fItype\fP に指定できる \(aqe\(aq は Linux での拡張である。
 .SH バグ
-.\"O Since the standard input of a command opened for reading shares its seek
-.\"O offset with the process that called
-.\"O .BR popen (),
-.\"O if the original process has done a buffered read, the command's input
-.\"O position may not be as expected.
-.\"O Similarly, the output from a command
-.\"O opened for writing may become intermingled with that of the original
-.\"O process.
-.\"O The latter can be avoided by calling
-.\"O .BR fflush (3)
-.\"O before
-.\"O .BR popen ().
-読み込みのために開かれたコマンドの標準入力は
-.BR popen (),
-を呼んだプロセスと一緒に、その読み取り位置を共有する。
-そのため、もとのプロセスがバッファリングされた読み取りを終了したら、
-そのコマンドの入力位置は予想されたものには
-なっていないかもしれない。
-同様に、書き込みのために開かれたコマンドからの出力は、
-もとのプロセスの出力と混ざり合うことになるかもしれない。
-後者は
-.BR popen ()
-の前に
-.BR fflush (3)
-を呼び出すことによって回避可能である。
+読み込みのために開かれたコマンドの標準入力は \fBpopen\fP(), を呼んだプロセスと一緒に、その読み取り位置を共有する。
+そのため、もとのプロセスがバッファリングされた読み取りを終了したら、 そのコマンドの入力位置は予想されたものには なっていないかもしれない。
+同様に、書き込みのために開かれたコマンドからの出力は、 もとのプロセスの出力と混ざり合うことになるかもしれない。 後者は \fBpopen\fP()  の前に
+\fBfflush\fP(3)  を呼び出すことによって回避可能である。
 .PP
-.\"O Failure to execute the shell is indistinguishable from the shell's failure
-.\"O to execute command, or an immediate exit of the command.
-.\"O The only hint is an exit status of 127.
-シェルの実行の失敗は、
-シェルがコマンドの実行に失敗したことや、
-コマンドがすぐに終了してしまったことと、区別がつかない。
-唯一のヒントは終了状態が 127 になることである。
-.\"O .\" .SH HISTORY
-.\" .SH 履歴
-.\"O .\" A
-.\"O .\" .BR popen ()
-.\"O .\" and a
-.\"O .\" .BR pclose ()
-.\"O .\" function appeared in Version 7 AT&T UNIX.
+.\" .SH HISTORY
+.\" A
 .\" .BR popen ()
-.\" 関数と
+.\" and a
 .\" .BR pclose ()
-.\" 関数は AT&T UNIX の Version 7 から導入された。
-.\"O .SH "SEE ALSO"
+.\" function appeared in Version 7 AT&T UNIX.
+シェルの実行の失敗は、 シェルがコマンドの実行に失敗したことや、 コマンドがすぐに終了してしまったことと、区別がつかない。 唯一のヒントは終了状態が
+127 になることである。
 .SH 関連項目
-.BR sh (1),
-.BR fork (2),
-.BR pipe (2),
-.BR wait4 (2),
-.BR fclose (3),
-.BR fflush (3),
-.BR fopen (3),
-.BR stdio (3),
-.BR system (3)
+\fBsh\fP(1), \fBfork\fP(2), \fBpipe\fP(2), \fBwait4\fP(2), \fBfclose\fP(3), \fBfflush\fP(3),
+\fBfopen\fP(3), \fBstdio\fP(3), \fBsystem\fP(3)