1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: Simplify an interactive import status line.

* g10/cpr.c (write_status_printf): Escape CR and LF.
* g10/import.c (print_import_check): Simplify by using
write_status_printf and hexfingerprint.

Signed-off-by: Werner Koch <wk@gnupg.org>

Fixed one conlict in a comment.
This commit is contained in:
Werner Koch 2019-03-15 13:02:44 +01:00
parent ee08a15e31
commit 184fbf014a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 34 additions and 19 deletions

View file

@ -1080,23 +1080,14 @@ print_import_ok (PKT_public_key *pk, unsigned int reason)
static void
print_import_check (PKT_public_key * pk, PKT_user_id * id)
{
char * buf;
byte fpr[24];
byte hexfpr[2*MAX_FINGERPRINT_LEN+1];
u32 keyid[2];
size_t i, n;
size_t pos = 0;
buf = xmalloc (17+41+id->len+32);
keyid_from_pk (pk, keyid);
sprintf (buf, "%08X%08X ", keyid[0], keyid[1]);
pos = 17;
fingerprint_from_pk (pk, fpr, &n);
for (i = 0; i < n; i++, pos += 2)
sprintf (buf+pos, "%02X", fpr[i]);
strcat (buf, " ");
strcat (buf, id->name);
write_status_text (STATUS_IMPORT_CHECK, buf);
xfree (buf);
hexfingerprint (pk, hexfpr, sizeof hexfpr);
write_status_printf (STATUS_IMPORT_CHECK, "%08X%08X %s %s",
keyid[0], keyid[1], hexfpr, id->name);
}