gnupg (include/ChangeLog include/ttyio.h util/ChangeLog util/ttyio.c)

cvs user dshaw cvs at cvs.gnupg.org
Fri Mar 18 21:04:01 CET 2005


    Date: Friday, March 18, 2005 @ 21:17:38
  Author: dshaw
    Path: /cvs/gnupg/gnupg

Modified: include/ChangeLog include/ttyio.h util/ChangeLog util/ttyio.c

* ttyio.c (tty_enable_completion, tty_disable_completion): Enable and
disable readline completion. (init_ttyfp): Completion is disabled by
default.


-------------------+
 include/ChangeLog |    5 +++++
 include/ttyio.h   |   17 ++++++++++++++++-
 util/ChangeLog    |    6 ++++++
 util/ttyio.c      |   20 ++++++++++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)


Index: gnupg/include/ChangeLog
diff -u gnupg/include/ChangeLog:1.82 gnupg/include/ChangeLog:1.83
--- gnupg/include/ChangeLog:1.82	Thu Feb 10 05:06:30 2005
+++ gnupg/include/ChangeLog	Fri Mar 18 21:17:38 2005
@@ -1,3 +1,8 @@
+2005-03-18  David Shaw  <dshaw at jabberwocky.com>
+
+	* ttyio.h: Prototype tty_enable_completion(), and
+	tty_disable_completion().
+
 2005-02-09  David Shaw  <dshaw at jabberwocky.com>
 
 	* cipher.h: Add a flag for a symmetric DEK.
Index: gnupg/include/ttyio.h
diff -u gnupg/include/ttyio.h:1.13 gnupg/include/ttyio.h:1.14
--- gnupg/include/ttyio.h:1.13	Wed Oct  8 17:20:58 2003
+++ gnupg/include/ttyio.h	Fri Mar 18 21:17:38 2005
@@ -1,5 +1,5 @@
 /* ttyio.h
- *	Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
  *
  * This file is part of GNUPG.
  *
@@ -20,6 +20,11 @@
 #ifndef G10_TTYIO_H
 #define G10_TTYIO_H
 
+#ifdef HAVE_LIBREADLINE
+#include <stdio.h>
+#include <readline/readline.h>
+#endif
+
 const char *tty_get_ttyname (void);
 int tty_batchmode( int onoff );
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
@@ -39,5 +44,15 @@
 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
 
 #endif /*G10_TTYIO_H*/
Index: gnupg/util/ChangeLog
diff -u gnupg/util/ChangeLog:1.183 gnupg/util/ChangeLog:1.184
--- gnupg/util/ChangeLog:1.183	Mon Mar 14 21:41:20 2005
+++ gnupg/util/ChangeLog	Fri Mar 18 21:17:38 2005
@@ -1,3 +1,9 @@
+2005-03-18  David Shaw  <dshaw at jabberwocky.com>
+
+	* ttyio.c (tty_enable_completion, tty_disable_completion): Enable
+	and disable readline completion.
+	(init_ttyfp): Completion is disabled by default.
+
 2005-03-14  Werner Koch  <wk at g10code.com>
 
 	* miscutil.c (isotimestamp): New.
Index: gnupg/util/ttyio.c
diff -u gnupg/util/ttyio.c:1.34 gnupg/util/ttyio.c:1.35
--- gnupg/util/ttyio.c:1.34	Sat Dec 18 23:23:49 2004
+++ gnupg/util/ttyio.c	Fri Mar 18 21:17:38 2005
@@ -165,6 +165,7 @@
 #ifdef HAVE_LIBREADLINE
     rl_catch_signals = 0;
     rl_instream = rl_outstream = ttyfp;
+    rl_inhibit_completion = 1;
 #endif
 #endif
 #ifdef HAVE_TCGETATTR
@@ -173,6 +174,25 @@
     initialized = 1;
 }
 
+#ifdef HAVE_LIBREADLINE
+void
+tty_enable_completion(rl_completion_func_t *completer)
+{
+  if( !initialized )
+    init_ttyfp();
+  rl_attempted_completion_function=completer;
+  rl_inhibit_completion=0;
+}
+
+void
+tty_disable_completion(void)
+{
+  if( !initialized )
+    init_ttyfp();
+  rl_inhibit_completion=1;
+}
+#endif
+
 int
 tty_batchmode( int onoff )
 {




More information about the Gnupg-commits mailing list