aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2005-03-18 20:17:38 +0000
committerDavid Shaw <[email protected]>2005-03-18 20:17:38 +0000
commit9c3484924bc23fe997699b79b7a68e73b7279533 (patch)
tree119e69bd42de87e0afeba8275c518606ff3bc976
parent* getkey.c (get_seckey_byname2): If no explicit default key is set, don't (diff)
downloadgnupg-9c3484924bc23fe997699b79b7a68e73b7279533.tar.gz
gnupg-9c3484924bc23fe997699b79b7a68e73b7279533.zip
* ttyio.c (tty_enable_completion, tty_disable_completion): Enable and
disable readline completion. (init_ttyfp): Completion is disabled by default.
Diffstat (limited to '')
-rw-r--r--include/ChangeLog5
-rw-r--r--include/ttyio.h17
-rw-r--r--util/ChangeLog6
-rw-r--r--util/ttyio.c20
4 files changed, 47 insertions, 1 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index dcd72c1b3..d922d6eb8 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-18 David Shaw <[email protected]>
+
+ * ttyio.h: Prototype tty_enable_completion(), and
+ tty_disable_completion().
+
2005-02-09 David Shaw <[email protected]>
* cipher.h: Add a flag for a symmetric DEK.
diff --git a/include/ttyio.h b/include/ttyio.h
index f3d83b9dc..85a7100a6 100644
--- a/include/ttyio.h
+++ b/include/ttyio.h
@@ -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 @@ void tty_kill_prompt(void);
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*/
diff --git a/util/ChangeLog b/util/ChangeLog
index 4248b2508..52b9c317b 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-18 David Shaw <[email protected]>
+
+ * 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 <[email protected]>
* miscutil.c (isotimestamp): New.
diff --git a/util/ttyio.c b/util/ttyio.c
index b7dd47173..5feab726e 100644
--- a/util/ttyio.c
+++ b/util/ttyio.c
@@ -165,6 +165,7 @@ init_ttyfp(void)
#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 @@ init_ttyfp(void)
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 )
{