X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..aa54d2fad3d9038b43475aa93c76795c5141a993:/gen/FreeBSD/popen.3 diff --git a/gen/FreeBSD/popen.3 b/gen/FreeBSD/popen.3 index 4831835..5f4a8c6 100644 --- a/gen/FreeBSD/popen.3 +++ b/gen/FreeBSD/popen.3 @@ -30,14 +30,14 @@ .\" SUCH DAMAGE. .\" .\" @(#)popen.3 8.2 (Berkeley) 5/3/95 -.\" $FreeBSD: src/lib/libc/gen/popen.3,v 1.15 2003/01/03 05:21:59 tjr Exp $ +.\" $FreeBSD: src/lib/libc/gen/popen.3,v 1.16 2003/06/08 10:01:51 charnier Exp $ .\" .Dd May 3, 1995 .Dt POPEN 3 .Os .Sh NAME -.Nm popen , -.Nm pclose +.Nm pclose , +.Nm popen .Nd process .Tn I/O .Sh LIBRARY @@ -45,16 +45,20 @@ .Sh SYNOPSIS .In stdio.h .Ft FILE * -.Fn popen "const char *command" "const char *type" +.Fo popen +.Fa "const char *command" +.Fa "const char *mode" +.Fc .Ft int -.Fn pclose "FILE *stream" +.Fo pclose +.Fa "FILE *stream" +.Fc .Sh DESCRIPTION The .Fn popen function .Dq opens -a process by creating a bidirectional pipe -forking, +a process by creating a bidirectional pipe, forking, and invoking the shell. Any streams opened by previous .Fn popen @@ -62,18 +66,18 @@ calls in the parent process are closed in the new child process. Historically, .Fn popen was implemented with a unidirectional pipe; -hence many implementations of +hence, many implementations of .Fn popen only allow the -.Fa type +.Fa mode argument to specify reading or writing, not both. -Since +Because .Fn popen is now implemented using a bidirectional pipe, the -.Fa type +.Fa mode argument may request a bidirectional data flow. The -.Fa type +.Fa mode argument is a pointer to a null-terminated string which must be .Ql r @@ -88,7 +92,7 @@ The argument is a pointer to a null-terminated string containing a shell command line. This command is passed to -.Pa /bin/sh +.Pa /bin/sh , using the .Fl c flag; interpretation, if any, is performed by the shell. @@ -97,7 +101,7 @@ The return value from .Fn popen is a normal standard .Tn I/O -stream in all respects +stream in all respects, save that it must be closed with .Fn pclose rather than @@ -115,14 +119,14 @@ the command's standard input is the same as that of the process that called .Pp Note that output .Fn popen -streams are fully buffered by default. +streams are fully buffered, by default. .Pp The .Fn pclose -function waits for the associated process to terminate -and returns the exit status of the command +function waits for the associated process to terminate; +it returns the exit status of the command, as returned by -.Fn wait4 . +.Xr wait4 2 . .Sh RETURN VALUES The .Fn popen @@ -147,7 +151,7 @@ command, if already .Dq pclosed , or if -.Xr wait4 +.Xr wait4 2 returns an error. .Sh ERRORS The