From 88908420120fd19a125654cc5fb62299536e7ed5 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 10 Feb 2004 03:38:15 +0000 Subject: [PATCH] * misc.c (compress_algo_to_string): Return NULL on failure like all of the other xxxx_algo_to_string() functions. * mainproc.c (list_node): Minor spacing tweak to match --list-keys output. * keylist.c (list_keyblock_print), mainproc.c (list_node): Mark revoked subkeys as revoked. Requested by Matthew Wilcox. Make revoked and expired tags translatable (they are already translated elsewhere). Revoked overrides expiration when both apply. * keyedit.c (show_prefs): Use compress algo constants. (show_basic_key_info): Make revoked and expired tags translatable (show_key_with_all_names): Revoked overrides expired when both apply. --- g10/ChangeLog | 18 ++++++++++++++++++ g10/keyedit.c | 18 +++++++++--------- g10/keylist.c | 14 ++++++++++---- g10/mainproc.c | 20 +++++++++++++------- g10/misc.c | 5 +++-- 5 files changed, 53 insertions(+), 22 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index e093bd685..016aae9f9 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,21 @@ +2004-02-09 David Shaw + + * misc.c (compress_algo_to_string): Return NULL on failure like + all of the other xxxx_algo_to_string() functions. + + * mainproc.c (list_node): Minor spacing tweak to match --list-keys + output. + + * keylist.c (list_keyblock_print), mainproc.c (list_node): Mark + revoked subkeys as revoked. Requested by Matthew Wilcox. Make + revoked and expired tags translatable (they are already translated + elsewhere). Revoked overrides expiration when both apply. + + * keyedit.c (show_prefs): Use compress algo constants. + (show_basic_key_info): Make revoked and expired tags translatable + (show_key_with_all_names): Revoked overrides expired when both + apply. + 2004-02-06 David Shaw * getkey.c (merge_selfsigs_main): Properly handle expired user IDs diff --git a/g10/keyedit.c b/g10/keyedit.c index eb33ac532..55e0cd90f 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1,6 +1,6 @@ /* keyedit.c - keyedit stuff - * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, + * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -1626,7 +1626,7 @@ show_prefs (PKT_user_id *uid, int verbose) tty_printf ("%s", s ); else tty_printf ("[%d]", prefs[i].value); - if (prefs[i].value == 0 ) + if (prefs[i].value == COMPRESS_ALGO_NONE ) uncomp_seen = 1; } } @@ -1634,10 +1634,10 @@ show_prefs (PKT_user_id *uid, int verbose) if (any) tty_printf (", "); else { - tty_printf ("%s",compress_algo_to_string(1)); + tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_ZIP)); tty_printf (", "); } - tty_printf ("%s",compress_algo_to_string(0)); + tty_printf ("%s",compress_algo_to_string(COMPRESS_ALGO_NONE)); } if(uid->mdc_feature) { @@ -1954,7 +1954,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker, tty_printf("(%d) ", i); if ( uid->is_revoked ) tty_printf (_("[revoked] ")); - if ( uid->is_expired ) + else if ( uid->is_expired ) tty_printf (_("[expired] ")); tty_print_utf8_string( uid->name, uid->len ); tty_printf("\n"); @@ -2036,9 +2036,9 @@ show_basic_key_info ( KBNODE keyblock ) tty_printf (" "); if (uid->is_revoked) - tty_printf ("[revoked] "); - if ( uid->is_expired ) - tty_printf ("[expired] "); + tty_printf (_("[revoked] ")); + else if ( uid->is_expired ) + tty_printf (_("[expired] ")); tty_print_utf8_string (uid->name, uid->len); tty_printf ("\n"); } diff --git a/g10/keylist.c b/g10/keylist.c index 061e51e91..096a21b59 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -489,8 +489,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque ) printf("uid%*s", 28, ""); if ( node->pkt->pkt.user_id->is_revoked ) - fputs ("[revoked] ", stdout); - if ( node->pkt->pkt.user_id->is_expired ) + fputs (_("[revoked] "), stdout); + else if ( node->pkt->pkt.user_id->is_expired ) fputs ("[expired] ", stdout); print_utf8_string( stdout, node->pkt->pkt.user_id->name, node->pkt->pkt.user_id->len ); @@ -523,9 +523,15 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque ) pubkey_letter( pk2->pubkey_algo ), (ulong)keyid2[1], datestr_from_pk( pk2 ) ); - if( pk2->expiredate ) { + /* Yes, this is an odd way to print the revoked string, + but we already have translations for "[revoked] " (with + the trailing space) and this is a simple way to take + advantage of it. In devel, this will be done rather + more elegantly. */ + if( pk2->is_revoked ) + printf(" %s",_("[revoked] ")); + else if( pk2->expiredate ) printf(_(" [expires: %s]"), expirestr_from_pk( pk2 ) ); - } putchar('\n'); if( fpr > 1 ) print_fingerprint( pk2, NULL, 0 ); diff --git a/g10/mainproc.c b/g10/mainproc.c index 6f8f45720..ebb00ee70 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1,6 +1,6 @@ /* mainproc.c - handle packets - * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, + * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -881,12 +881,13 @@ list_node( CTX c, KBNODE node ) } } else - printf("%s %4u%c/%08lX %s ", + printf("%s %4u%c/%08lX %s%s", mainkey? "pub":"sub", nbits_from_pk( pk ), pubkey_letter( pk->pubkey_algo ), (ulong)keyid_from_pk( pk, NULL ), - datestr_from_pk( pk ) ); + datestr_from_pk( pk ), + mainkey?" ":""); if( mainkey ) { /* and now list all userids with their signatures */ @@ -931,9 +932,14 @@ list_node( CTX c, KBNODE node ) } } } - else if( pk->expiredate ) { /* of subkey */ - printf(_(" [expires: %s]"), expirestr_from_pk( pk ) ); - } + else + { + /* of subkey */ + if( pk->is_revoked ) + printf(" %s",_("[revoked] ")); + else if( pk->expiredate ) + printf(_(" [expires: %s]"), expirestr_from_pk( pk ) ); + } if( !any ) putchar('\n'); diff --git a/g10/misc.c b/g10/misc.c index 3d1c12e6a..2b6f92f20 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1,5 +1,6 @@ /* misc.c - miscellaneous functions - * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + * 2004 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -542,7 +543,7 @@ deprecated_warning(const char *configname,unsigned int configlineno, const char * compress_algo_to_string(int algo) { - const char *s="?"; + const char *s=NULL; switch(algo) {