[svn] GnuPG - r4258 - in trunk: common doc g10 sm

svn author wk cvs at cvs.gnupg.org
Thu Sep 21 15:30:49 CEST 2006


Author: wk
Date: 2006-09-21 15:30:45 +0200 (Thu, 21 Sep 2006)
New Revision: 4258

Added:
   trunk/common/common-defs.h
Modified:
   trunk/common/ChangeLog
   trunk/common/Makefile.am
   trunk/common/iobuf.c
   trunk/common/ttyio.c
   trunk/common/ttyio.h
   trunk/common/util.h
   trunk/doc/gpgsm.texi
   trunk/doc/yat2m.c
   trunk/g10/ChangeLog
   trunk/g10/Makefile.am
   trunk/g10/card-util.c
   trunk/g10/comment.c
   trunk/g10/gpg.c
   trunk/g10/gpgv.c
   trunk/g10/keyedit.c
   trunk/g10/signal.c
   trunk/sm/ChangeLog
   trunk/sm/gpgsm.c
Log:
Various updates


Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/ChangeLog	2006-09-21 13:30:45 UTC (rev 4258)
@@ -1,3 +1,13 @@
+2006-09-21  Werner Koch  <wk at g10code.com>
+
+	* ttyio.c (tty_private_set_rl_hooks): New.
+	(tty_enable_completion, tty_disable_completion): Use a hook to
+	enable readline support.  Now always available.
+	(tty_cleanup_rl_after_signal): New.
+
+	* ttyio.h: Removed readline specific stuff.  Included util.h.
+	* common-defs.h: New.
+
 2006-09-15  Werner Koch  <wk at g10code.com>
 
 	* convert.c: New.

Modified: trunk/common/Makefile.am
===================================================================
--- trunk/common/Makefile.am	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/Makefile.am	2006-09-21 13:30:45 UTC (rev 4258)
@@ -20,7 +20,7 @@
 
 ## Process this file with automake to produce Makefile.in
 
-noinst_LIBRARIES = libcommon.a libsimple-pwquery.a
+noinst_LIBRARIES = libcommon.a libsimple-pwquery.a libgpgrl.a
 noinst_PROGRAMS = $(module_tests)
 TESTS = $(module_tests)
 
@@ -30,6 +30,7 @@
             $(PTH_CFLAGS)
 
 libcommon_a_SOURCES = \
+	common-defs.h \
 	util.h i18n.h \
 	errors.h \
 	openpgpdefs.h \
@@ -63,6 +64,8 @@
 libsimple_pwquery_a_SOURCES = \
 	simple-pwquery.c simple-pwquery.h asshelp.c asshelp.h
 
+libgpgrl_a_SOURCES = \
+        gpgrlhelp.c
 
 #
 # Module tests

Added: trunk/common/common-defs.h
===================================================================
--- trunk/common/common-defs.h	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/common-defs.h	2006-09-21 13:30:45 UTC (rev 4258)
@@ -0,0 +1,32 @@
+/* common-defs.h - Private declarations for common/
+ * Copyright (C) 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
+
+#ifndef GNUPG_COMMON_COMMON_DEFS_H
+#define GNUPG_COMMON_COMMON_DEFS_H
+
+/*-- ttyio.c --*/
+void tty_private_set_rl_hooks (void (*set_completer) (rl_completion_func_t*),
+                               void (*inhibit_completion) (int),
+                               void (*cleanup_after_signal) (void) );
+
+
+
+#endif /*GNUPG_COMMON_COMMON_DEFS_H*/

Modified: trunk/common/iobuf.c
===================================================================
--- trunk/common/iobuf.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/iobuf.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -39,7 +39,6 @@
 #include <swis.h>
 #endif /* __riscos__ */
 
-#include "memory.h"
 #include "util.h"
 #include "iobuf.h"
 

Modified: trunk/common/ttyio.c
===================================================================
--- trunk/common/ttyio.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/ttyio.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -47,15 +47,10 @@
 #endif
 #include <errno.h>
 #include <ctype.h>
-#ifdef HAVE_LIBREADLINE
-#include <readline/readline.h>
-#include <readline/history.h>
-#endif
 
-
 #include "util.h"
-#include "memory.h"
 #include "ttyio.h"
+#include "common-defs.h"
 
 #define CONTROL_D ('D' - 'A' + 1)
 
@@ -82,8 +77,13 @@
     static int restore_termios;
 #endif
 
+/* Hooks set by gpgrlhelp.c if required. */
+static void (*my_rl_set_completer) (rl_completion_func_t *);
+static void (*my_rl_inhibit_completion) (int);
+static void (*my_rl_cleanup_after_signal) (void);
 
 
+
 /* This is a wrapper around ttyname so that we can use it even when
    the standard streams are redirected.  It figures the name out the
    first time and returns it in a statically allocated buffer. */
@@ -181,34 +181,6 @@
 }
 
 
-#ifdef HAVE_LIBREADLINE
-void
-tty_enable_completion(rl_completion_func_t *completer)
-{
-/*   if( no_terminal ) */
-/*     return; */
-
-/*   if( !initialized ) */
-/*     init_ttyfp(); */
-
-/*   rl_attempted_completion_function=completer; */
-/*   rl_inhibit_completion=0; */
-}
-
-void
-tty_disable_completion(void)
-{
-/*   if( no_terminal ) */
-/*     return; */
-
-/*   if( !initialized ) */
-/*     init_ttyfp(); */
-
-/*   rl_inhibit_completion=1; */
-}
-#endif /*HAVE_LIBREADLINE*/
-
-
 int
 tty_batchmode( int onoff )
 {
@@ -597,3 +569,48 @@
     xfree(p);
     return yes;
 }
+
+
+/* Called by gnupg_rl_initialize to setup the reradline support. */
+void
+tty_private_set_rl_hooks (void (*set_completer) (rl_completion_func_t*),
+                          void (*inhibit_completion) (int),
+                          void (*cleanup_after_signal) (void))
+{
+  my_rl_set_completer = set_completer;
+  my_rl_inhibit_completion = inhibit_completion;
+  my_rl_cleanup_after_signal = cleanup_after_signal;
+}
+
+
+void
+tty_enable_completion (rl_completion_func_t *completer)
+{
+  if (no_terminal || !my_rl_set_completer )
+    return;
+
+  if (!initialized)
+    init_ttyfp();
+
+  my_rl_set_completer (completer);
+}
+
+void
+tty_disable_completion (void)
+{
+  if (no_terminal || !my_rl_inhibit_completion)
+    return;
+
+  if (!initialized)
+    init_ttyfp();
+
+  my_rl_inhibit_completion (1);
+}
+
+
+void
+tty_cleanup_rl_after_signal (void)
+{
+  if (my_rl_cleanup_after_signal)
+    my_rl_cleanup_after_signal ();
+}

Modified: trunk/common/ttyio.h
===================================================================
--- trunk/common/ttyio.h	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/ttyio.h	2006-09-21 13:30:45 UTC (rev 4258)
@@ -21,11 +21,9 @@
 #ifndef GNUPG_COMMON_TTYIO_H
 #define GNUPG_COMMON_TTYIO_H
 
-#ifdef HAVE_LIBREADLINE
-#include <stdio.h>
-#include <readline/readline.h>
-#endif
+#include "util.h" /* Make sure our readline typedef is available. */
 
+
 const char *tty_get_ttyname (void);
 int tty_batchmode (int onoff);
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
@@ -46,16 +44,9 @@
 int tty_get_answer_is_yes (const char *prompt);
 int tty_no_terminal (int onoff);
 
-#ifdef HAVE_LIBREADLINE
-void tty_enable_completion(rl_completion_func_t *completer);
-void tty_disable_completion(void);
-#else
-/* Use a macro to stub out these functions since a macro has no need
-   to typedef a "rl_completion_func_t" which would be undefined
-   without readline. */
-#define tty_enable_completion(x)
-#define tty_disable_completion()
-#endif
+void tty_enable_completion (rl_completion_func_t *completer);
+void tty_disable_completion (void);
+void tty_cleanup_rl_after_signal (void);
 
 
 #endif /*GNUPG_COMMON_TTYIO_H*/

Modified: trunk/common/util.h
===================================================================
--- trunk/common/util.h	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/common/util.h	2006-09-21 13:30:45 UTC (rev 4258)
@@ -45,6 +45,13 @@
 #include "../jnlib/dotlock.h"
 #include "../jnlib/utf8conv.h"
 
+/* We need this type even if we are not using libreadline and or we
+   did not include libreadline in the current file. */
+#ifndef GNUPG_LIBREADLINE_H_INCLUDED
+typedef char **rl_completion_func_t (const char *, int, int);
+#endif /*!GNUPG_LIBREADLINE_H_INCLUDED*/
+
+
 /* Handy malloc macros - please use only them. */
 #define xtrymalloc(a)    gcry_malloc ((a))
 #define xtrymalloc_secure(a)  gcry_malloc_secure ((a))
@@ -153,6 +160,8 @@
 /*-- homedir.c --*/
 const char *default_homedir (void);
 
+/*-- gpgrlhelp.c --*/
+void gnupg_rl_initialize (void);
 
 /*-- miscellaneous.c --*/
 

Modified: trunk/doc/gpgsm.texi
===================================================================
--- trunk/doc/gpgsm.texi	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/doc/gpgsm.texi	2006-09-21 13:30:45 UTC (rev 4258)
@@ -189,7 +189,9 @@
 Same as @option{--list-keys} but also prints all keys making up the chain.
 
 
- at item --dump-keys
+ at item --dump-cert
+ at itemx --dump-keys
+ at opindex dump-cert
 @opindex dump-keys
 List all available certificates stored in the local key database using a
 format useful mainly for debugging.

Modified: trunk/doc/yat2m.c
===================================================================
--- trunk/doc/yat2m.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/doc/yat2m.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -822,7 +822,7 @@
       lnr++;
       if (!n || line[n-1] != '\n')
         {
-          err ("%s:$d: trailing linefeed missing, line too long or "
+          err ("%s:%d: trailing linefeed missing, line too long or "
                "embedded Nul character", fname, lnr);
           break;
         }

Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/ChangeLog	2006-09-21 13:30:45 UTC (rev 4258)
@@ -1,3 +1,14 @@
+2006-09-21  Werner Koch  <wk at g10code.com>
+
+	* signal.c (got_fatal_signal): Replaced readline stuff by a tty
+	function.
+
+	* Makefile.am (LDADD): Include libgpgrl.a.
+
+	* gpg.c (main): Call gpg_rl_initialize.
+
+	* keyedit.c: Removed double inclusion of stdio.h.
+
 2006-09-20  Werner Koch  <wk at g10code.com>
 
 	* call-agent.c: Include asshelp.h.

Modified: trunk/g10/Makefile.am
===================================================================
--- trunk/g10/Makefile.am	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/Makefile.am	2006-09-21 13:30:45 UTC (rev 4258)
@@ -108,12 +108,13 @@
 #	       ks-db.h \
 #	       $(common_source)
 
-LDADD =  $(needed_libs) $(ZLIBS) $(DNSLIBS) $(LIBREADLINE) \
+LDADD =  $(needed_libs) ../common/libgpgrl.a \
+         $(ZLIBS) $(DNSLIBS) $(LIBREADLINE) \
          $(LIBINTL) $(CAPLIBS) $(W32LIBS)
 gpg2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS)
 gpgv2_LDADD = $(LIBGCRYPT_LIBS) $(LDADD) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS)
 
-$(PROGRAMS): $(needed_libs)
+$(PROGRAMS): $(needed_libs) ../common/libgpgrl.a
 
 install-data-local:
 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)

Modified: trunk/g10/card-util.c
===================================================================
--- trunk/g10/card-util.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/card-util.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -38,6 +38,7 @@
 #include "keyserver-internal.h"
 #if GNUPG_MAJOR_VERSION == 1
 # ifdef HAVE_LIBREADLINE
+# define GNUPG_LIBREADLINE_H_INCLUDED
 # include <stdio.h>
 # include <readline/readline.h>
 # endif /*HAVE_LIBREADLINE*/

Modified: trunk/g10/comment.c
===================================================================
--- trunk/g10/comment.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/comment.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -30,7 +30,6 @@
 #include "packet.h"
 #include "errors.h"
 #include "iobuf.h"
-#include "memory.h"
 #include "util.h"
 #include "main.h"
 #include "keydb.h"

Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/gpg.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -1771,7 +1771,8 @@
        when adding any stuff between here and the call to
        secmem_init() somewhere after the option parsing. */
     reopen_std ();
-    trap_unaligned();
+    trap_unaligned ();
+    gnupg_rl_initialize ();
     set_strusage (my_strusage);
     gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
     /* We don't need any locking in libgcrypt unless we use any kind of

Modified: trunk/g10/gpgv.c
===================================================================
--- trunk/g10/gpgv.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/gpgv.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -31,7 +31,7 @@
 #include <fcntl.h> /* for setmode() */
 #endif
 #ifdef HAVE_LIBREADLINE
-#include <stdio.h>
+#define GNUPG_LIBREADLINE_H_INCLUDED
 #include <readline/readline.h>
 #endif
 

Modified: trunk/g10/keyedit.c
===================================================================
--- trunk/g10/keyedit.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/keyedit.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -28,7 +28,7 @@
 #include <assert.h>
 #include <ctype.h>
 #ifdef HAVE_LIBREADLINE
-#include <stdio.h>
+#define GNUPG_LIBREADLINE_H_INCLUDED
 #include <readline/readline.h>
 #endif
 

Modified: trunk/g10/signal.c
===================================================================
--- trunk/g10/signal.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/g10/signal.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -28,10 +28,6 @@
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
-#ifdef HAVE_LIBREADLINE
-#include <readline/readline.h>
-#include <readline/history.h>
-#endif
 
 #include "gpg.h"
 #include "options.h"
@@ -86,10 +82,7 @@
 
     gcry_control (GCRYCTL_TERM_SECMEM );
 
-#ifdef HAVE_LIBREADLINE
-    rl_free_line_state ();
-    rl_cleanup_after_signal ();
-#endif
+    tty_cleanup_rl_after_signal ();
 
     /* Better don't translate these messages. */
     write(2, "\n", 1 );

Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/sm/ChangeLog	2006-09-21 13:30:45 UTC (rev 4258)
@@ -1,5 +1,7 @@
 2006-09-20  Werner Koch  <wk at g10code.com>
 
+	* gpgsm.c: Add alias command --dump-cert.
+
 	* Makefile.am:  Changes to allow parallel make runs.
 
 2006-09-18  Werner Koch  <wk at g10code.com>

Modified: trunk/sm/gpgsm.c
===================================================================
--- trunk/sm/gpgsm.c	2006-09-20 11:01:49 UTC (rev 4257)
+++ trunk/sm/gpgsm.c	2006-09-21 13:30:45 UTC (rev 4258)
@@ -268,6 +268,7 @@
     { aPasswd, "passwd",      256, N_("change a passphrase")},
     { aGPGConfList, "gpgconf-list", 256, "@" },
 
+    { aDumpKeys, "dump-cert", 256, "@"},
     { aDumpKeys, "dump-keys", 256, "@"},
     { aDumpChain, "dump-chain", 256, "@"},
     { aDumpExternalKeys, "dump-external-keys", 256, "@"},




More information about the Gnupg-commits mailing list