aboutsummaryrefslogtreecommitdiffstats
path: root/common/sh-exectool.h
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2015-11-30 13:23:02 +0000
committerJustus Winter <[email protected]>2015-12-04 11:52:26 +0000
commita81aca6e1c2a4529d416d1989f15d7338d2ee81e (patch)
treeb22e9abf6947b4a2f490ad526de89f6810d5498c /common/sh-exectool.h
parentcommon: Add header file and build the new code. (diff)
downloadgnupg-a81aca6e1c2a4529d416d1989f15d7338d2ee81e.tar.gz
gnupg-a81aca6e1c2a4529d416d1989f15d7338d2ee81e.zip
common: Add a stream interface to 'sh-exectool'.
* common/sh-exectool.c (struct copy_buffer): Add infrastructure for copying between streams. (copy_buffer_{init,shred,do_copy,flush}): New functions. (sh_exec_tool_stream): Rework 'sh_exec_tool' to operate on streams. (nop_free): New function. (sh_exec_tool): Express this in terms of 'sh_exec_tool_stream'. * common/sh-exectool.h (sh_exec_tool_stream): New prototype. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r--common/sh-exectool.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/sh-exectool.h b/common/sh-exectool.h
index bbdbb0342..6f511c2d5 100644
--- a/common/sh-exectool.h
+++ b/common/sh-exectool.h
@@ -20,6 +20,8 @@
#ifndef GNUPG_COMMON_SH_EXECTOOL_H
#define GNUPG_COMMON_SH_EXECTOOL_H
+#include <gpg-error.h>
+
/* Run the program PGMNAME with the command line arguments given in
the NULL terminates array ARGV. If INPUT_STRING is not NULL it
will be fed to stdin of the process. stderr is logged using
@@ -32,4 +34,13 @@ gpg_error_t sh_exec_tool (const char *pgmname, const char *argv[],
const char *input_string,
char **result, size_t *resultlen);
+/* Run the program PGMNAME with the command line arguments given in
+ the NULL terminates array ARGV. If INPUT is not NULL it will be
+ fed to stdin of the process. stderr is logged using log_info and
+ the process' stdout is written to OUTPUT. On error a diagnostic is
+ printed, and an error code returned. */
+gpg_error_t sh_exec_tool_stream (const char *pgmname, const char *argv[],
+ estream_t input,
+ estream_t output);
+
#endif /* GNUPG_COMMON_SH_EXECTOOL_H */