Annotation of 43BSDTahoe/man/man3/popen.3, revision 1.1.1.1

1.1       root        1: .\"    @(#)popen.3     6.1 (Berkeley) 5/15/85
                      2: .\"
                      3: .TH POPEN 3 "May 15, 1985"
                      4: .AT 3
                      5: .SH NAME
                      6: popen, pclose \- initiate I/O to/from a process
                      7: .SH SYNOPSIS
                      8: .B #include <stdio.h>
                      9: .PP
                     10: .SM
                     11: .B FILE
                     12: .B *popen(command, type)
                     13: .br
                     14: .B char *command, *type;
                     15: .PP
                     16: .B pclose(stream)
                     17: .br
                     18: .SM
                     19: .B FILE
                     20: .B *stream;
                     21: .SH DESCRIPTION
                     22: The arguments to 
                     23: .I popen
                     24: are pointers to null-terminated strings containing respectively a
                     25: shell command line and an I/O mode, either "r" for reading or "w" for
                     26: writing.  It creates a pipe between the calling process and
                     27: the command to be executed.  The value returned is a stream pointer that
                     28: can be used (as appropriate) to write to the standard input
                     29: of the command or read from its standard output.
                     30: .PP
                     31: A stream opened by
                     32: .I popen
                     33: should be closed by
                     34: .IR pclose ,
                     35: which waits for the associated process to terminate
                     36: and returns the exit status of the command.
                     37: .PP
                     38: Because open files are shared, a type "r" command may be used as an input
                     39: filter, and a type "w" as an output filter.
                     40: .SH "SEE ALSO"
                     41: pipe(2),
                     42: fopen(3S),
                     43: fclose(3S),
                     44: system(3),
                     45: wait(2),
                     46: sh(1)
                     47: .SH DIAGNOSTICS
                     48: .I Popen
                     49: returns a null pointer if files or processes cannot be created, or the shell 
                     50: cannot be accessed.
                     51: .PP
                     52: .I Pclose
                     53: returns \-1 if
                     54: .I stream
                     55: is not associated with a `popened' command.
                     56: .SH BUGS
                     57: Buffered reading before opening an input filter
                     58: may leave the standard input of that filter mispositioned.
                     59: Similar problems with an output filter may be
                     60: forestalled by careful buffer flushing, for instance, with
                     61: .I fflush,
                     62: see
                     63: .IR fclose (3S).
                     64: .LP
                     65: .I Popen
                     66: always calls
                     67: .IR sh ,
                     68: never calls
                     69: .IR csh .

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.