summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-09 16:21:23 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-07-09 16:21:23 +0000
commit16399962213c244a67845754cbae8cab26a49a7e (patch)
treee7b601d1348383edd4029b1aef377be2c33588aa
parent1f8c4fd24a8b76770bbdd9c53f8d2013bc7eb398 (diff)
downloadgdb-16399962213c244a67845754cbae8cab26a49a7e.tar.gz
Import of readline 4.1
-rw-r--r--readline/CHANGELOG123
-rw-r--r--readline/CHANGES108
-rw-r--r--readline/COPYING4
-rw-r--r--readline/MANIFEST12
-rw-r--r--readline/Makefile.in87
-rw-r--r--readline/README2
-rw-r--r--readline/aclocal.m4172
-rw-r--r--readline/ansi_stdlib.h2
-rw-r--r--readline/bind.c427
-rw-r--r--readline/callback.c14
-rw-r--r--readline/chardefs.h4
-rw-r--r--readline/complete.c135
-rw-r--r--readline/config.h.in3
-rwxr-xr-xreadline/configure403
-rw-r--r--readline/configure.in23
-rw-r--r--readline/display.c358
-rw-r--r--readline/doc/Makefile.in87
-rw-r--r--readline/doc/hist.texinfo4
-rw-r--r--readline/doc/hstech.texinfo9
-rw-r--r--readline/doc/hsuser.texinfo109
-rw-r--r--readline/doc/manvers.texinfo10
-rw-r--r--readline/doc/readline.0636
-rw-r--r--readline/doc/readline.311
-rw-r--r--readline/doc/rlman.texinfo4
-rw-r--r--readline/doc/rltech.texinfo51
-rw-r--r--readline/doc/rluser.texinfo448
-rw-r--r--readline/emacs_keymap.c16
-rw-r--r--readline/examples/Makefile.in38
-rw-r--r--readline/examples/fileman.c26
-rw-r--r--readline/examples/rl.c39
-rw-r--r--readline/examples/rltest.c16
-rw-r--r--readline/examples/rlversion.c8
-rw-r--r--readline/funmap.c16
-rw-r--r--readline/histexpand.c18
-rw-r--r--readline/histfile.c54
-rw-r--r--readline/histlib.h12
-rw-r--r--readline/history.c6
-rw-r--r--readline/history.h10
-rw-r--r--readline/histsearch.c7
-rw-r--r--readline/input.c92
-rw-r--r--readline/isearch.c21
-rw-r--r--readline/keymaps.c14
-rw-r--r--readline/keymaps.h12
-rw-r--r--readline/kill.c39
-rw-r--r--readline/macro.c19
-rw-r--r--readline/nls.c21
-rw-r--r--readline/parens.c41
-rw-r--r--readline/posixdir.h4
-rw-r--r--readline/posixjmp.h18
-rw-r--r--readline/posixstat.h4
-rw-r--r--readline/readline.c205
-rw-r--r--readline/readline.h23
-rw-r--r--readline/rlconf.h8
-rw-r--r--readline/rldefs.h7
-rw-r--r--readline/rlstdc.h52
-rw-r--r--readline/rltty.c202
-rw-r--r--readline/rltty.h25
-rw-r--r--readline/rlwinsize.h5
-rw-r--r--readline/savestring.c4
-rw-r--r--readline/search.c182
-rw-r--r--readline/shell.c50
-rw-r--r--readline/shlib/Makefile.in61
-rw-r--r--readline/signals.c54
-rwxr-xr-xreadline/support/config.guess382
-rwxr-xr-xreadline/support/config.sub397
-rwxr-xr-xreadline/support/shlib-install47
-rwxr-xr-xreadline/support/shobj-conf50
-rw-r--r--readline/tcap.h4
-rw-r--r--readline/terminal.c210
-rw-r--r--readline/tilde.c55
-rw-r--r--readline/tilde.h28
-rw-r--r--readline/undo.c6
-rw-r--r--readline/util.c24
-rw-r--r--readline/vi_keymap.c4
-rw-r--r--readline/vi_mode.c33
-rw-r--r--readline/xmalloc.c27
76 files changed, 3986 insertions, 1956 deletions
diff --git a/readline/CHANGELOG b/readline/CHANGELOG
index 479e6c042ac..9024bdfdadb 100644
--- a/readline/CHANGELOG
+++ b/readline/CHANGELOG
@@ -214,3 +214,126 @@ Makefile.in,{doc,examples,shlib}/Makefile.in
- set SHELL from @MAKE_SHELL@
[readline-4.0 released]
+
+ 3/11
+ ----
+doc/Makefile.in
+ - removed references to HTMLTOC, since separate HTML table-of-contents
+ files are no longer created
+
+examples/Makefile.in
+ - remove `*.exe' in clean target for MS-DOS
+
+Makefile.in
+ - make `readline' target depend on ./libreadline.a
+ - configure now substitutes TERMCAP_LIB into Makefile.in
+ - use ${TERMCAP_LIB} instead of -ltermcap in recipe for `readline'
+ - clean target now removes readline and readline.exe in case they
+ get built
+
+configure.in
+ - use `pwd.exe' to set BUILD_DIR on MS-DOS DJGPP
+
+ 3/15
+ ----
+support/shlib-install
+ - Irix 5.x and Irix 6.x should install shared libraries like Solaris 2
+ - changes for installing on hp-ux 1[01].x
+
+ 3/23
+ ----
+configure.in
+ - make sure that the $CC argument to shobj-conf is quoted
+
+ 4/8
+ ---
+
+xmalloc.h, rlprivate.h, rlshell.h
+ - new files
+
+Makefile.in,shlib/Makefile.in
+ - add dependencies on xmalloc.h, rlshell.h
+ - add xmalloc.h, rlprivate.h, rlshell.h to list of header files
+
+MANIFEST
+ - add xmalloc.h, rlprivate.h, rlshell.h
+
+ 4/9
+ ---
+Makefile.in,shlib/Makefile.in
+ - add dependencies on rlprivate.h
+
+ 4/13
+ ----
+doc/Makefile.in
+ - add variable, PSDVI, which is the desired resolution of the
+ generated postscript files. Set to 300 because I don't have
+ any 600-dpi printers
+ - set LANGUAGE= before calling makeinfo, so messages are in English
+ - add rluserman.{info,dvi,ps,html} to appropriate variables
+ - add rules to create rluserman.{info,dvi,ps,html}
+ - install and uninstall rluserman.info, but don't update the directory
+ file in $(infodir) yet
+
+MANIFEST
+ - add doc/rluserman.{texinfo,info,dvi,ps,html}
+
+ 4/30
+ ----
+configure.in
+ - updated library version to 4.1
+
+ 5/3
+ ---
+configure.in
+ - SHLIB_MAJOR and SHLIB_MINOR shared library version numbers are
+ constructed from $LIBRARY_VERSION and substituted into Makefiles
+
+ 5/5
+ ---
+support/shlib-install
+ - OSF/1 installs shared libraries like Solaris
+
+Makefile.in
+ - broke the header file install and uninstall into two new targets:
+ install-headers and uninstall-headers
+ - install and uninstall depend on install-headers and uninstall-headers
+ respectively
+ - changed install-shared and uninstall-shared targets to depend on
+ install-headers and uninstall-headers, respectively, so users may
+ choose to install only the shared libraries. I'm not sure about
+ the uninstall one yet -- maybe it should check whether or not
+ the static libraries are installed and not remove the header files
+ if they are
+
+ 9/3
+ ---
+configure.in, config.h.in
+ - added test for memmove (for later use)
+ - changed version to 4.1-beta1
+
+ 9/13
+ ----
+examples/rlfe.c
+ - Per Bothner's `rlfe' readline front-end program
+
+examples/Makefile.in
+ - added rules to build rlfe
+
+ 9/21
+ ----
+support/shlib-install
+ - changes to handle FreeBSD-3.x elf or a.out shared libraries, which
+ have different semantics and need different naming conventions
+
+ 1/24/2000
+ ---------
+doc/Makefile.in
+ - remove *.bt and *.bts on `make clean'
+
+ 2/4
+ ---
+
+
+configure.in
+ - changed LIBVERSION to 4.1-beta5
diff --git a/readline/CHANGES b/readline/CHANGES
index 65339c2e036..d2929ab6fd2 100644
--- a/readline/CHANGES
+++ b/readline/CHANGES
@@ -1,3 +1,111 @@
+This document details the changes between this version, readline-4.1,
+and the previous version, readline-4.0.
+
+1. Changes to Readline
+
+a. Changed the HTML documents so that the table-of-contents is no longer
+ a separate file.
+
+b. Changes to the shared object configuration for: Irix 5.x, Irix 6.x,
+ OSF/1.
+
+c. The shared library major and minor versions are now constructed
+ automatically by configure and substituted into the makefiles.
+
+d. It's now possible to install the shared libraries separately from the
+ static libraries.
+
+e. The history library tries to truncate the history file only if it is a
+ regular file.
+
+f. A bug that caused _rl_dispatch to address negative array indices on
+ systems with signed chars was fixed.
+
+g. rl-yank-nth-arg now leaves the history position the same as when it was
+ called.
+
+h. Changes to the completion code to handle MS-DOS drive-letter:pathname
+ filenames.
+
+i. Completion is now case-insensitive by default on MS-DOS.
+
+j. Fixes to the history file manipulation code for MS-DOS.
+
+k. Readline attempts to bind the arrow keys to appropriate defaults on MS-DOS.
+
+l. Some fixes were made to the redisplay code for better operation on MS-DOS.
+
+m. The quoted-insert code will now insert tty special chars like ^C.
+
+n. A bug was fixed that caused the display code to reference memory before
+ the start of the prompt string.
+
+o. More support for __EMX__ (OS/2).
+
+p. A bug was fixed in readline's signal handling that could cause infinite
+ recursion in signal handlers.
+
+q. A bug was fixed that caused the point to be less than zero when rl_forward
+ was given a very large numeric argument.
+
+r. The vi-mode code now gets characters via the application-settable value
+ of rl_getc_function rather than calling rl_getc directly.
+
+s. The history file code now uses O_BINARY mode when reading and writing
+ the history file on cygwin32.
+
+t. Fixed a bug in the redisplay code for lines with more than 256 line
+ breaks.
+
+u. A bug was fixed which caused invisible character markers to not be
+ stripped from the prompt string if the terminal was in no-echo mode.
+
+v. Readline no longer tries to get the variables it needs for redisplay
+ from the termcap entry if the calling application has specified its
+ own redisplay function. Readline treats the terminal as `dumb' in
+ this case.
+
+w. Fixes to the SIGWINCH code so that a multiple-line prompt with escape
+ sequences is redrawn correctly.
+
+x. Changes to the install and install-shared targets so that the libraries
+ and header files are installed separately.
+
+2. New Features in Readline
+
+a. A new Readline `user manual' is in doc/rluserman.texinfo.
+
+b. Parentheses matching is now always compiled into readline, and enabled
+ or disabled when the value of the `blink-matching-paren' variable is
+ changed.
+
+c. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
+
+d. MS-DOS systems now use ~/_history as the default history file.
+
+e. history-search-{forward,backward} now leave the point at the end of the
+ line when the string to search for is empty, like
+ {reverse,forward}-search-history.
+
+f. history-search-{forward,backward} now leave the last history line found
+ in the readline buffer if the second or subsequent search fails.
+
+g. New function for use by applications: rl_on_new_line_with_prompt, used
+ when an application displays the prompt itself before calling readline().
+
+h. New variable for use by applications: rl_already_prompted. An application
+ that displays the prompt itself before calling readline() must set this to
+ a non-zero value.
+
+i. A new variable, rl_gnu_readline_p, always 1. The intent is that an
+ application can verify whether or not it is linked with the `real'
+ readline library or some substitute.
+
+j. Per Bothner's `rlfe' (pronounced `Ralphie') readline front-end program
+ is included in the examples subdirectory, though it is not built
+ by default.
+
+-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.0,
and the previous version, readline-2.2.
diff --git a/readline/COPYING b/readline/COPYING
index a43ea2126fb..1bf15263878 100644
--- a/readline/COPYING
+++ b/readline/COPYING
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Also add information on how to contact you by electronic and paper mail.
diff --git a/readline/MANIFEST b/readline/MANIFEST
index f23ff41aff8..a51ca0525a7 100644
--- a/readline/MANIFEST
+++ b/readline/MANIFEST
@@ -11,8 +11,8 @@ MANIFEST f
INSTALL f
CHANGELOG f
CHANGES f
+USAGE f
aclocal.m4 f
-acconfig.h f
config.h.in f
configure f
configure.in f
@@ -28,11 +28,14 @@ posixstat.h f
readline.h f
rlconf.h f
rldefs.h f
+rlprivate.h f
+rlshell.h f
rlstdc.h f
rltty.h f
rlwinsize.h f
tcap.h f
tilde.h f
+xmalloc.h f
bind.c f
complete.c f
display.c f
@@ -77,6 +80,7 @@ doc/manvers.texinfo f
doc/rlman.texinfo f
doc/rltech.texinfo f
doc/rluser.texinfo f
+doc/rluserman.texinfo f
doc/hist.texinfo f
doc/hstech.texinfo f
doc/hsuser.texinfo f
@@ -84,8 +88,10 @@ doc/readline.3 f
doc/texi2dvi f
doc/texi2html f
examples/Makefile.in f
+examples/excallback.c f
examples/fileman.c f
examples/manexamp.c f
+examples/rlfe.c f
examples/rltest.c f
examples/rl.c f
examples/rlversion.c f
@@ -94,10 +100,14 @@ examples/Inputrc f
# formatted documentation, from MANIFEST.doc
doc/readline.ps f
doc/history.ps f
+doc/rluserman.ps f
doc/readline.dvi f
doc/history.dvi f
+doc/rluserman.dvi f
doc/readline.info f
doc/history.info f
+doc/rluserman.info f
doc/readline.html f
doc/history.html f
+doc/rluserman.html f
doc/readline.0 f
diff --git a/readline/Makefile.in b/readline/Makefile.in
index 746c83c14a3..023496d57bb 100644
--- a/readline/Makefile.in
+++ b/readline/Makefile.in
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
RL_LIBRARY_VERSION = @LIBVERSION@
RL_LIBRARY_NAME = readline
@@ -60,6 +60,8 @@ CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
+TERMCAP_LIB = @TERMCAP_LIB@
+
# For libraries which include headers from other libraries.
INCLUDES = -I. -I$(srcdir) -I$(includedir)
@@ -88,7 +90,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
- ansi_stdlib.h tcap.h rlstdc.h
+ ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h
HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
TILDEOBJ = tilde.o
@@ -115,6 +117,8 @@ INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
all: static
+everything: static shared examples
+
static: $(STATIC_LIBS)
libreadline.a: $(OBJECTS)
@@ -127,8 +131,8 @@ libhistory.a: $(HISTOBJ) xmalloc.o
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
-readline: $(OBJECTS) readline.h rldefs.h chardefs.h
- $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
+readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
+ $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
Makefile makefile: config.status $(srcdir)/Makefile.in
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
@@ -147,8 +151,8 @@ stamp-h: config.status $(srcdir)/config.h.in
CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
echo > $@
-$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
- cd $(srcdir) && autoconf ## Comment-me-out in distribution
+#$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
+# cd $(srcdir) && autoconf ## Comment-me-out in distribution
shared: force
@@ -165,10 +169,18 @@ examples: force
force:
-install: installdirs $(STATIC_LIBS)
+install-headers: installdirs ${INSTALLED_HEADERS}
for f in ${INSTALLED_HEADERS}; do \
$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
done
+
+uninstall-headers:
+ -test -n "$(includedir)" && cd $(includedir)/readline && \
+ ${RM} ${INSTALLED_HEADERS}
+
+maybe-uninstall-headers: uninstall-headers
+
+install: installdirs $(STATIC_LIBS) install-headers
-$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
$(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
-test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libreadline.a
@@ -184,16 +196,14 @@ installdirs: $(srcdir)/support/mkdirs
-$(SHELL) $(srcdir)/support/mkdirs $(includedir) \
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
-uninstall:
- -test -n "$(includedir)" && cd $(includedir)/readline && \
- ${RM} ${INSTALLED_HEADERS}
+uninstall: uninstall-headers
-test -n "$(libdir)" && cd $(libdir) && \
${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
-install-shared: installdirs shared
+install-shared: installdirs install-headers shared
-( cd shlib ; ${MAKE} ${MFLAGS} install )
-uninstall-shared:
+uninstall-shared: maybe-uninstall-headers
-( cd shlib; ${MAKE} ${MFLAGS} uninstall )
TAGS: force
@@ -204,6 +214,7 @@ tags: force
clean: force
$(RM) $(OBJECTS) $(STATIC_LIBS)
+ $(RM) readline readline.exe
-( cd shlib && $(MAKE) $(MFLAGS) $@ )
-( cd doc && $(MAKE) $(MFLAGS) $@ )
-( cd examples && $(MAKE) $(MFLAGS) $@ )
@@ -231,7 +242,7 @@ installcheck:
dist: force
@echo Readline distributions are created using $(srcdir)/support/mkdist.
@echo Here is a sample of the necessary commands:
- @echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION)
+ @echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME) $(RL_LIBRARY_VERSION)
@echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
@echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
@@ -290,6 +301,8 @@ macro.o: readline.h keymaps.h chardefs.h tilde.h
macro.o: history.h rlstdc.h
nls.o: ansi_stdlib.h
nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+nls.o: readline.h keymaps.h chardefs.h tilde.h
+nls.o: history.h rlstdc.h
parens.o: rlconf.h
parens.o: ${BUILD_DIR}/config.h
parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h
@@ -328,6 +341,54 @@ vi_mode.o: history.h ansi_stdlib.h rlstdc.h
xmalloc.o: ${BUILD_DIR}/config.h
xmalloc.o: ansi_stdlib.h
+bind.o: rlshell.h
+histfile.o: rlshell.h
+nls.o: rlshell.h
+readline.o: rlshell.h
+shell.o: rlshell.h
+terminal.o: rlshell.h
+histexpand.o: rlshell.h
+
+bind.o: rlprivate.h
+callback.o: rlprivate.h
+complete.o: rlprivate.h
+display.o: rlprivate.h
+input.o: rlprivate.h
+isearch.o: rlprivate.h
+kill.o: rlprivate.h
+macro.o: rlprivate.h
+nls.o: rlprivate.h
+parens.o: rlprivate.h
+readline.o: rlprivate.h
+rltty.o: rlprivate.h
+search.o: rlprivate.h
+signals.o: rlprivate.h
+terminal.o: rlprivate.h
+undo.o: rlprivate.h
+util.o: rlprivate.h
+vi_mode.o: rlprivate.h
+
+bind.o: xmalloc.h
+complete.o: xmalloc.h
+display.o: xmalloc.h
+funmap.o: xmalloc.h
+histexpand.o: xmalloc.h
+histfile.o: xmalloc.h
+history.o: xmalloc.h
+input.o: xmalloc.h
+isearch.o: xmalloc.h
+keymaps.o: xmalloc.h
+kill.o: xmalloc.h
+macro.o: xmalloc.h
+readline.o: xmalloc.h
+savestring.o: xmalloc.h
+search.o: xmalloc.h
+shell.o: xmalloc.h
+tilde.o: xmalloc.h
+tilde.o: xmalloc.h
+util.o: xmalloc.h
+vi_mode.o: xmalloc.h
+
readline.o: $(srcdir)/readline.c
vi_mode.o: $(srcdir)/vi_mode.c
funmap.o: $(srcdir)/funmap.c
diff --git a/readline/README b/readline/README
index 56565b2fb80..41a5d0c82d6 100644
--- a/readline/README
+++ b/readline/README
@@ -1,7 +1,7 @@
Introduction
============
-This is the Gnu Readline library, version 4.0.
+This is the Gnu Readline library, version 4.1.
The Readline library provides a set of functions for use by applications
that allow users to edit command lines as they are typed in. Both
diff --git a/readline/aclocal.m4 b/readline/aclocal.m4
index c277a0c6105..f8f5b74b72f 100644
--- a/readline/aclocal.m4
+++ b/readline/aclocal.m4
@@ -316,13 +316,19 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
main()
{
DIR *dir;
-int fd;
-unlink("/tmp/not_a_directory");
-fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666);
+int fd, err;
+err = mkdir("/tmp/bash-aclocal", 0700);
+if (err < 0) {
+ perror("mkdir");
+ exit(1);
+}
+unlink("/tmp/bash-aclocal/not_a_directory");
+fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
write(fd, "\n", 1);
close(fd);
-dir = opendir("/tmp/not_a_directory");
-unlink("/tmp/not_a_directory");
+dir = opendir("/tmp/bash-aclocal/not_a_directory");
+unlink("/tmp/bash-aclocal/not_a_directory");
+rmdir("/tmp/bash-aclocal");
exit (dir == 0);
}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
[AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
@@ -354,25 +360,59 @@ AC_DEFINE(VOID_SIGHANDLER)
fi
])
-AC_DEFUN(BASH_TYPE_INT32_T,
+dnl
+dnl A signed 16-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_BITS16_T,
+[
+if test "$ac_cv_sizeof_short" = 2; then
+ AC_CHECK_TYPE(bits16_t, short)
+elif test "$ac_cv_sizeof_char" = 2; then
+ AC_CHECK_TYPE(bits16_t, char)
+else
+ AC_CHECK_TYPE(bits16_t, short)
+fi
+])
+
+dnl
+dnl An unsigned 16-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_U_BITS16_T,
+[
+if test "$ac_cv_sizeof_short" = 2; then
+ AC_CHECK_TYPE(u_bits16_t, unsigned short)
+elif test "$ac_cv_sizeof_char" = 2; then
+ AC_CHECK_TYPE(u_bits16_t, unsigned char)
+else
+ AC_CHECK_TYPE(u_bits16_t, unsigned short)
+fi
+])
+
+dnl
+dnl A signed 32-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_BITS32_T,
[
if test "$ac_cv_sizeof_int" = 4; then
- AC_CHECK_TYPE(int32_t, int)
+ AC_CHECK_TYPE(bits32_t, int)
elif test "$ac_cv_sizeof_long" = 4; then
- AC_CHECK_TYPE(int32_t, long)
+ AC_CHECK_TYPE(bits32_t, long)
else
- AC_CHECK_TYPE(int32_t, int)
+ AC_CHECK_TYPE(bits32_t, int)
fi
])
-AC_DEFUN(BASH_TYPE_U_INT32_T,
+dnl
+dnl An unsigned 32-bit integer quantity
+dnl
+AC_DEFUN(BASH_TYPE_U_BITS32_T,
[
if test "$ac_cv_sizeof_int" = 4; then
- AC_CHECK_TYPE(u_int32_t, unsigned int)
+ AC_CHECK_TYPE(u_bits32_t, unsigned int)
elif test "$ac_cv_sizeof_long" = 4; then
- AC_CHECK_TYPE(u_int32_t, unsigned long)
+ AC_CHECK_TYPE(u_bits32_t, unsigned long)
else
- AC_CHECK_TYPE(u_int32_t, unsigned int)
+ AC_CHECK_TYPE(u_bits32_t, unsigned int)
fi
])
@@ -387,6 +427,9 @@ else
fi
])
+dnl
+dnl A signed 64-bit quantity
+dnl
AC_DEFUN(BASH_TYPE_BITS64_T,
[
if test "$ac_sv_sizeof_char_p" = 8; then
@@ -427,6 +470,20 @@ if test $bash_cv_func_lstat = yes; then
fi
])
+AC_DEFUN(BASH_FUNC_INET_ATON,
+[
+AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
+[AC_TRY_LINK([
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
+bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
+if test $bash_cv_func_inet_aton = yes; then
+ AC_DEFINE(HAVE_INET_ATON)
+fi
+])
+
AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
[AC_MSG_CHECKING([for a c_line member of struct termios])
AC_CACHE_VAL(bash_cv_termios_ldisc,
@@ -845,7 +902,7 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
/* Add more tests in here as appropriate. */
main()
{
-int fd;
+int fd, err;
#if defined (HAVE_MKFIFO)
exit (0);
@@ -858,12 +915,19 @@ exit (1);
#if defined (NeXT)
exit (1);
#endif
-
-fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0);
-if (fd == -1)
+err = mkdir("/tmp/bash-aclocal", 0700);
+if (err < 0) {
+ perror ("mkdir");
+ exit(1);
+}
+fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
+if (fd == -1) {
+ rmdir ("/tmp/bash-aclocal");
exit (1);
+}
close(fd);
-unlink ("/tmp/sh-np-autoconf");
+unlink ("/tmp/bash-aclocal/sh-np-autoconf");
+rmdir ("/tmp/bash-aclocal");
exit(0);
}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
[AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
@@ -1037,12 +1101,32 @@ elif test $bash_cv_dev_fd = "whacky"; then
fi
])
+AC_DEFUN(BASH_CHECK_DEV_STDIN,
+[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
+AC_CACHE_VAL(bash_cv_dev_stdin,
+[if test -d /dev/fd && test -r /dev/stdin; then
+ bash_cv_dev_stdin=present
+ elif test -d /proc/self/fd && test -r /dev/stdin; then
+ bash_cv_dev_stdin=present
+ else
+ bash_cv_dev_stdin=absent
+ fi
+])
+AC_MSG_RESULT($bash_cv_dev_stdin)
+if test $bash_cv_dev_stdin = "present"; then
+ AC_DEFINE(HAVE_DEV_STDIN)
+fi
+])
+
+dnl
+dnl Check for the presence of getpeername in libsocket.
+dnl If libsocket is present, check for libnsl and add it to LIBS if
+dnl it's there, since most systems with libsocket require linking
+dnl with libnsl as well. This should only be called if getpeername
+dnl was not found in libc.
dnl
-dnl Check for the presence of getpeername (the only networking function
-dnl bash currently requires) in libsocket. If libsocket is present,
-dnl check for libnsl and add it to LIBS if it's there, since most
-dnl systems with libsocket require linking with libnsl as well.
-dnl This should only be called if getpeername was not found in libc.
+dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
+dnl AS WELL
dnl
AC_DEFUN(BASH_CHECK_SOCKLIB,
[
@@ -1084,6 +1168,32 @@ if test $bash_cv_have_socklib = yes; then
fi
])
+dnl
+dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
+dnl system, we can't use AC_PREREQ
+dnl
+AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
+[if test "X$bash_cv_have_gethostbyname" = "X"; then
+_bash_needmsg=yes
+else
+AC_MSG_CHECKING(for gethostbyname in socket library)
+_bash_needmsg=
+fi
+AC_CACHE_VAL(bash_cv_have_gethostbyname,
+[AC_TRY_LINK([#include <netdb.h>],
+[ struct hostent *hp;
+ hp = gethostbyname("localhost");
+], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
+)
+if test "X$_bash_needmsg" = Xyes; then
+ AC_MSG_CHECKING(for gethostbyname in socket library)
+fi
+AC_MSG_RESULT($bash_cv_have_gethostbyname)
+if test "$bash_cv_have_gethostbyname" = yes; then
+AC_DEFINE(HAVE_GETHOSTBYNAME)
+fi
+])
+
AC_DEFUN(BASH_DEFAULT_MAIL_DIR,
[AC_MSG_CHECKING(for default mail directory)
AC_CACHE_VAL(bash_cv_mail_dir,
@@ -1299,3 +1409,19 @@ switch (0) case 0: case (sizeof (off_t) <= 4):;
if test $bash_cv_off_t_64 = yes; then
AC_DEFINE(HAVE_OFF_T_64)
fi])
+
+AC_DEFUN(BASH_STRUCT_TIMEVAL,
+[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
+AC_CACHE_VAL(bash_cv_struct_timeval,
+[
+AC_EGREP_HEADER(struct timeval, sys/time.h,
+ bash_cv_struct_timeval=yes,
+ AC_EGREP_HEADER(struct timeval, time.h,
+ bash_cv_struct_timeval=yes,
+ bash_cv_struct_timeval=no))
+])
+AC_MSG_RESULT($bash_cv_struct_timeval)
+if test $bash_cv_struct_timeval = yes; then
+ AC_DEFINE(HAVE_TIMEVAL)
+fi
+])
diff --git a/readline/ansi_stdlib.h b/readline/ansi_stdlib.h
index 52339da5d33..a720cb9bcbc 100644
--- a/readline/ansi_stdlib.h
+++ b/readline/ansi_stdlib.h
@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_STDLIB_H_)
#define _STDLIB_H_ 1
diff --git a/readline/bind.c b/readline/bind.c
index f446dc8cd10..6a6424e9e02 100644
--- a/readline/bind.c
+++ b/readline/bind.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -42,7 +42,6 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#include <signal.h>
#include <errno.h>
#if !defined (errno)
@@ -58,61 +57,25 @@ extern int errno;
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_bell_preference;
-extern int _rl_meta_flag;
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_complete_show_all;
-extern int _rl_complete_mark_directories;
-extern int _rl_print_completions_horizontally;
-extern int _rl_completion_case_fold;
-extern int _rl_enable_keypad;
-#if defined (PAREN_MATCHING)
-extern int rl_blink_matching_paren;
-#endif /* PAREN_MATCHING */
-#if defined (VISIBLE_STATS)
-extern int rl_visible_stats;
-#endif /* VISIBLE_STATS */
-extern int rl_complete_with_tilde_expansion;
-extern int rl_completion_query_items;
-extern int rl_inhibit_completion;
-extern char *_rl_comment_begin;
-extern unsigned char *_rl_isearch_terminators;
-
-extern int rl_explicit_arg;
-extern int rl_editing_mode;
-extern unsigned char _rl_parsing_conditionalized_out;
-extern Keymap _rl_keymap;
-
-extern char *possible_control_prefixes[], *possible_meta_prefixes[];
-
-/* Functions imported from funmap.c */
-extern char **rl_funmap_names ();
-extern int rl_add_funmap_entry ();
-
-/* Functions imported from util.c */
-extern char *_rl_strindex ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
/* Variables exported by this file. */
Keymap rl_binding_keymap;
-/* Forward declarations */
-void rl_set_keymap_from_edit_mode ();
+static int _rl_read_init_file __P((char *, int));
+static int glean_key_from_name __P((char *));
+static int substring_member_of_array __P((char *, char **));
-static int _rl_read_init_file ();
-static int glean_key_from_name ();
-static int substring_member_of_array ();
+static int currently_reading_init_file;
-extern char *xmalloc (), *xrealloc ();
+/* used only in this file */
+static int _rl_prefer_visible_bell = 1;
/* **************************************************************** */
/* */
@@ -677,9 +640,16 @@ _rl_read_file (filename, sizep)
return ((char *)NULL);
}
+#if 0
buffer[file_size] = '\0';
if (sizep)
*sizep = file_size;
+#else
+ buffer[i] = '\0';
+ if (sizep)
+ *sizep = i;
+#endif
+
return (buffer);
}
@@ -718,6 +688,11 @@ rl_read_init_file (filename)
if (*filename == 0)
filename = DEFAULT_INPUTRC;
+#if defined (__MSDOS__)
+ if (_rl_read_init_file (filename, 0) == 0)
+ return 0;
+ filename = "~/_inputrc";
+#endif
return (_rl_read_init_file (filename, 0));
}
@@ -746,6 +721,8 @@ _rl_read_init_file (filename, include_level)
last_readline_init_file = savestring (filename);
}
+ currently_reading_init_file = 1;
+
/* Loop over the lines in the file. Lines that start with `#' are
comments; all other lines are commands for readline initialization. */
current_readline_init_lineno = 1;
@@ -756,6 +733,12 @@ _rl_read_init_file (filename, include_level)
/* Find the end of this line. */
for (i = 0; line + i != end && line[i] != '\n'; i++);
+#if defined (__CYGWIN32__)
+ /* ``Be liberal in what you accept.'' */
+ if (line[i] == '\n' && line[i-1] == '\r')
+ line[i - 1] = '\0';
+#endif
+
/* Mark end of line. */
line[i] = '\0';
@@ -776,6 +759,7 @@ _rl_read_init_file (filename, include_level)
}
free (buffer);
+ currently_reading_init_file = 0;
return (0);
}
@@ -783,9 +767,11 @@ static void
_rl_init_file_error (msg)
char *msg;
{
- fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
- current_readline_init_lineno,
- msg);
+ if (currently_reading_init_file)
+ fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
+ current_readline_init_lineno, msg);
+ else
+ fprintf (stderr, "readline: %s\n", msg);
}
/* **************************************************************** */
@@ -1232,154 +1218,273 @@ rl_parse_and_bind (string)
have one of two values; either "On" or 1 for truth, or "Off" or 0 for
false. */
+#define V_SPECIAL 0x1
+
static struct {
char *name;
int *value;
+ int flags;
} boolean_varlist [] = {
-#if defined (PAREN_MATCHING)
- { "blink-matching-paren", &rl_blink_matching_paren },
-#endif
- { "completion-ignore-case", &_rl_completion_case_fold },
- { "convert-meta", &_rl_convert_meta_chars_to_ascii },
- { "disable-completion", &rl_inhibit_completion },
- { "enable-keypad", &_rl_enable_keypad },
- { "expand-tilde", &rl_complete_with_tilde_expansion },
- { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode },
- { "input-meta", &_rl_meta_flag },
- { "mark-directories", &_rl_complete_mark_directories },
- { "mark-modified-lines", &_rl_mark_modified_lines },
- { "meta-flag", &_rl_meta_flag },
- { "output-meta", &_rl_output_meta_chars },
- { "print-completions-horizontally", &_rl_print_completions_horizontally },
- { "show-all-if-ambiguous", &_rl_complete_show_all },
+ { "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
+ { "completion-ignore-case", &_rl_completion_case_fold, 0 },
+ { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
+ { "disable-completion", &rl_inhibit_completion, 0 },
+ { "enable-keypad", &_rl_enable_keypad, 0 },
+ { "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
+ { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
+ { "input-meta", &_rl_meta_flag, 0 },
+ { "mark-directories", &_rl_complete_mark_directories, 0 },
+ { "mark-modified-lines", &_rl_mark_modified_lines, 0 },
+ { "meta-flag", &_rl_meta_flag, 0 },
+ { "output-meta", &_rl_output_meta_chars, 0 },
+ { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
+ { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
+ { "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
#if defined (VISIBLE_STATS)
- { "visible-stats", &rl_visible_stats },
+ { "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */
{ (char *)NULL, (int *)NULL }
};
+static int
+find_boolean_var (name)
+ char *name;
+{
+ register int i;
+
+ for (i = 0; boolean_varlist[i].name; i++)
+ if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
+ return i;
+ return -1;
+}
+
+/* Hooks for handling special boolean variables, where a
+ function needs to be called or another variable needs
+ to be changed when they're changed. */
+static void
+hack_special_boolean_var (i)
+ int i;
+{
+ char *name;
+
+ name = boolean_varlist[i].name;
+
+ if (_rl_stricmp (name, "blink-matching-paren") == 0)
+ _rl_enable_paren_matching (rl_blink_matching_paren);
+ else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
+ {
+ if (_rl_prefer_visible_bell)
+ _rl_bell_preference = VISIBLE_BELL;
+ else
+ _rl_bell_preference = AUDIBLE_BELL;
+ }
+}
+
+/* These *must* correspond to the array indices for the appropriate
+ string variable. (Though they're not used right now.) */
+#define V_BELLSTYLE 0
+#define V_COMBEGIN 1
+#define V_EDITMODE 2
+#define V_ISRCHTERM 3
+#define V_KEYMAP 4
+
+#define V_STRING 1
+#define V_INT 2
+
+/* Forward declarations */
+static int sv_bell_style __P((char *));
+static int sv_combegin __P((char *));
+static int sv_compquery __P((char *));
+static int sv_editmode __P((char *));
+static int sv_isrchterm __P((char *));
+static int sv_keymap __P((char *));
+
+static struct {
+ char *name;
+ int flags;
+ Function *set_func;
+} string_varlist[] = {
+ { "bell-style", V_STRING, sv_bell_style },
+ { "comment-begin", V_STRING, sv_combegin },
+ { "completion-query-items", V_INT, sv_compquery },
+ { "editing-mode", V_STRING, sv_editmode },
+ { "isearch-terminators", V_STRING, sv_isrchterm },
+ { "keymap", V_STRING, sv_keymap },
+ { (char *)NULL, 0 }
+};
+
+static int
+find_string_var (name)
+ char *name;
+{
+ register int i;
+
+ for (i = 0; string_varlist[i].name; i++)
+ if (_rl_stricmp (name, string_varlist[i].name) == 0)
+ return i;
+ return -1;
+}
+
+/* A boolean value that can appear in a `set variable' command is true if
+ the value is null or empty, `on' (case-insenstive), or "1". Any other
+ values result in 0 (false). */
+static int
+bool_to_int (value)
+ char *value;
+{
+ return (value == 0 || *value == '\0' ||
+ (_rl_stricmp (value, "on") == 0) ||
+ (value[0] == '1' && value[1] == '\0'));
+}
+
int
rl_variable_bind (name, value)
char *name, *value;
{
register int i;
+ int v;
/* Check for simple variables first. */
- for (i = 0; boolean_varlist[i].name; i++)
+ i = find_boolean_var (name);
+ if (i >= 0)
{
- if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
- {
- /* A variable is TRUE if the "value" is "on", "1" or "". */
- *boolean_varlist[i].value = *value == 0 ||
- _rl_stricmp (value, "on") == 0 ||
- (value[0] == '1' && value[1] == '\0');
- return 0;
- }
+ *boolean_varlist[i].value = bool_to_int (value);
+ if (boolean_varlist[i].flags & V_SPECIAL)
+ hack_special_boolean_var (i);
+ return 0;
}
- /* Not a boolean variable, so check for specials. */
+ i = find_string_var (name);
- /* Editing mode change? */
- if (_rl_stricmp (name, "editing-mode") == 0)
+ /* For the time being, unknown variable names or string names without a
+ handler function are simply ignored. */
+ if (i < 0 || string_varlist[i].set_func == 0)
+ return 0;
+
+ v = (*string_varlist[i].set_func) (value);
+ return v;
+}
+
+static int
+sv_editmode (value)
+ char *value;
+{
+ if (_rl_strnicmp (value, "vi", 2) == 0)
{
- if (_rl_strnicmp (value, "vi", 2) == 0)
- {
#if defined (VI_MODE)
- _rl_keymap = vi_insertion_keymap;
- rl_editing_mode = vi_mode;
+ _rl_keymap = vi_insertion_keymap;
+ rl_editing_mode = vi_mode;
#endif /* VI_MODE */
- }
- else if (_rl_strnicmp (value, "emacs", 5) == 0)
- {
- _rl_keymap = emacs_standard_keymap;
- rl_editing_mode = emacs_mode;
- }
+ return 0;
}
-
- /* Comment string change? */
- else if (_rl_stricmp (name, "comment-begin") == 0)
+ else if (_rl_strnicmp (value, "emacs", 5) == 0)
{
- if (*value)
- {
- if (_rl_comment_begin)
- free (_rl_comment_begin);
-
- _rl_comment_begin = savestring (value);
- }
+ _rl_keymap = emacs_standard_keymap;
+ rl_editing_mode = emacs_mode;
+ return 0;
}
- else if (_rl_stricmp (name, "completion-query-items") == 0)
+ return 1;
+}
+
+static int
+sv_combegin (value)
+ char *value;
+{
+ if (value && *value)
{
- int nval = 100;
- if (*value)
- {
- nval = atoi (value);
- if (nval < 0)
- nval = 0;
- }
- rl_completion_query_items = nval;
+ FREE (_rl_comment_begin);
+ _rl_comment_begin = savestring (value);
+ return 0;
}
- else if (_rl_stricmp (name, "keymap") == 0)
+ return 1;
+}
+
+static int
+sv_compquery (value)
+ char *value;
+{
+ int nval = 100;
+
+ if (value && *value)
{
- Keymap kmap;
- kmap = rl_get_keymap_by_name (value);
- if (kmap)
- rl_set_keymap (kmap);
+ nval = atoi (value);
+ if (nval < 0)
+ nval = 0;
}
- else if (_rl_stricmp (name, "bell-style") == 0)
+ rl_completion_query_items = nval;
+ return 0;
+}
+
+static int
+sv_keymap (value)
+ char *value;
+{
+ Keymap kmap;
+
+ kmap = rl_get_keymap_by_name (value);
+ if (kmap)
{
- if (!*value)
- _rl_bell_preference = AUDIBLE_BELL;
- else
- {
- if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
- _rl_bell_preference = NO_BELL;
- else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
- _rl_bell_preference = AUDIBLE_BELL;
- else if (_rl_stricmp (value, "visible") == 0)
- _rl_bell_preference = VISIBLE_BELL;
- }
+ rl_set_keymap (kmap);
+ return 0;
}
- else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
+ return 1;
+}
+
+#define _SET_BELL(v) do { _rl_bell_preference = v; return 0; } while (0)
+
+static int
+sv_bell_style (value)
+ char *value;
+{
+ if (value == 0 || *value == '\0')
+ _SET_BELL (AUDIBLE_BELL);
+ else if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
+ _SET_BELL (NO_BELL);
+ else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
+ _SET_BELL (AUDIBLE_BELL);
+ else if (_rl_stricmp (value, "visible") == 0)
+ _SET_BELL (VISIBLE_BELL);
+ else
+ return 1;
+}
+#undef _SET_BELL
+
+static int
+sv_isrchterm (value)
+ char *value;
+{
+ int beg, end, delim;
+ char *v;
+
+ if (value == 0)
+ return 1;
+
+ /* Isolate the value and translate it into a character string. */
+ v = savestring (value);
+ FREE (_rl_isearch_terminators);
+ if (v[0] == '"' || v[0] == '\'')
{
- /* Backwards compatibility. */
- if (*value && (_rl_stricmp (value, "on") == 0 ||
- (*value == '1' && !value[1])))
- _rl_bell_preference = VISIBLE_BELL;
- else
- _rl_bell_preference = AUDIBLE_BELL;
+ delim = v[0];
+ for (beg = end = 1; v[end] && v[end] != delim; end++)
+ ;
}
- else if (_rl_stricmp (name, "isearch-terminators") == 0)
+ else
{
- /* Isolate the value and translate it into a character string. */
- int beg, end;
- char *v;
+ for (beg = end = 0; whitespace (v[end]) == 0; end++)
+ ;
+ }
- v = savestring (value);
- FREE (_rl_isearch_terminators);
- if (v[0] == '"' || v[0] == '\'')
- {
- int delim = v[0];
- for (beg = end = 1; v[end] && v[end] != delim; end++)
- ;
- }
- else
- {
- for (beg = end = 0; whitespace (v[end]) == 0; end++)
- ;
- }
+ v[end] = '\0';
- v[end] = '\0';
- /* The value starts at v + beg. Translate it into a character string. */
- _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
- rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
- _rl_isearch_terminators[end] = '\0';
- free (v);
- }
-
- /* For the time being, unknown variable names are simply ignored. */
+ /* The value starts at v + beg. Translate it into a character string. */
+ _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
+ rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
+ _rl_isearch_terminators[end] = '\0';
+
+ free (v);
return 0;
}
-
+
/* Return the character which matches NAME.
For example, `Space' returns ' '. */
diff --git a/readline/callback.c b/readline/callback.c
index 6915be483a4..117235697e1 100644
--- a/readline/callback.c
+++ b/readline/callback.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -35,15 +35,7 @@
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "readline.h"
-
-extern void readline_internal_setup ();
-extern char *readline_internal_teardown ();
-extern int readline_internal_char ();
-extern void _rl_init_line_state ();
-
-extern int _rl_meta_flag;
-extern char *rl_prompt;
-extern int rl_visible_prompt_length;
+#include "rlprivate.h"
/* **************************************************************** */
/* */
diff --git a/readline/chardefs.h b/readline/chardefs.h
index 3e9e2737706..664c1e43368 100644
--- a/readline/chardefs.h
+++ b/readline/chardefs.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _CHARDEFS_H_
#define _CHARDEFS_H_
diff --git a/readline/complete.c b/readline/complete.c
index 714a2bf49dc..fb48712a4e0 100644
--- a/readline/complete.c
+++ b/readline/complete.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -70,20 +70,14 @@ extern struct passwd *getpwent ();
/* Some standard library routines. */
#include "readline.h"
+#include "xmalloc.h"
+#include "rlprivate.h"
-extern char *tilde_expand ();
-extern char *rl_copy_text ();
-extern void _rl_abort_internal ();
-extern int _rl_qsort_string_compare ();
-extern void _rl_replace_text ();
-
-extern Function *rl_last_func;
-extern int rl_editing_mode;
-extern int screenwidth;
-
-extern void _rl_move_vert ();
-extern int _rl_vis_botlin;
-extern int rl_display_fixed;
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
/* If non-zero, then this is the address of a function to call when
completing a word would normally display the list of possible matches.
@@ -95,27 +89,25 @@ extern int rl_display_fixed;
VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
/* Forward declarations for functions defined and used in this file. */
-char *filename_completion_function ();
-char **completion_matches ();
+char *filename_completion_function __P((char *, int));
+char **completion_matches __P((char *, CPFunction *));
#if defined (VISIBLE_STATS)
# if !defined (X_OK)
# define X_OK 1
# endif
-static int stat_char ();
+static int stat_char __P((char *));
#endif
-static char *rl_quote_filename ();
-static char *rl_strpbrk ();
-
-static char **remove_duplicate_matches ();
-static void insert_match ();
-static int append_to_match ();
-static void insert_all_matches ();
-static void display_matches ();
-static int compute_lcd_of_matches ();
+static char *rl_quote_filename __P((char *, int, char *));
+static char *rl_strpbrk __P((char *, char *));
-extern char *xmalloc (), *xrealloc ();
+static char **remove_duplicate_matches __P((char **));
+static void insert_match __P((char *, int, int, char *));
+static int append_to_match __P((char *, int, int));
+static void insert_all_matches __P((char **, int, char *));
+static void display_matches __P((char **));
+static int compute_lcd_of_matches __P((char **, int, char *));
/* **************************************************************** */
/* */
@@ -136,7 +128,11 @@ int _rl_complete_mark_directories = 1;
int _rl_print_completions_horizontally;
/* Non-zero means that case is not significant in filename completion. */
+#if defined (__MSDOS__) && !defined (__DJGPP__)
+int _rl_completion_case_fold = 1;
+#else
int _rl_completion_case_fold;
+#endif
/* Global variables available to applications using readline. */
@@ -417,6 +413,10 @@ printable_part (pathname)
char *temp;
temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
+#if defined (__MSDOS__)
+ if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
+ temp = pathname + 1;
+#endif
return (temp ? ++temp : pathname);
}
@@ -477,7 +477,12 @@ print_filename (to_print, full_pathname)
c = to_print[-1];
to_print[-1] = '\0';
- s = tilde_expand (full_pathname);
+ /* If setting the last slash in full_pathname to a NUL results in
+ full_pathname being the empty string, we are trying to complete
+ files in the root directory. If we pass a null string to the
+ bash directory completion hook, for example, it will expand it
+ to the current directory. We just want the `/'. */
+ s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
if (rl_directory_completion_hook)
(*rl_directory_completion_hook) (&s);
@@ -627,25 +632,31 @@ find_completion_word (fp, dp)
/* If there is an application-specific function to say whether or not
a character is quoted and we found a quote character, let that
function decide whether or not a character is a word break, even
- if it is found in rl_completer_word_break_characters. */
- if (rl_char_is_quoted_p)
- isbrk = (found_quote == 0 ||
- (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
- strchr (rl_completer_word_break_characters, scan) != 0;
- else
- isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
-
- if (isbrk)
+ if it is found in rl_completer_word_break_characters. Don't bother
+ if we're at the end of the line, though. */
+ if (scan)
{
- /* If the character that caused the word break was a quoting
- character, then remember it as the delimiter. */
- if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, scan) && (end - rl_point) > 1)
- delimiter = scan;
-
- /* If the character isn't needed to determine something special
- about what kind of completion to perform, then advance past it. */
- if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
- rl_point++;
+ if (rl_char_is_quoted_p)
+ isbrk = (found_quote == 0 ||
+ (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
+ strchr (rl_completer_word_break_characters, scan) != 0;
+ else
+ isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
+
+ if (isbrk)
+ {
+ /* If the character that caused the word break was a quoting
+ character, then remember it as the delimiter. */
+ if (rl_basic_quote_characters &&
+ strchr (rl_basic_quote_characters, scan) &&
+ (end - rl_point) > 1)
+ delimiter = scan;
+
+ /* If the character isn't needed to determine something special
+ about what kind of completion to perform, then advance past it. */
+ if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
+ rl_point++;
+ }
}
if (fp)
@@ -715,7 +726,7 @@ remove_duplicate_matches (matches)
/* Sort the array without matches[0], since we need it to
stay in place no matter what. */
if (i)
- qsort (matches+1, i-1, sizeof (char *), _rl_qsort_string_compare);
+ qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
/* Remember the lowest common denominator for it may be unique. */
lowest_common = savestring (matches[0]);
@@ -908,7 +919,7 @@ rl_display_match_list (matches, len, max)
/* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0)
- qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
+ qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
crlf ();
@@ -1407,9 +1418,9 @@ username_completion_function (text, state)
char *text;
int state;
{
-#if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT)
+#if defined (__WIN32__) || defined (__OPENNT)
return (char *)NULL;
-#else /* !__GO32__ */
+#else /* !__WIN32__ && !__OPENNT) */
static char *username = (char *)NULL;
static struct passwd *entry;
static int namelen, first_char, first_char_loc;
@@ -1452,7 +1463,7 @@ username_completion_function (text, state)
return (value);
}
-#endif /* !__GO32__ */
+#endif /* !__WIN32__ && !__OPENNT */
}
/* Okay, now we write the entry_function for filename completion. In the
@@ -1494,11 +1505,25 @@ filename_completion_function (text, state)
temp = strrchr (dirname, '/');
+#if defined (__MSDOS__)
+ /* special hack for //X/... */
+ if (dirname[0] == '/' && dirname[1] == '/' && isalpha (dirname[2]) && dirname[3] == '/')
+ temp = strrchr (dirname + 3, '/');
+#endif
+
if (temp)
{
strcpy (filename, ++temp);
*temp = '\0';
}
+#if defined (__MSDOS__)
+ /* searches from current directory on the drive */
+ else if (isalpha (dirname[0]) && dirname[1] == ':')
+ {
+ strcpy (filename, dirname + 2);
+ dirname[2] = '\0';
+ }
+#endif
else
{
dirname[0] = '.';
@@ -1660,11 +1685,7 @@ rl_menu_complete (count, ignore)
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
- {
- for (match_list_index = 0; matches[match_list_index]; match_list_index++)
- free (matches[match_list_index]);
- free (matches);
- }
+ free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
diff --git a/readline/config.h.in b/readline/config.h.in
index 65927a8440d..d9aa5354c1d 100644
--- a/readline/config.h.in
+++ b/readline/config.h.in
@@ -14,6 +14,9 @@
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
diff --git a/readline/configure b/readline/configure
index 454a177e35d..bcb5ff85ab6 100755
--- a/readline/configure
+++ b/readline/configure
@@ -1,7 +1,19 @@
#! /bin/sh
-# From configure.in for Readline 4.0, version 2.14, from autoconf version 2.12
-LIBVERSION=4.0
+# From configure.in for Readline 4.1, version 2.22, from autoconf version 2.13
+LIBVERSION=4.1
+
+
+
+
+
+
+
+
+
+
+
+
@@ -92,7 +104,7 @@ LIBVERSION=4.0
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -142,6 +154,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@@ -425,7 +438,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@@ -595,9 +608,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -637,26 +652,26 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:646: checking host system type" >&5
+echo "configure:661: checking host system type" >&5
host_alias=$host
case "$host_alias" in
NONE)
case $nonopt in
NONE)
- if host_alias=`$ac_config_guess`; then :
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
fi ;;
*) host_alias=$nonopt ;;
esac ;;
esac
-host=`$ac_config_sub $host_alias`
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
@@ -683,15 +698,16 @@ test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:687: checking for $ac_word" >&5
+echo "configure:702: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -712,16 +728,17 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:716: checking for $ac_word" >&5
+echo "configure:732: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -756,25 +773,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:783: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 774 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 826 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -788,18 +841,24 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:857: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:803: checking whether we are using GNU C" >&5
+echo "configure:862: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -808,7 +867,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -819,11 +878,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:827: checking whether ${CC-cc} accepts -g" >&5
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:890: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -838,20 +901,24 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:855: checking how to run the C preprocessor" >&5
+echo "configure:922: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -866,14 +933,14 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 870 "configure"
+#line 937 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -883,14 +950,31 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 887 "configure"
+#line 954 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 971 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -903,6 +987,8 @@ fi
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
@@ -913,18 +999,18 @@ echo "$ac_t""$CPP" 1>&6
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:917: checking for minix/config.h" >&5
+echo "configure:1003: checking for minix/config.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 922 "configure"
+#line 1008 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -966,13 +1052,13 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:970: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:1056: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 976 "configure"
+#line 1062 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -990,7 +1076,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 994 "configure"
+#line 1080 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -1018,28 +1104,30 @@ fi
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1026: checking for a BSD compatible install" >&5
+echo "configure:1113: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -1069,20 +1157,23 @@ echo "$ac_t""$INSTALL" 1>&6
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1078: checking for $ac_word" >&5
+echo "configure:1168: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_AR="ar"
@@ -1103,15 +1194,16 @@ test -n "$ARFLAGS" || ARFLAGS="cr"
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1107: checking for $ac_word" >&5
+echo "configure:1198: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_RANLIB="ranlib"
@@ -1134,12 +1226,12 @@ MAKE_SHELL=/bin/sh
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1138: checking return type of signal handlers" >&5
+echo "configure:1230: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1143 "configure"
+#line 1235 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1156,7 +1248,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1176,12 +1268,12 @@ EOF
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:1180: checking whether stat file-mode macros are broken" >&5
+echo "configure:1272: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1185 "configure"
+#line 1277 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1236,12 +1328,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1240: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1332: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
+#line 1337 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -1249,7 +1341,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:1253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1345: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -1274,7 +1366,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1278: checking for opendir in -ldir" >&5
+echo "configure:1370: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1282,7 +1374,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1286 "configure"
+#line 1378 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1293,7 +1385,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1315,7 +1407,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1319: checking for opendir in -lx" >&5
+echo "configure:1411: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1323,7 +1415,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1327 "configure"
+#line 1419 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1334,7 +1426,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1357,15 +1449,16 @@ fi
fi
-for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat
+for ac_func in lstat memmove putenv select setenv setlocale \
+ strcasecmp tcgetattr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1364: checking for $ac_func" >&5
+echo "configure:1457: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1369 "configure"
+#line 1462 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1388,7 +1481,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1414,7 +1507,7 @@ done
echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:1418: checking for working strcoll" >&5
+echo "configure:1511: checking for working strcoll" >&5
if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1422,7 +1515,7 @@ else
ac_cv_func_strcoll_works=no
else
cat > conftest.$ac_ext <<EOF
-#line 1426 "configure"
+#line 1519 "configure"
#include "confdefs.h"
#include <string.h>
main ()
@@ -1432,7 +1525,7 @@ main ()
strcoll ("123", "456") >= 0);
}
EOF
-if { (eval echo configure:1436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strcoll_works=yes
else
@@ -1461,18 +1554,18 @@ for ac_hdr in unistd.h stdlib.h varargs.h stdarg.h string.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1465: checking for $ac_hdr" >&5
+echo "configure:1558: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1470 "configure"
+#line 1563 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1500,13 +1593,13 @@ done
echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
-echo "configure:1504: checking for type of signal functions" >&5
+echo "configure:1597: checking for type of signal functions" >&5
if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1510 "configure"
+#line 1603 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
@@ -1519,7 +1612,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:1523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=posix
else
@@ -1528,7 +1621,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 1532 "configure"
+#line 1625 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
@@ -1538,7 +1631,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:1542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=4.2bsd
else
@@ -1547,7 +1640,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 1551 "configure"
+#line 1644 "configure"
#include "confdefs.h"
#include <signal.h>
@@ -1560,7 +1653,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:1564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=svr3
else
@@ -1601,7 +1694,7 @@ fi
echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
-echo "configure:1605: checking if signal handlers must be reinstalled when invoked" >&5
+echo "configure:1698: checking if signal handlers must be reinstalled when invoked" >&5
if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1611,7 +1704,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1615 "configure"
+#line 1708 "configure"
#include "confdefs.h"
#include <signal.h>
@@ -1658,7 +1751,7 @@ main()
}
EOF
-if { (eval echo configure:1662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_must_reinstall_sighandlers=no
else
@@ -1683,7 +1776,7 @@ fi
echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
-echo "configure:1687: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+echo "configure:1780: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1693,7 +1786,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1697 "configure"
+#line 1790 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
@@ -1734,7 +1827,7 @@ exit(1);
#endif
}
EOF
-if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_func_sigsetjmp=present
else
@@ -1757,12 +1850,12 @@ EOF
fi
echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:1761: checking for lstat" >&5
+echo "configure:1854: checking for lstat" >&5
if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1766 "configure"
+#line 1859 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -1772,7 +1865,7 @@ int main() {
lstat(".",(struct stat *)0);
; return 0; }
EOF
-if { (eval echo configure:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_func_lstat=yes
else
@@ -1793,12 +1886,12 @@ EOF
fi
echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
-echo "configure:1797: checking whether programs are able to redeclare getpw functions" >&5
+echo "configure:1890: checking whether programs are able to redeclare getpw functions" >&5
if eval "test \"`echo '$''{'bash_cv_can_redecl_getpw'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1802 "configure"
+#line 1895 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <pwd.h>
@@ -1809,7 +1902,7 @@ int main() {
struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");
; return 0; }
EOF
-if { (eval echo configure:1813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_can_redecl_getpw=yes
else
@@ -1831,7 +1924,7 @@ fi
echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
-echo "configure:1835: checking whether or not strcoll and strcmp differ" >&5
+echo "configure:1928: checking whether or not strcoll and strcmp differ" >&5
if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1841,7 +1934,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1845 "configure"
+#line 1938 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -1880,7 +1973,7 @@ char *v[];
}
EOF
-if { (eval echo configure:1884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_func_strcoll_broken=yes
else
@@ -1904,12 +1997,12 @@ fi
echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
-echo "configure:1908: checking whether signal handlers are of type void" >&5
+echo "configure:2001: checking whether signal handlers are of type void" >&5
if eval "test \"`echo '$''{'bash_cv_void_sighandler'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1913 "configure"
+#line 2006 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1924,7 +2017,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_void_sighandler=yes
else
@@ -1944,12 +2037,12 @@ EOF
fi
echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:1948: checking for TIOCGWINSZ in sys/ioctl.h" >&5
+echo "configure:2041: checking for TIOCGWINSZ in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1953 "configure"
+#line 2046 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -1957,7 +2050,7 @@ int main() {
int x = TIOCGWINSZ;
; return 0; }
EOF
-if { (eval echo configure:1961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_tiocgwinsz_in_ioctl=yes
else
@@ -1978,12 +2071,12 @@ EOF
fi
echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:1982: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo "configure:2075: checking for TIOCSTAT in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1987 "configure"
+#line 2080 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -1991,7 +2084,7 @@ int main() {
int x = TIOCSTAT;
; return 0; }
EOF
-if { (eval echo configure:1995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_tiocstat_in_ioctl=yes
else
@@ -2012,12 +2105,12 @@ EOF
fi
echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:2016: checking for FIONREAD in sys/ioctl.h" >&5
+echo "configure:2109: checking for FIONREAD in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_fionread_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2021 "configure"
+#line 2114 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -2025,7 +2118,7 @@ int main() {
int x = FIONREAD;
; return 0; }
EOF
-if { (eval echo configure:2029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_fionread_in_ioctl=yes
else
@@ -2046,19 +2139,19 @@ EOF
fi
echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2050: checking for speed_t in sys/types.h" >&5
+echo "configure:2143: checking for speed_t in sys/types.h" >&5
if eval "test \"`echo '$''{'bash_cv_speed_t_in_sys_types'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2055 "configure"
+#line 2148 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
speed_t x;
; return 0; }
EOF
-if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_speed_t_in_sys_types=yes
else
@@ -2079,12 +2172,12 @@ EOF
fi
echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6
-echo "configure:2083: checking for struct winsize in sys/ioctl.h and termios.h" >&5
+echo "configure:2176: checking for struct winsize in sys/ioctl.h and termios.h" >&5
if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2088 "configure"
+#line 2181 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -2092,7 +2185,7 @@ int main() {
struct winsize x;
; return 0; }
EOF
-if { (eval echo configure:2096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_struct_winsize_header=ioctl_h
else
@@ -2100,7 +2193,7 @@ else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 2104 "configure"
+#line 2197 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <termios.h>
@@ -2108,7 +2201,7 @@ int main() {
struct winsize x;
; return 0; }
EOF
-if { (eval echo configure:2112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_struct_winsize_header=termios_h
else
@@ -2141,12 +2234,12 @@ fi
echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
-echo "configure:2145: checking if struct dirent has a d_ino member" >&5
+echo "configure:2238: checking if struct dirent has a d_ino member" >&5
if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2150 "configure"
+#line 2243 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2175,7 +2268,7 @@ struct dirent d; int z; z = d.d_ino;
; return 0; }
EOF
-if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_dirent_has_dino=yes
else
@@ -2197,12 +2290,12 @@ fi
echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
-echo "configure:2201: checking if struct dirent has a d_fileno member" >&5
+echo "configure:2294: checking if struct dirent has a d_fileno member" >&5
if eval "test \"`echo '$''{'bash_cv_dirent_has_d_fileno'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2206 "configure"
+#line 2299 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2231,7 +2324,7 @@ struct dirent d; int z; z = d.d_fileno;
; return 0; }
EOF
-if { (eval echo configure:2235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_dirent_has_d_fileno=yes
else
@@ -2260,14 +2353,14 @@ if test "X$bash_cv_termcap_lib" = "X"; then
_bash_needmsg=yes
else
echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2264: checking which library has the termcap functions" >&5
+echo "configure:2357: checking which library has the termcap functions" >&5
_bash_needmsg=
fi
if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:2271: checking for tgetent in -ltermcap" >&5
+echo "configure:2364: checking for tgetent in -ltermcap" >&5
ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2275,7 +2368,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2279 "configure"
+#line 2372 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2286,7 +2379,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2305,7 +2398,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:2309: checking for tgetent in -lcurses" >&5
+echo "configure:2402: checking for tgetent in -lcurses" >&5
ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2313,7 +2406,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2317 "configure"
+#line 2410 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2324,7 +2417,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2343,7 +2436,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:2347: checking for tgetent in -lncurses" >&5
+echo "configure:2440: checking for tgetent in -lncurses" >&5
ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2351,7 +2444,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2355 "configure"
+#line 2448 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2362,7 +2455,7 @@ int main() {
tgetent()
; return 0; }
EOF
-if { (eval echo configure:2366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2391,7 +2484,7 @@ fi
if test "X$_bash_needmsg" = "Xyes"; then
echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2395: checking which library has the termcap functions" >&5
+echo "configure:2488: checking which library has the termcap functions" >&5
fi
echo "$ac_t""using $bash_cv_termcap_lib" 1>&6
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
@@ -2428,8 +2521,8 @@ esac
#
if test -f ${srcdir}/support/shobj-conf; then
echo $ac_n "checking configuration for building shared libraries""... $ac_c" 1>&6
-echo "configure:2432: checking configuration for building shared libraries" >&5
- eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+echo "configure:2525: checking configuration for building shared libraries" >&5
+ eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
@@ -2443,9 +2536,20 @@ echo "configure:2432: checking configuration for building shared libraries" >&5
echo "$ac_t""$SHLIB_STATUS" 1>&6
+
+ # shared library versioning
+ # quoted for m4 so I can use character classes
+ SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
+ SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
+
+
fi
-BUILD_DIR=`pwd`
+case "$host_os" in
+msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
+*) BUILD_DIR=`pwd` ;;
+esac
+
@@ -2486,7 +2590,7 @@ EOF
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(set) 2>&1 |
- case `(ac_space=' '; set) 2>&1` in
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
*ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote substitution
# turns \\\\ into \\, and sed turns \\ into \).
@@ -2553,7 +2657,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -2573,9 +2677,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
+s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@@ -2602,6 +2708,7 @@ s%@host_os@%$host_os%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
@@ -2618,6 +2725,8 @@ s%@SHLIB_XLDFLAGS@%$SHLIB_XLDFLAGS%g
s%@SHLIB_LIBSUFF@%$SHLIB_LIBSUFF%g
s%@SHLIB_LIBVERSION@%$SHLIB_LIBVERSION%g
s%@SHLIB_LIBS@%$SHLIB_LIBS%g
+s%@SHLIB_MAJOR@%$SHLIB_MAJOR%g
+s%@SHLIB_MINOR@%$SHLIB_MINOR%g
s%@BUILD_DIR@%$BUILD_DIR%g
s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g
diff --git a/readline/configure.in b/readline/configure.in
index 240a3addc45..f977feca361 100644
--- a/readline/configure.in
+++ b/readline/configure.in
@@ -4,8 +4,8 @@ dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION([for Readline 4.0, version 2.14, from autoconf version] AC_ACVERSION)
-LIBVERSION=4.0
+AC_REVISION([for Readline 4.1, version 2.22, from autoconf version] AC_ACVERSION)
+LIBVERSION=4.1
AC_INIT(readline.h)
AC_CONFIG_HEADER(config.h)
@@ -32,6 +32,7 @@ fi
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
AC_PROG_CC
+dnl AC_AIX
AC_MINIX
# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
@@ -53,7 +54,8 @@ AC_RETSIGTYPE
AC_HEADER_STAT
AC_HEADER_DIRENT
-AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
+AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
+ strcasecmp tcgetattr)
AC_FUNC_STRCOLL
@@ -102,7 +104,7 @@ esac
#
if test -f ${srcdir}/support/shobj-conf; then
AC_MSG_CHECKING(configuration for building shared libraries)
- eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+ eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
AC_SUBST(SHOBJ_CC)
AC_SUBST(SHOBJ_CFLAGS)
AC_SUBST(SHOBJ_LD)
@@ -116,9 +118,20 @@ if test -f ${srcdir}/support/shobj-conf; then
AC_SUBST(SHLIB_LIBVERSION)
AC_SUBST(SHLIB_LIBS)
AC_MSG_RESULT($SHLIB_STATUS)
+
+ # shared library versioning
+ # quoted for m4 so I can use character classes
+ SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
+ SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
+ AC_SUBST(SHLIB_MAJOR)
+ AC_SUBST(SHLIB_MINOR)
fi
-BUILD_DIR=`pwd`
+case "$host_os" in
+msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
+*) BUILD_DIR=`pwd` ;;
+esac
+
AC_SUBST(BUILD_DIR)
AC_SUBST(CFLAGS)
diff --git a/readline/display.c b/readline/display.c
index 25aba64ca67..4487004a027 100644
--- a/readline/display.c
+++ b/readline/display.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -41,11 +41,6 @@
#include <stdio.h>
-#if defined (__GO32__)
-# include <go32.h>
-# include <pc.h>
-#endif /* __GO32__ */
-
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -56,48 +51,25 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-/* Global and pseudo-global variables and functions
- imported from readline.c. */
-extern char *rl_prompt;
-extern int readline_echoing_p;
-
-extern int _rl_output_meta_chars;
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_prefer_visible_bell;
-
-/* Variables and functions imported from terminal.c */
-extern void _rl_output_some_chars ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
-#else
-extern int _rl_output_character_function ();
+#if defined (HACK_TERMCAP_MOTION)
+extern char *term_forward_char;
#endif
-extern int _rl_backspace ();
-
-extern char *term_clreol, *term_clrpag;
-extern char *term_im, *term_ic, *term_ei, *term_DC;
-extern char *term_up, *term_dc, *term_cr, *term_IC;
-extern int screenheight, screenwidth, screenchars;
-extern int terminal_can_insert, _rl_term_autowrap;
-
-/* Pseudo-global functions (local to the readline library) exported
- by this file. */
-void _rl_move_cursor_relative (), _rl_output_some_chars ();
-void _rl_move_vert ();
-void _rl_clear_to_eol (), _rl_clear_screen ();
-static void update_line (), space_to_eol ();
-static void delete_chars (), insert_some_chars ();
-static void cr ();
+static void update_line __P((char *, char *, int, int, int, int));
+static void space_to_eol __P((int));
+static void delete_chars __P((int));
+static void insert_some_chars __P((char *, int));
+static void cr __P((void));
static int *inv_lbreaks, *vis_lbreaks;
-
-extern char *xmalloc (), *xrealloc ();
+static int inv_lbsize, vis_lbsize;
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. */
@@ -190,7 +162,7 @@ static int visible_first_line_len;
/* Expand the prompt string S and return the number of visible
characters in *LP, if LP is not null. This is currently more-or-less
a placeholder for expansion. LIP, if non-null is a place to store the
- index of the last invisible character in ther eturned string. */
+ index of the last invisible character in the returned string. */
/* Current implementation:
\001 (^A) start non-visible characters
@@ -250,6 +222,18 @@ expand_prompt (pmt, lp, lip)
return ret;
}
+/* Just strip out RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE from
+ PMT and return the rest of PMT. */
+char *
+_rl_strip_prompt (pmt)
+ char *pmt;
+{
+ char *ret;
+
+ ret = expand_prompt (pmt, (int *)NULL, (int *)NULL);
+ return ret;
+}
+
/*
* Expand the prompt string into the various display components, if
* necessary.
@@ -307,6 +291,49 @@ rl_expand_prompt (prompt)
}
}
+/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
+ arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
+ and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
+ increased. If the lines have already been allocated, this ensures that
+ they can hold at least MINSIZE characters. */
+static void
+init_line_structures (minsize)
+ int minsize;
+{
+ register int n;
+
+ if (invisible_line == 0) /* initialize it */
+ {
+ if (line_size < minsize)
+ line_size = minsize;
+ visible_line = xmalloc (line_size);
+ invisible_line = xmalloc (line_size);
+ }
+ else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
+ {
+ line_size *= 2;
+ if (line_size < minsize)
+ line_size = minsize;
+ visible_line = xrealloc (visible_line, line_size);
+ invisible_line = xrealloc (invisible_line, line_size);
+ }
+
+ for (n = minsize; n < line_size; n++)
+ {
+ visible_line[n] = 0;
+ invisible_line[n] = 1;
+ }
+
+ if (vis_lbreaks == 0)
+ {
+ /* should be enough. */
+ inv_lbsize = vis_lbsize = 256;
+ inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
+ vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
+ inv_lbreaks[0] = vis_lbreaks[0] = 0;
+ }
+}
+
/* Basic redisplay algorithm. */
void
rl_redisplay ()
@@ -325,19 +352,7 @@ rl_redisplay ()
if (invisible_line == 0)
{
- visible_line = xmalloc (line_size);
- invisible_line = xmalloc (line_size);
- for (in = 0; in < line_size; in++)
- {
- visible_line[in] = 0;
- invisible_line[in] = 1;
- }
-
- /* should be enough, but then again, this is just for testing. */
- inv_lbreaks = (int *)malloc (256 * sizeof (int));
- vis_lbreaks = (int *)malloc (256 * sizeof (int));
- inv_lbreaks[0] = vis_lbreaks[0] = 0;
-
+ init_line_structures (0);
rl_on_new_line ();
}
@@ -395,12 +410,13 @@ rl_redisplay ()
else
{
prompt_this_line++;
+ pmtlen = prompt_this_line - rl_display_prompt; /* temp var */
if (forced_display)
{
- _rl_output_some_chars (rl_display_prompt, prompt_this_line - rl_display_prompt);
+ _rl_output_some_chars (rl_display_prompt, pmtlen);
/* Make sure we are at column zero even after a newline,
regardless of the state of terminal output processing. */
- if (prompt_this_line[-2] != '\r')
+ if (pmtlen < 2 || prompt_this_line[-2] != '\r')
cr ();
}
}
@@ -419,11 +435,25 @@ rl_redisplay ()
wrap_offset = 0;
}
+#define CHECK_INV_LBREAKS() \
+ do { \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ } \
+ } while (0)
+
#define CHECK_LPOS() \
do { \
lpos++; \
if (lpos >= screenwidth) \
{ \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ } \
inv_lbreaks[++newlines] = out; \
lpos = 0; \
} \
@@ -437,14 +467,13 @@ rl_redisplay ()
contents of the command line? */
while (lpos >= screenwidth)
{
-#if 0
- temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
-#else
/* XXX - possible fix from Darin Johnson <darin@acuson.com> for prompt
string with invisible characters that is longer than the screen
- width. */
+ width. XXX - this doesn't work right if invisible characters have
+ to be put on the second screen line -- it adds too much (the number
+ of invisible chars after the screenwidth). */
temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0);
-#endif
+
inv_lbreaks[++newlines] = temp;
lpos -= screenwidth;
}
@@ -477,6 +506,7 @@ rl_redisplay ()
if (lpos + 4 >= screenwidth)
{
temp = screenwidth - lpos;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp;
lpos = 4 - temp;
}
@@ -506,6 +536,7 @@ rl_redisplay ()
{
register int temp2;
temp2 = screenwidth - lpos;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp2;
lpos = temp - temp2;
while (out < newout)
@@ -522,6 +553,7 @@ rl_redisplay ()
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
{
line[out++] = '\0'; /* XXX - sentinel */
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
lpos = 0;
}
@@ -546,6 +578,7 @@ rl_redisplay ()
}
inv_botlin = lb_botlin = newlines;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
@@ -651,8 +684,12 @@ rl_redisplay ()
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
_rl_last_c_pos <= last_invisible && local_prompt)
{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
if (term_cr)
tputs (term_cr, 1, _rl_output_character_function);
+#endif
_rl_output_some_chars (local_prompt, nleft);
_rl_last_c_pos = nleft;
}
@@ -772,11 +809,17 @@ rl_redisplay ()
/* Swap visible and non-visible lines. */
{
char *temp = visible_line;
- int *itemp = vis_lbreaks;
+ int *itemp = vis_lbreaks, ntemp = vis_lbsize;
+
visible_line = invisible_line;
invisible_line = temp;
+
vis_lbreaks = inv_lbreaks;
inv_lbreaks = itemp;
+
+ vis_lbsize = inv_lbsize;
+ inv_lbsize = ntemp;
+
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
are not displaying any invisible characters, so set visible_wrap_offset
@@ -899,7 +942,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
term_cr && lendiff > visible_length && _rl_last_c_pos > 0 &&
od > lendiff && _rl_last_c_pos < last_invisible)
{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
tputs (term_cr, 1, _rl_output_character_function);
+#endif
_rl_output_some_chars (local_prompt, lendiff);
_rl_last_c_pos = lendiff;
}
@@ -1029,6 +1076,58 @@ rl_on_new_line ()
return 0;
}
+/* Tell the update routines that we have moved onto a new line with the
+ prompt already displayed. Code originally from the version of readline
+ distributed with CLISP. */
+int
+rl_on_new_line_with_prompt ()
+{
+ int prompt_size, i, l, real_screenwidth, newlines;
+ char *prompt_last_line;
+
+ /* Initialize visible_line and invisible_line to ensure that they can hold
+ the already-displayed prompt. */
+ prompt_size = strlen (rl_prompt) + 1;
+ init_line_structures (prompt_size);
+
+ /* Make sure the line structures hold the already-displayed prompt for
+ redisplay. */
+ strcpy (visible_line, rl_prompt);
+ strcpy (invisible_line, rl_prompt);
+
+ /* If the prompt contains newlines, take the last tail. */
+ prompt_last_line = strrchr (rl_prompt, '\n');
+ if (!prompt_last_line)
+ prompt_last_line = rl_prompt;
+
+ l = strlen (prompt_last_line);
+ _rl_last_c_pos = l;
+
+ /* Dissect prompt_last_line into screen lines. Note that here we have
+ to use the real screenwidth. Readline's notion of screenwidth might be
+ one less, see terminal.c. */
+ real_screenwidth = screenwidth + (_rl_term_autowrap ? 0 : 1);
+ _rl_last_v_pos = l / real_screenwidth;
+ /* If the prompt length is a multiple of real_screenwidth, we don't know
+ whether the cursor is at the end of the last line, or already at the
+ beginning of the next line. Output a newline just to be safe. */
+ if (l > 0 && (l % real_screenwidth) == 0)
+ _rl_output_some_chars ("\n", 1);
+ last_lmargin = 0;
+
+ newlines = 0; i = 0;
+ while (i <= l)
+ {
+ _rl_vis_botlin = newlines;
+ vis_lbreaks[newlines++] = i;
+ i += real_screenwidth;
+ }
+ vis_lbreaks[newlines] = l;
+ visible_wrap_offset = 0;
+
+ return 0;
+}
+
/* Actually update the display, period. */
int
rl_forced_update_display ()
@@ -1086,8 +1185,6 @@ _rl_move_cursor_relative (new, data)
That kind of control is for people who don't know what the
data is underneath the cursor. */
#if defined (HACK_TERMCAP_MOTION)
- extern char *term_forward_char;
-
if (term_forward_char)
for (i = _rl_last_c_pos; i < new; i++)
tputs (term_forward_char, 1, _rl_output_character_function);
@@ -1114,20 +1211,15 @@ _rl_move_vert (to)
if (_rl_last_v_pos == to || to > screenheight)
return;
-#if defined (__GO32__)
- {
- int row, col;
-
- ScreenGetCursor (&row, &col);
- ScreenSetCursor ((row + to - _rl_last_v_pos), col);
- }
-#else /* !__GO32__ */
-
if ((delta = to - _rl_last_v_pos) > 0)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
tputs (term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
}
else
@@ -1136,7 +1228,7 @@ _rl_move_vert (to)
for (i = 0; i < -delta; i++)
tputs (term_up, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
+
_rl_last_v_pos = to; /* Now TO is here */
}
@@ -1344,11 +1436,9 @@ void
_rl_clear_to_eol (count)
int count;
{
-#if !defined (__GO32__)
if (term_clreol)
tputs (term_clreol, 1, _rl_output_character_function);
else if (count)
-#endif /* !__GO32__ */
space_to_eol (count);
}
@@ -1369,11 +1459,9 @@ space_to_eol (count)
void
_rl_clear_screen ()
{
-#if !defined (__GO32__)
if (term_clrpag)
tputs (term_clrpag, 1, _rl_output_character_function);
else
-#endif /* !__GO32__ */
crlf ();
}
@@ -1383,20 +1471,6 @@ insert_some_chars (string, count)
char *string;
int count;
{
-#if defined (__GO32__)
- int row, col, width;
- char *row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
-
- memcpy (row_start + col + count, row_start + col, width - col - count);
-
- /* Place the text on the screen. */
- _rl_output_some_chars (string, count);
-#else /* !_GO32 */
-
/* If IC is defined, then we do not have to "enter" insert mode. */
if (term_IC)
{
@@ -1429,7 +1503,6 @@ insert_some_chars (string, count)
if (term_ei && *term_ei)
tputs (term_ei, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
}
/* Delete COUNT characters from the display line. */
@@ -1437,18 +1510,6 @@ static void
delete_chars (count)
int count;
{
-#if defined (__GO32__)
- int row, col, width;
- char *row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
-
- memcpy (row_start + col, row_start + col + count, width - col - count);
- memset (row_start + width - count, 0, count * 2);
-#else /* !_GO32 */
-
if (count > screenwidth) /* XXX */
return;
@@ -1464,7 +1525,6 @@ delete_chars (count)
while (count--)
tputs (term_dc, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
}
void
@@ -1486,7 +1546,11 @@ _rl_update_final ()
if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == screenwidth))
{
char *last_line;
+#if 0
last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
+#else
+ last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
+#endif
_rl_move_cursor_relative (screenwidth - 1, last_line);
_rl_clear_to_eol (0);
putc (last_line[screenwidth - 1], rl_outstream);
@@ -1503,23 +1567,66 @@ cr ()
{
if (term_cr)
{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
tputs (term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
}
}
+/* Redraw the last line of a multi-line prompt that may possibly contain
+ terminal escape sequences. Called with the cursor at column 0 of the
+ line to draw the prompt on. */
+static void
+redraw_prompt (t)
+ char *t;
+{
+ char *oldp, *oldl, *oldlprefix;
+ int oldlen, oldlast, oldplen;
+
+ /* Geez, I should make this a struct. */
+ oldp = rl_display_prompt;
+ oldl = local_prompt;
+ oldlprefix = local_prompt_prefix;
+ oldlen = visible_length;
+ oldplen = prefix_length;
+ oldlast = last_invisible;
+
+ rl_display_prompt = t;
+ local_prompt = expand_prompt (t, &visible_length, &last_invisible);
+ local_prompt_prefix = (char *)NULL;
+ rl_forced_update_display ();
+
+ rl_display_prompt = oldp;
+ local_prompt = oldl;
+ local_prompt_prefix = oldlprefix;
+ visible_length = oldlen;
+ prefix_length = oldplen;
+ last_invisible = oldlast;
+}
+
/* Redisplay the current line after a SIGWINCH is received. */
void
_rl_redisplay_after_sigwinch ()
{
- char *t, *oldp, *oldl, *oldlprefix;
+ char *t;
/* Clear the current line and put the cursor at column 0. Make sure
the right thing happens if we have wrapped to a new screen line. */
if (term_cr)
{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
tputs (term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
+#if defined (__MSDOS__)
+ space_to_eol (screenwidth);
+ putc ('\r', rl_outstream);
+#else
if (term_clreol)
tputs (term_clreol, 1, _rl_output_character_function);
else
@@ -1527,6 +1634,7 @@ _rl_redisplay_after_sigwinch ()
space_to_eol (screenwidth);
tputs (term_cr, 1, _rl_output_character_function);
}
+#endif
if (_rl_last_v_pos > 0)
_rl_move_vert (0);
}
@@ -1536,17 +1644,7 @@ _rl_redisplay_after_sigwinch ()
/* Redraw only the last line of a multi-line prompt. */
t = strrchr (rl_display_prompt, '\n');
if (t)
- {
- oldp = rl_display_prompt;
- oldl = local_prompt;
- oldlprefix = local_prompt_prefix;
- rl_display_prompt = ++t;
- local_prompt = local_prompt_prefix = (char *)NULL;
- rl_forced_update_display ();
- rl_display_prompt = oldp;
- local_prompt = oldl;
- local_prompt_prefix = oldlprefix;
- }
+ redraw_prompt (++t);
else
rl_forced_update_display ();
}
@@ -1571,3 +1669,25 @@ _rl_erase_entire_line ()
cr ();
fflush (rl_outstream);
}
+
+/* return the `current display line' of the cursor -- the number of lines to
+ move up to get to the first screen line of the current readline line. */
+int
+_rl_current_display_line ()
+{
+ int ret, nleft;
+
+ /* Find out whether or not there might be invisible characters in the
+ editing buffer. */
+ if (rl_display_prompt == rl_prompt)
+ nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
+ else
+ nleft = _rl_last_c_pos - screenwidth;
+
+ if (nleft > 0)
+ ret = 1 + nleft / screenwidth;
+ else
+ ret = 0;
+
+ return ret;
+}
diff --git a/readline/doc/Makefile.in b/readline/doc/Makefile.in
index 103147292d9..4a38563e46e 100644
--- a/readline/doc/Makefile.in
+++ b/readline/doc/Makefile.in
@@ -1,6 +1,23 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
-top_srcdir = @top_srcdir@
+
+# Copyright (C) 1996 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+topdir = @top_srcdir@
srcdir = @srcdir@
VPATH = .:@srcdir@
@@ -8,25 +25,33 @@ prefix = @prefix@
infodir = @infodir@
mandir = @mandir@
-man3dir = $(mandir)/man3
+manpfx = man
+
+man1ext = 1
+man1dir = $(mandir)/$(manpfx)$(man1ext)
+man3ext = 3
+man3dir = $(mandir)/$(manpfx)$(man3ext)
SHELL = @MAKE_SHELL@
RM = rm -f
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+BUILD_DIR = @BUILD_DIR@
TEXINPUTDIR = $(srcdir)
-MAKEINFO = makeinfo
+MAKEINFO = LANGUAGE= makeinfo
TEXI2DVI = $(srcdir)/texi2dvi
TEXI2HTML = $(srcdir)/texi2html
QUIETPS = #set this to -q to shut up dvips
-DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
+PAPERSIZE = letter
+PSDPI = 300 # I don't have any 600-dpi printers
+DVIPS = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@ # tricky
RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
- $(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo
+ $(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo \
+ $(srcdir)/rluserman.texinfo
HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
$(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo
@@ -36,16 +61,15 @@ NROFF = groff -Tascii
# This should be a program that converts troff to postscript
GROFF = groff
-DVIOBJ = readline.dvi history.dvi
-INFOOBJ = readline.info history.info
-PSOBJ = readline.ps history.ps
-HTMLOBJ = readline.html history.html
-HTMLTOC = readline_toc.html history_toc.html
+DVIOBJ = readline.dvi history.dvi rluserman.dvi
+INFOOBJ = readline.info history.info rluserman.info
+PSOBJ = readline.ps history.ps rluserman.ps
+HTMLOBJ = readline.html history.html rluserman.html
TEXTOBJ = readline.0
-INTERMEDIATE_OBJ = rlman.dvi hist.dvi
+INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi
-CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(HTMLTOC) $(TEXTOBJ)
+CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ)
.SUFFIXES: .0 .3 .ps .txt .dvi
@@ -63,6 +87,12 @@ readline.dvi: $(RLSRC)
readline.info: $(RLSRC)
$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
+rluserman.dvi: $(RLSRC)
+ TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texinfo
+
+rluserman.info: $(RLSRC)
+ $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texinfo
+
history.dvi: ${HISTSRC}
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
mv hist.dvi history.dvi
@@ -74,18 +104,25 @@ readline.ps: readline.dvi
$(RM) $@
$(DVIPS) readline.dvi
+rluserman.ps: rluserman.dvi
+ $(RM) $@
+ $(DVIPS) rluserman.dvi
+
history.ps: history.dvi
$(RM) $@
$(DVIPS) history.dvi
readline.html: ${RLSRC}
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
- sed -e 's:rlman.html:readline.html:' rlman.html > readline.html
+ sed -e 's:rlman.html:readline.html:g' rlman.html > readline.html
$(RM) rlman.html
+rluserman.html: ${RLSRC}
+ $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texinfo
+
history.html: ${HISTSRC}
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
- sed -e 's:hist.html:history.html:' hist.html > history.html
+ sed -e 's:hist.html:history.html:g' hist.html > history.html
$(RM) hist.html
info: $(INFOOBJ)
@@ -98,7 +135,7 @@ readline.0: readline.3
clean:
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
- *.fns *.kys *.tps *.vrs *.o core
+ *.fns *.kys *.tps *.vrs *.bt *.bts *.o core
distclean: clean
$(RM) $(CREATED_DOCS)
@@ -112,8 +149,8 @@ maintainer-clean: clean
$(RM) $(INTERMEDIATE_OBJ)
$(RM) Makefile
-installdirs: $(top_srcdir)/support/mkdirs
- -$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
+installdirs: $(topdir)/support/mkdirs
+ -$(SHELL) $(topdir)/support/mkdirs $(infodir) $(man3dir)
install: installdirs
if test -f readline.info; then \
@@ -121,12 +158,17 @@ install: installdirs
else \
${INSTALL_DATA} $(srcdir)/readline.info $(infodir)/readline.info; \
fi
+ if test -f rluserman.info; then \
+ ${INSTALL_DATA} rluserman.info $(infodir)/rluserman.info; \
+ else \
+ ${INSTALL_DATA} $(srcdir)/rluserman.info $(infodir)/rluserman.info; \
+ fi
if test -f history.info; then \
${INSTALL_DATA} history.info $(infodir)/history.info; \
else \
${INSTALL_DATA} $(srcdir)/history.info $(infodir)/history.info; \
fi
- if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
+ -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(infodir)/dir $(infodir)/readline.info ; \
install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \
else true; fi
@@ -134,5 +176,6 @@ install: installdirs
uninstall:
$(RM) $(infodir)/readline.info
+ $(RM) $(infodir)/rluserman.info
$(RM) $(infodir)/history.info
$(RM) $(man3dir)/readline.3
diff --git a/readline/doc/hist.texinfo b/readline/doc/hist.texinfo
index 31a0ba0ae72..8a9c9413bc9 100644
--- a/readline/doc/hist.texinfo
+++ b/readline/doc/hist.texinfo
@@ -55,8 +55,8 @@ provides a consistent user interface for recalling lines of previously
typed input.
Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
+59 Temple Place, Suite 330, @*
+Boston, MA 02111 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
diff --git a/readline/doc/hstech.texinfo b/readline/doc/hstech.texinfo
index 54100908407..12fff2c9a75 100644
--- a/readline/doc/hstech.texinfo
+++ b/readline/doc/hstech.texinfo
@@ -66,6 +66,13 @@ If the programmer desires, he can use the Readline library, which
includes some history manipulation by default, and has the added
advantage of command line editing.
+Before declaring any functions using any functionality the History
+library provides in other code, an application writer should include
+the file @code{<readline/history.h>} in any file that uses the
+History library's features. It supplies extern declarations for all
+of the library's public functions and variables, and declares all of
+the public data structures.
+
@node History Storage
@section History Storage
@@ -334,7 +341,7 @@ if expansions did take place;
@item -1
if there was an error in expansion;
@item 2
-if the returned line should only be displayed, but not executed,
+if the returned line should be displayed, but not executed,
as with the @code{:p} modifier (@pxref{Modifiers}).
@end table
diff --git a/readline/doc/hsuser.texinfo b/readline/doc/hsuser.texinfo
index 76cb63b1eee..5f75f5df490 100644
--- a/readline/doc/hsuser.texinfo
+++ b/readline/doc/hsuser.texinfo
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -26,11 +26,16 @@ into another language, under the above conditions for modified versions.
@node Using History Interactively
@chapter Using History Interactively
+@ifclear BashFeatures
+@defcodeindex bt
+@end ifclear
+
@ifset BashFeatures
-This chapter describes how to use the GNU History Library interactively,
-from a user's standpoint. It should be considered a user's guide. For
-information on using the GNU History Library in other programs,
-see the GNU Readline Library Manual.
+This chapter describes how to use the @sc{gnu} History Library
+interactively, from a user's standpoint.
+It should be considered a user's guide.
+For information on using the @sc{gnu} History Library in other programs,
+see the @sc{gnu} Readline Library Manual.
@end ifset
@ifclear BashFeatures
This chapter describes how to use the GNU History Library interactively,
@@ -63,20 +68,25 @@ information on using the GNU History Library in your own programs,
When the @samp{-o history} option to the @code{set} builtin
is enabled (@pxref{The Set Builtin}),
the shell provides access to the @var{command history},
-the list of commands previously typed. The text of the last
-@code{HISTSIZE}
-commands (default 500) is saved in a history list. The shell
-stores each command in the history list prior to parameter and
-variable expansion
+the list of commands previously typed.
+The value of the @code{HISTSIZE} shell variable is used as the
+number of commands to save in a history list.
+The text of the last @code{$HISTSIZE}
+commands (default 500) is saved.
+The shell stores each command in the history list prior to
+parameter and variable expansion
but after history expansion is performed, subject to the
values of the shell variables
@code{HISTIGNORE} and @code{HISTCONTROL}.
+
When the shell starts up, the history is initialized from the
file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
-@code{HISTFILE} is truncated, if necessary, to contain no more than
-the number of lines specified by the value of the @code{HISTFILESIZE}
-variable. When an interactive shell exits, the last
-@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
+The file named by the value of @code{HISTFILE} is truncated, if
+necessary, to contain no more than the number of lines specified by
+the value of the @code{HISTFILESIZE} variable.
+When an interactive shell exits, the last
+@code{$HISTSIZE} lines are copied from the history list to the file
+named by @code{$HISTFILE}.
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
the lines are appended to the history file,
otherwise the history file is overwritten.
@@ -88,11 +98,11 @@ lines. If @code{HISTFILESIZE} is not set, no truncation is performed.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
-The @code{history} builtin can be used to display or modify the history
+The @code{history} builtin may be used to display or modify the history
list and manipulate the history file.
-When using the command-line editing, search commands
+When using command-line editing, search commands
are available in each editing mode that provide access to the
-history list.
+history list (@pxref{Commands For History}).
The shell allows control over which commands are saved on the history
list. The @code{HISTCONTROL} and @code{HISTIGNORE}
@@ -105,13 +115,14 @@ semicolons where necessary to preserve syntactic correctness.
The @code{lithist}
shell option causes the shell to save the command with embedded newlines
instead of semicolons.
+The @code{shopt} builtin is used to set these options.
@xref{Bash Builtins}, for a description of @code{shopt}.
@node Bash History Builtins
@section Bash History Builtins
@cindex history builtins
-Bash provides two builtin commands that allow you to manipulate the
+Bash provides two builtin commands which manipulate the
history list and history file.
@table @code
@@ -151,23 +162,27 @@ and typing @samp{r} re-executes the last command (@pxref{Aliases}).
@item history
@btindex history
@example
-history [-c] [@var{n}]
+history [@var{n}]
+history -c
+history -d @var{offset}
history [-anrw] [@var{filename}]
history -ps @var{arg}
@end example
-Display the history list with line numbers. Lines prefixed with
-with a @samp{*} have been modified. An argument of @var{n} says
-to list only the last @var{n} lines. Options, if supplied, have
-the following meanings:
+With no options, display the history list with line numbers.
+Lines prefixed with with a @samp{*} have been modified.
+An argument of @var{n} lists only the last @var{n} lines.
+Options, if supplied, have the following meanings:
@table @code
-@item -w
-Write out the current history to the history file.
+@item -c
+Clear the history list. This may be combined
+with the other options to replace the history list completely.
-@item -r
-Read the current history file and append its contents to
-the history list.
+@item -d @var{offset}
+Delete the history entry at position @var{offset}.
+@var{offset} should be specified as it appears when the history is
+displayed.
@item -a
Append the new
@@ -179,20 +194,24 @@ Append the history lines not already read from the history file
to the current history list. These are lines appended to the history
file since the beginning of the current Bash session.
-@item -c
-Clear the history list. This may be combined
-with the other options to replace the history list completely.
+@item -r
+Read the current history file and append its contents to
+the history list.
-@item -s
-The @var{arg}s are added to the end of
-the history list as a single entry.
+@item -w
+Write out the current history to the history file.
@item -p
Perform history substitution on the @var{arg}s and display the result
on the standard output, without storing the results in the history list.
+
+@item -s
+The @var{arg}s are added to the end of
+the history list as a single entry.
+
@end table
-When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
+When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is
used, if @var{filename}
is given, then it is used as the history file. If not, then
the value of the @code{HISTFILE} variable is used.
@@ -309,6 +328,26 @@ may be omitted if the word designator begins with a @samp{^}, @samp{$},
of the line, with the first word being denoted by 0 (zero). Words are
inserted into the current line separated by single spaces.
+@need 0.75
+For example,
+
+@table @code
+@item !!
+designates the preceding command. When you type this, the preceding
+command is repeated in toto.
+
+@item !!:$
+designates the last argument of the preceding command. This may be
+shortened to @code{!$}.
+
+@item !fi:2
+designates the second argument of the most recent command starting with
+the letters @code{fi}.
+@end table
+
+@need 0.75
+Here are the word designators:
+
@table @code
@item 0 (zero)
diff --git a/readline/doc/manvers.texinfo b/readline/doc/manvers.texinfo
index 63924e3801d..3122b6c6fad 100644
--- a/readline/doc/manvers.texinfo
+++ b/readline/doc/manvers.texinfo
@@ -1,6 +1,6 @@
-@set EDITION 4.0
-@set VERSION 4.0
-@set UPDATED 31 December 1998
-@set UPDATE-MONTH December 1998
+@set EDITION 4.1
+@set VERSION 4.1
+@set UPDATED 2000 January 19
+@set UPDATE-MONTH January 2000
-@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998
+@set LASTCHANGE Wed Jan 19 12:16:30 EST 2000
diff --git a/readline/doc/readline.0 b/readline/doc/readline.0
index 970d8c6d0c7..8d453cd098f 100644
--- a/readline/doc/readline.0
+++ b/readline/doc/readline.0
@@ -61,7 +61,7 @@ NNOOTTAATTIIOONN
-GNU 1998 Dec 31 1
+GNU 1999 Jun 1 1
@@ -100,19 +100,21 @@ IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE
The following symbolic character names are recognized
while processing key bindings: _R_U_B_O_U_T, _D_E_L, _E_S_C, _L_F_D, _N_E_W_-
- _L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B. In addition to
- command names, readline allows keys to be bound to a
- string that is inserted when the key is pressed (a _m_a_c_r_o).
+ _L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B.
+
+ In addition to command names, readline allows keys to be
+ bound to a string that is inserted when the key is pressed
+ (a _m_a_c_r_o).
KKeeyy BBiinnddiinnggss
- The syntax for controlling key bindings in the _i_n_p_u_t_r_c
- file is simple. All that is required is the name of the
+ The syntax for controlling key bindings in the _i_n_p_u_t_r_c
+ file is simple. All that is required is the name of the
command or the text of a macro and a key sequence to which
- it should be bound. The name may be specified in one of
- two ways: as a symbolic key name, possibly with _M_e_t_a_- or
- _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the
- form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name
+ it should be bound. The name may be specified in one of
+ two ways: as a symbolic key name, possibly with _M_e_t_a_- or
+ _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the
+ form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name
of a key spelled out in English. For example:
Control-u: universal-argument
@@ -120,14 +122,12 @@ IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE
Control-o: ">&output"
In the above example, _C_-_u is bound to the function uunniivveerr--
- ssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckk--
- wwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro
- expressed on the right hand side (that is, to insert the
- text _>_&_o_u_t_p_u_t into the line).
+ ssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckk--
+ wwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro
-GNU 1998 Dec 31 2
+GNU 1999 Jun 1 2
@@ -136,20 +136,23 @@ GNU 1998 Dec 31 2
READLINE(3) READLINE(3)
- In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy--
+ expressed on the right hand side (that is, to insert the
+ text _>_&_o_u_t_p_u_t into the line).
+
+ In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy--
sseeqq differs from kkeeyynnaammee above in that strings denoting an
- entire key sequence may be specified by placing the
- sequence within double quotes. Some GNU Emacs style key
+ entire key sequence may be specified by placing the
+ sequence within double quotes. Some GNU Emacs style key
escapes can be used, as in the following example.
"\C-u": universal-argument
"\C-x\C-r": re-read-init-file
"\e[11~": "Function Key 1"
- In this example, _C_-_u is again bound to the function uunnii--
- vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function
- rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the
- text FFuunnccttiioonn KKeeyy 11. The full set of GNU Emacs style
+ In this example, _C_-_u is again bound to the function uunnii--
+ vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function
+ rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the
+ text FFuunnccttiioonn KKeeyy 11. The full set of GNU Emacs style
escape sequences is
\\CC-- control prefix
\\MM-- meta prefix
@@ -158,7 +161,7 @@ READLINE(3) READLINE(3)
\\"" literal "
\\'' literal '
- In addition to the GNU Emacs style escape sequences, a
+ In addition to the GNU Emacs style escape sequences, a
second set of backslash escapes is available:
\\aa alert (bell)
\\bb backspace
@@ -168,32 +171,29 @@ READLINE(3) READLINE(3)
\\rr carriage return
\\tt horizontal tab
\\vv vertical tab
- \\_n_n_n the character whose ASCII code is the octal
+ \\_n_n_n the character whose ASCII code is the octal
value _n_n_n (one to three digits)
- \\xx_n_n_n the character whose ASCII code is the hex-
+ \\xx_n_n_n the character whose ASCII code is the hex-
adecimal value _n_n_n (one to three digits)
When entering the text of a macro, single or double quotes
- should be used to indicate a macro definition. Unquoted
+ should be used to indicate a macro definition. Unquoted
text is assumed to be a function name. In the macro body,
the backslash escapes described above are expanded. Back-
- slash will quote any other character in the macro text,
+ slash will quote any other character in the macro text,
including " and '.
- BBaasshh allows the current readline key bindings to be dis-
- played or modified with the bbiinndd builtin command. The
- editing mode may be switched during interactive use by
- using the --oo option to the sseett builtin command. Other
- programs using this library provide similar mechanisms.
- The _i_n_p_u_t_r_c file may be edited and re-read if a program
- does not provide any other means to incorporate new bind-
- ings.
+ BBaasshh allows the current readline key bindings to be dis-
+ played or modified with the bbiinndd builtin command. The
+ editing mode may be switched during interactive use by
+ using the --oo option to the sseett builtin command. Other
+ programs using this library provide similar mechanisms.
+ The _i_n_p_u_t_r_c file may be edited and re-read if a program
+ does not provide any other means to incorporate new
-
-
-GNU 1998 Dec 31 3
+GNU 1999 Jun 1 3
@@ -202,8 +202,10 @@ GNU 1998 Dec 31 3
READLINE(3) READLINE(3)
+ bindings.
+
VVaarriiaabblleess
- Readline has variables that can be used to further cus-
+ Readline has variables that can be used to further cus-
tomize its behavior. A variable may be set in the _i_n_p_u_t_r_c
file with a statement of the form
@@ -213,53 +215,51 @@ READLINE(3) READLINE(3)
OOnn or OOffff. The variables and their default values are:
bbeellll--ssttyyllee ((aauuddiibbllee))
- Controls what happens when readline wants to ring
- the terminal bell. If set to nnoonnee, readline never
+ Controls what happens when readline wants to ring
+ the terminal bell. If set to nnoonnee, readline never
rings the bell. If set to vviissiibbllee, readline uses a
- visible bell if one is available. If set to aauuddii--
+ visible bell if one is available. If set to aauuddii--
bbllee, readline attempts to ring the terminal's bell.
ccoommmmeenntt--bbeeggiinn ((````##''''))
- The string that is inserted in vvii mode when the
- iinnsseerrtt--ccoommmmeenntt command is executed. This command
- is bound to MM--## in emacs mode and to ## in vi com-
+ The string that is inserted in vvii mode when the
+ iinnsseerrtt--ccoommmmeenntt command is executed. This command
+ is bound to MM--## in emacs mode and to ## in vi com-
mand mode.
ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff))
- If set to OOnn, readline performs filename matching
+ If set to OOnn, readline performs filename matching
and completion in a case-insensitive fashion.
ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000))
- This determines when the user is queried about
- viewing the number of possible completions gener-
- ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may
- be set to any integer value greater than or equal
- to zero. If the number of possible completions is
- greater than or equal to the value of this vari-
+ This determines when the user is queried about
+ viewing the number of possible completions gener-
+ ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may
+ be set to any integer value greater than or equal
+ to zero. If the number of possible completions is
+ greater than or equal to the value of this vari-
able, the user is asked whether or not he wishes to
- view them; otherwise they are simply listed on the
+ view them; otherwise they are simply listed on the
terminal.
ccoonnvveerrtt--mmeettaa ((OOnn))
If set to OOnn, readline will convert characters with
- the eighth bit set to an ASCII key sequence by
- stripping the eighth bit and prepending an escape
+ the eighth bit set to an ASCII key sequence by
+ stripping the eighth bit and prepending an escape
character (in effect, using escape as the _m_e_t_a _p_r_e_-
_f_i_x).
ddiissaabbllee--ccoommpplleettiioonn ((OOffff))
- If set to OOnn, readline will inhibit word comple-
- tion. Completion characters will be inserted into
+ If set to OOnn, readline will inhibit word comple-
+ tion. Completion characters will be inserted into
the line as if they had been mapped to sseellff--iinnsseerrtt.
eeddiittiinngg--mmooddee ((eemmaaccss))
- Controls whether readline begins with a set of key
- bindings similar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can
+ Controls whether readline begins with a set of key
+ bindings similar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can
be set to either eemmaaccss or vvii.
eennaabbllee--kkeeyyppaadd ((OOffff))
- When set to OOnn, readline will try to enable the
+ When set to OOnn, readline will try to enable the
application keypad when it is called. Some systems
need this to enable the arrow keys.
- eexxppaanndd--ttiillddee ((OOffff))
- If set to oonn, tilde expansion is performed when
-GNU 1998 Dec 31 4
+GNU 1999 Jun 1 4
@@ -268,64 +268,64 @@ GNU 1998 Dec 31 4
READLINE(3) READLINE(3)
+ eexxppaanndd--ttiillddee ((OOffff))
+ If set to oonn, tilde expansion is performed when
readline attempts word completion.
hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff))
- When set to OOnn, makes readline use a single line
- for display, scrolling the input horizontally on a
- single screen line when it becomes longer than the
+ When set to OOnn, makes readline use a single line
+ for display, scrolling the input horizontally on a
+ single screen line when it becomes longer than the
screen width rather than wrapping to a new line.
iinnppuutt--mmeettaa ((OOffff))
- If set to OOnn, readline will enable eight-bit input
- (that is, it will not strip the high bit from the
+ If set to OOnn, readline will enable eight-bit input
+ (that is, it will not strip the high bit from the
characters it reads), regardless of what the termi-
nal claims it can support. The name mmeettaa--ffllaagg is a
synonym for this variable.
iisseeaarrcchh--tteerrmmiinnaattoorrss ((````CC--[[CC--JJ''''))
- The string of characters that should terminate an
- incremental search without subsequently executing
- the character as a command. If this variable has
- not been given a value, the characters _E_S_C and _C_-_J
+ The string of characters that should terminate an
+ incremental search without subsequently executing
+ the character as a command. If this variable has
+ not been given a value, the characters _E_S_C and _C_-_J
will terminate an incremental search.
kkeeyymmaapp ((eemmaaccss))
- Set the current readline keymap. The set of legal
- keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_,
+ Set the current readline keymap. The set of legal
+ keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_,
_e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t.
_v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent
to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the
- value of eeddiittiinngg--mmooddee also affects the default
+ value of eeddiittiinngg--mmooddee also affects the default
keymap.
mmaarrkk--ddiirreeccttoorriieess ((OOnn))
- If set to OOnn, complete<d directory names have a
+ If set to OOnn, complete<d directory names have a
slash appended.
mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff))
If set to OOnn, history lines that have been modified
are displayed with a preceding asterisk (**).
oouuttppuutt--mmeettaa ((OOffff))
If set to OOnn, readline will display characters with
- the eighth bit set directly rather than as a meta-
+ the eighth bit set directly rather than as a meta-
prefixed escape sequence.
pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff))
- If set to OOnn, readline will display completions
- with matches sorted horizontally in alphabetical
+ If set to OOnn, readline will display completions
+ with matches sorted horizontally in alphabetical
order, rather than down the screen.
sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff))
- This alters the default behavior of the completion
- functions. If set to oonn, words which have more
- than one possible completion cause the matches to
- be listed immediately instead of ringing the bell.
+ This alters the default behavior of the completion
+ functions. If set to oonn, words which have more
+ than one possible completion cause the matches to
+ be listed immediately instead of ringing the bell.
vviissiibbllee--ssttaattss ((OOffff))
If set to OOnn, a character denoting a file's type as
- reported by ssttaatt(2) is appended to the filename
+ reported by ssttaatt(2) is appended to the filename
when listing possible completions.
CCoonnddiittiioonnaall CCoonnssttrruuccttss
- Readline implements a facility similar in spirit to the
- conditional compilation features of the C preprocessor
- which allows key bindings and variable settings to be
+ Readline implements a facility similar in spirit to the
-GNU 1998 Dec 31 5
+GNU 1999 Jun 1 5
@@ -334,28 +334,30 @@ GNU 1998 Dec 31 5
READLINE(3) READLINE(3)
- performed as the result of tests. There are four parser
+ conditional compilation features of the C preprocessor
+ which allows key bindings and variable settings to be per-
+ formed as the result of tests. There are four parser
directives used.
- $$iiff The $$iiff construct allows bindings to be made based
- on the editing mode, the terminal being used, or
- the application using readline. The text of the
- test extends to the end of the line; no characters
+ $$iiff The $$iiff construct allows bindings to be made based
+ on the editing mode, the terminal being used, or
+ the application using readline. The text of the
+ test extends to the end of the line; no characters
are required to isolate it.
- mmooddee The mmooddee== form of the $$iiff directive is used
- to test whether readline is in emacs or vi
- mode. This may be used in conjunction with
+ mmooddee The mmooddee== form of the $$iiff directive is used
+ to test whether readline is in emacs or vi
+ mode. This may be used in conjunction with
the sseett kkeeyymmaapp command, for instance, to set
- bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_-
- _c_t_l_x keymaps only if readline is starting
+ bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_-
+ _c_t_l_x keymaps only if readline is starting
out in emacs mode.
tteerrmm The tteerrmm== form may be used to include termi-
- nal-specific key bindings, perhaps to bind
- the key sequences output by the terminal's
- function keys. The word on the right side
- of the == is tested against the full name of
+ nal-specific key bindings, perhaps to bind
+ the key sequences output by the terminal's
+ function keys. The word on the right side
+ of the == is tested against the full name of
the terminal and the portion of the terminal
name before the first --. This allows _s_u_n to
match both _s_u_n and _s_u_n_-_c_m_d, for instance.
@@ -364,12 +366,12 @@ READLINE(3) READLINE(3)
The aapppplliiccaattiioonn construct is used to include
application-specific settings. Each program
using the readline library sets the _a_p_p_l_i_c_a_-
- _t_i_o_n _n_a_m_e, and an initialization file can
- test for a particular value. This could be
+ _t_i_o_n _n_a_m_e, and an initialization file can
+ test for a particular value. This could be
used to bind key sequences to functions use-
- ful for a specific program. For instance,
- the following command adds a key sequence
- that quotes the current or previous word in
+ ful for a specific program. For instance,
+ the following command adds a key sequence
+ that quotes the current or previous word in
Bash:
$$iiff bash
@@ -380,18 +382,16 @@ READLINE(3) READLINE(3)
$$eennddiiff This command, as seen in the previous example, ter-
minates an $$iiff command.
- $$eellssee Commands in this branch of the $$iiff directive are
+ $$eellssee Commands in this branch of the $$iiff directive are
executed if the test fails.
$$iinncclluuddee
- This directive takes a single filename as an argu-
- ment and reads commands and bindings from that
- file. For example, the following directive would
- read _/_e_t_c_/_i_n_p_u_t_r_c:
+ This directive takes a single filename as an argu-
+ ment and reads commands and bindings from that
-GNU 1998 Dec 31 6
+GNU 1999 Jun 1 6
@@ -400,44 +400,47 @@ GNU 1998 Dec 31 6
READLINE(3) READLINE(3)
+ file. For example, the following directive would
+ read _/_e_t_c_/_i_n_p_u_t_r_c:
+
$$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c
SSEEAARRCCHHIINNGG
- Readline provides commands for searching through the com-
- mand history for lines containing a specified string.
- There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_-
+ Readline provides commands for searching through the com-
+ mand history for lines containing a specified string.
+ There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_-
_t_a_l.
- Incremental searches begin before the user has finished
+ Incremental searches begin before the user has finished
typing the search string. As each character of the search
string is typed, readline displays the next entry from the
- history matching the string typed so far. An incremental
- search requires only as many characters as needed to find
- the desired history entry. The characters present in the
+ history matching the string typed so far. An incremental
+ search requires only as many characters as needed to find
+ the desired history entry. The characters present in the
value of the _i_s_e_a_r_c_h_-_t_e_r_m_i_n_a_t_o_r_s variable are used to ter-
- minate an incremental search. If that variable has not
- been assigned a value the Escape and Control-J characters
- will terminate an incremental search. Control-G will
+ minate an incremental search. If that variable has not
+ been assigned a value the Escape and Control-J characters
+ will terminate an incremental search. Control-G will
abort an incremental search and restore the original line.
- When the search is terminated, the history entry contain-
- ing the search string becomes the current line. To find
+ When the search is terminated, the history entry contain-
+ ing the search string becomes the current line. To find
other matching entries in the history list, type Control-S
or Control-R as appropriate. This will search backward or
- forward in the history for the next line matching the
- search string typed so far. Any other key sequence bound
- to a readline command will terminate the search and exe-
+ forward in the history for the next line matching the
+ search string typed so far. Any other key sequence bound
+ to a readline command will terminate the search and exe-
cute that command. For instance, a _n_e_w_l_i_n_e will terminate
the search and accept the line, thereby executing the com-
mand from the history list.
- Non-incremental searches read the entire search string
+ Non-incremental searches read the entire search string
before starting to search for matching history lines. The
- search string may be typed by the user or be part of the
+ search string may be typed by the user or be part of the
contents of the current line.
EEDDIITTIINNGG CCOOMMMMAANNDDSS
- The following is a list of the names of the commands and
- the default key sequences to which they are bound. Com-
+ The following is a list of the names of the commands and
+ the default key sequences to which they are bound. Com-
mand names without an accompanying key sequence are
unbound by default.
@@ -450,14 +453,11 @@ EEDDIITTIINNGG CCOOMMMMAANNDDSS
Move forward a character.
bbaacckkwwaarrdd--cchhaarr ((CC--bb))
Move back a character.
- ffoorrwwaarrdd--wwoorrdd ((MM--ff))
- Move forward to the end of the next word. Words
- are composed of alphanumeric characters (letters
- and digits).
-GNU 1998 Dec 31 7
+
+GNU 1999 Jun 1 7
@@ -466,64 +466,64 @@ GNU 1998 Dec 31 7
READLINE(3) READLINE(3)
+ ffoorrwwaarrdd--wwoorrdd ((MM--ff))
+ Move forward to the end of the next word. Words
+ are composed of alphanumeric characters (letters
+ and digits).
bbaacckkwwaarrdd--wwoorrdd ((MM--bb))
- Move back to the start of this, or the previous,
- word. Words are composed of alphanumeric charac-
+ Move back to the start of the current or previous
+ word. Words are composed of alphanumeric charac-
ters (letters and digits).
cclleeaarr--ssccrreeeenn ((CC--ll))
- Clear the screen leaving the current line at the
- top of the screen. With an argument, refresh the
+ Clear the screen leaving the current line at the
+ top of the screen. With an argument, refresh the
current line without clearing the screen.
rreeddrraaww--ccuurrrreenntt--lliinnee
Refresh the current line.
CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy
aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn))
- Accept the line regardless of where the cursor is.
- If this line is non-empty, add it to the history
- list. If the line is a modified history line, then
+ Accept the line regardless of where the cursor is.
+ If this line is non-empty, add it to the history
+ list. If the line is a modified history line, then
restore the history line to its original state.
pprreevviioouuss--hhiissttoorryy ((CC--pp))
- Fetch the previous command from the history list,
+ Fetch the previous command from the history list,
moving back in the list.
nneexxtt--hhiissttoorryy ((CC--nn))
- Fetch the next command from the history list, mov-
+ Fetch the next command from the history list, mov-
ing forward in the list.
bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<))
Move to the first line in the history.
eenndd--ooff--hhiissttoorryy ((MM-->>))
- Move to the end of the input history, i.e., the
+ Move to the end of the input history, i.e., the
line currently being entered.
rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr))
- Search backward starting at the current line and
+ Search backward starting at the current line and
moving `up' through the history as necessary. This
is an incremental search.
ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss))
- Search forward starting at the current line and
- moving `down' through the history as necessary.
+ Search forward starting at the current line and
+ moving `down' through the history as necessary.
This is an incremental search.
nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp))
Search backward through the history starting at the
- current line using a non-incremental search for a
+ current line using a non-incremental search for a
string supplied by the user.
nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn))
- Search forward through the history using a non-
- incremental search for a string supplied by the
+ Search forward through the history using a non-
+ incremental search for a string supplied by the
user.
hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd
- Search forward through the history for the string
+ Search forward through the history for the string
of characters between the start of the current line
- and the current cursor position (the _p_o_i_n_t). This
+ and the current cursor position (the _p_o_i_n_t). This
is a non-incremental search.
- hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd
- Search backward through the history for the string
- of characters between the start of the current line
- and the point. This is a non-incremental search.
-GNU 1998 Dec 31 8
+GNU 1999 Jun 1 8
@@ -532,64 +532,64 @@ GNU 1998 Dec 31 8
READLINE(3) READLINE(3)
+ hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd
+ Search backward through the history for the string
+ of characters between the start of the current line
+ and the point. This is a non-incremental search.
yyaannkk--nntthh--aarrgg ((MM--CC--yy))
- Insert the first argument to the previous command
- (usually the second word on the previous line) at
+ Insert the first argument to the previous command
+ (usually the second word on the previous line) at
point (the current cursor position). With an argu-
- ment _n, insert the _nth word from the previous com-
- mand (the words in the previous command begin with
- word 0). A negative argument inserts the _nth word
+ ment _n, insert the _nth word from the previous com-
+ mand (the words in the previous command begin with
+ word 0). A negative argument inserts the _nth word
from the end of the previous command.
yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__))
- Insert the last argument to the previous command
- (the last word of the previous history entry).
+ Insert the last argument to the previous command
+ (the last word of the previous history entry).
With an argument, behave exactly like yyaannkk--nntthh--aarrgg.
Successive calls to yyaannkk--llaasstt--aarrgg move back through
- the history list, inserting the last argument of
+ the history list, inserting the last argument of
each line in turn.
CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt
ddeelleettee--cchhaarr ((CC--dd))
Delete the character under the cursor. If point is
- at the beginning of the line, there are no charac-
- ters in the line, and the last character typed was
+ at the beginning of the line, there are no charac-
+ ters in the line, and the last character typed was
not bound to BBddeelleettee--cchhaarr, then return EEOOFF.
bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt))
Delete the character behind the cursor. When given
- a numeric argument, save the deleted text on the
+ a numeric argument, save the deleted text on the
kill ring.
ffoorrwwaarrdd--bbaacckkwwaarrdd--ddeelleettee--cchhaarr
- Delete the character under the cursor, unless the
+ Delete the character under the cursor, unless the
cursor is at the end of the line, in which case the
- character behind the cursor is deleted. By
+ character behind the cursor is deleted. By
default, this is not bound to a key.
qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv))
- Add the next character that you type to the line
- verbatim. This is how to insert characters like
+ Add the next character that you type to the line
+ verbatim. This is how to insert characters like
CC--qq, for example.
ttaabb--iinnsseerrtt ((MM--TTAABB))
Insert a tab character.
sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ......))
Insert the character typed.
ttrraannssppoossee--cchhaarrss ((CC--tt))
- Drag the character before point forward over the
- character at point. Point moves forward as well.
- If point is at the end of the line, then transpose
- the two characters before point. Negative argu-
+ Drag the character before point forward over the
+ character at point. Point moves forward as well.
+ If point is at the end of the line, then transpose
+ the two characters before point. Negative argu-
ments don't work.
ttrraannssppoossee--wwoorrddss ((MM--tt))
- Drag the word behind the cursor past the word in
- front of the cursor moving the cursor over that
+ Drag the word behind the cursor past the word in
+ front of the cursor moving the cursor over that
word as well.
- uuppccaassee--wwoorrdd ((MM--uu))
- Uppercase the current (or following) word. With a
- negative argument, uppercase the previous word, but
- do not move point.
-GNU 1998 Dec 31 9
+GNU 1999 Jun 1 9
@@ -598,44 +598,48 @@ GNU 1998 Dec 31 9
READLINE(3) READLINE(3)
+ uuppccaassee--wwoorrdd ((MM--uu))
+ Uppercase the current (or following) word. With a
+ negative argument, uppercase the previous word, but
+ do not move point.
ddoowwnnccaassee--wwoorrdd ((MM--ll))
- Lowercase the current (or following) word. With a
+ Lowercase the current (or following) word. With a
negative argument, lowercase the previous word, but
do not move point.
ccaappiittaalliizzee--wwoorrdd ((MM--cc))
Capitalize the current (or following) word. With a
- negative argument, capitalize the previous word,
+ negative argument, capitalize the previous word,
but do not move point.
KKiilllliinngg aanndd YYaannkkiinngg
kkiillll--lliinnee ((CC--kk))
- Kill the text from the current cursor position to
+ Kill the text from the current cursor position to
the end of the line.
bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt))
Kill backward to the beginning of the line.
uunniixx--lliinnee--ddiissccaarrdd ((CC--uu))
- Kill backward from point to the beginning of the
+ Kill backward from point to the beginning of the
line. The killed text is saved on the kill-ring.
kkiillll--wwhhoollee--lliinnee
- Kill all characters on the current line, no matter
+ Kill all characters on the current line, no matter
where the cursor is.
kkiillll--wwoorrdd ((MM--dd))
- Kill from the cursor to the end of the current
- word, or if between words, to the end of the next
- word. Word boundaries are the same as those used
+ Kill from the cursor to the end of the current
+ word, or if between words, to the end of the next
+ word. Word boundaries are the same as those used
by ffoorrwwaarrdd--wwoorrdd.
bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt))
- Kill the word behind the cursor. Word boundaries
+ Kill the word behind the cursor. Word boundaries
are the same as those used by bbaacckkwwaarrdd--wwoorrdd.
uunniixx--wwoorrdd--rruubboouutt ((CC--ww))
- Kill the word behind the cursor, using white space
- as a word boundary. The word boundaries are dif-
+ Kill the word behind the cursor, using white space
+ as a word boundary. The word boundaries are dif-
ferent from bbaacckkwwaarrdd--kkiillll--wwoorrdd.
ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\))
Delete all spaces and tabs around point.
kkiillll--rreeggiioonn
- Kill the text between the point and _m_a_r_k (saved
- cursor position). This text is referred to as the
+ Kill the text between the point and _m_a_r_k (saved
+ cursor position). This text is referred to as the
_r_e_g_i_o_n.
ccooppyy--rreeggiioonn--aass--kkiillll
Copy the text in the region to the kill buffer.
@@ -643,19 +647,15 @@ READLINE(3) READLINE(3)
Copy the word before point to the kill buffer. The
word boundaries are the same as bbaacckkwwaarrdd--wwoorrdd.
ccooppyy--ffoorrwwaarrdd--wwoorrdd
- Copy the word following point to the kill buffer.
+ Copy the word following point to the kill buffer.
The word boundaries are the same as ffoorrwwaarrdd--wwoorrdd.
yyaannkk ((CC--yy))
- Yank the top of the kill ring into the buffer at
+ Yank the top of the kill ring into the buffer at
the cursor.
- yyaannkk--ppoopp ((MM--yy))
- Rotate the kill ring, and yank the new top. Only
- works following yyaannkk or yyaannkk--ppoopp.
-
-GNU 1998 Dec 31 10
+GNU 1999 Jun 1 10
@@ -664,64 +664,64 @@ GNU 1998 Dec 31 10
READLINE(3) READLINE(3)
+ yyaannkk--ppoopp ((MM--yy))
+ Rotate the kill ring, and yank the new top. Only
+ works following yyaannkk or yyaannkk--ppoopp.
+
NNuummeerriicc AArrgguummeennttss
ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----))
- Add this digit to the argument already accumulat-
- ing, or start a new argument. M-- starts a nega-
+ Add this digit to the argument already accumulat-
+ ing, or start a new argument. M-- starts a nega-
tive argument.
uunniivveerrssaall--aarrgguummeenntt
- This is another way to specify an argument. If
- this command is followed by one or more digits,
- optionally with a leading minus sign, those digits
+ This is another way to specify an argument. If
+ this command is followed by one or more digits,
+ optionally with a leading minus sign, those digits
define the argument. If the command is followed by
digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the
- numeric argument, but is otherwise ignored. As a
- special case, if this command is immediately fol-
- lowed by a character that is neither a digit or
+ numeric argument, but is otherwise ignored. As a
+ special case, if this command is immediately fol-
+ lowed by a character that is neither a digit or
minus sign, the argument count for the next command
- is multiplied by four. The argument count is ini-
- tially one, so executing this function the first
- time makes the argument count four, a second time
+ is multiplied by four. The argument count is ini-
+ tially one, so executing this function the first
+ time makes the argument count four, a second time
makes the argument count sixteen, and so on.
CCoommpplleettiinngg
ccoommpplleettee ((TTAABB))
- Attempt to perform completion on the text before
+ Attempt to perform completion on the text before
point. The actual completion performed is applica-
- tion-specific. BBaasshh, for instance, attempts com-
- pletion treating the text as a variable (if the
- text begins with $$), username (if the text begins
- with ~~), hostname (if the text begins with @@), or
- command (including aliases and functions) in turn.
+ tion-specific. BBaasshh, for instance, attempts com-
+ pletion treating the text as a variable (if the
+ text begins with $$), username (if the text begins
+ with ~~), hostname (if the text begins with @@), or
+ command (including aliases and functions) in turn.
If none of these produces a match, filename comple-
- tion is attempted. GGddbb, on the other hand, allows
- completion of program functions and variables, and
- only attempts filename completion under certain
+ tion is attempted. GGddbb, on the other hand, allows
+ completion of program functions and variables, and
+ only attempts filename completion under certain
circumstances.
ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??))
- List the possible completions of the text before
+ List the possible completions of the text before
point.
iinnsseerrtt--ccoommpplleettiioonnss ((MM--**))
- Insert all completions of the text before point
- that would have been generated by ppoossssiibbllee--ccoommppllee--
+ Insert all completions of the text before point
+ that would have been generated by ppoossssiibbllee--ccoommppllee--
ttiioonnss.
mmeennuu--ccoommpplleettee
- Similar to ccoommpplleettee, but replaces the word to be
+ Similar to ccoommpplleettee, but replaces the word to be
completed with a single match from the list of pos-
sible completions. Repeated execution of mmeennuu--ccoomm--
- pplleettee steps through the list of possible comple-
+ pplleettee steps through the list of possible comple-
tions, inserting each match in turn. At the end of
- the list of completions, the bell is rung and the
- original text is restored. An argument of _n moves
- _n positions forward in the list of matches; a nega-
- tive argument may be used to move backward through
- the list. This command is intended to be bound to
- TTAABB, but is unbound by default.
-
+ the list of completions, the bell is rung and the
+ original text is restored. An argument of _n moves
+ _n positions forward in the list of matches; a
-GNU 1998 Dec 31 11
+GNU 1999 Jun 1 11
@@ -730,64 +730,64 @@ GNU 1998 Dec 31 11
READLINE(3) READLINE(3)
+ negative argument may be used to move backward
+ through the list. This command is intended to be
+ bound to TTAABB, but is unbound by default.
ddeelleettee--cchhaarr--oorr--lliisstt
- Deletes the character under the cursor if not at
- the beginning or end of the line (like ddeelleettee--
- cchhaarr). If at the end of the line, behaves identi-
- cally to ppoossssiibbllee--ccoommpplleettiioonnss. This command is
+ Deletes the character under the cursor if not at
+ the beginning or end of the line (like ddeelleettee--
+ cchhaarr). If at the end of the line, behaves identi-
+ cally to ppoossssiibbllee--ccoommpplleettiioonnss. This command is
unbound by default.
KKeeyybbooaarrdd MMaaccrrooss
ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (())
- Begin saving the characters typed into the current
+ Begin saving the characters typed into the current
keyboard macro.
eenndd--kkbbdd--mmaaccrroo ((CC--xx ))))
- Stop saving the characters typed into the current
+ Stop saving the characters typed into the current
keyboard macro and store the definition.
ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee))
Re-execute the last keyboard macro defined, by mak-
- ing the characters in the macro appear as if typed
+ ing the characters in the macro appear as if typed
at the keyboard.
MMiisscceellllaanneeoouuss
rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr))
- Read in the contents of the _i_n_p_u_t_r_c file, and
- incorporate any bindings or variable assignments
+ Read in the contents of the _i_n_p_u_t_r_c file, and
+ incorporate any bindings or variable assignments
found there.
aabboorrtt ((CC--gg))
Abort the current editing command and ring the ter-
minal's bell (subject to the setting of
bbeellll--ssttyyllee).
ddoo--uuppppeerrccaassee--vveerrssiioonn ((MM--aa,, MM--bb,, MM--_x,, ......))
- If the metafied character _x is lowercase, run the
- command that is bound to the corresponding upper-
+ If the metafied character _x is lowercase, run the
+ command that is bound to the corresponding upper-
case character.
pprreeffiixx--mmeettaa ((EESSCC))
- Metafy the next character typed. EESSCC ff is equiva-
+ Metafy the next character typed. EESSCC ff is equiva-
lent to MMeettaa--ff.
uunnddoo ((CC--__,, CC--xx CC--uu))
- Incremental undo, separately remembered for each
+ Incremental undo, separately remembered for each
line.
rreevveerrtt--lliinnee ((MM--rr))
- Undo all changes made to this line. This is like
- executing the uunnddoo command enough times to return
+ Undo all changes made to this line. This is like
+ executing the uunnddoo command enough times to return
the line to its initial state.
ttiillddee--eexxppaanndd ((MM--&&))
Perform tilde expansion on the current word.
sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>))
- Set the mark to the current point. If a numeric
+ Set the mark to the current point. If a numeric
argument is supplied, the mark is set to that posi-
tion.
eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx))
- Swap the point with the mark. The current cursor
- position is set to the saved position, and the old
- cursor position is saved as the mark.
- cchhaarraacctteerr--sseeaarrcchh ((CC--]]))
- A character is read and point is moved to the next
+ Swap the point with the mark. The current cursor
+ position is set to the saved position, and the old
-GNU 1998 Dec 31 12
+GNU 1999 Jun 1 12
@@ -796,64 +796,64 @@ GNU 1998 Dec 31 12
READLINE(3) READLINE(3)
- occurrence of that character. A negative count
+ cursor position is saved as the mark.
+ cchhaarraacctteerr--sseeaarrcchh ((CC--]]))
+ A character is read and point is moved to the next
+ occurrence of that character. A negative count
searches for previous occurrences.
cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]]))
- A character is read and point is moved to the pre-
- vious occurrence of that character. A negative
+ A character is read and point is moved to the pre-
+ vious occurrence of that character. A negative
count searches for subsequent occurrences.
iinnsseerrtt--ccoommmmeenntt ((MM--##))
The value of the readline ccoommmmeenntt--bbeeggiinn variable is
- inserted at the beginning of the current line, and
- the line is accepted as if a newline had been
- typed. This makes the current line a shell com-
+ inserted at the beginning of the current line, and
+ the line is accepted as if a newline had been
+ typed. This makes the current line a shell com-
ment.
dduummpp--ffuunnccttiioonnss
- Print all of the functions and their key bindings
- to the readline output stream. If a numeric argu-
+ Print all of the functions and their key bindings
+ to the readline output stream. If a numeric argu-
ment is supplied, the output is formatted in such a
way that it can be made part of an _i_n_p_u_t_r_c file.
dduummpp--vvaarriiaabblleess
- Print all of the settable variables and their val-
- ues to the readline output stream. If a numeric
- argument is supplied, the output is formatted in
- such a way that it can be made part of an _i_n_p_u_t_r_c
+ Print all of the settable variables and their val-
+ ues to the readline output stream. If a numeric
+ argument is supplied, the output is formatted in
+ such a way that it can be made part of an _i_n_p_u_t_r_c
file.
dduummpp--mmaaccrrooss
- Print all of the readline key sequences bound to
- macros and the strings they ouput. If a numeric
- argument is supplied, the output is formatted in
- such a way that it can be made part of an _i_n_p_u_t_r_c
+ Print all of the readline key sequences bound to
+ macros and the strings they ouput. If a numeric
+ argument is supplied, the output is formatted in
+ such a way that it can be made part of an _i_n_p_u_t_r_c
file.
eemmaaccss--eeddiittiinngg--mmooddee ((CC--ee))
- When in vvii editing mode, this causes a switch to
+ When in vvii editing mode, this causes a switch to
eemmaaccss editing mode.
vvii--eeddiittiinngg--mmooddee ((MM--CC--jj))
When in eemmaaccss editing mode, this causes a switch to
vvii editing mode.
DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS
- The following is a list of the default emacs and vi bind-
- ings. Characters with the 8th bit set are written as
+ The following is a list of the default emacs and vi bind-
+ ings. Characters with the 8th bit set are written as
M-<character>, and are referred to as _m_e_t_a_f_i_e_d characters.
- The printable ASCII characters not mentioned in the list
- of emacs standard bindings are bound to the _s_e_l_f_-_i_n_s_e_r_t
- function, which just inserts the given character into the
- input line. In vi insertion mode, all characters not
- specifically mentioned are bound to _s_e_l_f_-_i_n_s_e_r_t. Charac-
- ters assigned to signal generation by _s_t_t_y(1) or the ter-
- minal driver, such as C-Z or C-C, retain that function.
- Upper and lower case _m_e_t_a_f_i_e_d characters are bound to the
- same function in the emacs mode meta keymap. The remain-
- ing characters are unbound, which causes readline to ring
- the bell (subject to the setting of the bbeellll--ssttyyllee vari-
- able).
+ The printable ASCII characters not mentioned in the list
+ of emacs standard bindings are bound to the _s_e_l_f_-_i_n_s_e_r_t
+ function, which just inserts the given character into the
+ input line. In vi insertion mode, all characters not
+ specifically mentioned are bound to _s_e_l_f_-_i_n_s_e_r_t. Charac-
+ ters assigned to signal generation by _s_t_t_y(1) or the ter-
+ minal driver, such as C-Z or C-C, retain that function.
+ Upper and lower case _m_e_t_a_f_i_e_d characters are bound to the
+ same function in the emacs mode meta keymap. The remain-
+ ing characters are unbound, which causes readline to ring
+ the bell (subject to the setting of the bbeellll--ssttyyllee
-
-
-GNU 1998 Dec 31 13
+GNU 1999 Jun 1 13
@@ -862,6 +862,8 @@ GNU 1998 Dec 31 13
READLINE(3) READLINE(3)
+ variable).
+
EEmmaaccss MMooddee
Emacs Standard bindings
@@ -914,12 +916,10 @@ READLINE(3) READLINE(3)
"M-." yank-last-arg
"M-0" digit-argument
"M-1" digit-argument
- "M-2" digit-argument
- "M-3" digit-argument
-GNU 1998 Dec 31 14
+GNU 1999 Jun 1 14
@@ -928,6 +928,8 @@ GNU 1998 Dec 31 14
READLINE(3) READLINE(3)
+ "M-2" digit-argument
+ "M-3" digit-argument
"M-4" digit-argument
"M-5" digit-argument
"M-6" digit-argument
@@ -980,12 +982,10 @@ READLINE(3) READLINE(3)
"C-U" unix-line-discard
"C-V" quoted-insert
"C-W" unix-word-rubout
- "C-Y" yank
- "C-[" vi-movement-mode
-GNU 1998 Dec 31 15
+GNU 1999 Jun 1 15
@@ -994,6 +994,8 @@ GNU 1998 Dec 31 15
READLINE(3) READLINE(3)
+ "C-Y" yank
+ "C-[" vi-movement-mode
"C-_" undo
" " to "~" self-insert
"C-?" backward-delete-char
@@ -1046,12 +1048,10 @@ READLINE(3) READLINE(3)
"P" vi-put
"R" vi-replace
"S" vi-subst
- "T" vi-char-search
- "U" revert-line
-GNU 1998 Dec 31 16
+GNU 1999 Jun 1 16
@@ -1060,6 +1060,8 @@ GNU 1998 Dec 31 16
READLINE(3) READLINE(3)
+ "T" vi-char-search
+ "U" revert-line
"W" vi-next-word
"X" backward-delete-char
"Y" vi-yank-to
@@ -1101,23 +1103,21 @@ FFIILLEESS
Individual rreeaaddlliinnee initialization file
AAUUTTHHOORRSS
- Brian Fox, Free Software Foundation (primary author)
- bfox@ai.MIT.Edu
+ Brian Fox, Free Software Foundation
+ bfox@gnu.org
Chet Ramey, Case Western Reserve University
chet@ins.CWRU.Edu
BBUUGG RREEPPOORRTTSS
- If you find a bug in rreeaaddlliinnee,, you should report it. But
- first, you should make sure that it really is a bug, and
- that it appears in the latest version of the rreeaaddlliinnee
+ If you find a bug in rreeaaddlliinnee,, you should report it. But
+ first, you should make sure that it really is a bug, and
+ that it appears in the latest version of the rreeaaddlliinnee
library that you have.
- Once you have determined that a bug actually exists, mail
-
-GNU 1998 Dec 31 17
+GNU 1999 Jun 1 17
@@ -1126,13 +1126,14 @@ GNU 1998 Dec 31 17
READLINE(3) READLINE(3)
- a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix,
- you are welcome to mail that as well! Suggestions and
- `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_-
+ Once you have determined that a bug actually exists, mail
+ a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix,
+ you are welcome to mail that as well! Suggestions and
+ `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_-
_l_i_n_e@_g_n_u_._o_r_g or posted to the Usenet newsgroup
ggnnuu..bbaasshh..bbuugg.
- Comments and bug reports concerning this manual page
+ Comments and bug reports concerning this manual page
should be directed to _c_h_e_t_@_i_n_s_._C_W_R_U_._E_d_u.
BBUUGGSS
@@ -1182,7 +1183,6 @@ BBUUGGSS
-
-GNU 1998 Dec 31 18
+GNU 1999 Jun 1 18
diff --git a/readline/doc/readline.3 b/readline/doc/readline.3
index 6b36f2f5695..c1ed9cf7da5 100644
--- a/readline/doc/readline.3
+++ b/readline/doc/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Thu Dec 31 10:16:30 EST 1998
+.\" Last Change: Tue Jun 1 13:28:03 EDT 1999
.\"
-.TH READLINE 3 "1998 Dec 31" GNU
+.TH READLINE 3 "1999 Jun 1" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -148,6 +148,7 @@ processing key bindings:
.IR SPACE ,
and
.IR TAB .
+.PP
In addition to command names, readline allows keys to be bound
to a string that is inserted when the key is pressed (a \fImacro\fP).
.PP
@@ -564,7 +565,7 @@ Move forward to the end of the next word. Words are composed of
alphanumeric characters (letters and digits).
.TP
.B backward\-word (M\-b)
-Move back to the start of this, or the previous, word. Words are
+Move back to the start of the current or previous word. Words are
composed of alphanumeric characters (letters and digits).
.TP
.B clear\-screen (C\-l)
@@ -1172,9 +1173,9 @@ VI Command Mode functions
Individual \fBreadline\fP initialization file
.PD
.SH AUTHORS
-Brian Fox, Free Software Foundation (primary author)
+Brian Fox, Free Software Foundation
.br
-bfox@ai.MIT.Edu
+bfox@gnu.org
.PP
Chet Ramey, Case Western Reserve University
.br
diff --git a/readline/doc/rlman.texinfo b/readline/doc/rlman.texinfo
index 41bafbf501b..759f0eb3d40 100644
--- a/readline/doc/rlman.texinfo
+++ b/readline/doc/rlman.texinfo
@@ -55,8 +55,8 @@ in the consistency of user interface across discrete programs that need
to provide a command line interface.
Published by the Free Software Foundation @*
-675 Massachusetts Avenue, @*
-Cambridge, MA 02139 USA
+59 Temple Place, Suite 330, @*
+Boston, MA 02111 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
diff --git a/readline/doc/rltech.texinfo b/readline/doc/rltech.texinfo
index ea8d7f8c5e5..51c340a99a2 100644
--- a/readline/doc/rltech.texinfo
+++ b/readline/doc/rltech.texinfo
@@ -167,6 +167,13 @@ programs. This section describes the various functions and variables
defined within the Readline library which allow a user program to add
customized functionality to Readline.
+Before declaring any functions that customize Readline's behavior, or
+using any functionality Readline provides in other code, an
+application writer should include the file @code{<readline/readline.h>}
+in any file that uses Readline's features. Since some of the definitions
+in @code{readline.h} use the @code{stdio} library, the file
+@code{<stdio.h>} should be included before @code{readline.h}.
+
@menu
* The Function Type:: C declarations to make code readable.
* Function Writing:: Variables and calling conventions.
@@ -241,7 +248,9 @@ These variables are available to function writers.
@deftypevar {char *} rl_line_buffer
This is the line gathered so far. You are welcome to modify the
-contents of the line, but see @ref{Allowing Undoing}.
+contents of the line, but see @ref{Allowing Undoing}. The
+function @code{rl_extend_line_buffer} is available to increase
+the memory allocated to @code{rl_line_buffer}.
@end deftypevar
@deftypevar int rl_point
@@ -282,6 +291,16 @@ The prompt Readline uses. This is set from the argument to
@code{readline ()}, and should not be assigned to directly.
@end deftypevar
+@deftypevar int rl_already_prompted
+If an application wishes to display the prompt itself, rather than have
+Readline do it the first time @code{readline()} is called, it should set
+this variable to a non-zero value after displaying the prompt.
+The prompt must also be passed as the argument to @code{readline()} so
+the redisplay functions can update the display properly.
+The calling application is responsible for managing the value; Readline
+never sets it.
+@end deftypevar
+
@deftypevar {char *} rl_library_version
The version number of this revision of the library.
@end deftypevar
@@ -447,6 +466,13 @@ several internal keymaps: @code{emacs_standard_keymap},
@code{emacs_standard_keymap} is the default, and the examples in
this manual assume that.
+Since @code{readline} installs a set of default key bindings the first
+time it is called, there is always the danger that a custom binding
+installed before the first call to @code{readline} will be overridden.
+An alternate mechanism is to install custom key bindings in an
+initialization function assigned to the @code{rl_startup_hook} variable
+(@pxref{Readline Variables}).
+
These functions manage key bindings.
@deftypefun int rl_bind_key (int key, Function *function)
@@ -534,6 +560,12 @@ the list is formatted in such a way that it can be made part of an
Print the names of all bindable Readline functions to @code{rl_outstream}.
@end deftypefun
+@deftypefun {char **} rl_funmap_names ()
+Return a NULL terminated array of known function names. The array is
+sorted. The array itself is allocated, but not the strings inside. You
+should free () the array when you done, but not the pointrs.
+@end deftypefun
+
@node Allowing Undoing
@subsection Allowing Undoing
@@ -615,10 +647,19 @@ Readline thinks the screen display is correct.
@end deftypefun
@deftypefun int rl_on_new_line ()
-Tell the update routines that we have moved onto a new (empty) line,
+Tell the update functions that we have moved onto a new (empty) line,
usually after ouputting a newline.
@end deftypefun
+@deftypefun int rl_on_new_line_with_prompt ()
+Tell the update functions that we have moved onto a new line, with
+@var{rl_prompt} already displayed.
+This could be used by applications that want to output the prompt string
+themselves, but still need Readline to know the prompt string length for
+redisplay.
+It should be used after setting @var{rl_already_prompted}.
+@end deftypefun
+
@deftypefun int rl_reset_line_state ()
Reset the display state to a clean state and redisplay the current line
starting on a new line.
@@ -688,7 +729,7 @@ before Readline attempts to read characters from the terminal with
@code{rl_read_key ()}.
@end deftypefun
-@deftypefun rl_extend_line_buffer (int len)
+@deftypefun int rl_extend_line_buffer (int len)
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
characters, possibly reallocating it if necessary.
@end deftypefun
@@ -700,6 +741,8 @@ Initialize or re-initialize Readline's internal state.
@deftypefun int rl_reset_terminal (char *terminal_name)
Reinitialize Readline's idea of the terminal settings using
@var{terminal_name} as the terminal type (e.g., @code{vt100}).
+If @var{terminal_name} is NULL, the value of the @code{TERM}
+environment variable is used.
@end deftypefun
@deftypefun int alphabetic (int c)
@@ -1106,7 +1149,7 @@ for subsequent calls.
@deftypevar {Function *} rl_completion_entry_function
A pointer to the generator function for @code{completion_matches ()}.
-@code{NULL} means to use @code{filename_entry_function ()}, the default
+@code{NULL} means to use @code{filename_completion_function ()}, the default
filename completer.
@end deftypevar
diff --git a/readline/doc/rluser.texinfo b/readline/doc/rluser.texinfo
index 755f7ca3a35..9f088ff3d48 100644
--- a/readline/doc/rluser.texinfo
+++ b/readline/doc/rluser.texinfo
@@ -7,10 +7,10 @@
This file documents the end user interface to the GNU command line
editing features. It is to be an appendix to manuals for programs which
use these features. There is a document entitled "readline.texinfo"
-which contains both end-user and programmer documentation for the GNU
-Readline Library.
+which contains both end-user and programmer documentation for the
+GNU Readline Library.
-Copyright (C) 1988, 1991, 1993, 1996 Free Software Foundation, Inc.
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -36,11 +36,19 @@ into another language, under the above conditions for modified versions.
@comment If you are including this manual as an appendix, then set the
@comment variable readline-appendix.
+@ifclear BashFeatures
+@defcodeindex bt
+@end ifclear
+
@node Command Line Editing
@chapter Command Line Editing
-This chapter describes the basic features of the @sc{GNU}
+This chapter describes the basic features of the @sc{gnu}
command line editing interface.
+@ifset BashFeatures
+Command line editing is provided by the Readline library, which is
+used by several different programs, including Bash.
+@end ifset
@menu
* Introduction and Notation:: Notation used in this text.
@@ -50,6 +58,12 @@ command line editing interface.
available for binding
* Readline vi Mode:: A short description of how to make Readline
behave like the vi editor.
+@ifset BashFeatures
+* Programmable Completion:: How to specify the possible completions for
+ a specific command.
+* Programmable Completion Builtins:: Builtin commands to specify how to
+ complete arguments for a particular command.
+@end ifset
@end menu
@node Introduction and Notation
@@ -63,9 +77,19 @@ produced when the @key{k} key is pressed while the Control key
is depressed.
The text @key{M-k} is read as `Meta-K' and describes the character
-produced when the meta key (if you have one) is depressed, and the @key{k}
-key is pressed. If you do not have a meta key, the identical keystroke
-can be generated by typing @key{ESC} @i{first}, and then typing @key{k}.
+produced when the Meta key (if you have one) is depressed, and the @key{k}
+key is pressed.
+The Meta key is labeled @key{ALT} on many keyboards.
+On keyboards with two keys labeled @key{ALT} (usually to either side of
+the space bar), the @key{ALT} on the left side is generally set to
+work as a Meta key.
+The @key{ALT} key on the right may also be configured to work as a
+Meta key or may be configured as some other modifier, such as a
+Compose key for typing accented characters.
+
+If you do not have a Meta or @key{ALT} key, or another key working as
+a Meta key, the identical keystroke can be generated by typing @key{ESC}
+@i{first}, and then typing @key{k}.
Either process is known as @dfn{metafying} the @key{k} key.
The text @key{M-C-k} is read as `Meta-Control-k' and describes the
@@ -75,6 +99,10 @@ In addition, several keys have their own names. Specifically,
@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
stand for themselves when seen in this text, or in an init file
(@pxref{Readline Init File}).
+If your keyboard lacks a @key{LFD} key, typing @key{C-j} will
+produce the desired character.
+The @key{RET} key may be labeled @key{Return} or @key{Enter} on
+some keyboards.
@node Readline Interaction
@section Readline Interaction
@@ -110,8 +138,8 @@ character appears where the cursor was, and then the cursor moves one
space to the right. If you mistype a character, you can use your
erase character to back up and delete the mistyped character.
-Sometimes you may miss typing a character that you wanted to type, and
-not notice your error until you have typed several other characters. In
+Sometimes you may mistype a character, and
+not notice the error until you have typed several other characters. In
that case, you can type @key{C-b} to move the cursor to the left, and then
correct your mistake. Afterwards, you can move the cursor to the right
with @key{C-f}.
@@ -120,7 +148,7 @@ When you add text in the middle of a line, you will notice that characters
to the right of the cursor are `pushed over' to make room for the text
that you have inserted. Likewise, when you delete text behind the cursor,
characters to the right of the cursor are `pulled back' to fill in the
-blank space created by the removal of the text. A list of the basic bare
+blank space created by the removal of the text. A list of the bare
essentials for editing the text of an input line follows.
@table @asis
@@ -128,22 +156,28 @@ essentials for editing the text of an input line follows.
Move back one character.
@item @key{C-f}
Move forward one character.
-@item @key{DEL}
+@item @key{DEL} or @key{Backspace}
Delete the character to the left of the cursor.
@item @key{C-d}
Delete the character underneath the cursor.
@item @w{Printing characters}
Insert the character into the line at the cursor.
-@item @key{C-_}
+@item @key{C-_} or @key{C-x C-u}
Undo the last editing command. You can undo all the way back to an
empty line.
@end table
+@noindent
+(Depending on your configuration, the @key{Backspace} key be set to
+delete the character to the left of the cursor and the @key{DEL} key set
+to delete the character underneath the cursor, like @key{C-d}, rather
+than the character to the left of the cursor.)
+
@node Readline Movement Commands
@subsection Readline Movement Commands
-The above table describes the most basic possible keystrokes that you need
+The above table describes the most basic keystrokes that you need
in order to do editing of the input line. For your convenience, many
other commands have been added in addition to @key{C-b}, @key{C-f},
@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidly
@@ -175,6 +209,8 @@ operate on characters while meta keystrokes operate on words.
@dfn{Killing} text means to delete the text from the line, but to save
it away for later use, usually by @dfn{yanking} (re-inserting)
it back into the line.
+(`Cut' and `paste' are more recent jargon for `kill' and `yank'.)
+
If the description for a command says that it `kills' text, then you can
be sure that you can get the text back in a different (or the same)
place later.
@@ -194,12 +230,14 @@ Here is the list of commands for killing text.
Kill the text from the current cursor position to the end of the line.
@item M-d
-Kill from the cursor to the end of the current word, or if between
+Kill from the cursor to the end of the current word, or, if between
words, to the end of the next word.
+Word boundaries are the same as those used by @key{M-f}.
@item M-DEL
-Kill from the cursor the start of the previous word, or if between
+Kill from the cursor the start of the previous word, or, if between
words, to the start of the previous word.
+Word boundaries are the same as those used by @key{M-b}.
@item C-w
Kill from the cursor to the previous whitespace. This is different than
@@ -231,7 +269,7 @@ start of the line, you might type @samp{M-- C-k}.
The general way to pass numeric arguments to a command is to type meta
digits before the command. If the first `digit' typed is a minus
-sign (@key{-}), then the sign of the argument will be negative. Once
+sign (@samp{-}), then the sign of the argument will be negative. Once
you have typed one meta digit to get the argument started, you can type
the remainder of the digits, and then the command. For example, to give
the @key{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}.
@@ -252,15 +290,18 @@ As each character of the search string is typed, Readline displays
the next entry from the history matching the string typed so far.
An incremental search requires only as many characters as needed to
find the desired history entry.
-The characters present in the value of the @var{isearch-terminators} variable
+To search backward in the history for a particular string, type
+@key{C-r}. Typing @key{C-s} searches forward through the history.
+The characters present in the value of the @code{isearch-terminators} variable
are used to terminate an incremental search.
If that variable has not been assigned a value, the @key{ESC} and
@key{C-J} characters will terminate an incremental search.
@key{C-g} will abort an incremental search and restore the original line.
When the search is terminated, the history entry containing the
search string becomes the current line.
-To find other matching entries in the history list, type @key{C-s} or
-@key{C-r} as appropriate.
+
+To find other matching entries in the history list, type @key{C-r} or
+@key{C-s} as appropriate.
This will search backward or forward in the history for the next
entry matching the search string typed so far.
Any other key sequence bound to a Readline command will terminate
@@ -276,11 +317,11 @@ typed by the user or be part of the contents of the current line.
@section Readline Init File
@cindex initialization file, readline
-Although the Readline library comes with a set of @code{emacs}-like
+Although the Readline library comes with a set of Emacs-like
keybindings installed by default, it is possible to use a different set
of keybindings.
Any user can customize programs that use Readline by putting
-commands in an @dfn{inputrc} file in his home directory.
+commands in an @dfn{inputrc} file, conventionally in his home directory.
The name of this
@ifset BashFeatures
file is taken from the value of the shell variable @code{INPUTRC}. If
@@ -326,6 +367,11 @@ change from the default Emacs-like key binding to use
set editing-mode vi
@end example
+@ifset BashFeatures
+The @w{@code{bind -V}} command lists the current Readline variable names
+and values. @xref{Bash Builtins}.
+@end ifset
+
A great deal of run-time behavior is changeable with the following
variables.
@@ -363,7 +409,7 @@ them; otherwise, they are simply listed. The default limit is
@vindex convert-meta
If set to @samp{on}, Readline will convert characters with the
eighth bit set to an ASCII key sequence by stripping the eighth
-bit and prepending an @key{ESC} character, converting them to a
+bit and prefixing an @key{ESC} character, converting them to a
meta-prefixed key sequence. The default value is @samp{on}.
@item disable-completion
@@ -469,7 +515,7 @@ completions. The default is @samp{off}.
@item Key Bindings
The syntax for controlling key bindings in the init file is
-simple. First you have to know the name of the command that you
+simple. First you need to find the name of the command that you
want to change. The following sections contain tables of the command
name, the default keybinding, if any, and a short description of what
the command does.
@@ -480,6 +526,12 @@ command on a line in the init file. The name of the key
can be expressed in different ways, depending on which is most
comfortable for you.
+@ifset BashFeatures
+The @w{@code{bind -p}} command displays Readline function names and
+bindings in a format that can put directly into an initialization file.
+@xref{Bash Builtins}.
+@end ifset
+
@table @asis
@item @w{@var{keyname}: @var{function-name} or @var{macro}}
@var{keyname} is the name of a key spelled out in English. For example:
@@ -497,7 +549,7 @@ expressed on the right hand side (that is, to insert the text
@item @w{"@var{keyseq}": @var{function-name} or @var{macro}}
@var{keyseq} differs from @var{keyname} above in that strings
denoting an entire key sequence can be specified, by placing
-the key sequence in double quotes. Some GNU Emacs style key
+the key sequence in double quotes. Some @sc{gnu} Emacs style key
escapes can be used, as in the following example, but the
special character names are not recognized.
@@ -515,7 +567,7 @@ the text @samp{Function Key 1}.
@end table
-The following GNU Emacs style escape sequences are available when
+The following @sc{gnu} Emacs style escape sequences are available when
specifying key sequences:
@table @code
@@ -528,12 +580,12 @@ an escape character
@item @kbd{\\}
backslash
@item @kbd{\"}
-@key{"}
+@key{"}, a double quotation mark
@item @kbd{\'}
-@key{'}
+@key{'}, a single quote or apostrophe
@end table
-In addition to the GNU Emacs style escape sequences, a second
+In addition to the @sc{gnu} Emacs style escape sequences, a second
set of backslash escapes is available:
@table @code
@@ -554,10 +606,10 @@ horizontal tab
@item \v
vertical tab
@item \@var{nnn}
-the character whose ASCII code is the octal value @var{nnn}
+the character whose @code{ASCII} code is the octal value @var{nnn}
(one to three digits)
@item \x@var{nnn}
-the character whose ASCII code is the hexadecimal value @var{nnn}
+the character whose @code{ASCII} code is the hexadecimal value @var{nnn}
(one to three digits)
@end table
@@ -762,6 +814,17 @@ $endif
This section describes Readline commands that may be bound to key
sequences.
+@ifset BashFeatures
+You can list your key bindings by executing
+@w{@code{bind -P}} or, for a more terse format, suitable for an
+@var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.)
+@end ifset
+
+Command names without an accompanying key sequence are unbound by default.
+In the following descriptions, @var{point} refers to the current cursor
+position, and @var{mark} refers to a cursor position saved by the
+@code{set-mark} command.
+The text between the point and mark is referred to as the @var{region}.
@node Commands For Moving
@subsection Commands For Moving
@@ -783,7 +846,7 @@ Move forward to the end of the next word. Words are composed of
letters and digits.
@item backward-word (M-b)
-Move back to the start of this, or the previous, word. Words are
+Move back to the start of the current or previous word. Words are
composed of letters and digits.
@item clear-screen (C-l)
@@ -846,9 +909,9 @@ for a string supplied by the user.
@item history-search-forward ()
Search forward through the history for the string of characters
-between the start of the current line and the current cursor
-position (the @var{point}). This is a non-incremental search. By
-default, this command is unbound.
+between the start of the current line and the point.
+This is a non-incremental search.
+By default, this command is unbound.
@item history-search-backward ()
Search backward through the history for the string of characters
@@ -908,11 +971,11 @@ the character at the cursor, moving the
cursor forward as well. If the insertion point
is at the end of the line, then this
transposes the last two characters of the line.
-Negative arguments don't work.
+Negative arguments have no effect.
@item transpose-words (M-t)
-Drag the word behind the cursor past the word in front of the cursor
-moving the cursor over that word as well.
+Drag the word before point past the word after point,
+moving point past that word as well.
@item upcase-word (M-u)
Uppercase the current (or following) word. With a negative argument,
@@ -934,38 +997,36 @@ capitalize the previous word, but do not move the cursor.
@ftable @code
@item kill-line (C-k)
-Kill the text from the current cursor position to the end of the line.
+Kill the text from point to the end of the line.
@item backward-kill-line (C-x Rubout)
Kill backward to the beginning of the line.
@item unix-line-discard (C-u)
Kill backward from the cursor to the beginning of the current line.
-The killed text is saved on the kill-ring.
@item kill-whole-line ()
-Kill all characters on the current line, no matter where the
-cursor is. By default, this is unbound.
+Kill all characters on the current line, no matter point is.
+By default, this is unbound.
@item kill-word (M-d)
-Kill from the cursor to the end of the current word, or if between
-words, to the end of the next word. Word boundaries are the same
-as @code{forward-word}.
+Kill from point to the end of the current word, or if between
+words, to the end of the next word.
+Word boundaries are the same as @code{forward-word}.
@item backward-kill-word (M-DEL)
-Kill the word behind the cursor. Word boundaries are the same
-as @code{backward-word}.
+Kill the word behind point.
+Word boundaries are the same as @code{backward-word}.
@item unix-word-rubout (C-w)
-Kill the word behind the cursor, using white space as a word
-boundary. The killed text is saved on the kill-ring.
+Kill the word behind point, using white space as a word boundary.
+The killed text is saved on the kill-ring.
@item delete-horizontal-space ()
Delete all spaces and tabs around point. By default, this is unbound.
@item kill-region ()
-Kill the text between the point and the @emph{mark} (saved
-cursor position). This text is referred to as the @var{region}.
+Kill the text in the current region.
By default, this command is unbound.
@item copy-region-as-kill ()
@@ -1109,7 +1170,7 @@ the text against lines from the history list for possible
completion matches.
@item complete-into-braces (M-@{)
-Perform filename completion and return the list of possible completions
+Perform filename completion and insert the list of possible completions
enclosed within braces so the list is available to the shell
(@pxref{Brace Expansion}).
@@ -1138,7 +1199,7 @@ in the macro appear as if typed at the keyboard.
@ftable @code
@item re-read-init-file (C-x C-r)
-Read in the contents of the inputrc file, and incorporate
+Read in the contents of the @var{inputrc} file, and incorporate
any bindings or variable assignments found there.
@item abort (C-g)
@@ -1192,7 +1253,8 @@ The value of the @code{comment-begin}
variable is inserted at the beginning of the current line,
and the line is accepted as if a newline had been typed.
@ifset BashFeatures
-This makes the current line a shell comment.
+The default value of @code{comment-begin} causes this command
+to make the current line a shell comment.
@end ifset
@item dump-functions ()
@@ -1285,3 +1347,283 @@ switches you into `command' mode, where you can edit the text of the
line with the standard @code{vi} movement keys, move to previous
history lines with @samp{k} and subsequent lines with @samp{j}, and
so forth.
+
+@ifset BashFeatures
+@node Programmable Completion
+@section Programmable Completion
+@cindex programmable completion
+
+When word completion is attempted for an argument to a command for
+which a completion specification (a @var{compspec}) has been defined
+using the @code{complete} builtin (@pxref{Programmable Completion Builtins}),
+the programmable completion facilities are invoked.
+
+First, the command name is identified.
+If a compspec has been defined for that command, the
+compspec is used to generate the list of possible completions for the word.
+If the command word is a full pathname, a compspec for the full
+pathname is searched for first.
+If no compspec is found for the full pathname, an attempt is made to
+find a compspec for the portion following the final slash.
+
+Once a compspec has been found, it is used to generate the list of
+matching words.
+If a compspec is not found, the default Bash completion
+described above (@pxref{Commands For Completion}) is performed.
+
+First, the actions specified by the compspec are used.
+Only matches which are prefixed by the word being completed are
+returned.
+When the @samp{-f} or @samp{-d} option is used for filename or
+directory name completion, the shell variable @code{FIGNORE} is
+used to filter the matches.
+@xref{Bash Variables}, for a description of @code{FIGNORE}.
+
+Any completions specified by a filename expansion pattern to the
+@samp{-G} option are generated next.
+The words generated by the pattern need not match the word being completed.
+The @code{GLOBIGNORE} shell variable is not used to filter the matches,
+but the @code{FIGNORE} shell variable is used.
+
+Next, the string specified as the argument to the @samp{-W} option
+is considered.
+The string is first split using the characters in the @code{IFS}
+special variable as delimiters.
+Shell quoting is honored.
+Each word is then expanded using
+brace expansion, tilde expansion, parameter and variable expansion,
+command substitution, arithmetic expansion, and pathname expansion,
+as described above (@pxref{Shell Expansions}).
+The results are split using the rules described above
+(@pxref{Word Splitting}).
+The results of the expansion are prefix-matched against the word being
+completed, and the matching words become the possible completions.
+
+After these matches have been generated, any shell function or command
+specified with the @samp{-F} and @samp{-C} options is invoked.
+When the command or function is invoked, the @code{COMP_LINE} and
+@code{COMP_POINT} variables are assigned values as described above
+(@pxref{Bash Variables}).
+If a shell function is being invoked, the @code{COMP_WORDS} and
+@code{COMP_CWORD} variables are also set.
+When the function or command is invoked, the first argument is the
+name of the command whose arguments are being completed, the
+second argument is the word being completed, and the third argument
+is the word preceding the word being completed on the current command line.
+No filtering of the generated completions against the word being completed
+is performed; the function or command has complete freedom in generating
+the matches.
+
+Any function specified with @samp{-F} is invoked first.
+The function may use any of the shell facilities, including the
+@code{compgen} builtin described below
+(@pxref{Programmable Completion Builtins}), to generate the matches.
+It must put the possible completions in the @code{COMPREPLY} array
+variable.
+
+Next, any command specified with the @samp{-C} option is invoked
+in an environment equivalent to command substitution.
+It should print a list of completions, one per line, to
+the standard output.
+Backslash may be used to escape a newline, if necessary.
+
+After all of the possible completions are generated, any filter
+specified with the @samp{-X} option is applied to the list.
+The filter is a pattern as used for pathname expansion; a @samp{&}
+in the pattern is replaced with the text of the word being completed.
+A literal @samp{&} may be escaped with a backslash; the backslash
+is removed before attempting a match.
+Any completion that matches the pattern will be removed from the list.
+A leading @samp{!} negates the pattern; in this case any completion
+not matching the pattern will be removed.
+
+Finally, any prefix and suffix specified with the @samp{-P} and @samp{-S}
+options are added to each member of the completion list, and the result is
+returned to the Readline completion code as the list of possible
+completions.
+
+If a compspec is found, whatever it generates is returned to the completion
+code as the full set of possible completions.
+The default Bash completions are not attempted, and the Readline
+default of filename completion is disabled.
+
+@node Programmable Completion Builtins
+@section Programmable Completion Builtins
+@cindex completion builtins
+
+Two builtin commands are available to manipulate the programmable completion
+facilities.
+
+@table @code
+@item compgen
+@btindex compgen
+@example
+@code{compgen [@var{option}] [@var{word}]}
+@end example
+
+Generate possible completion matches for @var{word} according to
+the @var{option}s, which may be any option accepted by the
+@code{complete}
+builtin with the exception of @samp{-p} and @samp{-r}, and write
+the matches to the standard output.
+When using the @samp{-F} or @samp{-C} options, the various shell variables
+set by the programmable completion facilities, while available, will not
+have useful values.
+
+The matches will be generated in the same way as if the programmable
+completion code had generated them directly from a completion specification
+with the same flags.
+If @var{word} is specified, only those completions matching @var{word}
+will be displayed.
+
+The return value is true unless an invalid option is supplied, or no
+matches were generated.
+
+@item complete
+@btindex complete
+@example
+@code{complete [-abcdefjkvu] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
+[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}]
+[-C @var{command}] @var{name} [@var{name} @dots{}]}
+@code{complete -pr [@var{name} @dots{}]}
+@end example
+
+Specify how arguments to each @var{name} should be completed.
+If the @samp{-p} option is supplied, or if no options are supplied, existing
+completion specifications are printed in a way that allows them to be
+reused as input.
+The @samp{-r} option removes a completion specification for
+each @var{name}, or, if no @var{name}s are supplied, all
+completion specifications.
+
+The process of applying these completion specifications when word completion
+is attempted is described above (@pxref{Programmable Completion}).
+
+Other options, if specified, have the following meanings.
+The arguments to the @samp{-G}, @samp{-W}, and @samp{-X} options
+(and, if necessary, the @samp{-P} and @samp{-S} options)
+should be quoted to protect them from expansion before the
+@code{complete} builtin is invoked.
+
+@table @code
+@item -A @var{action}
+The @var{action} may be one of the following to generate a list of possible
+completions:
+
+@table @code
+@item alias
+Alias names. May also be specified as @samp{-a}.
+
+@item arrayvar
+Array variable names.
+
+@item binding
+Readline key binding names (@pxref{Bindable Readline Commands}).
+
+@item builtin
+Names of shell builtin commands. May also be specified as @samp{-b}.
+
+@item command
+Command names. May also be specified as @samp{-c}.
+
+@item directory
+Directory names. May also be specified as @samp{-d}.
+
+@item disabled
+Names of disabled shell builtins.
+
+@item enabled
+Names of enabled shell builtins.
+
+@item export
+Names of exported shell variables. May also be specified as @samp{-e}.
+
+@item file
+File names. May also be specified as @samp{-f}.
+
+@item function
+Names of shell functions.
+
+@item helptopic
+Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}).
+
+@item hostname
+Hostnames, as taken from the file specified by the
+@code{HOSTFILE} shell variable (@pxref{Bash Variables}).
+
+@item job
+Job names, if job control is active. May also be specified as @samp{-j}.
+
+@item keyword
+Shell reserved words. May also be specified as @samp{-k}.
+
+@item running
+Names of running jobs, if job control is active.
+
+@item setopt
+Valid arguments for the @samp{-o} option to the @code{set} builtin
+(@pxref{The Set Builtin}).
+
+@item shopt
+Shell option names as accepted by the @code{shopt} builtin
+(@pxref{Bash Builtins}).
+
+@item signal
+Signal names.
+
+@item stopped
+Names of stopped jobs, if job control is active.
+
+@item user
+User names. May also be specified as @samp{-u}.
+
+@item variable
+Names of all shell variables. May also be specified as @samp{-v}.
+@end table
+
+@item -G @var{globpat}
+The filename expansion pattern @var{globpat} is expanded to generate
+the possible completions.
+
+@item -W @var{wordlist}
+The @var{wordlist} is split using the characters in the
+@code{IFS} special variable as delimiters, and each resultant word
+is expanded.
+The possible completions are the members of the resultant list which
+match the word being completed.
+
+@item -C @var{command}
+@var{command} is executed in a subshell environment, and its output is
+used as the possible completions.
+
+@item -F @var{function}
+The shell function @var{function} is executed in the current shell
+environment.
+When it finishes, the possible completions are retrieved from the value
+of the @code{COMPREPLY} array variable.
+
+@item -X @var{filterpat}
+@var{filterpat} is a pattern as used for filename expansion.
+It is applied to the list of possible completions generated by the
+preceding options and arguments, and each completion matching
+@var{filterpat} is removed from the list.
+A leading @samp{!} in @var{filterpat} negates the pattern; in this
+case, any completion not matching @var{filterpat} is removed.
+
+@item -P @var{prefix}
+@var{prefix} is added at the beginning of each possible completion
+after all other options have been applied.
+
+@item -S @var{suffix}
+@var{suffix} is appended to each possible completion
+after all other options have been applied.
+@end table
+
+The return value is true unless an invalid option is supplied, an option
+other than @samp{-p} or @samp{-r} is supplied without a @var{name}
+argument, an attempt is made to remove a completion specification for
+a @var{name} for which no specification exists, or
+an error occurs adding a completion specification.
+
+@end table
+@end ifset
diff --git a/readline/emacs_keymap.c b/readline/emacs_keymap.c
index 4ba385843f6..daba213ba07 100644
--- a/readline/emacs_keymap.c
+++ b/readline/emacs_keymap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (BUFSIZ)
#include <stdio.h>
@@ -76,11 +76,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
{ ISFUNC, rl_insert }, /* & */
{ ISFUNC, rl_insert }, /* ' */
{ ISFUNC, rl_insert }, /* ( */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* ) */
-#else
{ ISFUNC, rl_insert }, /* ) */
-#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* * */
{ ISFUNC, rl_insert }, /* + */
{ ISFUNC, rl_insert }, /* , */
@@ -140,11 +136,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
/* Some more punctuation. */
{ ISFUNC, rl_insert }, /* [ */
{ ISFUNC, rl_insert }, /* \ */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* ] */
-#else
{ ISFUNC, rl_insert }, /* ] */
-#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* ^ */
{ ISFUNC, rl_insert }, /* _ */
{ ISFUNC, rl_insert }, /* ` */
@@ -180,11 +172,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
/* Final punctuation. */
{ ISFUNC, rl_insert }, /* { */
{ ISFUNC, rl_insert }, /* | */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* } */
-#else
{ ISFUNC, rl_insert }, /* } */
-#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* ~ */
{ ISFUNC, rl_rubout }, /* RUBOUT */
diff --git a/readline/examples/Makefile.in b/readline/examples/Makefile.in
index 879aa49555b..7246e75f8ce 100644
--- a/readline/examples/Makefile.in
+++ b/readline/examples/Makefile.in
@@ -1,5 +1,22 @@
-# This is the Makefile for the examples subdirectory of readline. -*- text -*-
#
+# This is the Makefile for the readline examples subdirectory.
+#
+# Copyright (C) 1994 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
SHELL = @MAKE_SHELL@
RM = rm -f
@@ -11,7 +28,7 @@ BUILD_DIR = .
DEFS = @DEFS@
CC = @CC@
CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DREADLINE_LIBRARY
CPPFLAGS = @CPPFLAGS@
INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
@@ -19,6 +36,9 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
LDFLAGS = -g -L..
+READLINE_LIB = ../libreadline.a
+HISTORY_LIB = ../libhistory.a
+
TERMCAP_LIB = @TERMCAP_LIB@
.c.o:
@@ -39,12 +59,12 @@ fileman: fileman.o
rltest: rltest.o
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline $(TERMCAP_LIB)
-rlversion: rlversion.o
+rlversion: rlversion.o $(READLINE_LIB)
$(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB)
clean mostlyclean:
$(RM) $(OBJECTS)
- $(RM) $(EXECUTABLES)
+ $(RM) $(EXECUTABLES) *.exe
distclean maintainer-clean: clean
$(RM) Makefile
@@ -53,3 +73,13 @@ fileman.o: fileman.c
rltest.o: rltest.c
rl.o: rl.c
rlversion.o: rlversion.c
+
+# Stuff for Per Bothner's `rlfe' program
+
+rlfe: rlfe.o $(READLINE_LIB) $(HISTORY_LIB)
+ $(CC) $(LDFLAGS) -o $@ rlfe.o -lreadline -lhistory ${TERMCAP_LIB}
+
+rlfe.o: rlfe.c
+
+rlfe.o: $(top_srcdir)/readline.h
+rlfe.o: $(top_srcdir)/history.h
diff --git a/readline/examples/fileman.c b/readline/examples/fileman.c
index 0702a5badc7..dc29a40104f 100644
--- a/readline/examples/fileman.c
+++ b/readline/examples/fileman.c
@@ -1,22 +1,22 @@
/* fileman.c -- A tiny application which demonstrates how to use the
GNU Readline library. This application interactively allows users
to manipulate files and their modes. */
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
+# include <sys/file.h>
#endif
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
@@ -26,6 +26,10 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
#ifdef READLINE_LIBRARY
# include "readline.h"
# include "history.h"
@@ -34,7 +38,6 @@
# include <readline/history.h>
#endif
-extern char *getwd ();
extern char *xmalloc ();
/* The names of functions that actually do the manipulation. */
@@ -300,7 +303,12 @@ com_view (arg)
if (!valid_argument ("view", arg))
return 1;
+#if defined (__MSDOS__)
+ /* more.com doesn't grok slashes in pathnames */
+ sprintf (syscom, "less %s", arg);
+#else
sprintf (syscom, "more %s", arg);
+#endif
return (system (syscom));
}
@@ -406,7 +414,7 @@ com_pwd (ignore)
{
char dir[1024], *s;
- s = getwd (dir);
+ s = getcwd (dir, sizeof(dir) - 1);
if (s == 0)
{
printf ("Error getting pwd: %s\n", dir);
diff --git a/readline/examples/rl.c b/readline/examples/rl.c
index 17a63434f24..2d1d17e600d 100644
--- a/readline/examples/rl.c
+++ b/readline/examples/rl.c
@@ -2,15 +2,9 @@
* rl - command-line interface to read a line from the standard input
* (or another fd) using readline.
*
- * usage: rl [-p prompt] [-u unit] [-d default]
+ * usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
*/
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
-
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@@ -18,8 +12,14 @@
#include <stdio.h>
#include <sys/types.h>
#include "posixstat.h"
-#include "readline.h"
-#include "history.h"
+
+#if defined (READLINE_LIBRARY)
+# include "readline.h"
+# include "history.h"
+#else
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
extern int optind;
extern char *optarg;
@@ -40,22 +40,24 @@ set_deftext ()
deftext = (char *)NULL;
rl_startup_hook = (Function *)NULL;
}
+ return 0;
}
static void
usage()
{
- fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
+ fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
progname, progname);
}
+int
main (argc, argv)
int argc;
char **argv;
{
char *temp, *prompt;
struct stat sb;
- int opt, fd;
+ int opt, fd, nch;
FILE *ifp;
progname = strrchr(argv[0], '/');
@@ -66,10 +68,10 @@ main (argc, argv)
/* defaults */
prompt = "readline$ ";
- fd = 0;
+ fd = nch = 0;
deftext = (char *)0;
- while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
+ while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF)
{
switch (opt)
{
@@ -87,6 +89,14 @@ main (argc, argv)
case 'd':
deftext = optarg;
break;
+ case 'n':
+ nch = atoi(optarg);
+ if (nch < 0)
+ {
+ fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg);
+ exit (2);
+ }
+ break;
default:
usage ();
exit (2);
@@ -107,6 +117,9 @@ main (argc, argv)
if (deftext && *deftext)
rl_startup_hook = set_deftext;
+ if (nch > 0)
+ rl_num_chars_to_read = nch;
+
temp = readline (prompt);
/* Test for EOF. */
diff --git a/readline/examples/rltest.c b/readline/examples/rltest.c
index 453f8ec2ada..6250f900d42 100644
--- a/readline/examples/rltest.c
+++ b/readline/examples/rltest.c
@@ -4,20 +4,20 @@
/* */
/* **************************************************************** */
-/*
- * Remove the next line if you're compiling this against an installed
- * libreadline.a
- */
-#define READLINE_LIBRARY
-
#if defined (HAVE_CONFIG_H)
#include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
-#include "readline.h"
-#include "history.h"
+
+#ifdef READLINE_LIBRARY
+# include "readline.h"
+# include "history.h"
+#else
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
extern HIST_ENTRY **history_list ();
diff --git a/readline/examples/rlversion.c b/readline/examples/rlversion.c
index 2d73a96c386..652d37ccb88 100644
--- a/readline/examples/rlversion.c
+++ b/readline/examples/rlversion.c
@@ -2,8 +2,6 @@
* rlversion -- print out readline's version number
*/
-#define READLINE_LIBRARY
-
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@@ -12,7 +10,11 @@
#include <sys/types.h>
#include "posixstat.h"
-#include "readline.h"
+#ifdef READLINE_LIBRARY
+# include "readline.h"
+#else
+# include <readline/readline.h>
+#endif
main()
{
diff --git a/readline/funmap.c b/readline/funmap.c
index f6b86286fe0..1f7ba87129d 100644
--- a/readline/funmap.c
+++ b/readline/funmap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,15 +18,13 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
-extern char *xmalloc (), *xrealloc ();
-
#if !defined (BUFSIZ)
#include <stdio.h>
#endif /* BUFSIZ */
@@ -40,6 +38,14 @@ extern char *xmalloc (), *xrealloc ();
#include "rlconf.h"
#include "readline.h"
+#include "xmalloc.h"
+
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
+
extern int _rl_qsort_string_compare ();
FUNMAP **funmap;
@@ -240,7 +246,7 @@ rl_funmap_names ()
result[result_index + 1] = (char *)NULL;
}
- qsort (result, result_index, sizeof (char *), _rl_qsort_string_compare);
+ qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
return (result);
}
diff --git a/readline/histexpand.c b/readline/histexpand.c
index 392e6d38d9e..78da3e585a6 100644
--- a/readline/histexpand.c
+++ b/readline/histexpand.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@@ -50,6 +50,9 @@
#include "history.h"
#include "histlib.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>"
#define HISTORY_QUOTE_CHARACTERS "\"'`"
@@ -60,15 +63,10 @@ static char *subst_rhs;
static int subst_lhs_len;
static int subst_rhs_len;
-static char *get_history_word_specifier ();
-static char *history_find_word ();
-
-extern int history_offset;
-
-extern char *single_quote ();
-static char *quote_breaks ();
+static char *get_history_word_specifier __P((char *, char *, int *));
+static char *history_find_word __P((char *, int));
-extern char *xmalloc (), *xrealloc ();
+static char *quote_breaks __P((char *));
/* Variables exported by this file. */
/* The character that represents the start of a history expansion
diff --git a/readline/histfile.c b/readline/histfile.c
index 3325b7fc1f7..b908e2261f8 100644
--- a/readline/histfile.c
+++ b/readline/histfile.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -35,7 +35,7 @@
#ifndef _MINIX
# include <sys/file.h>
#endif
-#include <sys/stat.h>
+#include "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_STDLIB_H)
@@ -54,15 +54,19 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
-#if defined (__EMX__)
+
+/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
+ on win 95/98/nt), we want to open files with O_BINARY mode so that there
+ is no \n -> \r\n conversion performed. On other systems, we don't want to
+ mess around with O_BINARY at all, so we ensure that it's defined to 0. */
+#if defined (__EMX__) || defined (__CYGWIN__)
# ifndef O_BINARY
# define O_BINARY 0
# endif
-#else /* !__EMX__ */
- /* If we're not compiling for __EMX__, we don't want this at all. Ever. */
+#else /* !__EMX__ && !__CYGWIN__ */
# undef O_BINARY
# define O_BINARY 0
-#endif /* !__EMX__ */
+#endif /* !__EMX__ && !__CYGWIN__ */
#include <errno.h>
#if !defined (errno)
@@ -72,10 +76,8 @@ extern int errno;
#include "history.h"
#include "histlib.h"
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlshell.h"
+#include "xmalloc.h"
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
@@ -105,7 +107,11 @@ history_filename (filename)
return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
strcpy (return_val, home);
return_val[home_len] = '/';
+#if defined (__MSDOS__)
+ strcpy (return_val + home_len + 1, "_history");
+#else
strcpy (return_val + home_len + 1, ".history");
+#endif
return (return_val);
}
@@ -132,7 +138,7 @@ read_history_range (filename, from, to)
{
register int line_start, line_end;
char *input, *buffer;
- int file, current_line;
+ int file, current_line, chars_read;
struct stat finfo;
size_t file_size;
@@ -155,11 +161,9 @@ read_history_range (filename, from, to)
}
buffer = xmalloc (file_size + 1);
-#if 0
- if (read (file, buffer, file_size) != file_size)
-#else
- if (read (file, buffer, file_size) < 0)
-#endif
+
+ chars_read = read (file, buffer, file_size);
+ if (chars_read < 0)
{
error_and_exit:
if (file >= 0)
@@ -175,15 +179,15 @@ read_history_range (filename, from, to)
/* Set TO to larger than end of file if negative. */
if (to < 0)
- to = file_size;
+ to = chars_read;
/* Start at beginning of file, work to end. */
line_start = line_end = current_line = 0;
/* Skip lines until we are at FROM. */
- while (line_start < file_size && current_line < from)
+ while (line_start < chars_read && current_line < from)
{
- for (line_end = line_start; line_end < file_size; line_end++)
+ for (line_end = line_start; line_end < chars_read; line_end++)
if (buffer[line_end] == '\n')
{
current_line++;
@@ -194,7 +198,7 @@ read_history_range (filename, from, to)
}
/* If there are lines left to gobble, then gobble them now. */
- for (line_end = line_start; line_end < file_size; line_end++)
+ for (line_end = line_start; line_end < chars_read; line_end++)
if (buffer[line_end] == '\n')
{
buffer[line_end] = '\0';
@@ -236,6 +240,10 @@ history_truncate_file (fname, lines)
if (file == -1 || fstat (file, &finfo) == -1)
goto truncate_exit;
+ /* Don't try to truncate non-regular files. */
+ if (S_ISREG(finfo.st_mode) == 0)
+ goto truncate_exit;
+
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
@@ -279,11 +287,11 @@ history_truncate_file (fname, lines)
truncate to. */
if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
- write (file, buffer + i, file_size - i);
+ write (file, buffer + i, chars_read - i);
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
- ftruncate (file, file_size - i);
+ ftruncate (file, chars_read - i);
#endif
close (file);
diff --git a/readline/histlib.h b/readline/histlib.h
index 422cf5974db..88a34d10f1d 100644
--- a/readline/histlib.h
+++ b/readline/histlib.h
@@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_
@@ -31,8 +31,11 @@ typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
+#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n) (((n) == 0) ? (1) \
+ : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#endif
#ifndef savestring
# ifndef strcpy
@@ -79,4 +82,7 @@ extern char *strchr ();
#define HISTORY_APPEND 0
#define HISTORY_OVERWRITE 1
+/* Some variable definitions shared across history source files. */
+extern int history_offset;
+
#endif /* !_HISTLIB_H_ */
diff --git a/readline/history.c b/readline/history.c
index d56ffacc6a0..400f18bc602 100644
--- a/readline/history.c
+++ b/readline/history.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -53,7 +53,7 @@
#include "history.h"
#include "histlib.h"
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
diff --git a/readline/history.h b/readline/history.h
index 8ecce726779..5210deb39a4 100644
--- a/readline/history.h
+++ b/readline/history.h
@@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _HISTORY_H_
#define _HISTORY_H_
@@ -119,7 +119,7 @@ extern int where_history __P((void));
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history __P((void));
+extern HIST_ENTRY *current_history __P((void));
/* Return the history entry which is logically at OFFSET in the history
array. OFFSET is relative to history_base. */
@@ -132,7 +132,7 @@ extern int history_total_bytes __P((void));
/* Moving around the history list. */
/* Set the position in the history list to POS. */
-int history_set_pos __P((int));
+extern int history_set_pos __P((int));
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry, return
@@ -187,7 +187,7 @@ extern int write_history __P((char *));
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */
-int append_history __P((int, char *));
+extern int append_history __P((int, char *));
/* Truncate the history file, leaving only the last NLINES lines. */
extern int history_truncate_file __P((char *, int));
diff --git a/readline/histsearch.c b/readline/histsearch.c
index 7e98e950acb..8d153b63edd 100644
--- a/readline/histsearch.c
+++ b/readline/histsearch.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@@ -47,9 +47,6 @@
#include "history.h"
#include "histlib.h"
-/* Variables imported from other history library files. */
-extern int history_offset;
-
/* The list of alternate characters that can delimit a history search
string. */
char *history_search_delimiter_chars = (char *)NULL;
diff --git a/readline/input.c b/readline/input.c
index 3b48483d262..64a55c6f90d 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -67,39 +67,15 @@ extern int errno;
/* Some standard library routines. */
#include "readline.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
-/* Functions imported from other files in the library. */
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-extern void _rl_vi_set_last ();
-extern int _rl_vi_textmod_command ();
-#endif /* VI_MODE */
-
-extern FILE *rl_instream, *rl_outstream;
-extern Function *rl_last_func;
-extern int rl_key_sequence_length;
-extern int rl_pending_input;
-extern int rl_editing_mode;
-
-extern Keymap _rl_keymap;
-
-extern int _rl_convert_meta_chars_to_ascii;
-
-#if defined (__GO32__)
-# include <pc.h>
-#endif /* __GO32__ */
-
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
Function *rl_event_hook = (Function *)NULL;
@@ -176,17 +152,6 @@ rl_unget_char (key)
static void
rl_gather_tyi ()
{
-#if defined (__GO32__)
- char input;
-
- if (isatty (0) && kbhit () && ibuffer_space ())
- {
- int i;
- i = (*rl_getc_function) (rl_instream);
- rl_stuff_char (i);
- }
-#else /* !__GO32__ */
-
int tty;
register int tem, result;
int chars_avail;
@@ -255,7 +220,6 @@ rl_gather_tyi ()
if (chars_avail)
rl_stuff_char (input);
}
-#endif /* !__GO32__ */
}
/* Is there input available to be read on the readline input file
@@ -394,14 +358,9 @@ int
rl_getc (stream)
FILE *stream;
{
- int result, flags;
+ int result;
unsigned char c;
-#if defined (__GO32__)
- if (isatty (0))
- return (getkey () & 0x7F);
-#endif /* __GO32__ */
-
while (1)
{
result = read (fileno (stream), &c, sizeof (unsigned char));
@@ -420,40 +379,31 @@ rl_getc (stream)
#endif
#if defined (EWOULDBLOCK)
- if (errno == EWOULDBLOCK)
+# define X_EWOULDBLOCK EWOULDBLOCK
+#else
+# define X_EWOULDBLOCK -99
+#endif
+
+#if defined (EAGAIN)
+# define X_EAGAIN EAGAIN
+#else
+# define X_EAGAIN -99
+#endif
+
+ if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
{
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
+ if (unset_nodelay_mode (fileno (stream)) < 0)
return (EOF);
- if (flags & O_NDELAY)
- {
- flags &= ~O_NDELAY;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
continue;
}
-#endif /* EWOULDBLOCK */
-#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
- if (errno == EAGAIN)
- {
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
- return (EOF);
- if (flags & O_NONBLOCK)
- {
- flags &= ~O_NONBLOCK;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
- }
-#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
+#undef X_EWOULDBLOCK
+#undef X_EAGAIN
-#if !defined (__GO32__)
/* If the error that we received was SIGINT, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
return (EOF);
-#endif /* !__GO32__ */
}
}
diff --git a/readline/isearch.c b/readline/isearch.c
index 67279e18924..952c10ddf8e 100644
--- a/readline/isearch.c
+++ b/readline/isearch.c
@@ -12,7 +12,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -23,7 +23,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -48,24 +48,17 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
/* Variables exported to other files in the readline library. */
unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
/* Variables imported from other files in the readline library. */
-extern Keymap _rl_keymap;
extern HIST_ENTRY *saved_line_for_history;
-extern int rl_line_buffer_len;
-extern int rl_point, rl_end;
-extern char *rl_line_buffer;
-
-extern int rl_execute_next ();
-extern void rl_extend_line_buffer ();
-
-extern int _rl_input_available ();
-
-extern char *xmalloc (), *xrealloc ();
-static int rl_search_history ();
+/* Forward declarations */
+static int rl_search_history __P((int, int));
/* Last line found by the current incremental search, so we don't `find'
identical lines many times in a row. */
diff --git a/readline/keymaps.c b/readline/keymaps.c
index c73666bf273..8fb7de3bc1f 100644
--- a/readline/keymaps.c
+++ b/readline/keymaps.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -30,18 +30,18 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+#include <stdio.h> /* for FILE * definition for readline.h */
+
+#include "readline.h"
#include "rlconf.h"
-#include "keymaps.h"
+
#include "emacs_keymap.c"
#if defined (VI_MODE)
#include "vi_keymap.c"
#endif
-extern int rl_do_lowercase_version ();
-extern int rl_rubout (), rl_insert ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
/* **************************************************************** */
/* */
diff --git a/readline/keymaps.h b/readline/keymaps.h
index 5dff46f56c2..3a504fb014f 100644
--- a/readline/keymaps.h
+++ b/readline/keymaps.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,11 +18,15 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
# include "chardefs.h"
@@ -97,4 +101,8 @@ extern Keymap rl_get_keymap __P((void));
/* Set the current keymap to MAP. */
extern void rl_set_keymap __P((Keymap));
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _KEYMAPS_H_ */
diff --git a/readline/kill.c b/readline/kill.c
index 0b4714fafa8..c3241bdadd0 100644
--- a/readline/kill.c
+++ b/readline/kill.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,17 +46,8 @@
#include "readline.h"
#include "history.h"
-extern int _rl_last_command_was_kill;
-extern int rl_editing_mode;
-extern int rl_explicit_arg;
-extern Function *rl_last_func;
-
-extern void _rl_init_argument ();
-extern int _rl_set_mark_at_pos ();
-extern void _rl_fix_point ();
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlprivate.h"
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -385,10 +376,12 @@ int
rl_kill_region (count, ignore)
int count, ignore;
{
- int r;
+ int r, npoint;
+ npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
_rl_fix_point (1);
+ rl_point = npoint;
return r;
}
@@ -503,7 +496,9 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
{
register HIST_ENTRY *entry;
char *arg;
- int i;
+ int i, pos;
+
+ pos = where_history ();
if (history_skip)
{
@@ -512,16 +507,10 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
}
entry = previous_history ();
- if (entry)
- {
- if (history_skip)
- {
- for (i = 0; i < history_skip; i++)
- next_history ();
- }
- next_history ();
- }
- else
+
+ history_set_pos (pos);
+
+ if (entry == 0)
{
ding ();
return -1;
diff --git a/readline/macro.c b/readline/macro.c
index f3c442b41c3..5a44852f46c 100644
--- a/readline/macro.c
+++ b/readline/macro.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,19 +46,10 @@
#include "readline.h"
#include "history.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
-/* Forward definitions. */
-void _rl_push_executing_macro (), _rl_pop_executing_macro ();
-void _rl_add_macro_char ();
-
-/* Extern declarations. */
-extern int rl_explicit_arg;
-extern int rl_key_sequence_length;
+#include "rlprivate.h"
+#include "xmalloc.h"
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
+#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* **************************************************************** */
/* */
diff --git a/readline/nls.c b/readline/nls.c
index f2d413d59d5..67bed8a6fa4 100644
--- a/readline/nls.c
+++ b/readline/nls.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -27,6 +27,8 @@
#include <sys/types.h>
+#include <stdio.h>
+
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -44,13 +46,9 @@
#include <ctype.h>
#include "rldefs.h"
-
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_meta_flag;
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
+#include "readline.h"
+#include "rlshell.h"
+#include "rlprivate.h"
#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
@@ -70,12 +68,11 @@ static char *legal_lang_values[] =
"iso88599",
"iso885910",
"koi8r",
- "koi8-r",
0
};
-static char *normalize_codeset ();
-static char *find_codeset ();
+static char *normalize_codeset __P((char *));
+static char *find_codeset __P((char *, size_t *));
#endif /* !HAVE_SETLOCALE */
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
diff --git a/readline/parens.c b/readline/parens.c
index a500c0afac7..b6de529f1a0 100644
--- a/readline/parens.c
+++ b/readline/parens.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,23 +18,11 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "rlconf.h"
-#if !defined (PAREN_MATCHING)
-extern int rl_insert ();
-
-int
-rl_insert_close (count, invoking_key)
- int count, invoking_key;
-{
- return (rl_insert (count, invoking_key));
-}
-
-#else /* PAREN_MATCHING */
-
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@@ -64,8 +52,9 @@ extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#include "readline.h"
+#include "rlprivate.h"
-extern int rl_explicit_arg;
+static int find_matching_open __P((char *, int, int));
/* Non-zero means try to blink the matching open parenthesis when the
close parenthesis is inserted. */
@@ -75,7 +64,25 @@ int rl_blink_matching_paren = 1;
int rl_blink_matching_paren = 0;
#endif /* !HAVE_SELECT */
-static int find_matching_open ();
+/* Change emacs_standard_keymap to have bindings for paren matching when
+ ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */
+void
+_rl_enable_paren_matching (on_or_off)
+ int on_or_off;
+{
+ if (on_or_off)
+ { /* ([{ */
+ rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap);
+ rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap);
+ rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap);
+ }
+ else
+ { /* ([{ */
+ rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap);
+ rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap);
+ rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap);
+ }
+}
int
rl_insert_close (count, invoking_key)
@@ -152,5 +159,3 @@ find_matching_open (string, from, closer)
}
return (i);
}
-
-#endif /* PAREN_MATCHING */
diff --git a/readline/posixdir.h b/readline/posixdir.h
index 7480a93d5db..98ced75b346 100644
--- a/readline/posixdir.h
+++ b/readline/posixdir.h
@@ -6,7 +6,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
diff --git a/readline/posixjmp.h b/readline/posixjmp.h
index 1347cc07ebc..b52aa00332b 100644
--- a/readline/posixjmp.h
+++ b/readline/posixjmp.h
@@ -1,5 +1,23 @@
/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bash; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
#ifndef _POSIXJMP_H_
#define _POSIXJMP_H_
diff --git a/readline/posixstat.h b/readline/posixstat.h
index bfce8c04fef..c93b52887e9 100644
--- a/readline/posixstat.h
+++ b/readline/posixstat.h
@@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* This file should be included instead of <sys/stat.h>.
It relies on the local sys/stat.h to work though. */
diff --git a/readline/readline.c b/readline/readline.c
index 622811fc11e..2c6aef68f48 100644
--- a/readline/readline.c
+++ b/readline/readline.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -47,7 +47,6 @@
# include <locale.h>
#endif
-#include <signal.h>
#include <stdio.h>
#include "posixjmp.h"
@@ -63,117 +62,27 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#ifndef RL_LIBRARY_VERSION
-# define RL_LIBRARY_VERSION "4.0"
+# define RL_LIBRARY_VERSION "4.1"
#endif
/* Evaluates its arguments multiple times. */
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-/* NOTE: Functions and variables prefixed with `_rl_' are
- pseudo-global: they are global so they can be shared
- between files in the readline library, but are not intended
- to be visible to readline callers. */
-
-/* Variables and functions imported from terminal.c */
-extern int _rl_init_terminal_io ();
-extern void _rl_enable_meta_key ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
-#else
-extern int _rl_output_character_function ();
-#endif
-
-extern int _rl_enable_meta;
-extern int _rl_term_autowrap;
-extern int screenwidth, screenheight, screenchars;
-
-/* Variables and functions imported from rltty.c. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-extern void rltty_set_default_bindings ();
-
-/* Functions imported from util.c. */
-extern void _rl_abort_internal ();
-extern void rl_extend_line_buffer ();
-extern int alphabetic ();
-
-/* Functions imported from bind.c. */
-extern void _rl_bind_if_unbound ();
-
-/* Functions imported from input.c. */
-extern int _rl_any_typein ();
-extern void _rl_insert_typein ();
-extern int rl_read_key ();
-
-/* Functions imported from nls.c */
-extern int _rl_init_eightbit ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-/* External redisplay functions and variables from display.c */
-extern void _rl_move_vert ();
-extern void _rl_update_final ();
-extern void _rl_clear_to_eol ();
-extern void _rl_clear_screen ();
-extern void _rl_erase_entire_line ();
-
-extern void _rl_erase_at_end_of_line ();
-extern void _rl_move_cursor_relative ();
-
-extern int _rl_vis_botlin;
-extern int _rl_last_c_pos;
-extern int _rl_horizontal_scroll_mode;
-extern int rl_display_fixed;
-extern int _rl_suppress_redisplay;
-extern char *rl_display_prompt;
-
-/* Variables imported from complete.c. */
-extern char *rl_completer_word_break_characters;
-extern char *rl_basic_word_break_characters;
-extern int rl_completion_query_items;
-extern int rl_complete_with_tilde_expansion;
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-/* Functions imported from vi_mode.c. */
-extern void _rl_vi_set_last ();
-extern void _rl_vi_reset_last ();
-extern void _rl_vi_done_inserting ();
-extern int _rl_vi_textmod_command ();
-extern void _rl_vi_initialize_line ();
-#endif /* VI_MODE */
-
-extern UNDO_LIST *rl_undo_list;
-extern int _rl_doing_an_undo;
-
/* Forward declarations used in this file. */
-void _rl_free_history_entry ();
+void _rl_free_history_entry __P((HIST_ENTRY *));
-int _rl_dispatch ();
-int _rl_init_argument ();
+static char *readline_internal __P((void));
+static void readline_initialize_everything __P((void));
+static void start_using_history __P((void));
+static void bind_arrow_keys __P((void));
+static int rl_change_case __P((int, int));
-static char *readline_internal ();
-static void readline_initialize_everything ();
-static void start_using_history ();
-static void bind_arrow_keys ();
-
-#if !defined (__GO32__)
-static void readline_default_bindings ();
-#endif /* !__GO32__ */
-
-#if defined (__GO32__)
-# include <go32.h>
-# include <pc.h>
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
-
-extern char *xmalloc (), *xrealloc ();
+static void readline_default_bindings __P((void));
/* **************************************************************** */
/* */
@@ -183,6 +92,8 @@ extern char *xmalloc (), *xrealloc ();
char *rl_library_version = RL_LIBRARY_VERSION;
+int rl_gnu_readline_p = 1;
+
/* A pointer to the keymap that is currently in use.
By default, it is the standard emacs keymap. */
Keymap _rl_keymap = emacs_standard_keymap;
@@ -245,6 +156,10 @@ int readline_echoing_p = 1;
char *rl_prompt;
int rl_visible_prompt_length = 0;
+/* Set to non-zero by calling application if it has already printed rl_prompt
+ and does not want readline to do it the first time. */
+int rl_already_prompted = 0;
+
/* The number of characters read in order to type this complete command. */
int rl_key_sequence_length = 0;
@@ -290,6 +205,10 @@ Keymap rl_executing_keymap;
/* Non-zero means to erase entire line, including prompt, on empty input lines. */
int rl_erase_empty_line = 0;
+/* Non-zero means to read only this many characters rather than up to a
+ character bound to accept-line. */
+int rl_num_chars_to_read;
+
/* Line buffer and maintenence. */
char *rl_line_buffer = (char *)NULL;
int rl_line_buffer_len = 0;
@@ -369,6 +288,8 @@ readline (prompt)
STATIC_CALLBACK void
readline_internal_setup ()
{
+ char *nprompt;
+
_rl_in_stream = rl_instream;
_rl_out_stream = rl_outstream;
@@ -377,15 +298,20 @@ readline_internal_setup ()
if (readline_echoing_p == 0)
{
- if (rl_prompt)
+ if (rl_prompt && rl_already_prompted == 0)
{
- fprintf (_rl_out_stream, "%s", rl_prompt);
+ nprompt = _rl_strip_prompt (rl_prompt);
+ fprintf (_rl_out_stream, "%s", nprompt);
fflush (_rl_out_stream);
+ free (nprompt);
}
}
else
{
- rl_on_new_line ();
+ if (rl_prompt && rl_already_prompted)
+ rl_on_new_line_with_prompt ();
+ else
+ rl_on_new_line ();
(*rl_redisplay_function) ();
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
@@ -477,7 +403,7 @@ readline_internal_charloop ()
}
lastc = c;
- _rl_dispatch (c, _rl_keymap);
+ _rl_dispatch ((unsigned char)c, _rl_keymap);
/* If there was no change in _rl_last_command_was_kill, then no kill
has taken place. Note that if input is pending we are reading
@@ -492,6 +418,12 @@ readline_internal_charloop ()
rl_vi_check ();
#endif /* VI_MODE */
+ if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
+ {
+ (*rl_redisplay_function) ();
+ rl_newline (1, '\n');
+ }
+
if (rl_done == 0)
(*rl_redisplay_function) ();
@@ -689,6 +621,7 @@ rl_initialize ()
return 0;
}
+#if 0
#if defined (__EMX__)
static void
_emx_build_environ ()
@@ -712,15 +645,18 @@ _emx_build_environ ()
*tp = 0;
}
#endif /* __EMX__ */
+#endif
/* Initialize the entire state of the world. */
static void
readline_initialize_everything ()
{
+#if 0
#if defined (__EMX__)
if (environ == 0)
_emx_build_environ ();
#endif
+#endif
/* Find out if we are running in Emacs. */
running_in_emacs = get_env_value ("EMACS") != (char *)0;
@@ -745,10 +681,8 @@ readline_initialize_everything ()
/* Initialize the terminal interface. */
_rl_init_terminal_io ((char *)NULL);
-#if !defined (__GO32__)
/* Bind tty characters to readline functions. */
readline_default_bindings ();
-#endif /* !__GO32__ */
/* Initialize the function names. */
rl_initialize_funmap ();
@@ -797,6 +731,17 @@ bind_arrow_keys_internal ()
{
Function *f;
+#if defined (__MSDOS__)
+ f = rl_function_of_keyseq ("\033[0A", _rl_keymap, (int *)NULL);
+ if (!f || f == rl_do_lowercase_version)
+ {
+ _rl_bind_if_unbound ("\033[0A", rl_get_previous_history);
+ _rl_bind_if_unbound ("\033[0B", rl_backward);
+ _rl_bind_if_unbound ("\033[0C", rl_forward);
+ _rl_bind_if_unbound ("\033[0D", rl_get_next_history);
+ }
+#endif
+
f = rl_function_of_keyseq ("\033[A", _rl_keymap, (int *)NULL);
if (!f || f == rl_do_lowercase_version)
{
@@ -1121,6 +1066,10 @@ rl_forward (count, key)
else
rl_point = end;
}
+
+ if (rl_end < 0)
+ rl_end = 0;
+
return 0;
}
@@ -1255,35 +1204,14 @@ int
rl_refresh_line (ignore1, ignore2)
int ignore1, ignore2;
{
- int curr_line, nleft;
+ int curr_line;
- /* Find out whether or not there might be invisible characters in the
- editing buffer. */
- if (rl_display_prompt == rl_prompt)
- nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
- else
- nleft = _rl_last_c_pos - screenwidth;
-
- if (nleft > 0)
- curr_line = 1 + nleft / screenwidth;
- else
- curr_line = 0;
+ curr_line = _rl_current_display_line ();
_rl_move_vert (curr_line);
_rl_move_cursor_relative (0, the_line); /* XXX is this right */
-#if defined (__GO32__)
- {
- int row, col, width, row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
- memset (row_start + col, 0, (width - col) * 2);
- }
-#else /* !__GO32__ */
_rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
-#endif /* !__GO32__ */
rl_forced_update_display ();
rl_display_fixed = 1;
@@ -1421,7 +1349,14 @@ rl_quoted_insert (count, key)
{
int c;
+#if defined (HANDLE_SIGNALS)
+ _rl_disable_tty_signals ();
+#endif
c = rl_read_key ();
+#if defined (HANDLE_SIGNALS)
+ _rl_restore_tty_signals ();
+#endif
+
return (rl_insert (count, c));
}
@@ -1615,8 +1550,6 @@ rl_insert_comment (count, key)
#define DownCase 2
#define CapCase 3
-static int rl_change_case ();
-
/* Uppercase the word at point. */
int
rl_upcase_word (count, key)
diff --git a/readline/readline.h b/readline/readline.h
index dba1a0fdde9..97c62fd1534 100644
--- a/readline/readline.h
+++ b/readline/readline.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_READLINE_H_)
#define _READLINE_H_
@@ -192,7 +192,7 @@ extern int rl_noninc_reverse_search __P((int, int));
extern int rl_noninc_forward_search_again __P((int, int));
extern int rl_noninc_reverse_search_again __P((int, int));
-/* Not available unless readline is compiled -DPAREN_MATCHING. */
+/* Bindable command used when inserting a matching close character. */
extern int rl_insert_close __P((int, int));
/* Not available unless READLINE_CALLBACKS is defined. */
@@ -331,11 +331,12 @@ extern int rl_modifying __P((int, int));
/* Functions for redisplay. */
extern void rl_redisplay __P((void));
extern int rl_on_new_line __P((void));
+extern int rl_on_new_line_with_prompt __P((void));
extern int rl_forced_update_display __P((void));
extern int rl_clear_message __P((void));
extern int rl_reset_line_state __P((void));
-#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
+#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...);
#else
extern int rl_message ();
@@ -405,6 +406,9 @@ extern char *filename_completion_function __P((char *, int));
/* The version of this incarnation of the readline library. */
extern char *rl_library_version;
+/* True if this is real GNU readline. */
+extern int rl_gnu_readline_p;
+
/* The name of the calling program. You should initialize this to
whatever was in argv[0]. It is used when parsing conditionals. */
extern char *rl_readline_name;
@@ -468,6 +472,15 @@ extern Keymap rl_binding_keymap;
rl_newline. */
extern int rl_erase_empty_line;
+/* If non-zero, the application has already printed the prompt (rl_prompt)
+ before calling readline, so readline should not output it the first time
+ redisplay is done. */
+extern int rl_already_prompted;
+
+/* A non-zero value means to read only this many characters rather than
+ up to a character bound to accept-line. */
+extern int rl_num_chars_to_read;
+
/* Variables to control readline signal handling. */
/* If non-zero, readline will install its own signal handlers for
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
@@ -611,7 +624,7 @@ extern int rl_inhibit_completion;
#define MULT_MATCH 2
#if !defined (savestring)
-extern char *savestring (); /* XXX backwards compatibility */
+extern char *savestring __P((char *)); /* XXX backwards compatibility */
#endif
#ifdef __cplusplus
diff --git a/readline/rlconf.h b/readline/rlconf.h
index 1356fd87924..d2ab7040125 100644
--- a/readline/rlconf.h
+++ b/readline/rlconf.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLCONF_H_)
#define _RLCONF_H_
@@ -30,10 +30,6 @@
/* Define this to get an indication of file type when listing completions. */
#define VISIBLE_STATS
-/* If defined, readline shows opening parens and braces when closing
- paren or brace entered. */
-/* #define PAREN_MATCHING */
-
/* This definition is needed by readline.c, rltty.c, and signals.c. */
/* If on, then readline handles signals in a way that doesn't screw. */
#define HANDLE_SIGNALS
diff --git a/readline/rldefs.h b/readline/rldefs.h
index d4aced43e2a..e504d9b1c30 100644
--- a/readline/rldefs.h
+++ b/readline/rldefs.h
@@ -10,7 +10,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -21,7 +21,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLDEFS_H_)
#define _RLDEFS_H_
@@ -122,7 +122,8 @@ extern char *xmalloc ();
#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n) (((n) == 0) ? (1) \
+ : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
#if !defined (FREE)
diff --git a/readline/rlstdc.h b/readline/rlstdc.h
index 08b0f89aa2e..dac8e986e10 100644
--- a/readline/rlstdc.h
+++ b/readline/rlstdc.h
@@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RL_STDC_H_)
#define _RL_STDC_H_
@@ -28,52 +28,12 @@
and traditional C compilers with something like this:
extern char *func __P((char *, char *, int)); */
-#if defined (__STDC__)
-
-# if !defined (__P)
+#if !defined (__P)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
# define __P(protos) protos
-# endif
-# define __STRING(x) #x
-
-# if !defined (__GNUC__)
-# define inline
-# endif
-
-#else /* !__STDC__ */
-
-# if !defined (__P)
+# else
# define __P(protos) ()
# endif
-# define __STRING(x) "x"
-
-#if defined (__GNUC__) /* gcc with -traditional */
-# if !defined (const)
-# define const __const
-# endif
-# if !defined (inline)
-# define inline __inline
-# endif
-# if !defined (signed)
-# define signed __signed
-# endif
-# if !defined (volatile)
-# define volatile __volatile
-# endif
-#else /* !__GNUC__ */
-# if !defined (const)
-# define const
-# endif
-# if !defined (inline)
-# define inline
-# endif
-# if !defined (signed)
-# define signed
-# endif
-# if !defined (volatile)
-# define volatile
-# endif
-#endif /* !__GNUC__ */
-
-#endif /* !__STDC__ */
+#endif
#endif /* !_RL_STDC_H_ */
diff --git a/readline/rltty.c b/readline/rltty.c
index a5ef938b5c0..b868b6970c2 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -43,26 +43,12 @@
#include "rltty.h"
#include "readline.h"
+#include "rlprivate.h"
#if !defined (errno)
extern int errno;
#endif /* !errno */
-extern int readline_echoing_p;
-extern int _rl_eof_char;
-
-extern int _rl_enable_keypad, _rl_enable_meta;
-
-extern void _rl_control_keypad ();
-
-#if defined (__GO32__)
-# include <pc.h>
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
-
-/* Indirect functions to allow apps control over terminal management. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-
VFunction *rl_prep_term_function = rl_prep_terminal;
VFunction *rl_deprep_term_function = rl_deprep_terminal;
@@ -104,6 +90,7 @@ block_sigint ()
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+
sigint_blocked = 1;
}
@@ -111,7 +98,7 @@ block_sigint ()
static void
release_sigint ()
{
- if (!sigint_blocked)
+ if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
@@ -138,25 +125,27 @@ release_sigint ()
/* Non-zero means that the terminal is in a prepped state. */
static int terminal_prepped;
+static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
+
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
and output is suspended. */
#if defined (__ksr1__)
static int ksrflow;
#endif
-#if defined (TIOCGWINSZ)
/* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. */
static void
set_winsize (tty)
int tty;
{
+#if defined (TIOCGWINSZ)
struct winsize w;
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
-}
#endif /* TIOCGWINSZ */
+}
#if defined (NEW_TTY_DRIVER)
@@ -184,6 +173,42 @@ struct bsdtty {
static TIOTYPE otio;
+static void
+save_tty_chars (tiop)
+ TIOTYPE *tiop;
+{
+ _rl_last_tty_chars = _rl_tty_chars;
+
+ if (tiop->flags & SGTTY_SET)
+ {
+ _rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
+ _rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
+ }
+
+ if (tiop->flags & TCHARS_SET)
+ {
+ _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
+ _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
+ _rl_tty_chars.t_start = tiop->tchars.t_startc;
+ _rl_tty_chars.t_stop = tiop->tchars.t_stopc
+ _rl_tty_chars.t_eof = tiop->tchars.t_eofc;
+ _rl_tty_chars.t_eol = '\n';
+ _rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
+ }
+
+ if (tiop->flags & LTCHARS_SET)
+ {
+ _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
+ _rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
+ _rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
+ _rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
+ _rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
+ _rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
+ }
+
+ _rl_tty_chars.t_status = -1;
+}
+
static int
get_tty_settings (tty, tiop)
int tty;
@@ -258,7 +283,6 @@ prepare_terminal_settings (meta_flag, otio, tiop)
int meta_flag;
TIOTYPE otio, *tiop;
{
-#if !defined (__GO32__)
readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
/* Copy the original settings to the structure we're going to use for
@@ -324,7 +348,6 @@ prepare_terminal_settings (meta_flag, otio, tiop)
tiop->ltchars.t_dsuspc = -1; /* C-y */
tiop->ltchars.t_lnextc = -1; /* C-v */
#endif /* TIOCGLTC */
-#endif /* !__GO32__ */
}
#else /* !defined (NEW_TTY_DRIVER) */
@@ -362,11 +385,58 @@ static TIOTYPE otio;
#endif
static void
+save_tty_chars (tiop)
+ TIOTYPE *tiop;
+{
+ _rl_last_tty_chars = _rl_tty_chars;
+
+ _rl_tty_chars.t_eof = tiop->c_cc[VEOF];
+ _rl_tty_chars.t_eol = tiop->c_cc[VEOL];
+#ifdef VEOL2
+ _rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
+#endif
+ _rl_tty_chars.t_erase = tiop->c_cc[VERASE];
+#ifdef VWERASE
+ _rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
+#endif
+ _rl_tty_chars.t_kill = tiop->c_cc[VKILL];
+#ifdef VREPRINT
+ _rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
+#endif
+ _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
+ _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
+#ifdef VSUSP
+ _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
+#endif
+#ifdef VDSUSP
+ _rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
+#endif
+#ifdef VSTART
+ _rl_tty_chars.t_start = tiop->c_cc[VSTART];
+#endif
+#ifdef VSTOP
+ _rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
+#endif
+#ifdef VLNEXT
+ _rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
+#endif
+#ifdef VDISCARD
+ _rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
+#endif
+#ifdef VSTATUS
+ _rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
+#endif
+}
+
+#if defined (_AIX) || defined (_AIX41)
+/* Currently this is only used on AIX */
+static void
rltty_warning (msg)
char *msg;
{
fprintf (stderr, "readline: warning: %s\n", msg);
}
+#endif
#if defined (_AIX)
void
@@ -382,14 +452,12 @@ TIOTYPE *tp;
#endif
static int
-get_tty_settings (tty, tiop)
+_get_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
int ioctl_ret;
- set_winsize (tty);
-
while (1)
{
ioctl_ret = GETATTR (tty, tiop);
@@ -413,6 +481,19 @@ get_tty_settings (tty, tiop)
break;
}
+ return 0;
+}
+
+static int
+get_tty_settings (tty, tiop)
+ int tty;
+ TIOTYPE *tiop;
+{
+ set_winsize (tty);
+
+ if (_get_tty_settings (tty, tiop) < 0)
+ return -1;
+
#if defined (_AIX)
setopost(tiop);
#endif
@@ -421,7 +502,7 @@ get_tty_settings (tty, tiop)
}
static int
-set_tty_settings (tty, tiop)
+_set_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
@@ -431,7 +512,17 @@ set_tty_settings (tty, tiop)
return -1;
errno = 0;
}
+ return 0;
+}
+static int
+set_tty_settings (tty, tiop)
+ int tty;
+ TIOTYPE *tiop;
+{
+ if (_set_tty_settings (tty, tiop) < 0)
+ return -1;
+
#if 0
#if defined (TERMIOS_TTY_DRIVER)
@@ -448,7 +539,7 @@ set_tty_settings (tty, tiop)
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
#endif /* !TERMIOS_TTY_DRIVER */
-#endif
+#endif /* 0 */
return 0;
}
@@ -520,7 +611,6 @@ void
rl_prep_terminal (meta_flag)
int meta_flag;
{
-#if !defined (__GO32__)
int tty;
TIOTYPE tio;
@@ -540,6 +630,8 @@ rl_prep_terminal (meta_flag)
otio = tio;
+ save_tty_chars (&otio);
+
prepare_terminal_settings (meta_flag, otio, &tio);
if (set_tty_settings (tty, &tio) < 0)
@@ -555,14 +647,12 @@ rl_prep_terminal (meta_flag)
terminal_prepped = 1;
release_sigint ();
-#endif /* !__GO32__ */
}
/* Restore the terminal's normal settings and modes. */
void
rl_deprep_terminal ()
{
-#if !defined (__GO32__)
int tty;
if (!terminal_prepped)
@@ -587,7 +677,6 @@ rl_deprep_terminal ()
terminal_prepped = 0;
release_sigint ();
-#endif /* !__GO32__ */
}
/* **************************************************************** */
@@ -725,3 +814,54 @@ rltty_set_default_bindings (kmap)
}
#endif /* !NEW_TTY_DRIVER */
}
+
+#if defined (HANDLE_SIGNALS)
+
+#if defined (NEW_TTY_DRIVER)
+int
+_rl_disable_tty_signals ()
+{
+ return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+ return 0;
+}
+#else
+
+static TIOTYPE sigstty, nosigstty;
+static int tty_sigs_disabled = 0;
+
+int
+_rl_disable_tty_signals ()
+{
+ if (tty_sigs_disabled)
+ return 0;
+
+ if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
+ return -1;
+
+ nosigstty = sigstty;
+
+ nosigstty.c_lflag &= ~ISIG;
+
+ if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
+ return (_set_tty_settings (fileno (rl_instream), &sigstty));
+
+ tty_sigs_disabled = 1;
+ return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+ if (tty_sigs_disabled == 0)
+ return 0;
+
+ return (_set_tty_settings (fileno (rl_instream), &sigstty));
+}
+#endif /* !NEW_TTY_DRIVER */
+
+#endif /* HANDLE_SIGNALS */
diff --git a/readline/rltty.h b/readline/rltty.h
index fe783463f6a..029a3fbc0e1 100644
--- a/readline/rltty.h
+++ b/readline/rltty.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,10 +19,10 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLTTY_H_)
-#define _RLTTY_H
+#define _RLTTY_H_
/* Posix systems use termios and the Posix signal functions. */
#if defined (TERMIOS_TTY_DRIVER)
@@ -60,4 +60,23 @@
# endif /* !_SVR4_DISABLE */
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
+typedef struct _rl_tty_chars {
+ char t_eof;
+ char t_eol;
+ char t_eol2;
+ char t_erase;
+ char t_werase;
+ char t_kill;
+ char t_reprint;
+ char t_intr;
+ char t_quit;
+ char t_susp;
+ char t_dsusp;
+ char t_start;
+ char t_stop;
+ char t_lnext;
+ char t_flush;
+ char t_status;
+} _RL_TTY_CHARS;
+
#endif /* _RLTTY_H_ */
diff --git a/readline/rlwinsize.h b/readline/rlwinsize.h
index 92b3de174bf..7838154d023 100644
--- a/readline/rlwinsize.h
+++ b/readline/rlwinsize.h
@@ -9,7 +9,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -20,7 +20,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLWINSIZE_H_)
#define _RLWINSIZE_H_
@@ -55,4 +55,3 @@
#endif /* _RL_WINSIZE_H */
-
diff --git a/readline/savestring.c b/readline/savestring.c
index 3f53a87bcd1..485890ea57c 100644
--- a/readline/savestring.c
+++ b/readline/savestring.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
extern char *strcpy ();
extern char *xmalloc ();
diff --git a/readline/search.c b/readline/search.c
index 6c76e1a1c96..112f8072866 100644
--- a/readline/search.c
+++ b/readline/search.c
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -43,30 +43,51 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
#ifdef abs
# undef abs
#endif
#define abs(x) (((x) >= 0) ? (x) : -(x))
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_line_buffer_len;
-extern int rl_editing_mode;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
extern HIST_ENTRY *saved_line_for_history;
-extern Function *rl_last_func;
/* Functions imported from the rest of the library. */
-extern int _rl_free_history_entry ();
-extern char *_rl_make_prompt_for_search ();
-extern void rl_extend_line_buffer ();
+extern int _rl_free_history_entry __P((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
+
static char *prev_line_found = (char *) NULL;
+static int rl_history_search_len;
+static int rl_history_search_pos;
+static char *history_search_string;
+static int history_string_size;
+
+/* Make the data from the history entry ENTRY be the contents of the
+ current line. This doesn't do anything with rl_point; the caller
+ must set it. */
+static void
+make_history_line_current (entry)
+ HIST_ENTRY *entry;
+{
+ int line_len;
+
+ line_len = strlen (entry->line);
+ if (line_len >= rl_line_buffer_len)
+ rl_extend_line_buffer (line_len);
+ strcpy (rl_line_buffer, entry->line);
+
+ rl_undo_list = (UNDO_LIST *)entry->data;
+ rl_end = line_len;
+
+ if (saved_line_for_history)
+ _rl_free_history_entry (saved_line_for_history);
+ saved_line_for_history = (HIST_ENTRY *)NULL;
+}
+
/* Search the history list for STRING starting at absolute history position
POS. If STRING begins with `^', the search must match STRING at the
beginning of a history line, otherwise a full substring match is performed
@@ -102,7 +123,7 @@ noninc_dosearch (string, dir)
char *string;
int dir;
{
- int oldpos, pos, line_len;
+ int oldpos, pos;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
@@ -132,19 +153,10 @@ noninc_dosearch (string, dir)
#endif
history_set_pos (oldpos);
- line_len = strlen (entry->line);
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
- strcpy (rl_line_buffer, entry->line);
+ make_history_line_current (entry);
- rl_undo_list = (UNDO_LIST *)entry->data;
- rl_end = strlen (rl_line_buffer);
rl_point = 0;
rl_clear_message ();
-
- if (saved_line_for_history)
- _rl_free_history_entry (saved_line_for_history);
- saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Search non-interactively through the history list. DIR < 0 means to
@@ -235,8 +247,7 @@ noninc_search (dir, pchar)
{
/* We want to start the search from the current history position. */
noninc_history_pos = where_history ();
- if (noninc_search_string)
- free (noninc_search_string);
+ FREE (noninc_search_string);
noninc_search_string = savestring (rl_line_buffer);
}
@@ -295,59 +306,84 @@ rl_noninc_reverse_search_again (count, key)
}
static int
-rl_history_search_internal (count, direction)
- int count, direction;
+rl_history_search_internal (count, dir)
+ int count, dir;
{
- HIST_ENTRY *temp, *old_temp;
- int line_len;
+ HIST_ENTRY *temp;
+ int ret, oldpos;
maybe_save_line ();
+ temp = (HIST_ENTRY *)NULL;
- temp = old_temp = (HIST_ENTRY *)NULL;
+ /* Search COUNT times through the history for a line whose prefix
+ matches history_search_string. When this loop finishes, TEMP,
+ if non-null, is the history line to copy into the line buffer. */
while (count)
{
- temp = (direction < 0) ? previous_history () : next_history ();
- if (temp == 0)
- break;
- /* On an empty prefix, make this the same as previous-history. */
- if (rl_point == 0)
- {
- count--;
- continue;
- }
- if (STREQN (rl_line_buffer, temp->line, rl_point))
- {
- /* Don't find multiple instances of the same line. */
- if (prev_line_found && STREQ (prev_line_found, temp->line))
- continue;
- if (direction < 0)
- old_temp = temp;
- prev_line_found = temp->line;
- count--;
- }
+ ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
+ if (ret == -1)
+ break;
+
+ /* Get the history entry we found. */
+ rl_history_search_pos = ret;
+ oldpos = where_history ();
+ history_set_pos (rl_history_search_pos);
+ temp = current_history ();
+ history_set_pos (oldpos);
+
+ /* Don't find multiple instances of the same line. */
+ if (prev_line_found && STREQ (prev_line_found, temp->line))
+ continue;
+ prev_line_found = temp->line;
+ count--;
}
+ /* If we didn't find anything at all, return. */
if (temp == 0)
{
- if (direction < 0 && old_temp)
- temp = old_temp;
- else
- {
- maybe_unsave_line ();
- ding ();
- return 1;
- }
+ maybe_unsave_line ();
+ ding ();
+ /* If you don't want the saved history line (last match) to show up
+ in the line buffer after the search fails, change the #if 0 to
+ #if 1 */
+#if 0
+ if (rl_point > rl_history_search_len)
+ {
+ rl_point = rl_end = rl_history_search_len;
+ rl_line_buffer[rl_end] = '\0';
+ }
+#else
+ rl_point = rl_history_search_len; /* maybe_unsave_line changes it */
+#endif
+ return 1;
}
- line_len = strlen (temp->line);
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
- strcpy (rl_line_buffer, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = line_len;
+ /* Copy the line we found into the current line buffer. */
+ make_history_line_current (temp);
+
+ rl_point = rl_history_search_len;
return 0;
}
+static void
+rl_history_search_reinit ()
+{
+ rl_history_search_pos = where_history ();
+ rl_history_search_len = rl_point;
+ prev_line_found = (char *)NULL;
+ if (rl_point)
+ {
+ if (rl_history_search_len >= history_string_size - 2)
+ {
+ history_string_size = rl_history_search_len + 2;
+ history_search_string = xrealloc (history_search_string, history_string_size);
+ }
+ history_search_string[0] = '^';
+ strncpy (history_search_string + 1, rl_line_buffer, rl_point);
+ history_search_string[rl_point + 1] = '\0';
+ }
+}
+
/* Search forward in the history for the string of characters
from the start of the line to rl_point. This is a non-incremental
search. */
@@ -357,8 +393,13 @@ rl_history_search_forward (count, ignore)
{
if (count == 0)
return (0);
- if (rl_last_func != rl_history_search_forward)
- prev_line_found = (char *)NULL;
+
+ if (rl_last_func != rl_history_search_forward &&
+ rl_last_func != rl_history_search_backward)
+ rl_history_search_reinit ();
+
+ if (rl_history_search_len == 0)
+ return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
@@ -371,7 +412,12 @@ rl_history_search_backward (count, ignore)
{
if (count == 0)
return (0);
- if (rl_last_func != rl_history_search_backward)
- prev_line_found = (char *)NULL;
+
+ if (rl_last_func != rl_history_search_forward &&
+ rl_last_func != rl_history_search_backward)
+ rl_history_search_reinit ();
+
+ if (rl_history_search_len == 0)
+ return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}
diff --git a/readline/shell.c b/readline/shell.c
index 091ec08f645..3daef69b4c2 100644
--- a/readline/shell.c
+++ b/readline/shell.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -44,13 +44,21 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
+#include <fcntl.h>
#include <pwd.h>
+#include <stdio.h>
+
+#include "rlshell.h"
+#include "xmalloc.h"
+
#if !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid ();
#endif /* !HAVE_GETPW_DECLS */
-extern char *xmalloc ();
+#ifndef NULL
+# define NULL 0
+#endif
/* All of these functions are resolved from bash if we are linking readline
as part of bash. */
@@ -63,7 +71,7 @@ single_quote (string)
register int c;
char *result, *r, *s;
- result = (char *)xmalloc (3 + (3 * strlen (string)));
+ result = (char *)xmalloc (3 + (4 * strlen (string)));
r = result;
*r++ = '\'';
@@ -131,3 +139,37 @@ get_home_dir ()
home_dir = entry->pw_dir;
return (home_dir);
}
+
+#if !defined (O_NDELAY)
+# if defined (FNDELAY)
+# define O_NDELAY FNDELAY
+# endif
+#endif
+
+int
+unset_nodelay_mode (fd)
+ int fd;
+{
+ int flags, bflags;
+
+ if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
+ return -1;
+
+ bflags = 0;
+
+#ifdef O_NONBLOCK
+ bflags |= O_NONBLOCK;
+#endif
+
+#ifdef O_NDELAY
+ bflags |= O_NDELAY;
+#endif
+
+ if (flags & bflags)
+ {
+ flags &= ~bflags;
+ return (fcntl (fd, F_SETFL, flags));
+ }
+
+ return 0;
+}
diff --git a/readline/shlib/Makefile.in b/readline/shlib/Makefile.in
index bff52f7d9bf..b1f70dee09a 100644
--- a/readline/shlib/Makefile.in
+++ b/readline/shlib/Makefile.in
@@ -15,7 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
RL_LIBRARY_VERSION = @LIBVERSION@
RL_LIBRARY_NAME = readline
@@ -75,9 +76,9 @@ SHLIB_LIBVERSION = @SHLIB_LIBVERSION@
SHLIB_STATUS = @SHLIB_STATUS@
# shared library versioning
-SHLIB_MAJOR= 4
+SHLIB_MAJOR= @SHLIB_MAJOR@
# shared library systems like SVR4's do not use minor versions
-SHLIB_MINOR= .0
+SHLIB_MINOR= .@SHLIB_MINOR@
# For libraries which include headers from other libraries.
INCLUDES = -I. -I.. -I$(topdir) -I$(includedir)
@@ -112,7 +113,7 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
- ansi_stdlib.h tcap.h
+ ansi_stdlib.h tcap.h xmalloc.h rlprivate.h rlshell.h
SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
SHARED_TILDEOBJ = tilde.so
@@ -131,7 +132,7 @@ unsupported:
@echo "Your system and compiler (${host_os}-${CC}) are not supported by the"
@echo "${topdir}/support/shobj-conf script."
@echo "If your operating system provides facilities for creating"
- @echo "shared libraries, please update the script and re-run configure.
+ @echo "shared libraries, please update the script and re-run configure."
@echo "Please send the changes you made to bash-maintainers@gnu.org"
@echo "for inclusion in future bash and readline releases."
@@ -222,6 +223,8 @@ macro.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
macro.so: $(topdir)/tilde.h $(topdir)/history.h
nls.so: $(topdir)/ansi_stdlib.h
nls.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
+nls.o: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
+nls.o: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rlstdc.h
parens.so: $(topdir)/rlconf.h ${BUILD_DIR}/config.h
parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
parens.so: $(topdir)/tilde.h
@@ -257,6 +260,54 @@ vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h
xmalloc.so: ${BUILD_DIR}/config.h
xmalloc.so: $(topdir)/ansi_stdlib.h
+bind.so: $(topdir)/rlshell.h
+histfile.so: $(topdir)/rlshell.h
+nls.so: $(topdir)/rlshell.h
+readline.so: $(topdir)/rlshell.h
+shell.so: $(topdir)/rlshell.h
+terminal.so: $(topdir)/rlshell.h
+histexpand.so: $(topdir)/rlshell.h
+
+bind.so: $(topdir)/rlprivate.h
+callback.so: $(topdir)/rlprivate.h
+complete.so: $(topdir)/rlprivate.h
+display.so: $(topdir)/rlprivate.h
+input.so: $(topdir)/rlprivate.h
+isearch.so: $(topdir)/rlprivate.h
+kill.so: $(topdir)/rlprivate.h
+macro.so: $(topdir)/rlprivate.h
+nls.so: $(topdir)/rlprivate.h
+parens.so: $(topdir)/rlprivate.h
+readline.so: $(topdir)/rlprivate.h
+rltty.so: $(topdir)/rlprivate.h
+search.so: $(topdir)/rlprivate.h
+signals.so: $(topdir)/rlprivate.h
+terminal.so: $(topdir)/rlprivate.h
+undo.so: $(topdir)/rlprivate.h
+util.so: $(topdir)/rlprivate.h
+vi_mode.so: $(topdir)/rlprivate.h
+
+bind.so: $(topdir)/xmalloc.h
+complete.so: $(topdir)/xmalloc.h
+display.so: $(topdir)/xmalloc.h
+funmap.so: $(topdir)/xmalloc.h
+histexpand.so: $(topdir)/xmalloc.h
+histfile.so: $(topdir)/xmalloc.h
+history.so: $(topdir)/xmalloc.h
+input.so: $(topdir)/xmalloc.h
+isearch.so: $(topdir)/xmalloc.h
+keymaps.so: $(topdir)/xmalloc.h
+kill.so: $(topdir)/xmalloc.h
+macro.so: $(topdir)/xmalloc.h
+readline.so: $(topdir)/xmalloc.h
+savestring.so: $(topdir)/xmalloc.h
+search.so: $(topdir)/xmalloc.h
+shell.so: $(topdir)/xmalloc.h
+tilde.so: $(topdir)/xmalloc.h
+tilde.so: $(topdir)/xmalloc.h
+util.so: $(topdir)/xmalloc.h
+vi_mode.so: $(topdir)/xmalloc.h
+
readline.so: $(topdir)/readline.c
vi_mode.so: $(topdir)/vi_mode.c
funmap.so: $(topdir)/funmap.c
diff --git a/readline/signals.c b/readline/signals.c
index 3a34432f143..861019d3363 100644
--- a/readline/signals.c
+++ b/readline/signals.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -40,15 +40,13 @@
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
-#if defined (__GO32__)
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
-
#if defined (HANDLE_SIGNALS)
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
@@ -67,19 +65,15 @@
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef RETSIGTYPE SigHandler ();
-extern int readline_echoing_p;
-extern int rl_pending_input;
-extern int _rl_meta_flag;
-
-extern void free_undo_list ();
-extern void _rl_get_screen_size ();
-extern void _rl_redisplay_after_sigwinch ();
-extern void _rl_clean_up_for_exit ();
-extern void _rl_kill_kbd_macro ();
-extern void _rl_init_argument ();
-extern void rl_deprep_terminal (), rl_prep_terminal ();
+#if defined (HAVE_POSIX_SIGNALS)
+typedef struct sigaction sighandler_cxt;
+# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
+#else
+typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
+# define sigemptyset(m)
+#endif /* !HAVE_POSIX_SIGNALS */
-static SigHandler *rl_set_sighandler ();
+static SigHandler *rl_set_sighandler __P((int, SigHandler *, sighandler_cxt *));
/* Exported variables for use by applications. */
@@ -101,14 +95,6 @@ static int sigwinch_set_flag;
/* */
/* **************************************************************** */
-#if defined (HAVE_POSIX_SIGNALS)
-typedef struct sigaction sighandler_cxt;
-# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
-#else
-typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
-# define sigemptyset(m)
-#endif /* !HAVE_POSIX_SIGNALS */
-
static sighandler_cxt old_int, old_term, old_alrm, old_quit;
#if defined (SIGTSTP)
static sighandler_cxt old_tstp, old_ttou, old_ttin;
@@ -165,6 +151,10 @@ rl_signal_handler (sig)
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#if defined (__EMX__)
+ signal (sig, SIG_ACK);
+#endif
+
kill (getpid (), sig);
/* Let the signal that we just sent through. */
@@ -232,6 +222,7 @@ rl_set_sighandler (sig, handler, ohandler)
SigHandler *handler;
sighandler_cxt *ohandler;
{
+ sighandler_cxt old_handler;
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
@@ -239,10 +230,17 @@ rl_set_sighandler (sig, handler, ohandler)
act.sa_flags = 0;
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
- sigaction (sig, &act, ohandler);
+ sigaction (sig, &act, &old_handler);
#else
- ohandler->sa_handler = (SigHandler *)signal (sig, handler);
+ old_handler.sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
+
+ /* XXX -- assume we have memcpy */
+ /* If rl_set_signals is called twice in a row, don't set the old handler to
+ rl_signal_handler, because that would cause infinite recursion. */
+ if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
+ memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
+
return (ohandler->sa_handler);
}
diff --git a/readline/support/config.guess b/readline/support/config.guess
index 66a24282a47..ad5983e7618 100755
--- a/readline/support/config.guess
+++ b/readline/support/config.guess
@@ -35,6 +35,19 @@
# (but try to keep the structure clean).
#
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+ if test x"$HOST_CC" != x; then
+ CC_FOR_BUILD="$HOST_CC"
+ else
+ if test x"$CC" != x; then
+ CC_FOR_BUILD="$CC"
+ else
+ CC_FOR_BUILD=cc
+ fi
+ fi
+fi
+
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@@ -57,7 +70,8 @@ esac
REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
-trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
# is contrary to all other versions of uname
@@ -81,9 +95,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
i?86:OpenBSD:*:*)
echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
- i?86:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
sparc:NetBSD:*:*)
echo sparc-unknown-netbsd${UNAME_RELEASE}
exit 0 ;;
@@ -151,17 +162,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:QNX:*:42*)
echo i386-qssl-qnx`echo ${UNAME_VERSION}`
exit 0 ;;
- BeBox:BeOS:*:*)
- echo powerpc-be-beos
- exit 0 ;;
- BeMac:BeOS:*:*)
- echo powerpc-apple-beos
- exit 0 ;;
- BePC:BeOS:*:*)
- echo i586-pc-beos
+ Alpha*:Windows:NT:*:SP*)
+ echo alpha-pc-opennt
exit 0 ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
+ *:Windows:NT:*:SP*)
+ echo intel-pc-opennt
exit 0 ;;
# end cases added for Bash
alpha:OSF1:*:*)
@@ -172,7 +177,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- cat <<EOF >dummy.s
+ cat <<EOF >$dummy.s
.globl main
.ent main
main:
@@ -189,9 +194,9 @@ main:
ret \$31,(\$26),1
.end main
EOF
- ${CC-cc} dummy.s -o dummy 2>/dev/null
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
- ./dummy
+ ./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
@@ -210,9 +215,15 @@ EOF
;;
esac
fi
- rm -f dummy.s dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
- exit 0 ;;
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
@@ -255,7 +266,7 @@ EOF
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
@@ -263,9 +274,12 @@ EOF
echo pyramid-pyramid-bsd
fi
exit 0 ;;
- NILE:*:*:dcosx)
+ NILE:*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -287,7 +301,7 @@ EOF
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
- sun3*:SunOS:*:*|sun:SunOS:*:*)
+ sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
@@ -309,19 +323,45 @@ EOF
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
- echo m68k-atari-openbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
- echo m68k-sun-openbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
- echo m68k-apple-openbsd${UNAME_RELEASE}
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
@@ -329,15 +369,15 @@ EOF
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- Power?Macintosh:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-unknown-rhapsody${UNAME_RELEASE}
- exit 0 ;;
+ *:"Mac OS":*:*)
+ echo `uname -p`-apple-macos${UNAME_RELEASE}
+ exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
@@ -347,12 +387,16 @@ EOF
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
- 2020:CLIX:*:*)
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@@ -367,10 +411,10 @@ EOF
exit (-1);
}
EOF
- ${CC-cc} dummy.c -o dummy \
- && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@@ -389,13 +433,14 @@ EOF
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
- else
+ else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
@@ -422,7 +467,7 @@ EOF
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- sed 's/^ //' << EOF >dummy.c
+ sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
@@ -433,8 +478,8 @@ EOF
exit(0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@@ -443,7 +488,8 @@ EOF
fi
exit 0 ;;
*:AIX:*:4)
- if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
@@ -484,17 +530,46 @@ EOF
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/78? | 9000/80[24] | 9000/8[67]1 | 9000/8[78]9 | 9000/893 )
- HP_ARCH=hppa2.0 ;;
- 9000/7?? | 9000/8?[13679] | 9000/892 )
- HP_ARCH=hppa1.1 ;;
- 9000/[68]?? ) HP_ARCH=hppa1.0 ;;
+ 9000/[678][0-9][0-9])
+ sed 's/^ //' << EOF >$dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >dummy.c
+ sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
@@ -519,8 +594,8 @@ EOF
exit (0);
}
EOF
- ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -529,6 +604,9 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
+ *9??*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
@@ -537,14 +615,17 @@ EOF
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-pc-osf1mk
+ echo ${UNAME_MACHINE}-unknown-osf1mk
else
- echo ${UNAME_MACHINE}-pc-osf1
+ echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
@@ -577,11 +658,14 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE}
+ exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
@@ -591,14 +675,26 @@ EOF
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
- hp3[0-9][05]:OpenBSD:*:*)
- echo m68k-hp-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
*:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ if test -x /usr/bin/objformat; then
+ if test "elf" = "`/usr/bin/objformat`"; then
+ echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0
+ fi
+ fi
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
@@ -607,14 +703,23 @@ EOF
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
- echo i386-pc-cygwin32
+ echo ${UNAME_MACHINE}-pc-cygwin32
exit 0 ;;
i*:MINGW*:*)
- echo i386-pc-mingw32
+ echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
- exit 0 ;;
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@@ -622,9 +727,17 @@ EOF
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
+ # uname on the ARM produces all sorts of strangeness, and we need to
+ # filter it out.
+ case "$UNAME_MACHINE" in
+ armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
+ arm* | sa110*) UNAME_MACHINE="arm" ;;
+ esac
+
# The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_help_string=`cd /; ld --help 2>&1`
ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g
@@ -632,15 +745,46 @@ EOF
s/ .*//
p'`
case "$ld_supported_emulations" in
+ *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;;
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
- esac
+ elf32ppc | elf32ppclinux)
+ # Determine Lib Version
+ cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#if defined(__GLIBC__)
+ printf("%s %s\n", __libc_version, __libc_release);
+#else
+ printf("unkown\n");
+#endif
+ return 0;
+}
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy | grep 1\.99 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.c $dummy
+ echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
+ esac
if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >dummy.s
+ sed 's/^ //' <<EOF >$dummy.s
.globl main
.ent main
main:
@@ -658,9 +802,9 @@ EOF
.end main
EOF
LIBC=""
- ${CC-cc} dummy.s -o dummy 2>/dev/null
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
- ./dummy
+ ./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
@@ -679,20 +823,21 @@ EOF
;;
esac
- objdump --private-headers dummy | \
+ objdump --private-headers $dummy | \
grep ld.so.1 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
- rm -f dummy.s dummy
+ rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >dummy.c <<EOF
-main(argc, argv)
- int argc;
- char *argv[];
-{
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+int main (int argc, char *argv[]) {
+#else
+int main (argc, argv) int argc; char *argv[]; {
+#endif
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
@@ -702,8 +847,8 @@ main(argc, argv)
return 0;
}
EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
@@ -722,12 +867,13 @@ EOF
;;
esac
# Determine whether the default compiler is a.out or elf
- cat >dummy.c <<EOF
+ cat >$dummy.c <<EOF
#include <features.h>
-main(argc, argv)
- int argc;
- char *argv[];
-{
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
@@ -744,8 +890,8 @@ main(argc, argv)
return 0;
}
EOF
- ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
- rm -f dummy.c dummy
+ ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
@@ -754,9 +900,9 @@ EOF
exit 0 ;;
# added by chet for bash based on usenet posting from <hops@sco.com> and
# documentation on SCO's web site -- UnixWare 7 (SVR5)
- i?86:UnixWare:5*:*)
- echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
- exit 0 ;;
+# i?86:UnixWare:5*:*)
+# echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
+# exit 0 ;;
i?86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
@@ -772,6 +918,14 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
+ i?86:*:5:7*)
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
+ exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -781,6 +935,10 @@ EOF
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
@@ -827,7 +985,7 @@ EOF
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
- i?86:LynxOS:2.*:*)
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
echo i386-pc-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
@@ -872,23 +1030,40 @@ EOF
news*:NEWS-OS:*:6*)
echo mips-sony-newsos6
exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*)
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*)
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-cat >dummy.c <<EOF
+cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
@@ -930,7 +1105,10 @@ main ()
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
@@ -1097,8 +1275,8 @@ main ()
}
EOF
-${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
-rm -f dummy.c dummy
+${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
diff --git a/readline/support/config.sub b/readline/support/config.sub
index c1ec2df8f0b..7d0c026d9bd 100755
--- a/readline/support/config.sub
+++ b/readline/support/config.sub
@@ -98,6 +98,16 @@ case $os in
os=
basic_machine=$1
;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=vxworks
+ basic_machine=$1
+ ;;
-hiux*)
os=-hiuxwe2
;;
@@ -121,6 +131,9 @@ case $os in
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -149,19 +162,27 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
- | arme[lb] | pyramid \
- | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
- | hppa2.0 | alpha | we32k | ns16k | clipper | i370 | sh \
- | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
- | pdp11 | mips64el | mips64orion | mips64orionel \
- | sparc | sparclet | sparclite | sparc64)
+ tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+ | 580 | i960 | h8300 \
+ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+ | mips64orion | mips64orionel | mipstx39 | mipstx39el \
+ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+ | mips64vr5000 | miprs64vr5000el | mcore \
+ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
+ | thumb | d10v)
basic_machine=$basic_machine-unknown
;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
+ ;;
+
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
- i[3456]86)
+ i[34567]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
@@ -170,30 +191,53 @@ case $basic_machine in
exit 1
;;
# Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
- | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
- | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
- | alpha-* | alphaev5-* | alphaev56-* | alphapca56-* | alphaev6-* \
- | we32k-* | cydra-* | ns16k-* \
- | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
- | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* | f301-* \
- | butterfly-bbn* \
- | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
+ # FIXME: clean up the formatting here.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
+ | xmp-* | ymp-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
+ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
+ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+ | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+ | mipstx39-* | mipstx39el-* | mcore-* \
+ | f301-* | armv*-* | t3e-* \
+ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+ | thumb-* | v850-* | d30v-* | tic30-* | c30-* )
+ ;;
+ # BEGIN cases added for Bash
+ butterfly-bbn* | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
| tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
| concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
- | *-convex | sx4*-nec)
+ | *-convex | sx[45]*-nec )
;;
+ # END cases added for Bash
+
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
alliant | fx80)
basic_machine=fx80-alliant
;;
@@ -212,13 +256,9 @@ case $basic_machine in
# basic_machine=m68k-cbm
basic_machine=m68k-unknown
;;
- amigaos)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigados)
+ amigaos | amigados)
basic_machine=m68k-cbm
- os=-amigados
+ os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-cbm
@@ -228,6 +268,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-sysv
;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -307,6 +351,10 @@ case $basic_machine in
encore | umax | mmax | multimax)
basic_machine=ns32k-encore
;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
fx2800)
basic_machine=i860-alliant
;;
@@ -325,6 +373,14 @@ case $basic_machine in
basic_machine=h8300-hitachi
os=-hms
;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
harris)
basic_machine=m88k-harris
os=-sysv3
@@ -340,13 +396,30 @@ case $basic_machine in
basic_machine=m68k-hp
os=-hpux
;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
- hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -355,6 +428,14 @@ case $basic_machine in
hppa-next)
os=-nextstep3
;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
ibm032-*)
basic_machine=ibmrt-ibm
;;
@@ -363,22 +444,38 @@ case $basic_machine in
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[3456]86v32)
+ i[34567]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
- i[3456]86v4*)
+ i[34567]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
- i[3456]86v)
+ i[34567]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
- i[3456]86sol2)
+ i[34567]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ i386-go32 | go32)
+ basic_machine=i386-unknown
+ os=-go32
+ ;;
+ i386-mingw32 | mingw32)
+ basic_machine=i386-unknown
+ os=-mingw32
+ ;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
@@ -410,13 +507,17 @@ case $basic_machine in
miniframe)
basic_machine=m68000-convergent
;;
+ *mint | *MiNT)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
mipsel*-linux*)
basic_machine=mipsel-unknown
- os=-linux
+ os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
- os=-linux
+ os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
@@ -424,10 +525,26 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ msdos)
+ basic_machine=i386-unknown
+ os=-msdos
+ ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-corel
+ os=-linux
+ ;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
@@ -440,6 +557,10 @@ case $basic_machine in
basic_machine=mips-sony
os=-newsos
;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
next | m*-next )
basic_machine=m68k-next
case $os in
@@ -465,6 +586,10 @@ case $basic_machine in
basic_machine=i960-intel
os=-nindy
;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
np1)
basic_machine=np1-gould
;;
@@ -476,6 +601,18 @@ case $basic_machine in
basic_machine=i386-pc
os=-sco3.2v4
;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
@@ -490,28 +627,26 @@ case $basic_machine in
pbb)
basic_machine=m68k-tti
;;
- pc532 | pc532-*)
+ pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
- pentium | p5)
+ pentium | p5 | k5 | k6 | nexen)
basic_machine=i586-intel
;;
- pentiumpro | p6)
- basic_machine=i686-intel
+ pentiumpro | p6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
;;
- pentium-* | p5-*)
+ pentium-* | p5-* | k5-* | k6-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- pentiumpro-* | p6-*)
+ pentiumpro-* | p6-* | 6x86*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- k5)
- # We don't have specific support for AMD's K5 yet, so just call it a Pentium
- basic_machine=i586-amd
- ;;
- nexen)
- # We don't have specific support for Nexgen yet, so just call it a Pentium
- basic_machine=i586-nexgen
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
@@ -519,24 +654,32 @@ case $basic_machine in
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
- ;;
+ ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
- ;;
+ ;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
sequent)
basic_machine=i386-sequent
;;
@@ -544,6 +687,10 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
+ sparclite-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
sps7)
basic_machine=m68k-bull
os=-sysv2
@@ -551,6 +698,13 @@ case $basic_machine in
spur)
basic_machine=spur-unknown
;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
sun2)
basic_machine=m68000-sun
;;
@@ -595,6 +749,16 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
+ t3e)
+ basic_machine=t3e-cray
+ os=-unicos
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
tower | tower-32)
basic_machine=m68k-ncr
;;
@@ -614,6 +778,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-sysv5uw7
;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
vaxv)
basic_machine=vax-dec
os=-sysv
@@ -637,13 +805,25 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
- xps | xps100)
+ xps | xps100)
basic_machine=xps100-honeywell
;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
none)
basic_machine=none-none
os=-none
@@ -651,8 +831,17 @@ case $basic_machine in
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
mips)
- if test "x$os" = "x-linux" ; then
+ if test "x$os" = "x-linux-gnu" ; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
@@ -673,10 +862,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sparc)
+ sparc | sparcv9)
basic_machine=sparc-sun
;;
- cydra)
+ cydra)
basic_machine=cydra-cydrome
;;
orion)
@@ -685,6 +874,16 @@ case $basic_machine in
orion105)
basic_machine=clipper-highlevel
;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
@@ -717,7 +916,7 @@ case $os in
-solaris)
os=-solaris2
;;
- svr4*)
+ -svr4*)
os=-sysv4
;;
-unixware | -uw | -unixware2* | -uw2*)
@@ -726,6 +925,9 @@ case $os in
-unixware7* | -uw7*)
os=-sysv5uw7
;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
@@ -736,18 +938,31 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -linux-gnu* | -uxpv* | -qnx* | -powerux* | -beos* | -rhapsody* \
- | -superux* )
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
+ # BEGIN CASES ADDED FOR Bash
+ -qnx* | -powerux* | -superux* )
+ ;;
+ # END CASES ADDED FOR Bash
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@@ -772,11 +987,14 @@ case $os in
-acis*)
os=-aos
;;
+ -386bsd)
+ os=-bsd
+ ;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
- os=-nextstep2
+ os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
@@ -806,9 +1024,18 @@ case $os in
# This must come after -sysvr[45].
-sysv*)
;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
-xenix)
os=-xenix
;;
+ -*mint | -*MiNT)
+ os=-mint
+ ;;
-none)
;;
*)
@@ -837,7 +1064,7 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- pdp11-*)
+ pdp11-*)
os=-none
;;
*-dec | vax-*)
@@ -855,6 +1082,15 @@ case $basic_machine in
# default.
# os=-sunos4
;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
@@ -867,6 +1103,15 @@ case $basic_machine in
*-ibm)
os=-aix
;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
*-hp)
os=-hpux
;;
@@ -909,19 +1154,19 @@ case $basic_machine in
*-next)
os=-nextstep3
;;
- *-gould)
+ *-gould)
os=-sysv
;;
- *-highlevel)
+ *-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
- *-sgi)
+ *-sgi)
os=-irix
;;
- *-siemens)
+ *-siemens)
os=-sysv4
;;
*-masscomp)
@@ -930,6 +1175,18 @@ case $basic_machine in
f301-fujitsu)
os=-uxpv
;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
*)
os=-none
;;
@@ -954,6 +1211,9 @@ case $basic_machine in
-aix*)
vendor=ibm
;;
+ -beos*)
+ vendor=be
+ ;;
-hpux*)
vendor=hp
;;
@@ -984,6 +1244,15 @@ case $basic_machine in
-aux*)
vendor=apple
;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -*MiNT)
+ vendor=atari
+ ;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
diff --git a/readline/support/shlib-install b/readline/support/shlib-install
index e43a7c0935f..471fec78b52 100755
--- a/readline/support/shlib-install
+++ b/readline/support/shlib-install
@@ -49,7 +49,7 @@ LN="ln -s"
if [ -z "$uninstall" ]; then
${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
if [ -f "$INSTALLDIR/$LIBNAME" ]; then
- ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
+ ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
fi
fi
@@ -63,6 +63,14 @@ fi
# post-install/uninstall
+# HP-UX requires that a shared library have execute permission
+case "$host_os" in
+hpux*) if [ -z "$uninstall" ]; then
+ chmod 755 ${INSTALLDIR}/${LIBNAME}
+ fi ;;
+*) ;;
+esac
+
case "$LIBNAME" in
*.*.[0-9].[0-9]) # libname.so.M.N
LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M
@@ -71,6 +79,9 @@ case "$LIBNAME" in
*.*.[0-9]) # libname.so.M
LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
;;
+*.[0-9]) # libname.M
+ LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
+ ;;
esac
#
@@ -91,7 +102,7 @@ case "$host_os" in
fi
;;
-solaris2*|aix4.[2-9]*|hpux1*)
+solaris2*|aix4.[2-9]*|osf*|irix[56]*)
# libname.so -> libname.so.M
${echo} ${RM} ${INSTALLDIR}/$LINK1
if [ -z "$uninstall" ]; then
@@ -99,6 +110,38 @@ solaris2*|aix4.[2-9]*|hpux1*)
fi
;;
+
+# FreeBSD 3.x can have either a.out or ELF shared libraries
+freebsd3*)
+ if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+ # libname.so -> libname.so.M
+ ${echo} ${RM} ${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+ fi
+ else
+ # libname.so.M -> libname.so.M.N
+ ${echo} ${RM} ${INSTALLDIR}/$LINK2
+ if [ -z "$uninstall" ]; then
+ ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
+ fi
+
+ # libname.so -> libname.so.M.N
+ ${echo} ${RM} ${INSTALLDIR}/$LINK1
+ if [ -z "$uninstall" ]; then
+ ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
+ fi
+ fi
+ ;;
+
+hpux1*)
+ # libname.sl -> libname.M
+ ${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
+ if [ -z "$uninstall" ]; then
+ ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
+ fi
+ ;;
+
*) ;;
esac
diff --git a/readline/support/shobj-conf b/readline/support/shobj-conf
index cbd3d1b46c6..6649c700588 100755
--- a/readline/support/shobj-conf
+++ b/readline/support/shobj-conf
@@ -62,9 +62,9 @@ sunos4*)
sunos5*-gcc*|solaris2*-gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
- SHOBJ_LDFLAGS='-shared -Wl,-i'
+ SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
- SHLIB_XLDFLAGS='-R $(libdir)'
+# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
@@ -73,7 +73,7 @@ sunos5*|solaris2*)
SHOBJ_LD=/usr/ccs/bin/ld
SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
- SHLIB_XLDFLAGS='-R $(libdir)'
+# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
@@ -86,13 +86,32 @@ freebsd2* | netbsd* | openbsd*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
+# FreeBSD-3.x can have either a.out or ELF object files
+#freebsd3*)
+# SHOBJ_CFLAGS=-fpic
+# SHOBJ_LD='${CC}'
+# SHOBJ_LDFLAGS='-shared'
+#
+# SHLIB_XLDFLAGS='-R$(libdir)'
+# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+# ;;
+
+# FreeBSD-3.x ELF
freebsd3*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
- SHOBJ_LDFLAGS='-shared'
- SHLIB_XLDFLAGS='-R$(libdir)'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ else
+ SHOBJ_LDFLAGS='-shared'
+
+ SHLIB_XLDFLAGS='-R$(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
+ fi
;;
linux*)
@@ -142,6 +161,15 @@ bsdi4*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
+osf*-gcc*)
+ # Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
+ SHOBJ_LD='${CC}'
+ SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
+
+ SHLIB_XLDFLAGS='-rpath $(libdir)'
+ SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
+ ;;
+
osf*)
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
@@ -187,7 +215,9 @@ irix[56]*-gcc*)
irix[56]*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
- SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+# SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
+# Change from David Kaelbling <drk@sgi.com>
+ SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
@@ -305,6 +335,12 @@ dgux*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
+
+msdos*)
+ SHOBJ_STATUS=unsupported
+ SHLIB_STATUS=unsupported
+ ;;
+
#
# Rely on correct gcc configuration for everything else
#
diff --git a/readline/tcap.h b/readline/tcap.h
index acb2d76ab48..58ab894d93e 100644
--- a/readline/tcap.h
+++ b/readline/tcap.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLTCAP_H_)
#define _RLTCAP_H_
diff --git a/readline/terminal.c b/readline/terminal.c
index c22ec5170bd..20ad126ec37 100644
--- a/readline/terminal.c
+++ b/readline/terminal.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,9 +46,7 @@
# include <locale.h>
#endif
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -64,18 +62,8 @@
#include "readline.h"
#include "history.h"
-/* Variables and functions imported from readline.c */
-extern FILE *_rl_in_stream, *_rl_out_stream;
-extern int readline_echoing_p;
-extern int _rl_bell_preference;
-extern Keymap _rl_keymap;
-
-/* Functions imported from bind.c */
-extern void _rl_bind_if_unbound ();
-
-/* Functions imported from shell.c */
-extern void set_lines_and_columns ();
-extern char *get_env_value ();
+#include "rlprivate.h"
+#include "rlshell.h"
/* **************************************************************** */
/* */
@@ -149,6 +137,22 @@ int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
+#if defined (__EMX__)
+static void
+_emx_get_screensize (swp, shp)
+ int *swp, *shp;
+{
+ int sz[2];
+
+ _scrsize (sz);
+
+ if (swp)
+ *swp = sz[0];
+ if (shp)
+ *shp = sz[1];
+}
+#endif
+
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
@@ -161,9 +165,6 @@ _rl_get_screen_size (tty, ignore_env)
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
-#if defined (__EMX__)
- int sz[2];
-#endif
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
@@ -174,9 +175,7 @@ _rl_get_screen_size (tty, ignore_env)
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
- _scrsize (sz);
- screenwidth = sz[0];
- screenheight = sz[1];
+ _emx_get_screensize (&screenwidth, &screenheight);
#endif
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
@@ -186,8 +185,10 @@ _rl_get_screen_size (tty, ignore_env)
if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
screenwidth = atoi (ss);
+#if !defined (__DJGPP__)
if (screenwidth <= 0 && term_string_buffer)
screenwidth = tgetnum ("co");
+#endif
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
@@ -197,8 +198,10 @@ _rl_get_screen_size (tty, ignore_env)
if (ignore_env == 0 && (ss = get_env_value ("LINES")))
screenheight = atoi (ss);
+#if !defined (__DJGPP__)
if (screenheight <= 0 && term_string_buffer)
screenheight = tgetnum ("li");
+#endif
}
/* If all else fails, default to 80x24 terminal. */
@@ -213,7 +216,7 @@ _rl_get_screen_size (tty, ignore_env)
do a pair of putenv () or setenv () calls. */
set_lines_and_columns (screenheight, screenwidth);
- if (!_rl_term_autowrap)
+ if (_rl_term_autowrap == 0)
screenwidth--;
screenchars = screenwidth * screenheight;
@@ -251,32 +254,32 @@ struct _tc_string {
search algorithm to something smarter. */
static struct _tc_string tc_strings[] =
{
- "DC", &term_DC,
- "IC", &term_IC,
- "ce", &term_clreol,
- "cl", &term_clrpag,
- "cr", &term_cr,
- "dc", &term_dc,
- "ei", &term_ei,
- "ic", &term_ic,
- "im", &term_im,
- "kd", &term_kd,
- "kh", &term_kh, /* home */
- "kH", &term_kH, /* end */
- "kl", &term_kl,
- "kr", &term_kr,
- "ku", &term_ku,
- "ks", &term_ks,
- "ke", &term_ke,
- "le", &term_backspace,
- "mm", &term_mm,
- "mo", &term_mo,
+ { "DC", &term_DC },
+ { "IC", &term_IC },
+ { "ce", &term_clreol },
+ { "cl", &term_clrpag },
+ { "cr", &term_cr },
+ { "dc", &term_dc },
+ { "ei", &term_ei },
+ { "ic", &term_ic },
+ { "im", &term_im },
+ { "kd", &term_kd },
+ { "kh", &term_kh }, /* home */
+ { "kH", &term_kH }, /* end */
+ { "kl", &term_kl },
+ { "kr", &term_kr },
+ { "ku", &term_ku },
+ { "ks", &term_ks },
+ { "ke", &term_ke },
+ { "le", &term_backspace },
+ { "mm", &term_mm },
+ { "mo", &term_mo },
#if defined (HACK_TERMCAP_MOTION)
- "nd", &term_forward_char,
+ { "nd", &term_forward_char },
#endif
- "pc", &term_pc,
- "up", &term_up,
- "vb", &visible_bell,
+ { "pc", &term_pc },
+ { "up", &term_up },
+ { "vb", &visible_bell },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
@@ -287,72 +290,96 @@ static void
get_term_capabilities (bp)
char **bp;
{
+#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
+#endif
tcap_initialized = 1;
}
+#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
+#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
+
int
_rl_init_terminal_io (terminal_name)
char *terminal_name;
{
-#if defined (__GO32__)
- screenwidth = ScreenCols ();
- screenheight = ScreenRows ();
- screenchars = screenwidth * screenheight;
- term_cr = "\r";
- term_im = term_ei = term_ic = term_IC = (char *)NULL;
- term_up = term_dc = term_DC = visible_bell = (char *)NULL;
-
- /* Does the __GO32__ have a meta key? I don't know. */
- term_has_meta = 0;
- term_mm = term_mo = (char *)NULL;
-
- /* It probably has arrow keys, but I don't know what they are. */
- term_ku = term_kd = term_kr = term_kl = (char *)NULL;
-
-#if defined (HACK_TERMCAP_MOTION)
- term_forward_char = (char *)NULL;
-#endif /* HACK_TERMCAP_MOTION */
- terminal_can_insert = _rl_term_autowrap = 0;
- return;
-#else /* !__GO32__ */
-
char *term, *buffer;
- int tty;
+ int tty, tgetent_ret;
Keymap xkeymap;
term = terminal_name ? terminal_name : get_env_value ("TERM");
+ term_clrpag = term_cr = term_clreol = (char *)NULL;
+ tty = rl_instream ? fileno (rl_instream) : 0;
+ screenwidth = screenheight = 0;
- if (term_string_buffer == 0)
- term_string_buffer = xmalloc (2032);
+ if (term == 0)
+ term = "dumb";
- if (term_buffer == 0)
- term_buffer = xmalloc (4080);
+ /* I've separated this out for later work on not calling tgetent at all
+ if the calling application has supplied a custom redisplay function,
+ (and possibly if the application has supplied a custom input function). */
+ if (CUSTOM_REDISPLAY_FUNC())
+ {
+ tgetent_ret = -1;
+ }
+ else
+ {
+ if (term_string_buffer == 0)
+ term_string_buffer = xmalloc(2032);
- buffer = term_string_buffer;
+ if (term_buffer == 0)
+ term_buffer = xmalloc(4080);
- term_clrpag = term_cr = term_clreol = (char *)NULL;
+ buffer = term_string_buffer;
- if (term == 0)
- term = "dumb";
+ tgetent_ret = tgetent (term_buffer, term);
+ }
- if (tgetent (term_buffer, term) <= 0)
+ if (tgetent_ret <= 0)
{
+ FREE (term_string_buffer);
+ FREE (term_buffer);
+ buffer = term_buffer = term_string_buffer = (char *)NULL;
+
dumb_term = 1;
- screenwidth = 79;
- screenheight = 24;
- screenchars = 79 * 24;
+ _rl_term_autowrap = 0; /* used by _rl_get_screen_size */
+
+#if defined (__EMX__)
+ _emx_get_screensize (&screenwidth, &screenheight);
+ screenwidth--;
+#else /* !__EMX__ */
+ _rl_get_screen_size (tty, 0);
+#endif /* !__EMX__ */
+
+ /* Defaults. */
+ if (screenwidth <= 0 || screenheight <= 0)
+ {
+ screenwidth = 79;
+ screenheight = 24;
+ }
+
+ /* Everything below here is used by the redisplay code (tputs). */
+ screenchars = screenwidth * screenheight;
term_cr = "\r";
term_im = term_ei = term_ic = term_IC = (char *)NULL;
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
term_ku = term_kd = term_kl = term_kr = (char *)NULL;
+ term_mm = term_mo = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif
- terminal_can_insert = 0;
+ terminal_can_insert = term_has_meta = 0;
+
+ /* Reasonable defaults for tgoto(). Readline currently only uses
+ tgoto if term_IC or term_DC is defined, but just in case we
+ change that later... */
+ PC = '\0';
+ BC = term_backspace = "\b";
+ UP = term_up;
+
return 0;
}
@@ -367,10 +394,6 @@ _rl_init_terminal_io (terminal_name)
if (!term_cr)
term_cr = "\r";
- tty = rl_instream ? fileno (rl_instream) : 0;
-
- screenwidth = screenheight = 0;
-
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
_rl_get_screen_size (tty, 0);
@@ -413,7 +436,6 @@ _rl_init_terminal_io (terminal_name)
_rl_keymap = xkeymap;
-#endif /* !__GO32__ */
return 0;
}
@@ -459,6 +481,7 @@ _rl_output_character_function (c)
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
+
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
@@ -475,12 +498,10 @@ _rl_backspace (count)
{
register int i;
-#if !defined (__GO32__)
if (term_backspace)
for (i = 0; i < count; i++)
tputs (term_backspace, 1, _rl_output_character_function);
else
-#endif /* !__GO32__ */
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
@@ -504,7 +525,6 @@ ding ()
{
if (readline_echoing_p)
{
-#if !defined (__GO32__)
switch (_rl_bell_preference)
{
case NO_BELL:
@@ -522,10 +542,6 @@ ding ()
fflush (stderr);
break;
}
-#else /* __GO32__ */
- fprintf (stderr, "\007");
- fflush (stderr);
-#endif /* __GO32__ */
return (0);
}
return (-1);
@@ -540,16 +556,20 @@ ding ()
void
_rl_enable_meta_key ()
{
+#if !defined (__DJGPP__)
if (term_has_meta && term_mm)
tputs (term_mm, 1, _rl_output_character_function);
+#endif
}
void
_rl_control_keypad (on)
int on;
{
+#if !defined (__DJGPP__)
if (on && term_ks)
tputs (term_ks, 1, _rl_output_character_function);
else if (!on && term_ke)
tputs (term_ke, 1, _rl_output_character_function);
+#endif
}
diff --git a/readline/tilde.c b/readline/tilde.c
index d1853bd63d6..777b6559223 100644
--- a/readline/tilde.c
+++ b/readline/tilde.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if defined (HAVE_CONFIG_H)
# include <config.h>
@@ -47,12 +47,22 @@
#include "tilde.h"
+#if defined (TEST) || defined (STATIC_MALLOC)
+static char *xmalloc (), *xrealloc ();
+#else
+# if defined __STDC__
+extern char *xmalloc (int);
+extern char *xrealloc (void *, int);
+# else
+extern char *xmalloc (), *xrealloc ();
+# endif /* !__STDC__ */
+#endif /* TEST || STATIC_MALLOC */
+
#if !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid (), *getpwnam ();
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
-extern char *xmalloc ();
# ifndef strcpy
extern char *strcpy ();
# endif
@@ -67,17 +77,11 @@ extern char *strcpy ();
# endif /* !__STDC__ */
#endif /* !NULL */
-#if defined (TEST) || defined (STATIC_MALLOC)
-static char *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
-#endif /* TEST || STATIC_MALLOC */
-
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
-extern char *get_home_dir ();
-extern char *get_env_value ();
+extern char *get_home_dir __P((void));
+extern char *get_env_value __P((char *));
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
@@ -122,7 +126,9 @@ tilde_find_prefix (string, len)
int *len;
{
register int i, j, string_len;
- register char **prefixes = tilde_additional_prefixes;
+ register char **prefixes;
+
+ prefixes = tilde_additional_prefixes;
string_len = strlen (string);
*len = 0;
@@ -161,7 +167,11 @@ tilde_find_suffix (string)
for (i = 0; i < string_len; i++)
{
+#if defined (__MSDOS__)
+ if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
+#else
if (string[i] == '/' /* || !string[i] */)
+#endif
break;
for (j = 0; suffixes && suffixes[j]; j++)
@@ -225,11 +235,18 @@ tilde_expand (string)
free (tilde_word);
len = strlen (expansion);
- if ((result_index + len + 1) > result_size)
- result = xrealloc (result, 1 + (result_size += (len + 20)));
+#ifdef __CYGWIN32__
+ /* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
+ $HOME for `user' is /. On cygwin, // denotes a network drive. */
+ if (len > 1 || *expansion != '/' || *string != '/')
+#endif
+ {
+ if ((result_index + len + 1) > result_size)
+ result = xrealloc (result, 1 + (result_size += (len + 20)));
- strcpy (result + result_index, expansion);
- result_index += len;
+ strcpy (result + result_index, expansion);
+ result_index += len;
+ }
free (expansion);
}
@@ -250,7 +267,11 @@ isolate_tilde_prefix (fname, lenp)
int i;
ret = xmalloc (strlen (fname));
+#if defined (__MSDOS__)
+ for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
+#else
for (i = 1; fname[i] && fname[i] != '/'; i++)
+#endif
ret[i - 1] = fname[i];
ret[i - 1] = '\0';
if (lenp)
@@ -271,7 +292,7 @@ glue_prefix_and_suffix (prefix, suffix, suffind)
plen = (prefix && *prefix) ? strlen (prefix) : 0;
slen = strlen (suffix + suffind);
ret = xmalloc (plen + slen + 1);
- if (prefix && *prefix)
+ if (plen)
strcpy (ret, prefix);
strcpy (ret + plen, suffix + suffind);
return ret;
diff --git a/readline/tilde.h b/readline/tilde.h
index 634b95449aa..7783fd6101a 100644
--- a/readline/tilde.h
+++ b/readline/tilde.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,11 +19,27 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_TILDE_H_)
# define _TILDE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A function can be defined using prototypes and compile on both ANSI C
+ and traditional C compilers with something like this:
+ extern char *func __P((char *, char *, int)); */
+
+#if !defined (__P)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
+# define __P(protos) protos
+# else
+# define __P(protos) ()
+# endif
+#endif
+
/* Function pointers can be declared as (Function *)foo. */
#if !defined (_FUNCTION_DEF)
# define _FUNCTION_DEF
@@ -56,10 +72,14 @@ extern char **tilde_additional_prefixes;
extern char **tilde_additional_suffixes;
/* Return a new string which is the result of tilde expanding STRING. */
-extern char *tilde_expand ();
+extern char *tilde_expand __P((char *));
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
-extern char *tilde_expand_word ();
+extern char *tilde_expand_word __P((char *));
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _TILDE_H_ */
diff --git a/readline/undo.c b/readline/undo.c
index 28ebcc85b93..f7f30d17d9d 100644
--- a/readline/undo.c
+++ b/readline/undo.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -47,6 +47,8 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
diff --git a/readline/util.c b/readline/util.c
index 1dc3b664f1c..be9e0a9869a 100644
--- a/readline/util.c
+++ b/readline/util.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -52,24 +52,10 @@
/* Some standard library routines. */
#include "readline.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
-/* Pseudo-globals imported from readline.c */
-extern int readline_echoing_p;
-extern procenv_t readline_top_level;
-extern int rl_line_buffer_len;
-extern Function *rl_last_func;
-
-extern int _rl_defining_kbd_macro;
-extern char *_rl_executing_macro;
+#include "rlprivate.h"
+#include "xmalloc.h"
-/* Pseudo-global functions imported from other library files. */
-extern void _rl_replace_text ();
-extern void _rl_pop_executing_macro ();
-extern void _rl_set_the_line ();
-extern void _rl_init_argument ();
-
-extern char *xmalloc (), *xrealloc ();
+#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* **************************************************************** */
/* */
diff --git a/readline/vi_keymap.c b/readline/vi_keymap.c
index 14929a31930..cf6724cef13 100644
--- a/readline/vi_keymap.c
+++ b/readline/vi_keymap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (BUFSIZ)
#include <stdio.h>
diff --git a/readline/vi_mode.c b/readline/vi_mode.c
index d4868bf3b13..be7f9496434 100644
--- a/readline/vi_mode.c
+++ b/readline/vi_mode.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
/* **************************************************************** */
@@ -54,6 +54,9 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
#ifndef _rl_digit_p
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
#endif
@@ -74,26 +77,6 @@
#define exchange(x, y) do {int temp = x; x = y; y = temp;} while (0)
#endif
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_mark;
-extern FILE *rl_instream;
-extern int rl_line_buffer_len, rl_explicit_arg, rl_numeric_arg;
-extern Keymap _rl_keymap;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
-extern int rl_arg_sign;
-
-extern int _rl_doing_an_undo;
-extern int _rl_undo_group_level;
-
-extern void _rl_dispatch ();
-extern int _rl_char_search_internal ();
-
-extern void rl_extend_line_buffer ();
-extern int rl_vi_check ();
-
/* Non-zero means enter insertion mode. */
static int _rl_vi_doing_insert;
@@ -131,7 +114,7 @@ static char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
/* Arrays for the saved marks. */
static int vi_mark_chars[27];
-static int rl_digit_loop1 ();
+static int rl_digit_loop1 __P((void));
void
_rl_vi_initialize_line ()
@@ -1043,7 +1026,7 @@ rl_vi_char_search (count, key)
if (vi_redoing)
target = _rl_vi_last_search_char;
else
- _rl_vi_last_search_char = target = rl_getc (rl_instream);
+ _rl_vi_last_search_char = target = (*rl_getc_function) (rl_instream);
switch (key)
{
@@ -1159,7 +1142,7 @@ rl_vi_change_char (count, key)
if (vi_redoing)
c = _rl_vi_last_replacement;
else
- _rl_vi_last_replacement = c = rl_getc (rl_instream);
+ _rl_vi_last_replacement = c = (*rl_getc_function) (rl_instream);
if (c == '\033' || c == CTRL ('C'))
return -1;
diff --git a/readline/xmalloc.c b/readline/xmalloc.c
index 4160651191b..c0d06403a3c 100644
--- a/readline/xmalloc.c
+++ b/readline/xmalloc.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,8 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
@@ -31,7 +32,7 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-static void memory_error_and_abort ();
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -39,6 +40,14 @@ static void memory_error_and_abort ();
/* */
/* **************************************************************** */
+static void
+memory_error_and_abort (fname)
+ char *fname;
+{
+ fprintf (stderr, "%s: out of virtual memory\n", fname);
+ exit (2);
+}
+
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
@@ -56,7 +65,7 @@ xmalloc (bytes)
char *
xrealloc (pointer, bytes)
- char *pointer;
+ PTR_T pointer;
int bytes;
{
char *temp;
@@ -68,19 +77,11 @@ xrealloc (pointer, bytes)
return (temp);
}
-static void
-memory_error_and_abort (fname)
- char *fname;
-{
- fprintf (stderr, "%s: out of virtual memory\n", fname);
- exit (2);
-}
-
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
- char *string;
+ PTR_T string;
{
if (string)
free (string);