X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fpipecmd%2Fpipecmd.h;h=4816950502f2c949183ea72fcaacb60976a995cb;hp=87e3dcf8193ddf17985f0c33d372be34928566f6;hb=97a1ba3d6fac93e680e3d95cef930dea4fdd0822;hpb=c7e55a1601a5754363ee095d8c3f04fbc8b11ff5 diff --git a/ccan/pipecmd/pipecmd.h b/ccan/pipecmd/pipecmd.h index 87e3dcf8..48169505 100644 --- a/ccan/pipecmd/pipecmd.h +++ b/ccan/pipecmd/pipecmd.h @@ -10,29 +10,35 @@ * pipecmd - run a command, optionally connect pipes. * @infd: input fd to write to child (if non-NULL) * @outfd: output fd to read from child (if non-NULL) + * @errfd: error-output fd to read from child (if non-NULL) * @cmd...: NULL-terminate list of command and arguments. * * If @infd is NULL, the child's input is (read-only) /dev/null. * If @outfd is NULL, the child's output is (write-only) /dev/null. + * If @errfd is NULL, the child's stderr is (write-only) /dev/null. + * + * If @errfd == @outfd (and non-NULL) they will be shared. * * The return value is the pid of the child, or -1. */ -pid_t pipecmd(int *infd, int *outfd, const char *cmd, ...); +pid_t pipecmd(int *infd, int *outfd, int *errfd, const char *cmd, ...); /** * pipecmdv - run a command, optionally connect pipes (stdarg version) * @infd: input fd to write to child (if non-NULL) * @outfd: output fd to read from child (if non-NULL) + * @errfd: error-output fd to read from child (if non-NULL) * @cmd: command to run. * @ap: argument list for arguments. */ -pid_t pipecmdv(int *infd, int *outfd, const char *cmd, va_list ap); +pid_t pipecmdv(int *infd, int *outfd, int *errfd, const char *cmd, va_list ap); /** * pipecmdarr - run a command, optionally connect pipes (char arry version) * @infd: input fd to write to child (if non-NULL) * @outfd: output fd to read from child (if non-NULL) + * @errfd: error-output fd to read from child (if non-NULL) * @arr: NULL-terminated array for arguments (first is program to run). */ -pid_t pipecmdarr(int *infd, int *outfd, char *const *arr); +pid_t pipecmdarr(int *infd, int *outfd, int *errfd, char *const *arr); #endif /* CCAN_PIPECMD_H */