gnupg/g10 (ChangeLog gpgv.c keyedit.c keylist.c trustdb.c trustdb.h)
cvs user dshaw
cvs at cvs.gnupg.org
Wed Nov 24 06:18:23 CET 2004
Date: Wednesday, November 24, 2004 @ 06:25:03
Author: dshaw
Path: /cvs/gnupg/gnupg/g10
Modified: ChangeLog gpgv.c keyedit.c keylist.c trustdb.c trustdb.h
* trustdb.h, trustdb.c (uid_trust_string_fixed): New. Return a fixed-size
translatable string similar to trust_value_to_string. This allows for
easier lining up of displays.
* keyedit.c (show_key_with_all_names), keylist.c (list_keyblock_print):
Use it here to print validity strings.
* gpgv.c: Stub.
-----------+
ChangeLog | 11 +++++++++++
gpgv.c | 7 ++++++-
keyedit.c | 21 ++++++---------------
keylist.c | 14 ++++----------
trustdb.c | 28 ++++++++++++++++++++++++++++
trustdb.h | 6 +++---
6 files changed, 58 insertions(+), 29 deletions(-)
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.640 gnupg/g10/ChangeLog:1.641
--- gnupg/g10/ChangeLog:1.640 Thu Nov 18 17:01:08 2004
+++ gnupg/g10/ChangeLog Wed Nov 24 06:25:02 2004
@@ -1,3 +1,14 @@
+2004-11-24 David Shaw <dshaw at jabberwocky.com>
+
+ * trustdb.h, trustdb.c (uid_trust_string_fixed): New. Return a
+ fixed-size translatable string similar to trust_value_to_string.
+ This allows for easier lining up of displays.
+
+ * keyedit.c (show_key_with_all_names), keylist.c
+ (list_keyblock_print): Use it here to print validity strings.
+
+ * gpgv.c: Stub.
+
2004-11-18 Werner Koch <wk at g10code.com>
* g10.c (S_IRGRP) [HAVE_DOSISH_SYSTEM]: Define to 0.
Index: gnupg/g10/gpgv.c
diff -u gnupg/g10/gpgv.c:1.24 gnupg/g10/gpgv.c:1.25
--- gnupg/g10/gpgv.c:1.24 Fri Oct 1 12:18:30 2004
+++ gnupg/g10/gpgv.c Wed Nov 24 06:25:03 2004
@@ -251,7 +251,12 @@
return "err";
}
-/* Stub: */
+const char *
+uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid)
+{
+ return "err";
+}
+
int
get_ownertrust_info (PKT_public_key *pk)
{
Index: gnupg/g10/keyedit.c
diff -u gnupg/g10/keyedit.c:1.156 gnupg/g10/keyedit.c:1.157
--- gnupg/g10/keyedit.c:1.156 Fri Oct 29 00:09:09 2004
+++ gnupg/g10/keyedit.c Wed Nov 24 06:25:03 2004
@@ -892,7 +892,7 @@
while(class==0)
{
answer = cpr_get("sign_uid.class",_("Your selection? "
- "(enter '?' for more information): "));
+ "(enter `?' for more information): "));
if(answer[0]=='\0')
class=0x10+opt.def_cert_level; /* Default */
else if(ascii_strcasecmp(answer,"0")==0)
@@ -2360,16 +2360,7 @@
if( !only_marked || (only_marked && (node->flag & NODFLG_MARK_A)))
{
if(!only_marked)
- {
- if(uid->is_revoked)
- tty_printf(_("[%8.8s] "),_("revoked"));
- else if(uid->is_expired)
- tty_printf(_("[%8.8s] "),_("expired"));
- else if(primary)
- tty_printf(_("[%8.8s] "),
- trust_value_to_string(get_validity(primary,
- uid)));
- }
+ tty_printf("%s ",uid_trust_string_fixed(primary,uid));
if( only_marked )
tty_printf(" ");
@@ -2403,16 +2394,16 @@
show_prefs (uid, selfsig, with_prefs == 2);
}
else
- tty_printf(_("There are no preferences on a "
- "PGP 2.x-style user ID.\n"));
+ tty_printf(_("There are no preferences on a"
+ " PGP 2.x-style user ID.\n"));
}
}
}
}
if (do_warn)
- tty_printf (_("Please note that the shown key validity "
- "is not necessarily correct\n"
+ tty_printf (_("Please note that the shown key validity"
+ " is not necessarily correct\n"
"unless you restart the program.\n"));
}
Index: gnupg/g10/keylist.c
diff -u gnupg/g10/keylist.c:1.89 gnupg/g10/keylist.c:1.90
--- gnupg/g10/keylist.c:1.89 Thu Oct 28 05:14:55 2004
+++ gnupg/g10/keylist.c Wed Nov 24 06:25:03 2004
@@ -778,19 +778,13 @@
const char *validity;
int indent;
- if(uid->is_revoked)
- validity=_("revoked");
- else if(uid->is_expired)
- validity=_("expired");
- else
- validity=trust_value_to_string(get_validity(pk,uid));
+ validity=uid_trust_string_fixed(pk,uid);
+ indent=(keystrlen()+9)-atoi(uid_trust_string_fixed(NULL,NULL));
- indent=(keystrlen()+7)-strlen(validity);
-
- if(indent<0)
+ if(indent<0 || indent>40)
indent=0;
- printf("uid%*s[%s] ",indent,"",validity);
+ printf("uid%*s%s ",indent,"",validity);
}
else
printf("uid%*s",keystrlen()+10,"");
Index: gnupg/g10/trustdb.c
diff -u gnupg/g10/trustdb.c:1.131 gnupg/g10/trustdb.c:1.132
--- gnupg/g10/trustdb.c:1.131 Wed Oct 13 17:34:52 2004
+++ gnupg/g10/trustdb.c Wed Nov 24 06:25:03 2004
@@ -489,6 +489,34 @@
}
}
+/* NOTE TO TRANSLATOR: these strings are similar to those in
+ trust_value_to_string(), but are a fixed length. This is needed to
+ make attractive information listings where columns line up
+ properly. The value "10" should be the length of the strings you
+ choose to translate to. This is the length in printable
+ columns. */
+const char *
+uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid)
+{
+ if(!key && !uid)
+ return _("10");
+ else if(uid->is_revoked)
+ return _("[ revoked]");
+ else if(uid->is_expired)
+ return _("[ expired]");
+ else if(key)
+ switch(get_validity(key,uid)&TRUST_MASK)
+ {
+ case TRUST_UNKNOWN: return _("[ unknown]");
+ case TRUST_UNDEFINED: return _("[ undef ]");
+ case TRUST_MARGINAL: return _("[marginal]");
+ case TRUST_FULLY: return _("[ full ]");
+ case TRUST_ULTIMATE: return _("[ultimate]");
+ }
+
+ return "err";
+}
+
/* The strings here are similar to those in
pkclist.c:do_edit_ownertrust() */
const char *
Index: gnupg/g10/trustdb.h
diff -u gnupg/g10/trustdb.h:1.48 gnupg/g10/trustdb.h:1.49
--- gnupg/g10/trustdb.h:1.48 Sat Nov 1 02:13:16 2003
+++ gnupg/g10/trustdb.h Wed Nov 24 06:25:03 2004
@@ -1,6 +1,6 @@
/* trustdb.h - Trust database
- * 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.
*
@@ -22,7 +22,6 @@
#ifndef G10_TRUSTDB_H
#define G10_TRUSTDB_H
-
/* Trust values must be sorted in ascending order */
#define TRUST_MASK 15
#define TRUST_UNKNOWN 0 /* o: not yet calculated/assigned */
@@ -48,6 +47,7 @@
void check_trustdb_stale(void);
void sync_trustdb( void );
+const char *uid_trust_string_fixed(PKT_public_key *key,PKT_user_id *uid);
const char *trust_value_to_string (unsigned int value);
int string_to_trust_value (const char *str);
More information about the Gnupg-commits
mailing list