aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keylist.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-07-24 09:06:43 +0000
committerWerner Koch <[email protected]>2003-07-24 09:06:43 +0000
commit0fe6a1287fe447afb852dd9b4734c374c90d0740 (patch)
tree56ea9a8d827fba15394ff5f71b1f310c9d488445 /g10/keylist.c
parent* keygen.c (generate_keypair): Create an AUTHKEYTYPE entry for cards. (diff)
downloadgnupg-0fe6a1287fe447afb852dd9b4734c374c90d0740.tar.gz
gnupg-0fe6a1287fe447afb852dd9b4734c374c90d0740.zip
* g10.c: New command --card-status.
* card-util.c (card_status): New. * call-agent.c (learn_status_cb): Parse more information. * keylist.c (print_pubkey_info): Add FP arg for optinal printing to a stream. Changed all callers.
Diffstat (limited to 'g10/keylist.c')
-rw-r--r--g10/keylist.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/g10/keylist.c b/g10/keylist.c
index ef2cb5676..b5549fb47 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -93,25 +93,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);
xfree (p);
- tty_printf ("\n\n");
+ if (fp)
+ putc ('\n', fp);
+ else
+ tty_printf ("\n\n");
}
/*