r1360 - trunk/readline

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Wed Jan 18 19:43:26 PST 2006


Author: tushar
Date: 2006-01-18 20:43:25 -0700 (Wed, 18 Jan 2006)
New Revision: 1360

Added:
   trunk/readline/readline-5.1-global_inputrc-1.patch
Log:
Add readline patch

Added: trunk/readline/readline-5.1-global_inputrc-1.patch
===================================================================
--- trunk/readline/readline-5.1-global_inputrc-1.patch	2006-01-18 16:00:24 UTC (rev 1359)
+++ trunk/readline/readline-5.1-global_inputrc-1.patch	2006-01-19 03:43:25 UTC (rev 1360)
@@ -0,0 +1,88 @@
+Submitted By: Tushar Teredesai <tushar at linuxfromscratch.org>
+Date: 2006-01-18
+Initial Package Version: 5.1
+Origin: Debian
+Upstream Status: Not sent
+Description: In addition to user specific ~/.inputrc also use a global
+file /etc/inputrc without having to specify envar INPUTRC.
+diff -aur readline-5.1.orig/bind.c readline-5.1/bind.c
+--- readline-5.1.orig/bind.c	2005-10-14 10:04:27.000000000 -0500
++++ readline-5.1/bind.c	2006-01-18 20:21:54.000000000 -0600
+@@ -723,6 +723,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;
+@@ -790,7 +793,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
+@@ -801,14 +804,31 @@
+   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)
++    if (filename == last_readline_init_file)
++      {
++	filename = savestring (filename);
++	_rl_read_init_file (SYSTEM_INPUTRC, 0);
++	free (last_readline_init_file);
++	last_readline_init_file = filename;
++      }
++    else
++      _rl_read_init_file (SYSTEM_INPUTRC, 0);
+ 
+ #if defined (__MSDOS__)
+   if (_rl_read_init_file (filename, 0) == 0)
+diff -aur readline-5.1.orig/doc/rluser.texi readline-5.1/doc/rluser.texi
+--- readline-5.1.orig/doc/rluser.texi	2005-09-14 13:22:30.000000000 -0500
++++ readline-5.1/doc/rluser.texi	2006-01-18 20:22:04.000000000 -0600
+@@ -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 
++ at file{~/.inputrc}.
+ 
+ When a program which uses the Readline library starts up, the
+ init file is read, and the key bindings are set.
+diff -aur readline-5.1.orig/rlconf.h readline-5.1/rlconf.h
+--- readline-5.1.orig/rlconf.h	2002-01-22 11:54:23.000000000 -0600
++++ readline-5.1/rlconf.h	2006-01-18 20:22:07.000000000 -0600
+@@ -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




More information about the patches mailing list