diff options
author | Werner Koch <wk@gnupg.org> | 2015-06-20 15:05:32 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2015-06-20 15:05:32 +0200 |
commit | 0948c4f217308ffa0ec61ce189d387fd61b02bbd (patch) | |
tree | 461701ab3ef47ceeb9ff179a830ddf0c47ab4de9 | |
parent | gpg: Improve speed of --check-sigs and --lish-sigs. (diff) | |
download | gnupg2-0948c4f217308ffa0ec61ce189d387fd61b02bbd.tar.xz gnupg2-0948c4f217308ffa0ec61ce189d387fd61b02bbd.zip |
gpg: Print number of good signatures with --check-sigs.
* g10/keylist.c (keylist_context): Add field good_sigs.
(list_keyblock_print): Updated good_sigs.
(print_signature_stats): Print number of good signatures and use
log_info instead of tty_printf.
Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r-- | g10/keylist.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/g10/keylist.c b/g10/keylist.c index 2cd988d41..d4e572e8b 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -53,6 +53,7 @@ static void print_card_serialno (const char *serialno); struct keylist_context { int check_sigs; /* If set signatures shall be verified. */ + int good_sigs; /* Counter used if CHECK_SIGS is set. */ int inv_sigs; /* Counter used if CHECK_SIGS is set. */ int no_key; /* Counter used if CHECK_SIGS is set. */ int oth_err; /* Counter used if CHECK_SIGS is set. */ @@ -439,19 +440,25 @@ print_signature_stats (struct keylist_context *s) if (!s->check_sigs) return; /* Signature checking was not requested. */ + if (s->good_sigs == 1) + log_info (_("1 good signature\n")); + else if (s->good_sigs) + log_info (_("%d good signatures\n"), s->good_sigs); + if (s->inv_sigs == 1) - tty_printf (_("1 bad signature\n")); + log_info (_("1 bad signature\n")); else if (s->inv_sigs) - tty_printf (_("%d bad signatures\n"), s->inv_sigs); + log_info (_("%d bad signatures\n"), s->inv_sigs); + if (s->no_key == 1) - tty_printf (_("1 signature not checked due to a missing key\n")); + log_info (_("1 signature not checked due to a missing key\n")); else if (s->no_key) - tty_printf (_("%d signatures not checked due to missing keys\n"), - s->no_key); + log_info (_("%d signatures not checked due to missing keys\n"), s->no_key); + if (s->oth_err == 1) - tty_printf (_("1 signature not checked due to an error\n")); + log_info (_("1 signature not checked due to an error\n")); else if (s->oth_err) - tty_printf (_("%d signatures not checked due to errors\n"), s->oth_err); + log_info (_("%d signatures not checked due to errors\n"), s->oth_err); } @@ -1138,6 +1145,7 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, switch (gpg_err_code (rc)) { case 0: + listctx->good_sigs++; sigrc = '!'; break; case GPG_ERR_BAD_SIGNATURE: |