[PATCH] gpg --shutup

Thomas Roessler roessler@does-not-exist.org
Wed Jul 4 11:25:02 2001


--PmA2V3Z32TCmWXqI
Content-Type: multipart/mixed; boundary="ZGiS0Q5IWpPtfppv"
Content-Disposition: inline


--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

I find gnupg to be far too verbose even with --quiet and=20
--no-verbose.  The attached patches (for the current CVS and for=20
1.0.6) add an option --shutup which eliminates all the options I=20
find annoying in daily usage of gpg (from within mutt).

(The CVS version of the patch is entirely untested since I can't get=20
the CVS to compile.)

--=20
Thomas Roessler                        http://log.does-not-exist.org/

--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch.gnupg-1.06.tlr.shutup.1"
Content-Transfer-Encoding: quoted-printable

diff -ur gnupg-1.0.6.orig/g10/g10.c gnupg-1.0.6/g10/g10.c
--- gnupg-1.0.6.orig/g10/g10.c	Mon May 28 09:02:14 2001
+++ gnupg-1.0.6/g10/g10.c	Wed Jul  4 11:04:45 2001
@@ -124,6 +124,7 @@
     oOptions,
     oDebug,
     oDebugAll,
+    oShutUp,
     oStatusFD,
     oNoComment,
     oNoVersion,
@@ -302,6 +303,7 @@
=20
     { oDebug, "debug"     ,4|16, "@"},
     { oDebugAll, "debug-all" ,0, "@"},
+    { oShutUp, "shutup", 0, N_("Be even more quiet")},
     { oStatusFD, "status-fd" ,1, N_("|FD|write status info to this FD") },
     { oNoComment, "no-comment", 0,   "@"},
     { oCompletesNeeded, "completes-needed", 1, "@"},
@@ -803,6 +805,7 @@
 	  case oArmor: opt.armor =3D 1; opt.no_armor=3D0; break;
 	  case oOutput: opt.outfile =3D pargs.r.ret_str; break;
 	  case oQuiet: opt.quiet =3D 1; break;
+	  case oShutUp: opt.shutup =3D 1; break;
 	  case oNoTTY: tty_no_terminal(1); break;
 	  case oDryRun: opt.dry_run =3D 1; break;
 	  case oInteractive: opt.interactive =3D 1; break;
diff -ur gnupg-1.0.6.orig/g10/getkey.c gnupg-1.0.6/g10/getkey.c
--- gnupg-1.0.6.orig/g10/getkey.c	Sun May 27 16:08:33 2001
+++ gnupg-1.0.6/g10/getkey.c	Wed Jul  4 11:12:09 2001
@@ -2235,7 +2235,8 @@
                 keyid_from_sk( k->pkt->pkt.secret_key, aki );
 	        k =3D get_pubkeyblock( aki );
 	        if( !k ) {
-	            log_info(_("key %08lX: secret key without public key "
+		    if( !opt.shutup )
+	            	log_info(_("key %08lX: secret key without public key "
                                "- skipped\n"),  (ulong)aki[1] );
                     goto skip;
                 }
diff -ur gnupg-1.0.6.orig/g10/mainproc.c gnupg-1.0.6/g10/mainproc.c
--- gnupg-1.0.6.orig/g10/mainproc.c	Sun May 27 16:32:03 2001
+++ gnupg-1.0.6/g10/mainproc.c	Wed Jul  4 11:05:35 2001
@@ -398,8 +398,10 @@
 {
     int result =3D 0;
=20
-    print_pkenc_list( c->pkenc_list, 1 );
-    print_pkenc_list( c->pkenc_list, 0 );
+    if( !opt.shutup ) {
+    	print_pkenc_list( c->pkenc_list, 1 );
+      	print_pkenc_list( c->pkenc_list, 0 );
+    }
=20
     write_status( STATUS_BEGIN_DECRYPTION );
=20
@@ -1507,7 +1509,7 @@
         }
         else if ( c->pipemode.op =3D=3D 'B' )
             ; /* this is a detached signature trough the pipemode handler =
*/
-	else=20
+	else if( !opt.shutup )
 	    log_info(_("old style (PGP 2.x) signature\n"));
=20
 	for( n1 =3D node; n1; (n1 =3D find_next_kbnode(n1, PKT_SIGNATURE )) )
diff -ur gnupg-1.0.6.orig/g10/options.h gnupg-1.0.6/g10/options.h
--- gnupg-1.0.6.orig/g10/options.h	Tue Mar 27 16:24:39 2001
+++ gnupg-1.0.6/g10/options.h	Wed Jul  4 11:05:46 2001
@@ -28,6 +28,7 @@
 struct {
     int verbose;
     int quiet;
+    int shutup;
     unsigned debug;
     int armor;
     int compress;
diff -ur gnupg-1.0.6.orig/g10/pubkey-enc.c gnupg-1.0.6/g10/pubkey-enc.c
--- gnupg-1.0.6.orig/g10/pubkey-enc.c	Thu Mar  8 15:09:05 2001
+++ gnupg-1.0.6/g10/pubkey-enc.c	Wed Jul  4 11:17:12 2001
@@ -185,8 +185,8 @@
 	    /* Don't print a note while we are not on verbose mode,
 	     * the cipher is blowfish and the preferences have twofish
 	     * listed */
-	    if( opt.verbose || dek->algo !=3D CIPHER_ALGO_BLOWFISH
-		|| !is_algo_in_prefs( pk->local_id, PREFTYPE_SYM,
+	    if( opt.verbose && dek->algo !=3D CIPHER_ALGO_BLOWFISH
+		&& !is_algo_in_prefs( pk->local_id, PREFTYPE_SYM,
 						    CIPHER_ALGO_TWOFISH ) )
 		log_info(_(
 		    "NOTE: cipher algorithm %d not found in preferences\n"),
diff -ur gnupg-1.0.6.orig/g10/sig-check.c gnupg-1.0.6/g10/sig-check.c
--- gnupg-1.0.6.orig/g10/sig-check.c	Tue Apr 17 10:03:54 2001
+++ gnupg-1.0.6/g10/sig-check.c	Wed Jul  4 11:06:16 2001
@@ -546,7 +546,8 @@
 	    md_close(md);
 	}
 	else {
-	    log_info ("no subkey for subkey revocation packet\n");
+	    if( !opt.shutup )
+	    	log_info ("no subkey for subkey revocation packet\n");
 	    rc =3D G10ERR_SIG_CLASS;
 	}
     }
diff -ur gnupg-1.0.6.orig/g10/trustdb.c gnupg-1.0.6/g10/trustdb.c
--- gnupg-1.0.6.orig/g10/trustdb.c	Thu Mar  8 15:11:23 2001
+++ gnupg-1.0.6/g10/trustdb.c	Wed Jul  4 11:09:14 2001
@@ -574,7 +574,8 @@
 	memset( pk, 0, sizeof *pk );
 	rc =3D get_pubkey( pk, keyid );
 	if( rc ) {
-	    log_info(_("key %08lX: secret key without public key - skipped\n"),
+	    if( !opt.shutup )
+	    	log_info(_("key %08lX: secret key without public key - skipped\n"),
 							    (ulong)keyid[1] );
 	    goto skip;
 	}

--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch.gnupg-CVS20010704.tlr.shutup.1"
Content-Transfer-Encoding: quoted-printable

Index: g10/gpg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/gpg.c,v
retrieving revision 1.8
diff -u -r1.8 gpg.c
--- g10/gpg.c	2000/10/04 11:16:14	1.8
+++ g10/gpg.c	2001/07/04 09:21:28
@@ -121,6 +121,7 @@
     oOptions,
     oDebug,
     oDebugAll,
+    oShutUp,
     oStatusFD,
     oNoComment,
     oNoVersion,
@@ -288,6 +289,7 @@
=20
     { oDebug, "debug"     ,4|16, "@"},
     { oDebugAll, "debug-all" ,0, "@"},
+    { oShutUp, "shutup", 0, N_("Be even more quiet")},
     { oStatusFD, "status-fd" ,1, N_("|FD|write status info to this FD") },
     { oNoComment, "no-comment", 0,   "@"},
     { oCompletesNeeded, "completes-needed", 1, "@"},
@@ -808,6 +810,7 @@
 	  case oArmor: opt.armor =3D 1; opt.no_armor=3D0; break;
 	  case oOutput: opt.outfile =3D pargs.r.ret_str; break;
 	  case oQuiet: opt.quiet =3D 1; break;
+	  case oShutUp: opt.shutup =3D 1; break;
 	  case oNoTTY: tty_no_terminal(1); break;
 	  case oDryRun: opt.dry_run =3D 1; break;
 	  case oInteractive: opt.interactive =3D 1; break;
Index: g10/mainproc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/mainproc.c,v
retrieving revision 1.105
diff -u -r1.105 mainproc.c
--- g10/mainproc.c	2000/10/06 12:28:43	1.105
+++ g10/mainproc.c	2001/07/04 09:21:32
@@ -313,7 +313,8 @@
 {
     int result =3D 0;
=20
-    print_failed_pkenc( c->failed_pkenc );
+    if( !opt.shutup )
+        print_failed_pkenc( c->failed_pkenc );
=20
     write_status( STATUS_BEGIN_DECRYPTION );
=20
@@ -1278,8 +1279,8 @@
 		return;
 	    }
 	}
-	else
-	    log_info(_("old style (PGP 2.x) signature\n"));
+	else if( !opt.shutup )
+		log_info(_("old style (PGP 2.x) signature\n"));
=20
 	check_sig_and_print( c, node );
     }
Index: g10/options.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/options.h,v
retrieving revision 1.58
diff -u -r1.58 options.h
--- g10/options.h	2000/09/18 14:35:29	1.58
+++ g10/options.h	2001/07/04 09:21:33
@@ -28,6 +28,7 @@
 struct {
     int verbose;
     int quiet;
+    int shutup;
     unsigned int debug;
     int armor;
     int compress;
Index: g10/pubkey-enc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/pubkey-enc.c,v
retrieving revision 1.37
diff -u -r1.37 pubkey-enc.c
--- g10/pubkey-enc.c	2000/09/18 14:35:29	1.37
+++ g10/pubkey-enc.c	2001/07/04 09:21:34
@@ -248,8 +248,8 @@
 	    /* Don't print a note while we are not on verbose mode,
 	     * the cipher is blowfish and the preferences have twofish
 	     * listed */
-	    if( opt.verbose || dek->algo !=3D GCRY_CIPHER_BLOWFISH
-		|| !is_algo_in_prefs( pk->local_id, PREFTYPE_SYM,
+	    if( opt.verbose && dek->algo !=3D GCRY_CIPHER_BLOWFISH
+	       && !is_algo_in_prefs( pk->local_id, PREFTYPE_SYM,
 						    GCRY_CIPHER_TWOFISH ) )
 		log_info(_(
 		    "NOTE: cipher algorithm %d not found in preferences\n"),
Index: g10/sig-check.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/sig-check.c,v
retrieving revision 1.67
diff -u -r1.67 sig-check.c
--- g10/sig-check.c	2000/09/18 14:35:30	1.67
+++ g10/sig-check.c	2001/07/04 09:21:35
@@ -484,7 +484,8 @@
 	    gcry_md_close(md);
 	}
 	else {
-	    log_error("no subkey for subkey revocation packet\n");
+	    if( !opt.shutup )
+	    	log_error("no subkey for subkey revocation packet\n");
 	    rc =3D GPGERR_SIG_CLASS;
 	}
     }
Index: g10/trustdb.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/g10/trustdb.c,v
retrieving revision 1.88
diff -u -r1.88 trustdb.c
--- g10/trustdb.c	2000/10/10 12:58:41	1.88
+++ g10/trustdb.c	2001/07/04 09:21:43
@@ -575,7 +575,8 @@
 	memset( pk, 0, sizeof *pk );
 	rc =3D get_pubkey( pk, keyid );
 	if( rc ) {
-	    log_info(_("key %08lX: secret key without public key - skipped\n"),
+	    if( !opt.shutup )
+	    	log_info(_("key %08lX: secret key without public key - skipped\n"),
 							    (ulong)keyid[1] );
 	    goto skip;
 	}
Index: po/Makefile.in.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/po/Makefile.in.in,v
retrieving revision 1.12
diff -u -r1.12 Makefile.in.in
--- po/Makefile.in.in	2000/12/19 18:28:36	1.12
+++ po/Makefile.in.in	2001/07/04 09:21:44
@@ -62,7 +62,7 @@
 	$(COMPILE) $<
=20
 .po.pox:
-	$(MAKE) $(srcdir)/$(PACKAGE).pot
+	$(MAKE) $(PACKAGE).pot
 	$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
=20
 .po.mo:
@@ -79,7 +79,7 @@
=20
 all: all-@USE_NLS@
=20
-all-yes: $(srcdir)/cat-id-tbl.c $(CATALOGS)
+all-yes: cat-id-tbl.c $(CATALOGS)
 all-no:
=20
 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
@@ -90,8 +90,8 @@
 	   || ( rm -f $(srcdir)/$(PACKAGE).pot \
 		&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
=20
-$(srcdir)/cat-id-tbl.c: $(srcdir)/stamp-cat-id; @:
-$(srcdir)/stamp-cat-id: $(srcdir)/$(PACKAGE).pot
+$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
+$(srcdir)/stamp-cat-id: $(PACKAGE).pot
 	rm -f cat-id-tbl.tmp
 	sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
 		| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
@@ -180,8 +180,7 @@
=20
 check: all
=20
-cat-id-tbl.o: $(srcdir)/cat-id-tbl.c $(top_srcdir)/intl/libgettext.h
-	$(COMPILE) $(srcdir)/cat-id-tbl.c
+cat-id-tbl.o: ../intl/libgettext.h
=20
 dvi info tags TAGS ID:
=20
@@ -197,7 +196,7 @@
 maintainer-clean: distclean
 	@echo "This command is intended for maintainers to use;"
 	@echo "it deletes files that may require special tools to rebuild."
-	rm -f $(GMOFILES) cat-id-tbl.c stamp-cat-id
+	rm -f $(GMOFILES)
=20
 distdir =3D ../$(PACKAGE)-$(VERSION)/$(subdir)
 dist distdir: update-po $(DISTFILES)
@@ -208,7 +207,7 @@
 	done
=20
 update-po: Makefile
-	$(MAKE) $(srcdir)/$(PACKAGE).pot
+	$(MAKE) $(PACKAGE).pot
 	PATH=3D`pwd`/../src:$$PATH; \
 	cd $(srcdir); \
 	catalogs=3D'$(CATALOGS)'; \
Index: util/logger.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/koch/cvs/gnupg/util/logger.c,v
retrieving revision 1.23
diff -u -r1.23 logger.c
--- util/logger.c	2000/08/18 12:23:17	1.23
+++ util/logger.c	2001/07/04 09:21:45
@@ -188,7 +188,7 @@
     va_start( arg_ptr, fmt ) ;
     vfprintf(logfp,fmt,arg_ptr) ;
     va_end(arg_ptr);
-    secmem_dump_stats();
+    _gcry_secmem_dump_stats();
     exit(2);
 }
=20
@@ -201,7 +201,7 @@
     va_start( arg_ptr, fmt ) ;
     vfprintf(logfp,fmt,arg_ptr) ;
     va_end(arg_ptr);
-    secmem_dump_stats();
+    _gcry_secmem_dump_stats();
     exit(2);
 }
=20
@@ -216,7 +216,7 @@
     vfprintf(stderr,fmt,arg_ptr) ;
     va_end(arg_ptr);
     fflush(stderr);
-    secmem_dump_stats();
+    _gcry_secmem_dump_stats();
     abort();
 }
=20

--ZGiS0Q5IWpPtfppv--

--PmA2V3Z32TCmWXqI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iQEVAwUBO0Lgd9ImKUTOasbBAQLFKwf+IIgjhEXcIQy/u13S/lKSvOB1em2HzGJ+
0qG1J85Opoix7abHxcuvTMzWgqlLMUyVTjvNYUTar6tq6195/SG4hwjDN/XQKGPg
3IbSSjDbXklDT1qYx7KU1qFHtm7fBLFpTel00YU0pxz9LJjyQEWshtvx+0DnDYmM
MxgbzjD3vFMvN/QZj3J9ELlyQDbWc3jR1mBAgvl0XXJ92IBgFilOlgeqK3tIDW+q
P4v9Qb5QPpbsI/AdEfL84LdWZcZUPM+s7WmvZ14YsUWCIUg4HwQhLFHGeaqnlrYA
hRZk9c3XStm4fvtHI5054pHWM+5c70ZN4jKa+Obwy/C3slCqV/3sJQ==
=8kFQ
-----END PGP SIGNATURE-----

--PmA2V3Z32TCmWXqI--