summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-08-02 13:10:29 +0200
committerWerner Koch <wk@gnupg.org>2019-08-02 13:10:29 +0200
commitd8a84594abe4be933756db07b987dc8bcd79c8b9 (patch)
tree1b892c6865d78f66b4442a9ce0cd6ff5ae5cf506 /common
parentMerge branch 'master' into switch-to-gpgk (diff)
downloadgnupg2-d8a84594abe4be933756db07b987dc8bcd79c8b9.tar.xz
gnupg2-d8a84594abe4be933756db07b987dc8bcd79c8b9.zip
common: Change yet unused status_printf function.
* common/asshelp2.c (status_printf): Rename to status_no_printf. (status_printf): New. -- Using the the status identifier from status.h is a good idea for the external API but for some inter-component status line a keyword is a better way. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'common')
-rw-r--r--common/asshelp.h4
-rw-r--r--common/asshelp2.c21
2 files changed, 23 insertions, 2 deletions
diff --git a/common/asshelp.h b/common/asshelp.h
index c2c87e3c4..a04a0775c 100644
--- a/common/asshelp.h
+++ b/common/asshelp.h
@@ -87,7 +87,9 @@ void set_assuan_context_func (assuan_context_t (*func)(ctrl_t ctrl));
/* Helper function to print an assuan status line using a printf
format string. */
-gpg_error_t status_printf (ctrl_t ctrl, int no, const char *format,
+gpg_error_t status_printf (ctrl_t ctrl, const char *keyword, const char *format,
+ ...) GPGRT_ATTR_PRINTF(3,4);
+gpg_error_t status_no_printf (ctrl_t ctrl, int no, const char *format,
...) GPGRT_ATTR_PRINTF(3,4);
gpg_error_t print_assuan_status (assuan_context_t ctx,
diff --git a/common/asshelp2.c b/common/asshelp2.c
index 32e60dfb0..8410808e3 100644
--- a/common/asshelp2.c
+++ b/common/asshelp2.c
@@ -157,7 +157,26 @@ print_assuan_status_strings (assuan_context_t ctx, const char *keyword, ...)
/* This function is similar to print_assuan_status but takes a CTRL
* arg instead of an assuan context as first argument. */
gpg_error_t
-status_printf (ctrl_t ctrl, int no, const char *format, ...)
+status_printf (ctrl_t ctrl, const char *keyword, const char *format, ...)
+{
+ gpg_error_t err;
+ va_list arg_ptr;
+ assuan_context_t ctx;
+
+ if (!ctrl || !the_assuan_ctx_func || !(ctx = the_assuan_ctx_func (ctrl)))
+ return 0;
+
+ va_start (arg_ptr, format);
+ err = vprint_assuan_status (ctx, keyword, format, arg_ptr);
+ va_end (arg_ptr);
+ return err;
+}
+
+
+/* Same as sytus_printf but takes a status number instead of a
+ * keyword. */
+gpg_error_t
+status_no_printf (ctrl_t ctrl, int no, const char *format, ...)
{
gpg_error_t err;
va_list arg_ptr;