[PATCH 1/2] add --keyid-format=none

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Jan 28 00:07:01 CET 2016


---
 doc/gpg.texi  | 2 +-
 g10/gpg.c     | 4 +++-
 g10/keyid.c   | 8 ++++++++
 g10/options.h | 2 +-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/doc/gpg.texi b/doc/gpg.texi
index e1835cf..40eb8db 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -1596,7 +1596,7 @@ mechanisms, in the order they are to be tried:
 
 @end table
 
- at item --keyid-format @code{short|0xshort|long|0xlong}
+ at item --keyid-format @code{none|short|0xshort|long|0xlong}
 @opindex keyid-format
 Select how to display key IDs. "short" is the traditional 8-character
 key ID. "long" is the more accurate (but less convenient)
diff --git a/g10/gpg.c b/g10/gpg.c
index 56bbd0d..d660d47 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3235,7 +3235,9 @@ main (int argc, char **argv)
           case oEnableProgressFilter: opt.enable_progress_filter = 1; break;
 	  case oMultifile: multifile=1; break;
 	  case oKeyidFormat:
-	    if(ascii_strcasecmp(pargs.r.ret_str,"short")==0)
+	    if(ascii_strcasecmp(pargs.r.ret_str,"none")==0)
+	      opt.keyid_format=KF_NONE;
+	    else if(ascii_strcasecmp(pargs.r.ret_str,"short")==0)
 	      opt.keyid_format=KF_SHORT;
 	    else if(ascii_strcasecmp(pargs.r.ret_str,"long")==0)
 	      opt.keyid_format=KF_LONG;
diff --git a/g10/keyid.c b/g10/keyid.c
index f684276..0bbd05d 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -288,6 +288,11 @@ format_keyid (u32 *keyid, int format, char *buffer, int len)
 
   switch (format)
     {
+    case KF_NONE:
+      if (len > 0)
+        buffer[0] = '\0';
+      break;
+      
     case KF_SHORT:
       snprintf (buffer, len, "%08lX", (ulong)keyid[1]);
       break;
@@ -330,6 +335,9 @@ keystrlen(void)
 
   switch(format)
     {
+    case KF_NONE:
+      return 0;
+      
     case KF_SHORT:
       return 8;
 
diff --git a/g10/options.h b/g10/options.h
index 1407b2f..f8550d1 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -136,7 +136,7 @@ struct
     } compliance;
   enum
     {
-      KF_DEFAULT, KF_SHORT, KF_LONG, KF_0xSHORT, KF_0xLONG
+      KF_DEFAULT, KF_SHORT, KF_LONG, KF_0xSHORT, KF_0xLONG, KF_NONE
     } keyid_format;
   int shm_coprocess;
   const char *set_filename;
-- 
2.7.0.rc3




More information about the Gnupg-devel mailing list