aboutsummaryrefslogtreecommitdiffstats
path: root/common/status.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/status.c')
-rw-r--r--common/status.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/common/status.c b/common/status.c
index 269ffea5d..b752c12c6 100644
--- a/common/status.c
+++ b/common/status.c
@@ -105,6 +105,47 @@ gnupg_status_printf (int no, const char *format, ...)
}
+/* Write a status line with code NO followed by the remaining
+ * arguments which must be a list of strings terminated by a NULL.
+ * Embedded CR and LFs in the strings are C-style escaped. All
+ * strings are printed with a space as delimiter. */
+gpg_error_t
+gnupg_status_strings (ctrl_t dummy, int no, ...)
+{
+ va_list arg_ptr;
+ const char *s;
+
+ (void)dummy;
+
+ if (!statusfp)
+ return 0; /* Not enabled. */
+
+ va_start (arg_ptr, no);
+
+ es_fputs ("[GNUPG:] ", statusfp);
+ es_fputs (get_status_string (no), statusfp);
+ while ((s = va_arg (arg_ptr, const char*)))
+ {
+ if (*s)
+ es_putc (' ', statusfp);
+ for (; *s; s++)
+ {
+ if (*s == '\n')
+ es_fputs ("\\n", statusfp);
+ else if (*s == '\r')
+ es_fputs ("\\r", statusfp);
+ else
+ es_fputc (*(const byte *)s, statusfp);
+ }
+ }
+ es_putc ('\n', statusfp);
+ es_fflush (statusfp);
+
+ va_end (arg_ptr);
+ return 0;
+}
+
+
const char *
get_inv_recpsgnr_code (gpg_error_t err)
{