mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Use only one copy of the warn_server_mismatch function.
* common/asshelp.c (warn_server_version_mismatch): New. Actually a slightly modified version of warn_version_mismatch found in other modules. * common/status.c (gnupg_status_strings): New. * g10/cpr.c (write_status_strings2): New. * g10/call-agent.c (warn_version_mismatch): Use the new unified warn_server_version_mismatch function. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * g10/call-keyboxd.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. * tools/card-call-scd.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
16c1d8a14e
commit
2cd8bae23d
13 changed files with 174 additions and 206 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue