diff options
author | Werner Koch <[email protected]> | 2016-05-27 22:07:09 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-05-27 22:07:09 +0000 |
commit | 239a4d53916b47b5b0f0167a9b2c7a8915bb9c52 (patch) | |
tree | 81a7954bc955131f65cd87b26933b42833cdfee5 /common/exectool.h | |
parent | common: Allow a second input stream for gnupg_exec_tool_stream. (diff) | |
download | gnupg-239a4d53916b47b5b0f0167a9b2c7a8915bb9c52.tar.gz gnupg-239a4d53916b47b5b0f0167a9b2c7a8915bb9c52.zip |
common: Add a status callback to gnupg_exec_tool_stream.
* common/exectool.h (exec_tool_status_cb_t): New.
* common/exectool.c: Include missing exectool.h.
(read_and_log_buffer_t): Replace array by pointer.
(gnupg_exec_tool_stream): Add args 'status_cb' and 'status_cb_value'.
Change all callers to pass NULL for them. Malloc buffer for
FDERRSTATE.
(read_and_log_stderr): Implement status_fd feature.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'common/exectool.h')
-rw-r--r-- | common/exectool.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/common/exectool.h b/common/exectool.h index 21bc177a1..94091fdd7 100644 --- a/common/exectool.h +++ b/common/exectool.h @@ -32,6 +32,17 @@ #include <gpg-error.h> +/* This callback can be used to process --status-fd outputs of GnuPG + * tools. OPAQUE can be used to communicate between the caller of the + * function and the callback. KEYWORD is the status keyword (see + * doc/DETAILS); it is never NULL. ARGS are the arguments of the + * status line and will also never be NULL; the caller may modify this + * string. */ +typedef void (*exec_tool_status_cb_t) (void *opaque, + const char *keyword, + char *args); + + /* 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 @@ -51,6 +62,8 @@ gpg_error_t gnupg_exec_tool (const char *pgmname, const char *argv[], printed, and an error code returned. INEXTRA is reserved. */ gpg_error_t gnupg_exec_tool_stream (const char *pgmname, const char *argv[], estream_t input, estream_t inextra, - estream_t output); + estream_t output, + exec_tool_status_cb_t status_cb, + void *status_cb_value); #endif /* GNUPG_COMMON_EXECTOOL_H */ |