[Pkg-gnupg-commit] [gnupg2] 45/118: gpg: Add new function write_status_printf.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 15 18:25:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch encoding-and-speling
in repository gnupg2.

commit 6bdadae00512b4907826f6754cdb220d06e1ac6d
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Sep 1 16:33:21 2016 +0200

    gpg: Add new function write_status_printf.
    
    * g10/cpr.c (write_status_printf): New.
    --
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g10/cpr.c  | 27 +++++++++++++++++++++++++++
 g10/main.h |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/g10/cpr.c b/g10/cpr.c
index 9d8fec9..80af2c0 100644
--- a/g10/cpr.c
+++ b/g10/cpr.c
@@ -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)
diff --git a/g10/main.h b/g10/main.h
index 0956f66..340f3b3 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -191,6 +191,8 @@ void write_status_error (const char *where, gpg_error_t err);
 void write_status_errcode (const char *where, int errcode);
 void write_status_failure (const char *where, gpg_error_t err);
 void write_status_text ( int no, const char *text );
+void write_status_printf (int no, const char *format,
+                          ...) GPGRT_ATTR_PRINTF(2,3);
 void write_status_strings (int no, const char *text,
                            ...) GPGRT_ATTR_SENTINEL(0);
 void write_status_buffer ( int no,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list