From: Werner Koch Date: Wed, 25 Jun 2008 01:44:50 +0000 (+0000) Subject: Updated example. X-Git-Tag: gpgme-1.2.0@1385~64 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7e3d3a7c02376bb029d1badb1479b2288d6d69a;p=gpgme.git Updated example. --- diff --git a/trunk/doc/ChangeLog b/trunk/doc/ChangeLog index e7f113d..a6adbdb 100644 --- a/trunk/doc/ChangeLog +++ b/trunk/doc/ChangeLog @@ -1,3 +1,8 @@ +2008-06-25 Werner Koch + + * gpgme.texi (Listing Keys): Updated example to the current API. + Noted by Nico Schottelius. + 2008-06-05 Werner Koch * uiserver.texi (Miscellaneous UI Server Commands): Describe diff --git a/trunk/doc/gpgme.texi b/trunk/doc/gpgme.texi index b5fba15..2b96d87 100644 --- a/trunk/doc/gpgme.texi +++ b/trunk/doc/gpgme.texi @@ -2772,6 +2772,7 @@ and e-mail address of the main user ID: @example gpgme_ctx_t ctx; +gpgme_key_t key; gpgme_error_t err = gpgme_new (&ctx); if (!err) @@ -2782,15 +2783,19 @@ if (!err) err = gpgme_op_keylist_next (ctx, &key); if (err) break; - printf ("%s: %s <%s>\n", key->keyid, key->name, key->email); + printf ("%s:", key->subkeys->keyid); + if (key->uids && key->uids->name) + printf (" %s", key->uids->name); + if (key->uids && key->uids->email) + printf (" <%s>", key->uids->email); + putchar ('\n'); gpgme_key_release (key); @} gpgme_release (ctx); @} if (gpg_err_code (err) != GPG_ERR_EOF) @{ - fprintf (stderr, "%s: can not list keys: %s\n", - argv[0], gpgme_strerror (err)); + fprintf (stderr, "can not list keys: %s\n", gpgme_strerror (err)); exit (1); @} @end example