* ttyio.c (tty_enable_completion, tty_disable_completion): Add checks
authorDavid Shaw <dshaw@jabberwocky.com>
Mon, 12 Dec 2005 03:56:01 +0000 (03:56 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Mon, 12 Dec 2005 03:56:01 +0000 (03:56 +0000)
for no_terminal so we don't try to open("/dev/tty") when invoked with
--no-tty.

util/ChangeLog
util/ttyio.c

index 754b9d2..0834f5b 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-10  Ryan Lortie  <desrt@desrt.ca> (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  <dshaw@jabberwocky.com>
 
        * Makefile.am: Some cleanup so we don't build files that are
index 63a68a3..97b160e 100644 (file)
@@ -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*/