diff options
author | Werner Koch <wk@gnupg.org> | 2016-09-01 16:33:21 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-09-01 16:39:41 +0200 |
commit | 6bdadae00512b4907826f6754cdb220d06e1ac6d (patch) | |
tree | 00f902239858ef98b77b4833b9936f278c368e67 /g10/cpr.c | |
parent | gpg: Fix printing of pubkey algo in --verbose signature verify. (diff) | |
download | gnupg2-6bdadae00512b4907826f6754cdb220d06e1ac6d.tar.xz gnupg2-6bdadae00512b4907826f6754cdb220d06e1ac6d.zip |
gpg: Add new function write_status_printf.
* g10/cpr.c (write_status_printf): New.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/cpr.c')
-rw-r--r-- | g10/cpr.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -183,6 +183,33 @@ write_status_text (int no, const char *text) write_status_strings (no, text, NULL); } + +/* Write a status line with code NO followed by the outout of the + * printf style FORMAT. The caller needs to make sure that LFs and + * CRs are not printed. */ +void +write_status_printf (int no, const char *format, ...) +{ + va_list arg_ptr; + + if (!statusfp || !status_currently_allowed (no) ) + return; /* Not enabled or allowed. */ + + es_fputs ("[GNUPG:] ", statusfp); + es_fputs (get_status_string (no), statusfp); + if (format) + { + es_putc ( ' ', statusfp); + va_start (arg_ptr, format); + es_vfprintf (statusfp, format, arg_ptr); + va_end (arg_ptr); + } + es_putc ('\n', statusfp); + if (es_fflush (statusfp) && opt.exit_on_status_write_error) + g10_exit (0); +} + + /* Write an ERROR status line using a full gpg-error error value. */ void write_status_error (const char *where, gpg_error_t err) |