File readline-4.3.dif of Package compat-readline4

--- .pkgextract
+++ .pkgextract	2002/10/31 10:26:02
@@ -0,0 +1,10 @@
+patch -p2 -s --suffix=".display"    < ../bash-2.05b-display.patch
+patch -p2 -s --suffix=".dispmbs"    < ../bash-2.05b-display-mbspeed.patch
+patch -p3 -s --suffix=".complete"   < ../bash-2.05b-complete.patch
+patch -p2 -s --suffix=".infinite"   < ../bash-2.05b-infinite.patch
+patch -p2 -s --suffix=".mbutil"     < ../bash-2.05b-mbutil.patch
+patch -p3 -s --suffix=".rlinit"     < ../bash-2.05b-readline-init.patch
+patch -p2 -s --suffix=".vimode"     < ../bash-2.05b-vimode.patch
+patch -p2 -s --suffix=".utf8"       < ../bash-2.05b-utf8.patch
+#patch -p0 -s --suffix=".destdir"    < ../readline-4.3-destdir.patch
+#patch -p0 -s --suffix=".zerotty"    < ../readline-4.3-input.dif
--- Makefile.in
+++ Makefile.in	2002/10/31 10:26:02
@@ -208,15 +208,13 @@
 install:	$(INSTALL_TARGETS)
 
 install-static: installdirs $(STATIC_LIBS) install-headers
-	-$(MV) $(DESTDIR)$(libdir)/libreadline.a $(DESTDIR)$(libdir)/libreadline.old
 	$(INSTALL_DATA) libreadline.a $(DESTDIR)$(libdir)/libreadline.a
 	-test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libreadline.a
-	-$(MV) $(DESTDIR)$(libdir)/libhistory.a $(DESTDIR)$(libdir)/libhistory.old
 	$(INSTALL_DATA) libhistory.a $(DESTDIR)$(libdir)/libhistory.a
 	-test -n "$(RANLIB)" && $(RANLIB) $(DESTDIR)$(libdir)/libhistory.a
 	-( if test -d doc ; then \
 		cd doc && \
-		${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
+		${MAKE} infodir=$(infodir) DESTDIR=${DESTDIR} install; \
 	  fi )
 
 installdirs: $(srcdir)/support/mkdirs
--- bind.c
+++ bind.c	2002/10/31 10:26:02
@@ -279,7 +279,10 @@
 
       ic = uc;
       if (ic < 0 || ic >= KEYMAP_SIZE)
-	return -1;
+	{
+	  free (keys);
+	  return -1;
+	}
 
       if (_rl_convert_meta_chars_to_ascii && META_CHAR (ic))
 	{
@@ -625,6 +628,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 +698,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
@@ -704,13 +710,27 @@
     {
       filename = last_readline_init_file;
       if (filename == 0)
+      {
         filename = sh_get_env_value ("INPUTRC");
+	if (filename && !strncmp(SYSTEM_INPUTRC, filename, strlen(SYSTEM_INPUTRC)))
+	  read_system_init_file = 0;
+	else
+	  read_system_init_file = 1;
+      }
       if (filename == 0)
+      {
 	filename = DEFAULT_INPUTRC;
+        read_system_init_file = 1;
+      }
     }
 
   if (*filename == 0)
+  {
     filename = DEFAULT_INPUTRC;
+    read_system_init_file = 1;
+  }
+  if (read_system_init_file)
+    _rl_read_init_file (SYSTEM_INPUTRC, 1);
 
 #if defined (__MSDOS__)
   if (_rl_read_init_file (filename, 0) == 0)
@@ -1199,6 +1219,13 @@
 
 	  rl_macro_bind (seq, &funname[1], _rl_keymap);
 	}
+#if 0 /* defined (PREFIX_META_HACK) */
+      /* Ugly, but working hack to keep prefix-meta around. */
+      else if (_rl_stricmp (funname, "prefix-meta") == 0)
+	{
+	  rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
+	}
+#endif /* PREFIX_META_HACK */
       else
 	rl_set_key (seq, rl_named_function (funname), _rl_keymap);
 
--- complete.c
+++ complete.c	2002/10/31 10:26:02
@@ -395,7 +395,7 @@
 	return (1);
       if (c == 'n' || c == 'N' || c == RUBOUT)
 	return (0);
-      if (c == ABORT_CHAR)
+      if (c == ABORT_CHAR || c == EOF)
 	_rl_abort_internal ();
       if (for_pager && (c == NEWLINE || c == RETURN))
 	return (2);
@@ -714,7 +714,7 @@
          completion, so use the word break characters to find the
          substring on which to complete. */
 #if defined (HANDLE_MULTIBYTE)
-      while (rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY))
+      while ((rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY)))
 #else
       while (--rl_point)
 #endif
@@ -1612,7 +1612,7 @@
   match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
   match_list[1] = (char *)NULL;
 
-  while (string = (*entry_function) (text, matches))
+  while ((string = (*entry_function) (text, matches)))
     {
       if (matches + 1 == match_list_size)
 	match_list = (char **)xrealloc
@@ -1662,7 +1662,7 @@
       setpwent ();
     }
 
-  while (entry = getpwent ())
+  while ((entry = getpwent ()))
     {
       /* Null usernames should result in all users as possible completions. */
       if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
--- doc/Makefile.in
+++ doc/Makefile.in	2002/10/31 10:26:02
@@ -83,7 +83,7 @@
 	$(RM) $@
 	-${NROFF} -man $< > $@
 
-all: info dvi html ps text
+all: info html
 nodvi: info html text
 
 readline.dvi: $(RLSRC)
--- doc/readline.3
+++ doc/readline.3	2002/10/31 10:26:02
@@ -114,8 +114,8 @@
 file (the \fIinputrc\fP file).
 The name of this file is taken from the value of the
 .B INPUTRC
-environment variable.  If that variable is unset, the default is
-.IR ~/.inputrc .
+environment variable.  If that variable is unset, readline will read both
+.IR /etc/inputrc " and " ~/.inputrc .
 When a program which uses the readline library starts up, the
 init file is read, and the key bindings and variables are set.
 There are only a few basic constructs allowed in the
@@ -1238,6 +1238,9 @@
 .TP
 .FN ~/.inputrc
 Individual \fBreadline\fP initialization file
+.TP
+.FN /etc/inputrc
+System \fBreadline\fP initialization file
 .PD
 .SH AUTHORS
 Brian Fox, Free Software Foundation
--- doc/rluser.texinfo
+++ doc/rluser.texinfo	2002/10/31 10:26:02
@@ -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.
--- readline.c
+++ readline.c	2003/01/27 21:10:57
@@ -567,7 +567,11 @@
 	{
 	  /* Special case rl_do_lowercase_version (). */
 	  if (func == rl_do_lowercase_version)
-	    return (_rl_dispatch (_rl_to_lower (key), map));
+	    {
+	      if (key == ANYOTHERKEY)
+		return -1;
+	      return (_rl_dispatch (_rl_to_lower (key), map));
+	    }
 
 	  rl_executing_keymap = map;
 
--- readline.h
+++ readline.h	2002/10/31 10:26:02
@@ -429,7 +429,7 @@
 
 extern int rl_completion_mode PARAMS((rl_command_func_t *));
 
-#if 0
+#ifdef OLD_READLINE
 /* Backwards compatibility (compat.c).  These will go away sometime. */
 extern void free_undo_list PARAMS((void));
 extern int maybe_save_line PARAMS((void));
--- rlconf.h
+++ rlconf.h	2002/10/31 10:26:02
@@ -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
--- shlib/Makefile.in
+++ shlib/Makefile.in	2002/10/31 10:26:02
@@ -46,6 +46,7 @@
 exec_prefix = @exec_prefix@
 includedir = @includedir@
 libdir = @libdir@
+linkagedir = $(libdir)
 
 # Support an alternate destination root directory for package building
 DESTDIR =
@@ -55,7 +56,7 @@
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@
 
-DEFS = @DEFS@
+DEFS = @DEFS@ -D_REENTRANT
 LOCAL_DEFS = @LOCAL_DEFS@
 
 #
@@ -164,8 +165,8 @@
 	-$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(libdir)
 
 install: installdirs $(SHLIB_STATUS)
-	$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
-	$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
+	$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -l $(linkagedir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY)
+	$(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(DESTDIR)$(libdir) -l $(linkagedir) -i "$(INSTALL_DATA)" $(SHARED_READLINE)
 	@echo install: you may need to run ldconfig
 
 uninstall:
--- support/shlib-install
+++ support/shlib-install	2002/10/31 10:26:02
@@ -3,7 +3,7 @@
 # shlib-install - install a shared library and do any necessary host-specific
 #		  post-installation configuration (like ldconfig)
 #
-# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library
+# usage: shlib-install [-D] -O host_os -d installation-dir -l linkage-dir -i install-prog [-U] library
 #
 # Chet Ramey
 # chet@po.cwru.edu
@@ -24,12 +24,14 @@
 	-O)	shift; host_os="$1"; shift ;;
 	-d)	shift; INSTALLDIR="$1"; shift ;;
 	-i)	shift; INSTALLPROG="$1" ; shift ;;
+	-l)	shift; LINKAGEDIR="$1" ; shift ;;
 	-D)	echo=echo ; shift ;;
 	-U)	uninstall=true ; shift ;;
 	-*)	echo "$USAGE" >&2 ; exit 2;;
 	*)	break ;;
 	esac
 done
+[ -z "$LINKAGEDIR" ] && LINKAGEDIR=$INSTALLDIR
 
 # set install target name
 LIBNAME="$1"
@@ -103,9 +105,9 @@
 	fi
 
 	# libname.so -> libname.so.M.N
-	${echo} ${RM} ${INSTALLDIR}/$LINK1
+	${echo} ${RM} ${LINKAGEDIR}/$LINK1
 	if [ -z "$uninstall" ]; then
-		${echo} ln -s $LIBNAME ${INSTALLDIR}/$LINK1
+		${echo} ln -s ${INSTALLDIR}/$LIBNAME ${LINKAGEDIR}/$LINK1
 	fi
 	;;
 
--- support/shobj-conf
+++ support/shobj-conf	2002/10/31 10:26:02
@@ -100,10 +100,11 @@
 linux*|gnu*)
 	SHOBJ_CFLAGS=-fPIC
 	SHOBJ_LD='${CC}'
-	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+	SHOBJ_LDFLAGS='-shared -Wl,-soname,$(basename $@)'
 
 	SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+	SHLIB_LIBS=-lncurses
 	;;
 
 freebsd2* | netbsd*)
--- terminal.c
+++ terminal.c	2002/10/31 10:26:02
@@ -145,6 +145,9 @@
 static char *_rl_term_kH;
 static char *_rl_term_at7;	/* @7 */
 
+/* The key sequence sent by the Delete key, if any. */
+static char *_rl_term_kD;
+
 /* Insert key */
 static char *_rl_term_kI;
 
@@ -303,7 +306,7 @@
    search algorithm to something smarter. */
 static struct _tc_string tc_strings[] =
 {
-  { "@7", &_rl_term_at7 },
+  { "@7", &_rl_term_at7 },	/* end */
   { "DC", &_rl_term_DC },
   { "IC", &_rl_term_IC },
   { "ce", &_rl_term_clreol },
@@ -313,6 +316,7 @@
   { "ei", &_rl_term_ei },
   { "ic", &_rl_term_ic },
   { "im", &_rl_term_im },
+  { "kD", &_rl_term_kD },	/* delete */
   { "kH", &_rl_term_kH },	/* home down ?? */
   { "kI", &_rl_term_kI },	/* insert */
   { "kd", &_rl_term_kd },
@@ -496,6 +500,7 @@
 
   _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line);	/* Home */
   _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line);	/* End */
+  _rl_bind_if_unbound (_rl_term_kD, rl_delete);		/* Delete */
 
   _rl_keymap = xkeymap;
 }
--- text.c
+++ text.c	Fri Apr  9 20:50:55 1999
@@ -1100,6 +1100,9 @@
       else
 	rl_point = end;
     }
+  /* check for arithmetic overflow */
+  if (rl_point < 0)
+    rl_point = 0;
   return 0;
 }