diff options
author | Werner Koch <[email protected]> | 2003-10-02 10:20:12 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2003-10-02 10:20:12 +0000 |
commit | 99cabff03f3d27f7ac2a12b837b17a538be1fe1f (patch) | |
tree | 0a15a78faf6e50798ededc50e498bcbce28ae2bf /g10/keylist.c | |
parent | * g10.c (main): Add --no-groups to zero --group list. (diff) | |
download | gnupg-99cabff03f3d27f7ac2a12b837b17a538be1fe1f.tar.gz gnupg-99cabff03f3d27f7ac2a12b837b17a538be1fe1f.zip |
* cardglue.c (learn_status_cb): Release values before assignment
so that it can be used by getattr to update the structure.
(agent_scd_getattr): New.
* keylist.c (print_pubkey_info): Add FP arg for optional printing
to a stream. Changed all callers.
Diffstat (limited to 'g10/keylist.c')
-rw-r--r-- | g10/keylist.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/g10/keylist.c b/g10/keylist.c index 9970f0cb2..06edfa11b 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -129,25 +129,39 @@ print_seckey_info (PKT_secret_key *sk) tty_printf ("\n"); } +/* Print information about the public key. With FP passed as NULL, + the tty output interface is used, otherwise output is directted to + the given stream. */ void -print_pubkey_info (PKT_public_key *pk) +print_pubkey_info (FILE *fp, PKT_public_key *pk) { u32 pk_keyid[2]; size_t n; char *p; keyid_from_pk (pk, pk_keyid); - tty_printf ("\npub %4u%c/%08lX %s ", - nbits_from_pk (pk), - pubkey_letter (pk->pubkey_algo), - (ulong)pk_keyid[1], datestr_from_pk (pk)); - + if (fp) + fprintf (fp, "pub %4u%c/%08lX %s ", + nbits_from_pk (pk), + pubkey_letter (pk->pubkey_algo), + (ulong)pk_keyid[1], datestr_from_pk (pk)); + else + tty_printf ("\npub %4u%c/%08lX %s ", + nbits_from_pk (pk), + pubkey_letter (pk->pubkey_algo), + (ulong)pk_keyid[1], datestr_from_pk (pk)); p = get_user_id (pk_keyid, &n); - tty_print_utf8_string (p, n); + if (fp) + print_utf8_string2 (fp, p, n, '\n'); + else + tty_print_utf8_string (p, n); m_free (p); - tty_printf ("\n\n"); + if (fp) + putc ('\n', fp); + else + tty_printf ("\n\n"); } /* |