/*++ /* NAME /* vstream_popen 3 /* SUMMARY /* open stream to child process /* SYNOPSIS /* #include <vstream.h> /* /* VSTREAM *vstream_popen(flags, key, value, ...) /* int flags; /* int key; /* /* int vstream_pclose(stream) /* VSTREAM *stream; /* DESCRIPTION /* vstream_popen() opens a one-way or two-way stream to a user-specified /* command, which is executed by a child process. The \fIflags\fR /* argument is as with vstream_fopen(). The child's standard input and /* standard output are redirected to the stream, which is based on a /* socketpair or other suitable local IPC. vstream_popen() takes a list /* of macros with zero or more arguments, terminated by /* CA_VSTREAM_POPEN_END. The following is a listing of macros /* with the expected argument type. /* .RS /* .IP "CA_VSTREAM_POPEN_COMMAND(const char *)" /* Specifies the command to execute as a string. The string is /* passed to the shell when it contains shell meta characters /* or when it appears to be a shell built-in command, otherwise /* the command is executed without invoking a shell. /* One of CA_VSTREAM_POPEN_COMMAND or VSTREAM_POPEN_ARGV must be specified. /* .IP "CA_VSTREAM_POPEN_ARGV(char **)" /* The command is specified as an argument vector. This vector is /* passed without further inspection to the \fIexecvp\fR() routine. /* One of CA_VSTREAM_POPEN_COMMAND or VSTREAM_POPEN_ARGV must be specified. /* See also the CA_VSTREAM_POPEN_SHELL attribute below. /* .IP "CA_VSTREAM_POPEN_ENV(char **)" /* Additional environment information, in the form of a null-terminated /* list of name, value, name, value, ... elements. By default only the /* command search path is initialized to _PATH_DEFPATH. /* .IP "CA_VSTREAM_POPEN_EXPORT(char **)" /* This argument is passed to clean_env(). /* Null-terminated array of names of environment parameters /* that can be exported. By default, everything is exported. /* .IP "CA_VSTREAM_POPEN_UID(uid_t)" /* The user ID to execute the command as. The user ID must be non-zero. /* .IP "CA_VSTREAM_POPEN_GID(gid_t)" /* The group ID to execute the command as. The group ID must be non-zero. /* .IP "CA_VSTREAM_POPEN_SHELL(const char *)" /* The shell to use when executing the command specified with /* CA_VSTREAM_POPEN_COMMAND. This shell is invoked regardless of the /* command content. /* .IP "CA_VSTREAM_POPEN_WAITPID_FN(pid_t (*)(pid_t, WAIT_STATUS_T *, int))" /* waitpid()-like function to reap the child exit status when /* vstream_pclose() is called. /* .RE /* .PP /* vstream_pclose() closes the named stream and returns the child /* exit status. It is an error to specify a stream that was not /* returned by vstream_popen() or that is no longer open. /* DIAGNOSTICS /* Panics: interface violations. Fatal errors: out of memory. /* /* vstream_popen() returns a null pointer in case of trouble. /* The nature of the problem is specified via the \fIerrno\fR /* global variable. /* /* vstream_pclose() returns -1 in case of trouble. /* The nature of the problem is specified via the \fIerrno\fR /* global variable. /* SEE ALSO /* vstream(3) light-weight buffered I/O /* BUGS /* The interface, stolen from popen()/pclose(), ignores errors /* returned when the stream is closed, and does not distinguish /* between exit status codes and kill signals. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA
/*--*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.