Submitted By: Zack Winkles <winkie@linuxfromscratch.org>
Date: 2004-02-10
Initial Package Version: 2.05b
Origin: Debian
Description: Support for /etc/inputrc in addition to ~/.inputrc

diff -Naur bash-2.05b.orig/lib/readline/bind.c bash-2.05b/lib/readline/bind.c
--- bash-2.05b.orig/lib/readline/bind.c	2004-02-02 17:31:33.302441000 -0500
+++ bash-2.05b/lib/readline/bind.c	2004-02-02 17:47:18.944682160 -0500
@@ -625,6 +625,9 @@
 /* The last key bindings file read. */
 static char *last_readline_init_file = (char *)NULL;
 
+/* Flag to read system init file */
+static int read_system_init_file = 0;
+
 /* The file we're currently reading key bindings from. */
 static const char *current_readline_init_file;
 static int current_readline_init_include_level;
@@ -692,7 +695,7 @@
    to the first non-null filename from this list:
      1. the filename used for the previous call
      2. the value of the shell variable `INPUTRC'
-     3. ~/.inputrc
+     3. /etc/inputrc and ~/.inputrc
    If the file existed and could be opened and read, 0 is returned,
    otherwise errno is returned. */
 int
@@ -703,14 +706,23 @@
   if (filename == 0)
     {
       filename = last_readline_init_file;
-      if (filename == 0)
+      if (filename == 0) {
         filename = sh_get_env_value ("INPUTRC");
-      if (filename == 0)
+	read_system_init_file = 0;
+      }
+      if (filename == 0) {
 	filename = DEFAULT_INPUTRC;
+	read_system_init_file = 1;
+      }
     }
 
-  if (*filename == 0)
+  if (*filename == 0) {
     filename = DEFAULT_INPUTRC;
+    read_system_init_file = 1;
+  }
+
+  if (read_system_init_file)
+    _rl_read_init_file (SYSTEM_INPUTRC, 0);
 
 #if defined (__MSDOS__)
   if (_rl_read_init_file (filename, 0) == 0)
diff -Naur bash-2.05b.orig/lib/readline/doc/rluser.texinfo bash-2.05b/lib/readline/doc/rluser.texinfo
--- bash-2.05b.orig/lib/readline/doc/rluser.texinfo	2002-03-05 13:20:44.000000000 -0500
+++ bash-2.05b/lib/readline/doc/rluser.texinfo	2004-02-02 17:47:18.945682008 -0500
@@ -336,7 +336,8 @@
 @ifclear BashFeatures
 file is taken from the value of the environment variable @env{INPUTRC}.  If
 @end ifclear
-that variable is unset, the default is @file{~/.inputrc}.
+that variable is unset, Readline will read both @file{/etc/inputrc} and 
+@file{~/.inputrc}.
 
 When a program which uses the Readline library starts up, the
 init file is read, and the key bindings are set.
diff -Naur bash-2.05b.orig/lib/readline/rlconf.h bash-2.05b/lib/readline/rlconf.h
--- bash-2.05b.orig/lib/readline/rlconf.h	2002-01-22 12:54:23.000000000 -0500
+++ bash-2.05b/lib/readline/rlconf.h	2004-02-02 17:47:18.946681856 -0500
@@ -39,6 +39,7 @@
 
 /* The final, last-ditch effort file name for an init file. */
 #define DEFAULT_INPUTRC "~/.inputrc"
+#define SYSTEM_INPUTRC "/etc/inputrc"
 
 /* If defined, expand tabs to spaces. */
 #define DISPLAY_TABS
