From b12d50dccd0a1d54cad10bde3ed6bd94070518c9 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 12 Dec 2005 03:56:01 +0000 Subject: [PATCH] * ttyio.c (tty_enable_completion, tty_disable_completion): Add checks for no_terminal so we don't try to open("/dev/tty") when invoked with --no-tty. --- util/ChangeLog | 6 ++++++ util/ttyio.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/util/ChangeLog b/util/ChangeLog index 754b9d277..0834f5b47 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,9 @@ +2005-12-10 Ryan Lortie (dshaw) + + * ttyio.c (tty_enable_completion, tty_disable_completion): Add + checks for no_terminal so we don't try to open("/dev/tty") when + invoked with --no-tty. + 2005-12-06 David Shaw * Makefile.am: Some cleanup so we don't build files that are diff --git a/util/ttyio.c b/util/ttyio.c index 63a68a380..97b160ef2 100644 --- a/util/ttyio.c +++ b/util/ttyio.c @@ -179,8 +179,12 @@ init_ttyfp(void) 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; } @@ -188,8 +192,12 @@ tty_enable_completion(rl_completion_func_t *completer) void tty_disable_completion(void) { + if( no_terminal ) + return; + if( !initialized ) init_ttyfp(); + rl_inhibit_completion=1; } #endif /*HAVE_LIBREADLINE*/