[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-268-ge951782

by Werner Koch cvs at cvs.gnupg.org
Wed Nov 27 09:22:12 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  e951782e937ce290be0d89d83e84b3daea997587 (commit)
      from  cc9a0b69b698ba436eaf777e5020532845b56236 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e951782e937ce290be0d89d83e84b3daea997587
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Nov 27 09:20:02 2013 +0100

    gpg: Change armor Version header to emit only the major version.
    
    * g10/options.h (opt): Rename field no_version to emit_version.
    * g10/gpg.c (main): Init opt.emit_vesion to 1.  Change --emit-version
    to bump up opt.emit_version.
    * g10/armor.c (armor_filter): Implement different --emit-version
    values.
    --
    
    GnuPG-bug-id: 1572
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/NEWS b/NEWS
index ab1c597..7eb1fe9 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ Noteworthy changes in version 2.1.0-betaN (unreleased)
 
  * Fixed bug with deeply nested compressed packets.
 
+ * Only the major version number is by default included in the armored
+   output.
+
 
 Noteworthy changes in version 2.1.0beta3 (2011-12-20)
 -----------------------------------------------------
diff --git a/doc/gpg.texi b/doc/gpg.texi
index c588d7a..26179bd 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2408,8 +2408,12 @@ protected by the signature.
 @item --emit-version
 @itemx --no-emit-version
 @opindex emit-version
-Force inclusion of the version string in ASCII armored output.
- at option{--no-emit-version} disables this option.
+Force inclusion of the version string in ASCII armored output.  If
+given once only the name of the program and the major number is
+emitted (default), given twice the minor is also emitted, given triple
+the micro is added, and given quad an operating system identification
+is also emitted.  @option{--no-emit-version} disables the version
+line.
 
 @item --sig-notation @code{name=value}
 @itemx --cert-notation @code{name=value}
diff --git a/g10/armor.c b/g10/armor.c
index 9a43389..efdc92e 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -1077,10 +1077,24 @@ armor_filter( void *opaque, int control,
 	    iobuf_writestr(a, head_strings[afx->what] );
 	    iobuf_writestr(a, "-----" );
 	    iobuf_writestr(a,afx->eol);
-	    if( !opt.no_version )
+	    if (opt.emit_version)
 	      {
-		iobuf_writestr(a, "Version: "GNUPG_NAME" v"  VERSION " ("
-			       PRINTABLE_OS_NAME ")" );
+		iobuf_writestr (a, "Version: "GNUPG_NAME" v");
+                for (s=VERSION; *s && *s != '.'; s++)
+                  iobuf_writebyte (a, *s);
+                if (opt.emit_version > 1 && *s)
+                  {
+                    iobuf_writebyte (a, *s++);
+                    for (; *s && *s != '.'; s++)
+                      iobuf_writebyte (a, *s);
+                    if (opt.emit_version > 2)
+                      {
+                        for (; *s && *s != '-' && !spacep (s); s++)
+                          iobuf_writebyte (a, *s);
+                        if (opt.emit_version > 3)
+                          iobuf_writestr (a, " (" PRINTABLE_OS_NAME ")");
+                      }
+                  }
 		iobuf_writestr(a,afx->eol);
 	      }
 
diff --git a/g10/gpg.c b/g10/gpg.c
index 8e0aed0..085f2e0 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2013,6 +2013,7 @@ main (int argc, char **argv)
     opt.def_cert_expire = "0";
     set_homedir (default_homedir ());
     opt.passphrase_repeat = 1;
+    opt.emit_version = 1; /* Limit to the major number.  */
 
     /* Check whether we have a config file on the command line.  */
     orig_argc = argc;
@@ -2318,8 +2319,8 @@ main (int argc, char **argv)
           case oQuickRandom:
             gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
             break;
-	  case oEmitVersion: opt.no_version=0; break;
-	  case oNoEmitVersion: opt.no_version=1; break;
+	  case oEmitVersion: opt.emit_version++; break;
+	  case oNoEmitVersion: opt.emit_version=0; break;
 	  case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break;
 	  case oMarginalsNeeded: opt.marginals_needed = pargs.r.ret_int; break;
 	  case oMaxCertDepth: opt.max_cert_depth = pargs.r.ret_int; break;
diff --git a/g10/options.h b/g10/options.h
index d44d7a1..f9878bd 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -91,7 +91,11 @@ struct
   int def_cert_level;
   int min_cert_level;
   int ask_cert_level;
-  int no_version;
+  int emit_version;       /* 0 = none,
+                             1 = major only,
+                             2 = major and minor,
+                             3 = full version,
+                             4 = full version plus OS string. */
   int marginals_needed;
   int completes_needed;
   int max_cert_depth;

-----------------------------------------------------------------------

Summary of changes:
 NEWS          |    3 +++
 doc/gpg.texi  |    8 ++++++--
 g10/armor.c   |   20 +++++++++++++++++---
 g10/gpg.c     |    5 +++--
 g10/options.h |    6 +++++-
 5 files changed, 34 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list