aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpg/t-support.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-06-16 15:42:37 +0000
committerWerner Koch <[email protected]>2009-06-16 15:42:37 +0000
commitbebd9cbe29cf6db15469502b5c6b1f83c93513ef (patch)
treef2812ddbb4ddd2f00592b36a6c16cbf494cc7f81 /tests/gpg/t-support.h
parentdoc/ (diff)
downloadgpgme-bebd9cbe29cf6db15469502b5c6b1f83c93513ef.tar.gz
gpgme-bebd9cbe29cf6db15469502b5c6b1f83c93513ef.zip
Add support for gpg --fetch-keys.
Diffstat (limited to 'tests/gpg/t-support.h')
-rw-r--r--tests/gpg/t-support.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/gpg/t-support.h b/tests/gpg/t-support.h
index 362b857a..13475f29 100644
--- a/tests/gpg/t-support.h
+++ b/tests/gpg/t-support.h
@@ -48,6 +48,13 @@
while (0)
+static const char *
+nonnull (const char *s)
+{
+ return s? s :"[none]";
+}
+
+
void
print_data (gpgme_data_t dh)
{
@@ -113,3 +120,57 @@ init_gpgme (gpgme_protocol_t proto)
err = gpgme_engine_check_version (proto);
fail_if_err (err);
}
+
+
+void
+print_import_result (gpgme_import_result_t r)
+{
+ gpgme_import_status_t st;
+
+ for (st=r->imports; st; st = st->next)
+ {
+ printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr),
+ st->result, gpg_strerror (st->result));
+ if (st->status & GPGME_IMPORT_NEW)
+ fputs (" new", stdout);
+ if (st->status & GPGME_IMPORT_UID)
+ fputs (" uid", stdout);
+ if (st->status & GPGME_IMPORT_SIG)
+ fputs (" sig", stdout);
+ if (st->status & GPGME_IMPORT_SUBKEY)
+ fputs (" subkey", stdout);
+ if (st->status & GPGME_IMPORT_SECRET)
+ fputs (" secret", stdout);
+ putchar ('\n');
+ }
+ printf ("key import summary:\n"
+ " considered: %d\n"
+ " no user id: %d\n"
+ " imported: %d\n"
+ " imported_rsa: %d\n"
+ " unchanged: %d\n"
+ " new user ids: %d\n"
+ " new subkeys: %d\n"
+ " new signatures: %d\n"
+ " new revocations: %d\n"
+ " secret read: %d\n"
+ " secret imported: %d\n"
+ " secret unchanged: %d\n"
+ " skipped new keys: %d\n"
+ " not imported: %d\n",
+ r->considered,
+ r->no_user_id,
+ r->imported,
+ r->imported_rsa,
+ r->unchanged,
+ r->new_user_ids,
+ r->new_sub_keys,
+ r->new_signatures,
+ r->new_revocations,
+ r->secret_read,
+ r->secret_imported,
+ r->secret_unchanged,
+ r->skipped_new_keys,
+ r->not_imported);
+}
+