diff options
author | Werner Koch <wk@gnupg.org> | 2002-09-02 12:59:04 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2002-09-02 12:59:04 +0200 |
commit | 5819b1ee45461316e2936420d534ddbcba71d9d4 (patch) | |
tree | 6fd4b4f3e571df1ce77610d3f481a87bf8378378 /g10/import.c | |
parent | * gpg.sgml: Updated the charset option. (diff) | |
download | gnupg2-5819b1ee45461316e2936420d534ddbcba71d9d4.tar.xz gnupg2-5819b1ee45461316e2936420d534ddbcba71d9d4.zip |
* g10.c (main): Try to set a default character set. Print the
used one in verbosity level 3.
* gpgv.c (main): Try to set a default character set.
* status.c, status.h (STATUS_IMPORT_OK): New.
* import.c (import_one,import_secret_one): Print new status.
Diffstat (limited to 'g10/import.c')
-rw-r--r-- | g10/import.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c index 03adafb2b..706627f45 100644 --- a/g10/import.c +++ b/g10/import.c @@ -516,6 +516,29 @@ fix_hkp_corruption(KBNODE keyblock) return changed; } + +static void +print_import_ok (PKT_public_key *pk, PKT_secret_key *sk, unsigned int reason) +{ + byte array[MAX_FINGERPRINT_LEN], *s; + char buf[MAX_FINGERPRINT_LEN*2+30], *p; + size_t i, n; + + sprintf (buf, "%u ", reason); + p = buf + strlen (buf); + + if (pk) + fingerprint_from_pk (pk, array, &n); + else + fingerprint_from_sk (sk, array, &n); + s = array; + for (i=0; i < n ; i++, s++, p += 2) + sprintf (p, "%02X", *s); + + write_status_text (STATUS_IMPORT_OK, buf); +} + + /**************** * Try to import one keyblock. Return an error only in serious cases, but * never for an invalid keyblock. It uses log_error to increase the @@ -645,6 +668,7 @@ import_one( const char *fname, KBNODE keyblock, int fast, char *us = get_long_user_id_string( keyid ); write_status_text( STATUS_IMPORTED, us ); m_free(us); + print_import_ok (pk,NULL, 1); } stats->imported++; if( is_RSA( pk->pubkey_algo ) ) @@ -736,8 +760,15 @@ import_one( const char *fname, KBNODE keyblock, int fast, stats->n_uids +=n_uids; stats->n_sigs +=n_sigs; stats->n_subk +=n_subk; + + if (is_status_enabled ()) + print_import_ok (pk, NULL, + ((n_uids?2:0)|(n_sigs?4:0)|(n_subk?8:0))); } else { + if (is_status_enabled ()) + print_import_ok (pk, NULL, 0); + if( !opt.quiet ) { char *p=get_user_id_printable(keyid); log_info( _("key %08lX: \"%s\" not changed\n"), @@ -823,11 +854,15 @@ import_secret_one( const char *fname, KBNODE keyblock, if( !opt.quiet ) log_info( _("key %08lX: secret key imported\n"), (ulong)keyid[1]); stats->secret_imported++; + if (is_status_enabled ()) + print_import_ok (NULL, sk, 1|16); } else if( !rc ) { /* we can't merge secret keys */ log_error( _("key %08lX: already in secret keyring\n"), (ulong)keyid[1]); stats->secret_dups++; + if (is_status_enabled ()) + print_import_ok (NULL, sk, 16); } else log_error( _("key %08lX: secret key not found: %s\n"), |