aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-06-07 12:17:44 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-06-07 12:17:44 +0000
commit933f368172458b72e1a1e36f6cab3d618e9595f4 (patch)
tree273a40857d601fa83d190bfbfb6ae23041a7743d
parentb29a08bf10533847eec8595efaffc02857b5b353 (diff)
downloadsrc-933f368172458b72e1a1e36f6cab3d618e9595f4.tar.gz
src-933f368172458b72e1a1e36f6cab3d618e9595f4.zip
Virgin import of readline-2.1, unneded docs deleted
Notes
Notes: svn path=/vendor/libreadline/dist/; revision=26497
-rw-r--r--contrib/libreadline/INSTALL176
-rw-r--r--contrib/libreadline/MANIFEST83
-rw-r--r--contrib/libreadline/Makefile.in456
-rw-r--r--contrib/libreadline/README114
-rw-r--r--contrib/libreadline/acconfig.h30
-rw-r--r--contrib/libreadline/aclocal.m41096
-rw-r--r--contrib/libreadline/bind.c79
-rw-r--r--contrib/libreadline/callback.c5
-rw-r--r--contrib/libreadline/complete.c86
-rw-r--r--contrib/libreadline/config.h.in138
-rwxr-xr-xcontrib/libreadline/configure2458
-rw-r--r--contrib/libreadline/configure.in82
-rw-r--r--contrib/libreadline/display.c66
-rw-r--r--contrib/libreadline/doc/Makefile.in123
-rw-r--r--contrib/libreadline/doc/hstech.texinfo11
-rw-r--r--contrib/libreadline/doc/readline.317
-rw-r--r--contrib/libreadline/doc/rltech.texinfo18
-rw-r--r--contrib/libreadline/doc/rluser.texinfo52
-rw-r--r--contrib/libreadline/examples/Makefile.in37
-rw-r--r--contrib/libreadline/examples/fileman.c36
-rw-r--r--contrib/libreadline/examples/rl.c115
-rw-r--r--contrib/libreadline/examples/rltest.c14
-rw-r--r--contrib/libreadline/funmap.c1
-rw-r--r--contrib/libreadline/histexpand.c59
-rw-r--r--contrib/libreadline/histfile.c29
-rw-r--r--contrib/libreadline/history.h13
-rw-r--r--contrib/libreadline/isearch.c14
-rw-r--r--contrib/libreadline/kill.c9
-rw-r--r--contrib/libreadline/nls.c43
-rw-r--r--contrib/libreadline/posixdir.h2
-rw-r--r--contrib/libreadline/posixjmp.h20
-rw-r--r--contrib/libreadline/readline.317
-rw-r--r--contrib/libreadline/readline.c180
-rw-r--r--contrib/libreadline/readline.h19
-rw-r--r--contrib/libreadline/rldefs.h11
-rw-r--r--contrib/libreadline/rltty.c2
-rw-r--r--contrib/libreadline/rltty.h12
-rw-r--r--contrib/libreadline/search.c11
-rw-r--r--contrib/libreadline/shell.c129
-rw-r--r--contrib/libreadline/signals.c49
-rwxr-xr-xcontrib/libreadline/support/config.guess927
-rwxr-xr-xcontrib/libreadline/support/config.sub944
-rwxr-xr-xcontrib/libreadline/support/install.sh235
-rwxr-xr-xcontrib/libreadline/support/mkdirs32
-rwxr-xr-xcontrib/libreadline/support/mkdist100
-rw-r--r--contrib/libreadline/tcap.h3
-rw-r--r--contrib/libreadline/terminal.c88
-rw-r--r--contrib/libreadline/tilde.c219
-rw-r--r--contrib/libreadline/tilde.h6
-rw-r--r--contrib/libreadline/undo.c1
-rw-r--r--contrib/libreadline/util.c23
51 files changed, 8005 insertions, 485 deletions
diff --git a/contrib/libreadline/INSTALL b/contrib/libreadline/INSTALL
new file mode 100644
index 000000000000..95d84c820fb8
--- /dev/null
+++ b/contrib/libreadline/INSTALL
@@ -0,0 +1,176 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/contrib/libreadline/MANIFEST b/contrib/libreadline/MANIFEST
new file mode 100644
index 000000000000..5e68586f1aab
--- /dev/null
+++ b/contrib/libreadline/MANIFEST
@@ -0,0 +1,83 @@
+#
+# Master distribution manifest for the standalone readline distribution
+#
+doc d
+examples d
+support d
+COPYING f
+README f
+MANIFEST f
+INSTALL f
+aclocal.m4 f
+acconfig.h f
+config.h.in f
+configure f
+configure.in f
+Makefile.in f
+ChangeLog f
+ansi_stdlib.h f
+chardefs.h f
+history.h f
+histlib.h f
+keymaps.h f
+posixdir.h f
+posixjmp.h f
+posixstat.h f
+readline.h f
+rlconf.h f
+rldefs.h f
+rltty.h f
+tcap.h f
+tilde.h f
+bind.c f
+complete.c f
+display.c f
+emacs_keymap.c f
+funmap.c f
+input.c f
+isearch.c f
+keymaps.c f
+kill.c f
+macro.c f
+nls.c f
+parens.c f
+readline.c f
+rltty.c f
+search.c f
+shell.c f
+signals.c f
+terminal.c f
+tilde.c f
+undo.c f
+util.c f
+vi_keymap.c f
+vi_mode.c f
+callback.c f
+xmalloc.c f
+history.c f
+histexpand.c f
+histfile.c f
+histsearch.c f
+support/config.guess f
+support/config.sub f
+support/install.sh f
+support/mkdirs f
+support/mkdist f
+doc/Makefile.in f
+doc/texinfo.tex f
+doc/rlman.texinfo f
+doc/rltech.texinfo f
+doc/rluser.texinfo f
+doc/hist.texinfo f
+doc/hstech.texinfo f
+doc/hsuser.texinfo f
+doc/readline.3 f
+doc/texi2dvi f
+doc/texi2html f
+examples/Makefile.in f
+examples/fileman.c f
+examples/manexamp.c f
+examples/rltest.c f
+examples/rl.c f
+examples/histexamp.c f
+examples/Inputrc f
diff --git a/contrib/libreadline/Makefile.in b/contrib/libreadline/Makefile.in
index c5ac183cf0cc..3d2c68fcedc8 100644
--- a/contrib/libreadline/Makefile.in
+++ b/contrib/libreadline/Makefile.in
@@ -1,45 +1,96 @@
-## -*- text -*- ####################################################
-# #
-# Makefile for the GNU Readline and History Libraries. #
-# #
-####################################################################
+## -*- text -*- ##
+# Master Makefile for the GNU readline library.
+# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+RL_LIBRARY_VERSION = @LIBVERSION@
+RL_LIBRARY_NAME = readline
srcdir = @srcdir@
VPATH = .:@srcdir@
-topdir = @top_srcdir@
-BUILD_DIR = @BUILD_DIR@
+top_srcdir = @top_srcdir@
+BUILD_DIR = .
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
+LD = ld # needed when building shared libraries
RANLIB = @RANLIB@
-AR = @AR@
+AR = ar
RM = rm -f
CP = cp
MV = mv
-# See the file STANDALONE for the -D defines that readline understands
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+libdir = @libdir@
+mandir = @mandir@
+includedir = @includedir@
+
+infodir = @infodir@
+
+man3dir = $(mandir)/man3
+
+SHELL = /bin/sh
+
+# Programs to make tags files.
+ETAGS = etags -tw
+CTAGS = ctags -tw
CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
+LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@
DEFS = @DEFS@
+LOCAL_DEFS = @LOCAL_DEFS@
-INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
+# For libraries which include headers from other libraries.
+INCLUDES = -I. -I$(srcdir) -I$(includedir)
-CCFLAGS = $(DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
+CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS)
+
+# these two options need tweaking for compiler/OS versions other than gcc
+# and SunOS4
+PICFLAG= -fpic # -pic for some versions of cc
+SHLIB_OPTS= -assert pure-text -ldl # -Bshareable for some versions of gcc
+
+MAJOR= 3
+# shared library systems like SVR4's do not use minor versions
+MINOR= .0
+
+.SUFFIXES: .so
-# Here is a rule for making .o files from .c files that doesn't force
-# the type of the machine (like -sun3) into the flags.
.c.o:
$(CC) -c $(CCFLAGS) $<
+.c.so:
+ -mv $*.o z$*.o
+ $(CC) -c $(PICFLAG) $(CCFLAGS) $<
+ mv $*.o $@
+ -mv z$*.o $*.o
+
# The name of the main library target.
LIBRARY_NAME = libreadline.a
+SHARED_READLINE = libreadline.so.$(MAJOR)$(MINOR)
+SHARED_HISTORY = libhistory.so.$(MAJOR)$(MINOR)
+SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY)
# The C code source files for this library.
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
@@ -50,20 +101,27 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
$(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
$(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
$(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
- $(srcdir)/histfile.c $(srcdir)/nls.c \
- $(srcdir)/tilde.c \
+ $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \
+ $(srcdir)/shell.c $(srcdir)/tilde.c
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
- posixstat.h tilde.h rlconf.h tcap.h
+ posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
+ ansi_stdlib.h tcap.h
-HISTOBJ = history.o histexpand.o histfile.o histsearch.o
-TILDEOBJ= tilde.o
+HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
+TILDEOBJ = tilde.o
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
rltty.o complete.o bind.o isearch.o display.o signals.o \
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
- nls.o xmalloc.o \
- $(HISTOBJ) $(TILDEOBJ)
+ nls.o xmalloc.o $(HISTOBJ) $(TILDEOBJ)
+
+SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
+SHARED_TILDEOBJ = tilde.so
+SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
+ rltty.so complete.so bind.so isearch.so display.so signals.so \
+ util.so kill.so undo.so macro.so input.so callback.so terminal.so \
+ nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ)
# The texinfo files which document this library.
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
@@ -71,122 +129,320 @@ DOCOBJECT = doc/readline.dvi
DOCSUPPORT = doc/Makefile
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
-SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
-
-SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
-
-THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
+CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
##########################################################################
all: libreadline.a libhistory.a
+shared: $(SHARED_LIBS)
libreadline.a: $(OBJECTS)
- $(RM) -f $@
+ $(RM) $@
$(AR) cr $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
libhistory.a: $(HISTOBJ) xmalloc.o
- $(RM) -f $@
+ $(RM) $@
$(AR) cr $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
+$(SHARED_READLINE): $(SHARED_OBJ)
+ $(RM) $@
+ $(LD) ${SHLIB_OPTS} -o $@ $(SHARED_OBJ)
+
+$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so
+ $(RM) $@
+ $(LD) ${SHLIB_OPTS} -o $@ $(SHARED_HISTOBJ) xmalloc.so
+
+readline: $(OBJECTS) readline.h rldefs.h chardefs.h
+ $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
+
+Makefile makefile: config.status $(srcdir)/Makefile.in
+ CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
+
+Makefiles makefiles: config.status $(srcdir)/Makefile.in
+ @for mf in $(CREATED_MAKEFILES); do \
+ CONFIG_FILES=$$mf CONFIG_HEADERS= $(SHELL) ./config.status ; \
+ done
+
+config.status: configure
+ $(SHELL) ./config.status --recheck
+
+config.h: stamp-h
+
+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
+
documentation: force
- test -d doc || mkdir doc
+ -test -d doc || mkdir doc
-( cd doc && $(MAKE) $(MFLAGS) )
force:
-# The rule for 'includes' is written funny so that the if statement
-# always returns TRUE unless there really was an error installing the
-# include files.
install: installdirs libreadline.a
- for file in $(INSTALLED_HEADERS) ; do \
- $(INSTALL_DATA) $(srcdir)/$$file $(includedir)/readline ; \
+ for f in ${INSTALLED_HEADERS}; do \
+ $(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
done
- -${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
- ${INSTALL_DATA} libreadline.a $(libdir)/libreadline.a
- -test -n "$(RANLIB)" && $(RANLIB) -t $(bindir)/libreadline.a
-
-installdirs: $(topdir)/support/mkdirs
- $(SHELL) $(topdir)/support/mkdirs $(includedir) \
+ -$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
+ $(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
+ -test -n "$(RANLIB)" && -$(RANLIB) -t $(libdir)/libreadline.a
+ -( if test -d doc ; then \
+ cd doc && \
+ ${MAKE} ${MFLAGS} infodir=$(infodir) INSTALL_DATA=$(INSTALL_DATA) $@; \
+ fi )
+
+installdirs: $(srcdir)/support/mkdirs
+ -$(SHELL) $(srcdir)/support/mkdirs $(includedir) \
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
uninstall:
- cd $(includedir)/readline && ${RM} -f ${INSTALLED_HEADERS}
- cd $(libdir) && ${RM} -f libreadline.a libreadline.old
-
-tags: force
- etags $(CSOURCES) $(HSOURCES)
+ -test -n "$(includedir)" && cd $(includedir)/readline && \
+ ${RM} ${INSTALLED_HEADERS}
+ -test -n "$(libdir)" && cd $(libdir) && \
+ ${RM} libreadline.a libreadline.old $(SHARED_LIBS)
TAGS: force
- ctags -x $(CSOURCES) $(HSOURCES) > $@
+ $(ETAGS) $(CSOURCES) $(HSOURCES)
-readline: readline.h rldefs.h chardefs.h
-readline: $(OBJECTS)
- $(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
- $(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
- keymaps.o -ltermcap
+tags: force
+ $(CTAGS) $(CSOURCES) $(HSOURCES)
clean: force
$(RM) $(OBJECTS) *.a
+ $(RM) $(SHARED_OBJ) $(SHARED_LIBS)
+ -( cd doc && $(MAKE) $(MFLAGS) $@ )
+
+mostlyclean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
-distclean realclean maintainer-clean: clean
+distclean maintainer-clean: clean
-( cd doc && $(MAKE) $(MFLAGS) $@ )
$(RM) Makefile
+ $(RM) config.status config.h config.cache config.log
+ $(RM) stamp-config stamp-h
+ $(RM) TAGS tags
-mostlyclean: clean
+info dvi:
-( cd doc && $(MAKE) $(MFLAGS) $@ )
+install-info:
+check:
+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 tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
+ @echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
# Dependencies
-readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h tcap.h
-readline.o: keymaps.h history.h
-vi_mode.o: rldefs.h rlconf.h readline.h history.h
-funmap.o: funmap.c readline.h rlconf.h
-keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
-history.o: history.h histlib.h
+bind.o: ansi_stdlib.h posixstat.h
+bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+bind.o: readline.h keymaps.h chardefs.h tilde.h
+bind.o: history.h
+callback.o: rlconf.h
+callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+callback.o: readline.h keymaps.h chardefs.h tilde.h
+complete.o: ansi_stdlib.h posixdir.h posixstat.h
+complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+complete.o: readline.h keymaps.h chardefs.h tilde.h
+display.o: ansi_stdlib.h posixstat.h
+display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+display.o: tcap.h
+display.o: readline.h keymaps.h chardefs.h tilde.h
+display.o: history.h
+funmap.o: readline.h keymaps.h chardefs.h tilde.h
+funmap.o: rlconf.h ansi_stdlib.h
+funmap.o: ${BUILD_DIR}/config.h
+histexpand.o: ansi_stdlib.h
histexpand.o: history.h histlib.h
-histsearch.o: history.h histlib.h
+histexpand.o: ${BUILD_DIR}/config.h
+histfile.o: ansi_stdlib.h
histfile.o: history.h histlib.h
-isearch.o: readline.h history.h
-search.o: readline.h history.h
-display.o: readline.h history.h rldefs.h rlconf.h tcap.h
-complete.o: readline.h rldefs.h rlconf.h posixdir.h posixstat.h
-rltty.o: rldefs.h rlconf.h readline.h rltty.h
-bind.o: rldefs.h rlconf.h readline.h history.h
-signals.o: rldefs.h rlconf.h readline.h history.h
-parens.o: readline.h
-kill.o: rldefs.h rlconf.h readline.h history.h
-macro.o: rldefs.h rlconf.h readline.h history.h
-undo.o: rldefs.h rlconf.h readline.h history.h
-input.o: rldefs.h rlconf.h readline.h history.h
-callback.o: rlconf.h rldefs.h readline.h
-terminal.o: rlconf.h rldefs.h readline.h tcap.h history.h
-
-bind.o: $(BUILD_DIR)/config.h
-callback.o: $(BUILD_DIR)/config.h
-complete.o: $(BUILD_DIR)/config.h
-display.o: $(BUILD_DIR)/config.h
-funmap.o: $(BUILD_DIR)/config.h
-histexpand.o: $(BUILD_DIR)/config.h
-histfile.o: $(BUILD_DIR)/config.h
-history.o: $(BUILD_DIR)/config.h
-histsearch.o: $(BUILD_DIR)/config.h
-input.o: $(BUILD_DIR)/config.h
-isearch.o: $(BUILD_DIR)/config.h
-keymaps.o: $(BUILD_DIR)/config.h
-kill.o: $(BUILD_DIR)/config.h
-macro.o: $(BUILD_DIR)/config.h
-parens.o: $(BUILD_DIR)/config.h
-readline.o: $(BUILD_DIR)/config.h
-rltty.o: $(BUILD_DIR)/config.h
-search.o: $(BUILD_DIR)/config.h
-signals.o: $(BUILD_DIR)/config.h
-tilde.o: $(BUILD_DIR)/config.h
-undo.o: $(BUILD_DIR)/config.h
-util.o: $(BUILD_DIR)/config.h
-vi_mode.o: $(BUILD_DIR)/config.h
-xmalloc.o: $(BUILD_DIR)/config.h
+histfile.o: ${BUILD_DIR}/config.h
+history.o: ansi_stdlib.h
+history.o: history.h histlib.h
+history.o: ${BUILD_DIR}/config.h
+histsearch.o: ansi_stdlib.h
+histsearch.o: history.h histlib.h
+histsearch.o: ${BUILD_DIR}/config.h
+input.o: ansi_stdlib.h
+input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+input.o: readline.h keymaps.h chardefs.h tilde.h
+isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+isearch.o: readline.h keymaps.h chardefs.h tilde.h
+isearch.o: ansi_stdlib.h history.h
+keymaps.o: emacs_keymap.c vi_keymap.c
+keymaps.o: keymaps.h chardefs.h rlconf.h ansi_stdlib.h
+keymaps.o: readline.h keymaps.h chardefs.h tilde.h
+keymaps.o: ${BUILD_DIR}/config.h
+kill.o: ansi_stdlib.h
+kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+kill.o: readline.h keymaps.h chardefs.h tilde.h
+kill.o: history.h
+macro.o: ansi_stdlib.h
+macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+macro.o: readline.h keymaps.h chardefs.h tilde.h
+macro.o: history.h
+nls.o: ansi_stdlib.h
+nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+parens.o: rlconf.h
+parens.o: ${BUILD_DIR}/config.h
+parens.o: readline.h keymaps.h chardefs.h tilde.h
+readline.o: readline.h keymaps.h chardefs.h tilde.h
+readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+readline.o: history.h
+readline.o: posixstat.h ansi_stdlib.h posixjmp.h
+rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+rltty.o: rltty.h
+rltty.o: readline.h keymaps.h chardefs.h tilde.h
+search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+search.o: readline.h keymaps.h chardefs.h tilde.h
+search.o: ansi_stdlib.h history.h
+signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+signals.o: readline.h keymaps.h chardefs.h tilde.h
+signals.o: history.h
+terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+terminal.o: tcap.h
+terminal.o: readline.h keymaps.h chardefs.h tilde.h
+terminal.o: history.h
+tilde.o: ansi_stdlib.h
+tilde.o: ${BUILD_DIR}/config.h
+tilde.o: tilde.h
+undo.o: ansi_stdlib.h
+undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+undo.o: readline.h keymaps.h chardefs.h tilde.h
+undo.o: history.h
+util.o: posixjmp.h ansi_stdlib.h
+util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+util.o: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+vi_mode.o: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.o: history.h ansi_stdlib.h
+xmalloc.o: ${BUILD_DIR}/config.h
+xmalloc.o: ansi_stdlib.h
+
+bind.so: ansi_stdlib.h posixstat.h
+bind.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+bind.so: readline.h keymaps.h chardefs.h tilde.h
+bind.so: history.h
+callback.so: rlconf.h
+callback.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+callback.so: readline.h keymaps.h chardefs.h tilde.h
+complete.so: ansi_stdlib.h posixdir.h posixstat.h
+complete.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+complete.so: readline.h keymaps.h chardefs.h tilde.h
+display.so: ansi_stdlib.h posixstat.h
+display.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+display.so: tcap.h
+display.so: readline.h keymaps.h chardefs.h tilde.h
+display.so: history.h
+funmap.so: readline.h keymaps.h chardefs.h tilde.h
+funmap.so: rlconf.h ansi_stdlib.h
+funmap.so: ${BUILD_DIR}/config.h
+histexpand.so: ansi_stdlib.h
+histexpand.so: history.h histlib.h
+histexpand.so: ${BUILD_DIR}/config.h
+histfile.so: ansi_stdlib.h
+histfile.so: history.h histlib.h
+histfile.so: ${BUILD_DIR}/config.h
+history.so: ansi_stdlib.h
+history.so: history.h histlib.h
+history.so: ${BUILD_DIR}/config.h
+histsearch.so: ansi_stdlib.h
+histsearch.so: history.h histlib.h
+histsearch.so: ${BUILD_DIR}/config.h
+input.so: ansi_stdlib.h
+input.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+input.so: readline.h keymaps.h chardefs.h tilde.h
+isearch.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+isearch.so: readline.h keymaps.h chardefs.h tilde.h
+isearch.so: ansi_stdlib.h history.h
+keymaps.so: emacs_keymap.c vi_keymap.c
+keymaps.so: keymaps.h chardefs.h rlconf.h ansi_stdlib.h
+keymaps.so: readline.h keymaps.h chardefs.h tilde.h
+keymaps.so: ${BUILD_DIR}/config.h
+kill.so: ansi_stdlib.h
+kill.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+kill.so: readline.h keymaps.h chardefs.h tilde.h
+kill.so: history.h
+macro.so: ansi_stdlib.h
+macro.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+macro.so: readline.h keymaps.h chardefs.h tilde.h
+macro.so: history.h
+nls.so: ansi_stdlib.h
+nls.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+parens.so: rlconf.h
+parens.so: ${BUILD_DIR}/config.h
+parens.so: readline.h keymaps.h chardefs.h tilde.h
+readline.so: readline.h keymaps.h chardefs.h tilde.h
+readline.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+readline.so: history.h
+readline.so: posixstat.h ansi_stdlib.h posixjmp.h
+rltty.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+rltty.so: rltty.h
+rltty.so: readline.h keymaps.h chardefs.h tilde.h
+search.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+search.so: readline.h keymaps.h chardefs.h tilde.h
+search.so: ansi_stdlib.h history.h
+signals.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+signals.so: readline.h keymaps.h chardefs.h tilde.h
+signals.so: history.h
+terminal.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+terminal.so: tcap.h
+terminal.so: readline.h keymaps.h chardefs.h tilde.h
+terminal.so: history.h
+tilde.so: ansi_stdlib.h
+tilde.so: ${BUILD_DIR}/config.h
+tilde.so: tilde.h
+undo.so: ansi_stdlib.h
+undo.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+undo.so: readline.h keymaps.h chardefs.h tilde.h
+undo.so: history.h
+util.so: posixjmp.h ansi_stdlib.h
+util.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+util.so: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h
+vi_mode.so: readline.h keymaps.h chardefs.h tilde.h
+vi_mode.so: history.h ansi_stdlib.h
+xmalloc.so: ${BUILD_DIR}/config.h
+xmalloc.so: ansi_stdlib.h
+
+readline.so: $(srcdir)/readline.c
+vi_mode.so: $(srcdir)/vi_mode.c
+funmap.so: $(srcdir)/funmap.c
+keymaps.so: $(srcdir)/keymaps.c
+parens.so: $(srcdir)/parens.c
+search.so: $(srcdir)/search.c
+rltty.so: $(srcdir)/rltty.c
+complete.so: $(srcdir)/complete.c
+bind.so: $(srcdir)/bind.c
+isearch.so: $(srcdir)/isearch.c
+display.so: $(srcdir)/display.c
+signals.so: $(srcdir)/signals.c
+util.so: $(srcdir)/util.c
+kill.so: $(srcdir)/kill.c
+undo.so: $(srcdir)/undo.c
+macro.so: $(srcdir)/macro.c
+input.so: $(srcdir)/input.c
+callback.so: $(srcdir)/callback.c
+terminal.so: $(srcdir)/terminal.c
+nls.so: $(srcdir)/nls.c
+xmalloc.so: $(srcdir)/xmalloc.c
+history.so: $(srcdir)/history.c
+histexpand.so: $(srcdir)/histexpand.c
+histfile.so: $(srcdir)/histfile.c
+histsearch.so: $(srcdir)/histsearch.c
+shell.so: $(srcdir)/shell.c
+tilde.so: $(srcdir)/tilde.c
diff --git a/contrib/libreadline/README b/contrib/libreadline/README
index 131471ca8354..e14aee8bef2f 100644
--- a/contrib/libreadline/README
+++ b/contrib/libreadline/README
@@ -1,6 +1,112 @@
-This is the distribution of the Gnu Readline library. See the file
-STANDALONE for a description of the #defines that can be passed via
-the makefile to build readline on different systems.
+Introduction
+============
+
+This is the Gnu Readline library, version 2.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
+Emacs and vi editing modes are available. The Readline library includes
+additional functions to maintain a list of previously-entered command
+lines, to recall and perhaps reedit those lines, and perform csh-like
+history expansion on previous commands.
+
+The history facilites are also placed into a separate library, the
+History library, as part of the build process. The History library
+may be used without Readline in applications which desire its
+capabilities.
+
+The Readline library is free software, distributed under the terms of
+the GNU Public License, version 2. For more information, see the file
+COPYING.
+
+To build the library, try typing `./configure', then `make'. The
+configuration process is automated, so no further intervention should
+be necessary. Readline builds with `gcc' by default if it is
+available. If you want to use `cc' instead, type
+
+ CC=cc ./configure
+
+if you are using a Bourne-style shell. If you are not, the following
+may work:
+
+ env CC=cc ./configure
+
+Read the file INSTALL in this directory for more information about how
+to customize and control the build process.
The file rlconf.h contains defines that enable and disable certain
-readline features.
+Readline features.
+
+Examples
+========
+
+There are several example programs that use Readline features in the
+examples directory. The `rl' program is of particular interest. It
+is a command-line interface to Readline, suitable for use in shell
+scripts in place of `read'.
+
+Shared Libraries
+================
+
+There is skeletal support for building shared versions of the
+Readline and History libraries.
+
+Typing `make shared' will cause shared versions of the Readline and
+History libraries to be built on SunOS 4.1.x. For versions of Unix
+other than SunOS, you will have to make some changes to Makefile.in.
+The relevant variables are:
+
+PICFLAG Options to give to the compiler to produce position-independent
+ code. The value `-fpic' works for most versions of gcc.
+SHLIB_OPTS Options to give to the linker to produce a shared library.
+ The value `-assert pure-text -ldl' works on SunOS 4.1.x.
+ The value `-Bshareable' works for some versions of GNU ld.
+
+MAJOR The major version number of the shared library. You should
+ not need to change this.
+MINOR The minor version number of the shared library. Some systems,
+ such as SVR4 and its descendents (e.g., Solaris, Unixware),
+ do not use minor version numbers. For those systems, this
+ variable should be left unset.
+
+LD The linker. The value of `ld' is correct for SunOS 4.1.x.
+ You may need to change it to `gcc'; make sure to change
+ SHLIB_OPTS if you do so.
+
+Once you have edited Makefile.in, type `make Makefile' to rebuild the
+Makefile, then `make shared' to build the shared libraries.
+
+Documentation
+=============
+
+The documentation for the Readline and History libraries appears in the
+`doc' subdirectory. There are two texinfo files and a Unix-style manual
+page describing the programming facilities available in the Readline
+library. The texinfo files include both user and programmer's manuals.
+
+Reporting Bugs
+==============
+
+Bug reports for Readline should be sent to:
+
+ bug-readline@prep.ai.mit.edu
+
+When reporting a bug, please include the following information:
+
+ * the version number and release status of Readline (e.g., 2.1-release)
+ * the machine and OS that it is running on
+ * a list of the compilation flags or the contents of `config.h', if
+ appropriate
+ * a description of the bug
+ * a recipe for recreating the bug reliably
+ * a fix for the bug if you have one!
+
+If you would like to contact the Readline maintainer directly, send mail
+to bash-maintainers@prep.ai.mit.edu.
+
+Since Readline is developed along with bash, the bug-bash@prep.ai.mit.edu
+mailing list (mirrored to the Usenet newsgroup gnu.bash.bug) often contains
+Readline bug reports and fixes.
+
+Chet Ramey
+chet@po.cwru.edu
diff --git a/contrib/libreadline/acconfig.h b/contrib/libreadline/acconfig.h
new file mode 100644
index 000000000000..4f4223886c2b
--- /dev/null
+++ b/contrib/libreadline/acconfig.h
@@ -0,0 +1,30 @@
+/* acconfig.h
+ This file is in the public domain.
+
+ Descriptive text for the C preprocessor macros that
+ the distributed Autoconf macros can define.
+ No software package will use all of them; autoheader copies the ones
+ your configure.in uses into your configuration header file templates.
+
+ The entries are in sort -df order: alphabetical, case insensitive,
+ ignoring punctuation (such as underscores). Although this order
+ can split up related entries, it makes it easier to check whether
+ a given entry is in the file.
+
+ Leave the following blank line there!! Autoheader needs it. */
+
+
+/* Definitions pulled in from aclocal.m4. */
+#undef VOID_SIGHANDLER
+
+#undef TIOCGWINSZ_IN_SYS_IOCTL
+
+#undef TIOCSTAT_IN_SYS_IOCTL
+
+#undef HAVE_GETPW_DECLS
+
+
+/* Leave that blank line there!! Autoheader needs it.
+ If you're adding to this file, keep in mind:
+ The entries are in sort -df order: alphabetical, case insensitive,
+ ignoring punctuation (such as underscores). */
diff --git a/contrib/libreadline/aclocal.m4 b/contrib/libreadline/aclocal.m4
new file mode 100644
index 000000000000..b852ac0239ed
--- /dev/null
+++ b/contrib/libreadline/aclocal.m4
@@ -0,0 +1,1096 @@
+dnl
+dnl Bash specific tests
+dnl
+dnl Some derived from PDKSH 5.1.3 autoconf tests
+dnl
+dnl
+dnl Check if dup2() does not clear the close on exec flag
+dnl
+AC_DEFUN(BASH_DUP2_CLOEXEC_CHECK,
+[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
+AC_CACHE_VAL(bash_cv_dup2_broken,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <fcntl.h>
+main()
+{
+ int fd1, fd2, fl;
+ fd1 = open("/dev/null", 2);
+ if (fcntl(fd1, 2, 1) < 0)
+ exit(1);
+ fd2 = dup2(fd1, 1);
+ if (fd2 < 0)
+ exit(2);
+ fl = fcntl(fd2, 1, 0);
+ /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
+ exit(fl != 1);
+}
+], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
+ AC_MSG_ERROR(cannot check dup2 if cross compiling))
+])
+AC_MSG_RESULT($bash_cv_dup2_broken)
+if test $bash_cv_dup2_broken = yes; then
+AC_DEFINE(DUP2_BROKEN)
+fi
+])
+
+dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
+AC_DEFUN(BASH_SIGNAL_CHECK,
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_MSG_CHECKING(for type of signal functions)
+AC_CACHE_VAL(bash_cv_signal_vintage,
+[
+ AC_TRY_LINK([#include <signal.h>],[
+ sigset_t ss;
+ struct sigaction sa;
+ sigemptyset(&ss); sigsuspend(&ss);
+ sigaction(SIGINT, &sa, (struct sigaction *) 0);
+ sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+ ], bash_cv_signal_vintage=posix,
+ [
+ AC_TRY_LINK([#include <signal.h>], [
+ int mask = sigmask(SIGINT);
+ sigsetmask(mask); sigblock(mask); sigpause(mask);
+ ], bash_cv_signal_vintage=4.2bsd,
+ [
+ AC_TRY_LINK([
+ #include <signal.h>
+ RETSIGTYPE foo() { }], [
+ int mask = sigmask(SIGINT);
+ sigset(SIGINT, foo); sigrelse(SIGINT);
+ sighold(SIGINT); sigpause(SIGINT);
+ ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
+ )]
+ )]
+)
+])
+AC_MSG_RESULT($bash_cv_signal_vintage)
+if test "$bash_cv_signal_vintage" = posix; then
+AC_DEFINE(HAVE_POSIX_SIGNALS)
+elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
+AC_DEFINE(HAVE_BSD_SIGNALS)
+elif test "$bash_cv_signal_vintage" = svr3; then
+AC_DEFINE(HAVE_USG_SIGHOLD)
+fi
+])
+
+dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
+AC_DEFUN(BASH_PGRP_SYNC,
+[AC_REQUIRE([AC_FUNC_GETPGRP])
+AC_MSG_CHECKING(whether pgrps need synchronization)
+AC_CACHE_VAL(bash_cv_pgrp_pipe,
+[AC_TRY_RUN([
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+main()
+{
+# ifdef GETPGRP_VOID
+# define getpgID() getpgrp()
+# else
+# define getpgID() getpgrp(0)
+# define setpgid(x,y) setpgrp(x,y)
+# endif
+ int pid1, pid2, fds[2];
+ int status;
+ char ok;
+
+ switch (pid1 = fork()) {
+ case -1:
+ exit(1);
+ case 0:
+ setpgid(0, getpid());
+ exit(0);
+ }
+ setpgid(pid1, pid1);
+
+ sleep(2); /* let first child die */
+
+ if (pipe(fds) < 0)
+ exit(2);
+
+ switch (pid2 = fork()) {
+ case -1:
+ exit(3);
+ case 0:
+ setpgid(0, pid1);
+ ok = getpgID() == pid1;
+ write(fds[1], &ok, 1);
+ exit(0);
+ }
+ setpgid(pid2, pid1);
+
+ close(fds[1]);
+ if (read(fds[0], &ok, 1) != 1)
+ exit(4);
+ wait(&status);
+ wait(&status);
+ exit(ok ? 0 : 5);
+}
+], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
+ AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling))
+])
+AC_MSG_RESULT($bash_cv_pgrp_pipe)
+if test $bash_cv_pgrp_pipe = yes; then
+AC_DEFINE(PGRP_PIPE)
+fi
+])
+
+dnl
+dnl check for typedef'd symbols in header files, but allow the caller to
+dnl specify the include files to be checked in addition to the default
+dnl
+dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
+AC_DEFUN(BASH_CHECK_TYPE,
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(bash_cv_type_$1,
+[AC_EGREP_CPP($1, [#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#endif
+$2
+], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
+AC_MSG_RESULT($bash_cv_type_$1)
+ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
+ AC_DEFINE($4)
+ fi])
+if test $bash_cv_type_$1 = no; then
+ AC_DEFINE($1, $3)
+fi
+])
+
+dnl
+dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
+dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
+dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify
+dnl matters, this just checks for rlim_t, quad_t, or long.
+dnl
+AC_DEFUN(BASH_RLIMIT_TYPE,
+[AC_MSG_CHECKING(for size and type of struct rlimit fields)
+AC_CACHE_VAL(bash_cv_type_rlimit,
+[AC_TRY_COMPILE([#include <sys/types.h>],
+[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+main()
+{
+#ifdef HAVE_QUAD_T
+ struct rlimit rl;
+ if (sizeof(rl.rlim_cur) == sizeof(quad_t))
+ exit(0);
+#endif
+ exit(1);
+}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
+ AC_MSG_ERROR(cannot check quad_t if cross compiling))])
+])
+AC_MSG_RESULT($bash_cv_type_rlimit)
+if test $bash_cv_type_rlimit = quad_t; then
+AC_DEFINE(RLIMTYPE, quad_t)
+elif test $bash_cv_type_rlimit = rlim_t; then
+AC_DEFINE(RLIMTYPE, rlim_t)
+fi
+])
+
+dnl
+dnl Check for sys_siglist[] or _sys_siglist[]
+dnl
+AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
+[AC_MSG_CHECKING([for _sys_siglist in system C library])
+AC_CACHE_VAL(bash_cv_under_sys_siglist,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifndef _sys_siglist
+extern char *_sys_siglist[];
+#endif
+main()
+{
+char *msg = _sys_siglist[2];
+exit(msg == 0);
+}],
+bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
+AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling))])dnl
+AC_MSG_RESULT($bash_cv_under_sys_siglist)
+if test $bash_cv_under_sys_siglist = yes; then
+AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
+fi
+])
+
+AC_DEFUN(BASH_SYS_SIGLIST,
+[AC_REQUIRE([AC_DECL_SYS_SIGLIST])
+AC_MSG_CHECKING([for sys_siglist in system C library])
+AC_CACHE_VAL(bash_cv_sys_siglist,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifndef SYS_SIGLIST_DECLARED
+extern char *sys_siglist[];
+#endif
+main()
+{
+char *msg = sys_siglist[2];
+exit(msg == 0);
+}],
+bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
+AC_MSG_ERROR(cannot check for sys_siglist if cross compiling))])dnl
+AC_MSG_RESULT($bash_cv_sys_siglist)
+if test $bash_cv_sys_siglist = yes; then
+AC_DEFINE(HAVE_SYS_SIGLIST)
+fi
+])
+
+dnl Check for sys_errlist[] and sys_nerr, check for declaration
+AC_DEFUN(BASH_SYS_ERRLIST,
+[AC_MSG_CHECKING([for sys_errlist and sys_nerr])
+AC_CACHE_VAL(bash_cv_sys_errlist,
+[AC_TRY_LINK([#include <errno.h>],
+[extern char *sys_errlist[];
+ extern int sys_nerr;
+ char *msg = sys_errlist[sys_nerr - 1];],
+ bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
+AC_MSG_RESULT($bash_cv_sys_errlist)
+if test $bash_cv_sys_errlist = yes; then
+AC_DEFINE(HAVE_SYS_ERRLIST)
+fi
+])
+
+dnl Check to see if opendir will open non-directories (not a nice thing)
+AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
+[AC_REQUIRE([AC_HEADER_DIRENT])dnl
+AC_MSG_CHECKING(if opendir() opens non-directories)
+AC_CACHE_VAL(bash_cv_opendir_not_robust,
+[AC_TRY_RUN([
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+main()
+{
+DIR *dir;
+int fd;
+unlink("/tmp/not_a_directory");
+fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666);
+write(fd, "\n", 1);
+close(fd);
+dir = opendir("/tmp/not_a_directory");
+unlink("/tmp/not_a_directory");
+exit (dir == 0);
+}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
+ AC_MSG_ERROR(cannot check opendir if cross compiling))])
+AC_MSG_RESULT($bash_cv_opendir_not_robust)
+if test $bash_cv_opendir_not_robust = yes; then
+AC_DEFINE(OPENDIR_NOT_ROBUST)
+fi
+])
+
+dnl
+AC_DEFUN(BASH_TYPE_SIGHANDLER,
+[AC_MSG_CHECKING([whether signal handlers are of type void])
+AC_CACHE_VAL(bash_cv_void_sighandler,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C"
+#endif
+void (*signal ()) ();],
+[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
+AC_MSG_RESULT($bash_cv_void_sighandler)
+if test $bash_cv_void_sighandler = yes; then
+AC_DEFINE(VOID_SIGHANDLER)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_STRSIGNAL,
+[AC_MSG_CHECKING([for the existance of strsignal])
+AC_CACHE_VAL(bash_cv_have_strsignal,
+[AC_TRY_LINK([#include <sys/types.h>
+#include <signal.h>],
+[char *s = (char *)strsignal(2);],
+ bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
+AC_MSG_RESULT($bash_cv_have_strsignal)
+if test $bash_cv_have_strsignal = yes; then
+AC_DEFINE(HAVE_STRSIGNAL)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_LSTAT,
+[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
+dnl inline function in <sys/stat.h>.
+AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
+[AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/stat.h>
+],[ lstat("",(struct stat *)0); ],
+bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
+if test $bash_cv_func_lstat = yes; then
+ AC_DEFINE(HAVE_LSTAT)
+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,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <termios.h>],[struct termios t; int i; i = t.c_line;],
+ bash_cv_termios_ldisc=yes, bash_cv_termios_ldisc=no)])dnl
+AC_MSG_RESULT($bash_cv_termios_ldisc)
+if test $bash_cv_termios_ldisc = yes; then
+AC_DEFINE(TERMIOS_LDISC)
+fi
+])
+
+AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
+[AC_MSG_CHECKING([for a c_line member of struct termio])
+AC_CACHE_VAL(bash_cv_termio_ldisc,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <termio.h>],[struct termio t; int i; i = t.c_line;],
+ bash_cv_termio_ldisc=yes, bash_cv_termio_ldisc=no)])dnl
+AC_MSG_RESULT($bash_cv_termio_ldisc)
+if test $bash_cv_termio_ldisc = yes; then
+AC_DEFINE(TERMIO_LDISC)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_GETENV,
+[AC_MSG_CHECKING(to see if getenv can be redefined)
+AC_CACHE_VAL(bash_cv_getenv_redef,
+[AC_TRY_RUN([
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifndef __STDC__
+# ifndef const
+# define const
+# endif
+#endif
+char *
+getenv (name)
+#if defined (__linux__) || defined (__bsdi__) || defined (convex)
+ const char *name;
+#else
+ char const *name;
+#endif /* !__linux__ && !__bsdi__ && !convex */
+{
+return "42";
+}
+main()
+{
+char *s;
+/* The next allows this program to run, but does not allow bash to link
+ when it redefines getenv. I'm not really interested in figuring out
+ why not. */
+#if defined (NeXT)
+exit(1);
+#endif
+s = getenv("ABCDE");
+exit(s == 0); /* force optimizer to leave getenv in */
+}
+], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
+AC_MSG_ERROR(cannot check getenv redefinition if cross compiling))])
+AC_MSG_RESULT($bash_cv_getenv_redef)
+if test $bash_cv_getenv_redef = yes; then
+AC_DEFINE(CAN_REDEFINE_GETENV)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_PRINTF,
+[AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
+AC_CACHE_VAL(bash_cv_printf_declared,
+[AC_TRY_RUN([
+#include <stdio.h>
+#ifdef __STDC__
+typedef int (*_bashfunc)(const char *, ...);
+#else
+typedef int (*_bashfunc)();
+#endif
+main()
+{
+_bashfunc pf;
+pf = printf;
+exit(pf == 0);
+}
+],bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
+AC_MSG_ERROR(cannot check printf declaration if cross compiling))])
+AC_MSG_RESULT($bash_cv_printf_declared)
+if test $bash_cv_printf_declared = yes; then
+AC_DEFINE(PRINTF_DECLARED)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
+[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
+AC_CACHE_VAL(bash_cv_ulimit_maxfds,
+[AC_TRY_RUN([
+main()
+{
+long maxfds = ulimit(4, 0L);
+exit (maxfds == -1L);
+}
+],bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
+AC_MSG_ERROR(cannot check ulimit if cross compiling))])
+AC_MSG_RESULT($bash_cv_ulimit_maxfds)
+if test $bash_cv_ulimit_maxfds = yes; then
+AC_DEFINE(ULIMIT_MAXFDS)
+fi
+])
+
+AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
+[
+if test "X$bash_cv_termcap_lib" = "X"; then
+_bash_needmsg=yes
+else
+AC_MSG_CHECKING(which library has the termcap functions)
+_bash_needmsg=
+fi
+AC_CACHE_VAL(bash_cv_termcap_lib,
+[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
+ [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
+ [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
+ bash_cv_termcap_lib=gnutermcap)])])])
+if test "X$_bash_needmsg" = "Xyes"; then
+AC_MSG_CHECKING(which library has the termcap functions)
+fi
+AC_MSG_RESULT(using $bash_cv_termcap_lib)
+if test $bash_cv_termcap_lib = gnutermcap; then
+LDFLAGS="$LDFLAGS -L./lib/termcap"
+TERMCAP_LIB="./lib/termcap/libtermcap.a"
+TERMCAP_DEP="./lib/termcap/libtermcap.a"
+elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
+TERMCAP_LIB=-ltermcap
+TERMCAP_DEP=
+elif test $bash_cv_termcap_lib = libncurses; then
+TERMCAP_LIB=-lncurses
+TERMCAP_DEP=
+else
+TERMCAP_LIB=-lcurses
+TERMCAP_DEP=
+fi
+])
+
+AC_DEFUN(BASH_FUNC_GETCWD,
+[AC_MSG_CHECKING([if getcwd() calls popen()])
+AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
+[AC_TRY_RUN([
+#include <stdio.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifndef __STDC__
+#ifndef const
+#define const
+#endif
+#endif
+
+int popen_called;
+
+FILE *
+popen(command, type)
+ const char *command;
+ const char *type;
+{
+ popen_called = 1;
+ return (FILE *)NULL;
+}
+
+FILE *_popen(command, type)
+ const char *command;
+ const char *type;
+{
+ return (popen (command, type));
+}
+
+int
+pclose(stream)
+FILE *stream;
+{
+ return 0;
+}
+
+int
+_pclose(stream)
+FILE *stream;
+{
+ return 0;
+}
+
+main()
+{
+ char lbuf[32];
+ popen_called = 0;
+ getcwd(lbuf, 32);
+ exit (popen_called);
+}
+], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
+AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling))])
+AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
+if test $bash_cv_getcwd_calls_popen = yes; then
+AC_DEFINE(GETCWD_BROKEN)
+fi
+])
+
+AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
+[AC_REQUIRE([AC_HEADER_DIRENT])
+AC_MSG_CHECKING(if struct dirent has a d_ino member)
+AC_CACHE_VAL(bash_cv_dirent_has_dino,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+],[
+struct dirent d; int z; z = d.d_ino;
+], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
+AC_MSG_RESULT($bash_cv_dirent_has_dino)
+if test $bash_cv_dirent_has_dino = yes; then
+AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
+fi
+])
+
+AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
+[AC_REQUIRE([AC_HEADER_DIRENT])
+AC_MSG_CHECKING(if struct dirent has a d_fileno member)
+AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
+[AC_TRY_COMPILE([
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+],[
+struct dirent d; int z; z = d.d_fileno;
+], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
+AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
+if test $bash_cv_dirent_has_d_fileno = yes; then
+AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO)
+fi
+])
+
+AC_DEFUN(BASH_REINSTALL_SIGHANDLERS,
+[AC_REQUIRE([AC_TYPE_SIGNAL])
+AC_REQUIRE([BASH_SIGNAL_CHECK])
+AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
+AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
+[AC_TRY_RUN([
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+typedef RETSIGTYPE sigfunc();
+
+int nsigint;
+
+#ifdef HAVE_POSIX_SIGNALS
+sigfunc *
+set_signal_handler(sig, handler)
+ int sig;
+ sigfunc *handler;
+{
+ struct sigaction act, oact;
+ act.sa_handler = handler;
+ act.sa_flags = 0;
+ sigemptyset (&act.sa_mask);
+ sigemptyset (&oact.sa_mask);
+ sigaction (sig, &act, &oact);
+ return (oact.sa_handler);
+}
+#else
+#define set_signal_handler(s, h) signal(s, h)
+#endif
+
+RETSIGTYPE
+sigint(s)
+int s;
+{
+ nsigint++;
+}
+
+main()
+{
+ nsigint = 0;
+ set_signal_handler(SIGINT, sigint);
+ kill((int)getpid(), SIGINT);
+ kill((int)getpid(), SIGINT);
+ exit(nsigint != 2);
+}
+], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
+AC_MSG_ERROR(cannot check signal handling if cross compiling))])
+AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
+if test $bash_cv_must_reinstall_sighandlers = yes; then
+AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_SBRK_DECLARED,
+[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
+AC_CACHE_VAL(bash_cv_sbrk_declared,
+[AC_EGREP_HEADER(sbrk, unistd.h,
+ bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
+AC_MSG_RESULT($bash_cv_sbrk_declared)
+if test $bash_cv_sbrk_declared = yes; then
+AC_DEFINE(SBRK_DECLARED)
+fi
+])
+
+dnl check that some necessary job control definitions are present
+AC_DEFUN(BASH_JOB_CONTROL_MISSING,
+[AC_REQUIRE([BASH_SIGNAL_CHECK])
+AC_MSG_CHECKING(for presence of necessary job control definitions)
+AC_CACHE_VAL(bash_cv_job_control_missing,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <signal.h>
+
+/* Add more tests in here as appropriate. */
+main()
+{
+/* signal type */
+#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
+exit(1);
+#endif
+
+/* signals and tty control. */
+#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
+exit (1);
+#endif
+
+/* process control */
+#if !defined (WNOHANG) || !defined (WUNTRACED)
+exit(1);
+#endif
+
+/* Posix systems have tcgetpgrp and waitpid. */
+#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
+exit(1);
+#endif
+
+#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
+exit(1);
+#endif
+
+/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
+#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
+exit(1);
+#endif
+
+exit(0);
+}],bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
+ AC_MSG_ERROR(cannot check job control if cross-compiling))
+])
+AC_MSG_RESULT($bash_cv_job_control_missing)
+if test $bash_cv_job_control_missing = missing; then
+AC_DEFINE(JOB_CONTROL_MISSING)
+fi
+])
+
+dnl check whether named pipes are present
+dnl this requires a previous check for mkfifo, but that is awkward to specify
+AC_DEFUN(BASH_SYS_NAMED_PIPES,
+[AC_MSG_CHECKING(for presence of named pipes)
+AC_CACHE_VAL(bash_cv_sys_named_pipes,
+[AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* Add more tests in here as appropriate. */
+main()
+{
+int fd;
+
+#if defined (HAVE_MKFIFO)
+exit (0);
+#endif
+
+#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
+exit (1);
+#endif
+
+#if defined (NeXT)
+exit (1);
+#endif
+
+fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0);
+if (fd == -1)
+ exit (1);
+close(fd);
+unlink ("/tmp/sh-np-autoconf");
+exit(0);
+}],bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
+ AC_MSG_ERROR(cannot check for named pipes if cross-compiling))
+])
+AC_MSG_RESULT($bash_cv_sys_named_pipes)
+if test $bash_cv_sys_named_pipes = missing; then
+AC_DEFINE(NAMED_PIPES_MISSING)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
+[AC_REQUIRE([BASH_SIGNAL_CHECK])
+AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
+AC_CACHE_VAL(bash_cv_func_sigsetjmp,
+[AC_TRY_RUN([
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <signal.h>
+#include <setjmp.h>
+
+main()
+{
+#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
+exit (1);
+#else
+
+int code;
+sigset_t set, oset;
+sigjmp_buf xx;
+
+/* get the mask */
+sigemptyset(&set);
+sigemptyset(&oset);
+sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
+sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
+
+/* save it */
+code = sigsetjmp(xx, 1);
+if (code)
+ exit(0); /* could get sigmask and compare to oset here. */
+
+/* change it */
+sigaddset(&set, SIGINT);
+sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
+
+/* and siglongjmp */
+siglongjmp(xx, 10);
+exit(1);
+#endif
+}],bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
+ AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling))
+])
+AC_MSG_RESULT($bash_cv_func_sigsetjmp)
+if test $bash_cv_func_sigsetjmp = present; then
+AC_DEFINE(HAVE_POSIX_SIGSETJMP)
+fi
+])
+
+AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
+[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
+AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
+ bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
+AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
+if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
+AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
+fi
+])
+
+AC_DEFUN(BASH_STRUCT_WINSIZE,
+[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h)
+AC_CACHE_VAL(bash_cv_struct_winsize_in_ioctl,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ioctl.h>], [struct winsize x;],
+ bash_cv_struct_winsize_in_ioctl=yes,bash_cv_struct_winsize_in_ioctl=no)])
+AC_MSG_RESULT($bash_cv_struct_winsize_in_ioctl)
+if test $bash_cv_struct_winsize_in_ioctl = yes; then
+AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
+fi
+])
+
+AC_DEFUN(BASH_HAVE_TIOCSTAT,
+[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
+AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ioctl.h>], [int x = TIOCSTAT;],
+ bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
+AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
+if test $bash_cv_tiocstat_in_ioctl = yes; then
+AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
+fi
+])
+
+AC_DEFUN(BASH_HAVE_FIONREAD,
+[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
+AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/ioctl.h>], [int x = FIONREAD;],
+ bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
+AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
+if test $bash_cv_fionread_in_ioctl = yes; then
+AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
+fi
+])
+
+dnl
+dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
+dnl require a definition of speed_t each time <termcap.h> is included,
+dnl but you can only get speed_t if you include <termios.h> (on some
+dnl versions) or <sys/types.h> (on others).
+dnl
+AC_DEFUN(BASH_MISC_SPEED_T,
+[AC_MSG_CHECKING(for speed_t in sys/types.h)
+AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
+[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
+ bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
+AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
+if test $bash_cv_speed_t_in_sys_types = yes; then
+AC_DEFINE(SPEED_T_IN_SYS_TYPES)
+fi
+])
+
+AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
+[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
+AC_CACHE_VAL(bash_cv_can_redecl_getpw,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <pwd.h>
+extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
+ bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)])
+AC_MSG_RESULT($bash_cv_can_redecl_getpw)
+if test $bash_cv_can_redecl_getpw = no; then
+AC_DEFINE(HAVE_GETPW_DECLS)
+fi
+])
+
+AC_DEFUN(BASH_CHECK_DEV_FD,
+[AC_MSG_CHECKING(whether /dev/fd is available)
+AC_CACHE_VAL(bash_cv_dev_fd,
+[if test -d /dev/fd && test -r /dev/fd/0; then
+ bash_cv_dev_fd=standard
+ elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
+ bash_cv_dev_fd=whacky
+ else
+ bash_cv_dev_fd=absent
+ fi
+])
+AC_MSG_RESULT($bash_cv_dev_fd)
+if test $bash_cv_dev_fd = "standard"; then
+ AC_DEFINE(HAVE_DEV_FD)
+ AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
+elif test $bash_cv_dev_fd = "whacky"; then
+ AC_DEFINE(HAVE_DEV_FD)
+ AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
+fi
+])
+
+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
+AC_DEFUN(BASH_CHECK_SOCKLIB,
+[
+if test "X$bash_cv_have_socklib" = "X"; then
+_bash_needmsg=
+else
+AC_MSG_CHECKING(for socket library)
+_bash_needmsg=yes
+fi
+AC_CACHE_VAL(bash_cv_have_socklib,
+[AC_CHECK_LIB(socket, getpeername,
+ bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
+if test "X$_bash_needmsg" = Xyes; then
+ AC_MSG_RESULT($bash_cv_have_socklib)
+ _bash_needmsg=
+fi
+if test $bash_cv_have_socklib = yes; then
+ # check for libnsl, add it to LIBS if present
+ if test "X$bash_cv_have_libnsl" = "X"; then
+ _bash_needmsg=
+ else
+ AC_MSG_CHECKING(for libnsl)
+ _bash_needmsg=yes
+ fi
+ AC_CACHE_VAL(bash_cv_have_libnsl,
+ [AC_CHECK_LIB(nsl, t_open,
+ bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
+ if test "X$_bash_needmsg" = Xyes; then
+ AC_MSG_RESULT($bash_cv_have_libnsl)
+ _bash_needmsg=
+ fi
+ if test $bash_cv_have_libnsl = yes; then
+ LIBS="-lsocket -lnsl $LIBS"
+ else
+ LIBS="-lsocket $LIBS"
+ fi
+ AC_DEFINE(HAVE_LIBSOCKET)
+ AC_DEFINE(HAVE_GETPEERNAME)
+fi
+])
+
+AC_DEFUN(BASH_DEFAULT_MAIL_DIR,
+[AC_MSG_CHECKING(for default mail directory)
+AC_CACHE_VAL(bash_cv_mail_dir,
+[if test -d /var/mail; then
+ bash_cv_mail_dir=/var/mail
+ elif test -d /usr/mail; then
+ bash_cv_mail_dir=/usr/mail
+ elif test -d /usr/spool/mail; then
+ bash_cv_mail_dir=/usr/spool/mail
+ elif test -d /var/spool/mail; then
+ bash_cv_mail_dir=/var/spool/mail
+ else
+ bash_cv_mail_dir=unknown
+ fi
+])
+AC_MSG_RESULT($bash_cv_mail_dir)
+if test $bash_cv_mail_dir = "/var/mail"; then
+ AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/mail")
+elif test $bash_cv_mail_dir = "/usr/mail"; then
+ AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/mail")
+elif test $bash_cv_mail_dir = "/var/spool/mail"; then
+ AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/spool/mail")
+elif test $bash_cv_mail_dir = "/usr/spool/mail"; then
+ AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/spool/mail")
+else
+ AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "unknown")
+fi
+])
+
+dnl
+dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
+dnl
+AC_DEFUN(BASH_KERNEL_RLIMIT_CHECK,
+[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
+AC_CACHE_VAL(bash_cv_kernel_rlimit,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/resource.h>
+],
+[
+ int f;
+ f = RLIMIT_DATA;
+], bash_cv_kernel_rlimit=no,
+ [AC_TRY_COMPILE([
+ #include <sys/types.h>
+ #define _KERNEL
+ #include <sys/resource.h>
+ #undef _KERNEL
+ ],
+ [
+ int f;
+ f = RLIMIT_DATA;
+ ], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
+)])
+AC_MSG_RESULT($bash_cv_kernel_rlimit)
+if test $bash_cv_kernel_rlimit = yes; then
+AC_DEFINE(RLIMIT_NEEDS_KERNEL)
+fi
+])
+
+AC_DEFUN(BASH_FUNC_STRCOLL,
+[
+AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
+AC_CACHE_VAL(bash_cv_func_strcoll_broken,
+[AC_TRY_RUN([
+#include <stdio.h>
+#if defined (HAVE_LOCALE_H)
+#include <locale.h>
+#endif
+
+main(c, v)
+int c;
+char *v[];
+{
+ int r1, r2;
+ char *deflocale, *defcoll;
+
+#ifdef HAVE_SETLOCALE
+ deflocale = setlocale(LC_ALL, "");
+ defcoll = setlocale(LC_COLLATE, "");
+#endif
+
+#ifdef HAVE_STRCOLL
+ /* These two values are taken from tests/glob-test. */
+ r1 = strcoll("abd", "aXd");
+#else
+ r1 = 0;
+#endif
+ r2 = strcmp("abd", "aXd");
+
+ /* These two should both be greater than 0. It is permissible for
+ a system to return different values, as long as the sign is the
+ same. */
+
+ /* Exit with 1 (failure) if these two values are both > 0, since
+ this tests whether strcoll(3) is broken with respect to strcmp(3)
+ in the default locale. */
+ exit (r1 > 0 && r2 > 0);
+}
+], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
+ AC_MSG_ERROR(cannot check strcoll if cross compiling))
+])
+AC_MSG_RESULT($bash_cv_func_strcoll_broken)
+if test $bash_cv_func_strcoll_broken = yes; then
+AC_DEFINE(STRCOLL_BROKEN)
+fi
+])
diff --git a/contrib/libreadline/bind.c b/contrib/libreadline/bind.c
index bd899ca9f883..24c8c48c7008 100644
--- a/contrib/libreadline/bind.c
+++ b/contrib/libreadline/bind.c
@@ -89,11 +89,16 @@ 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;
@@ -202,7 +207,7 @@ rl_set_key (keyseq, function, map)
Function *function;
Keymap map;
{
- return (rl_generic_bind (ISFUNC, keyseq, function, map));
+ return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
}
/* Bind the key sequence represented by the string KEYSEQ to
@@ -381,7 +386,7 @@ rl_untranslate_keyseq (seq)
kseq[i++] = '\\';
kseq[i++] = 'C';
kseq[i++] = '-';
- c = UNCTRL (c);
+ c = _rl_to_lower (UNCTRL (c));
}
else if (c == RUBOUT)
{
@@ -394,7 +399,7 @@ rl_untranslate_keyseq (seq)
if (c == ESC)
{
kseq[i++] = '\\';
- kseq[i++] = 'e';
+ c = 'e';
}
else if (c == '\\' || c == '"')
{
@@ -406,6 +411,53 @@ rl_untranslate_keyseq (seq)
return kseq;
}
+static char *
+_rl_untranslate_macro_value (seq)
+ char *seq;
+{
+ char *ret, *r, *s;
+ int c;
+
+ r = ret = xmalloc (7 * strlen (seq) + 1);
+ for (s = seq; *s; s++)
+ {
+ c = *s;
+ if (META_CHAR (c))
+ {
+ *r++ = '\\';
+ *r++ = 'M';
+ *r++ = '-';
+ c = UNMETA (c);
+ }
+ else if (CTRL_CHAR (c) && c != ESC)
+ {
+ *r++ = '\\';
+ *r++ = 'C';
+ *r++ = '-';
+ c = _rl_to_lower (UNCTRL (c));
+ }
+ else if (c == RUBOUT)
+ {
+ *r++ = '\\';
+ *r++ = 'C';
+ *r++ = '-';
+ c = '?';
+ }
+
+ if (c == ESC)
+ {
+ *r++ = '\\';
+ c = 'e';
+ }
+ else if (c == '\\' || c == '"')
+ *r++ = '\\';
+
+ *r++ = (unsigned char)c;
+ }
+ *r = '\0';
+ return ret;
+}
+
/* Return a pointer to the function that STRING represents.
If STRING doesn't have a matching function, then a NULL pointer
is returned. */
@@ -523,7 +575,7 @@ rl_read_init_file (filename)
{
filename = last_readline_init_file;
if (filename == 0)
- filename = getenv ("INPUTRC");
+ filename = get_env_value ("INPUTRC");
if (filename == 0)
filename = DEFAULT_INPUTRC;
}
@@ -990,14 +1042,14 @@ rl_parse_and_bind (string)
/* Temporary. Handle old-style keyname with macro-binding. */
if (*funname == '\'' || *funname == '"')
{
- char seq[2];
+ unsigned char useq[2];
int fl = strlen (funname);
- seq[0] = key; seq[1] = '\0';
+ useq[0] = key; useq[1] = '\0';
if (fl && funname[fl - 1] == *funname)
funname[fl - 1] = '\0';
- rl_macro_bind (seq, &funname[1], _rl_keymap);
+ rl_macro_bind (useq, &funname[1], _rl_keymap);
}
#if defined (PREFIX_META_HACK)
/* Ugly, but working hack to keep prefix-meta around. */
@@ -1528,6 +1580,8 @@ int
rl_dump_functions (count, key)
int count, key;
{
+ if (rl_dispatching)
+ fprintf (rl_outstream, "\r\n");
rl_function_dumper (rl_explicit_arg);
rl_on_new_line ();
return (0);
@@ -1549,7 +1603,11 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
{
case ISMACR:
keyname = _rl_get_keyname (key);
+#if 0
out = (char *)map[key].function;
+#else
+ out = _rl_untranslate_macro_value ((char *)map[key].function);
+#endif
if (print_readably)
fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
keyname,
@@ -1559,6 +1617,9 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
keyname,
out ? out : "");
free (keyname);
+#if 1
+ free (out);
+#endif
break;
case ISFUNC:
break;
@@ -1604,6 +1665,8 @@ int
rl_dump_macros (count, key)
int count, key;
{
+ if (rl_dispatching)
+ fprintf (rl_outstream, "\r\n");
rl_macro_dumper (rl_explicit_arg);
rl_on_new_line ();
return (0);
@@ -1674,6 +1737,8 @@ int
rl_dump_variables (count, key)
int count, key;
{
+ if (rl_dispatching)
+ fprintf (rl_outstream, "\r\n");
rl_variable_dumper (rl_explicit_arg);
rl_on_new_line ();
return (0);
diff --git a/contrib/libreadline/callback.c b/contrib/libreadline/callback.c
index ad57f754b77a..04c5bbd09935 100644
--- a/contrib/libreadline/callback.c
+++ b/contrib/libreadline/callback.c
@@ -39,6 +39,7 @@
extern void readline_internal_startup ();
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;
@@ -120,6 +121,10 @@ rl_callback_read_char ()
in_handler = 0;
(*rl_linefunc) (line);
+ /* If the user did not clear out the line, do it for him. */
+ if (rl_line_buffer[0])
+ _rl_init_line_state ();
+
/* Redisplay the prompt if readline_handler_{install,remove} not called. */
if (in_handler == 0 && rl_linefunc)
_rl_callback_newline ();
diff --git a/contrib/libreadline/complete.c b/contrib/libreadline/complete.c
index f9e27ebddfb1..b17c63e25946 100644
--- a/contrib/libreadline/complete.c
+++ b/contrib/libreadline/complete.c
@@ -25,7 +25,6 @@
# include <config.h>
#endif
-#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
@@ -42,6 +41,8 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+#include <stdio.h>
+
#include <errno.h>
#if !defined (errno)
extern int errno;
@@ -137,7 +138,7 @@ int rl_visible_stats = 0;
static int completion_changed_buffer;
/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_entry_function (), the default filename
+ NULL means to use filename_completion_function (), the default filename
completer. */
Function *rl_completion_entry_function = (Function *)NULL;
@@ -761,12 +762,13 @@ insert_text (text, start, end)
}
static char *
-make_quoted_replacement (match, mtype, quote_char)
+make_quoted_replacement (match, mtype, qc)
char *match;
- int mtype, quote_char;
+ int mtype;
+ char *qc; /* Pointer to quoting character, if any */
{
int should_quote, do_replace;
- char *replacement, qc;
+ char *replacement;
/* If we are doing completion on quoted substrings, and any matches
contain any of the completer_word_break_characters, then auto-
@@ -784,10 +786,10 @@ make_quoted_replacement (match, mtype, quote_char)
if (should_quote)
#if defined (SHELL)
- should_quote = should_quote && (!quote_char || quote_char == '"' || quote_char == '\'');
-#else
- should_quote = should_quote && !quote_char;
-#endif
+ should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\'');
+#else /* !SHELL */
+ should_quote = should_quote && (!qc || !*qc);
+#endif /* !SHELL */
if (should_quote)
{
@@ -797,37 +799,37 @@ make_quoted_replacement (match, mtype, quote_char)
should_quote = rl_strpbrk (match, rl_filename_quote_characters) != 0;
do_replace = should_quote ? mtype : NO_MATCH;
- if (do_replace != NO_MATCH)
- {
- /* Quote the replacement, since we found an embedded
- word break character in a potential match. */
- if (rl_filename_quoting_function)
- {
- qc = quote_char; /* must pass a (char *) to quoting function */
- replacement = (*rl_filename_quoting_function)
- (match, do_replace, &qc);
- quote_char = qc;
- }
- }
+ /* Quote the replacement, since we found an embedded
+ word break character in a potential match. */
+ if (do_replace != NO_MATCH && rl_filename_quoting_function)
+ replacement = (*rl_filename_quoting_function) (match, do_replace, qc);
}
return (replacement);
}
static void
-insert_match (match, start, mtype, quote_char)
+insert_match (match, start, mtype, qc)
char *match;
- int start, mtype, quote_char;
+ int start, mtype;
+ char *qc;
{
char *replacement;
+ char oqc;
- replacement = make_quoted_replacement (match, mtype, quote_char);
+ oqc = qc ? *qc : '\0';
+ replacement = make_quoted_replacement (match, mtype, qc);
/* Now insert the match. */
if (replacement)
{
/* Don't double an opening quote character. */
- if (quote_char && start && rl_line_buffer[start - 1] == quote_char &&
- replacement[0] == quote_char)
+ if (qc && *qc && start && rl_line_buffer[start - 1] == *qc &&
+ replacement[0] == *qc)
+ start--;
+ /* If make_quoted_replacement changed the quoting character, remove
+ the opening quote and insert the (fully-quoted) replacement. */
+ else if (qc && (*qc != oqc) && start && rl_line_buffer[start - 1] == oqc &&
+ replacement[0] != oqc)
start--;
insert_text (replacement, start, rl_point - 1);
if (replacement != match)
@@ -882,9 +884,10 @@ append_to_match (text, delimiter, quote_char)
}
static void
-insert_all_matches (matches, point, quote_char)
+insert_all_matches (matches, point, qc)
char **matches;
- int point, quote_char;
+ int point;
+ char *qc;
{
int i;
char *rp;
@@ -892,7 +895,7 @@ insert_all_matches (matches, point, quote_char)
rl_begin_undo_group ();
/* remove any opening quote character; make_quoted_replacement will add
it back. */
- if (quote_char && point && rl_line_buffer[point - 1] == quote_char)
+ if (qc && *qc && point && rl_line_buffer[point - 1] == *qc)
point--;
rl_delete_text (point, rl_point);
rl_point = point;
@@ -901,7 +904,7 @@ insert_all_matches (matches, point, quote_char)
{
for (i = 1; matches[i]; i++)
{
- rp = make_quoted_replacement (matches[i], SINGLE_MATCH, quote_char);
+ rp = make_quoted_replacement (matches[i], SINGLE_MATCH, qc);
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[i])
@@ -910,7 +913,7 @@ insert_all_matches (matches, point, quote_char)
}
else
{
- rp = make_quoted_replacement (matches[0], SINGLE_MATCH, quote_char);
+ rp = make_quoted_replacement (matches[0], SINGLE_MATCH, qc);
rl_insert_text (rp);
rl_insert_text (" ");
if (rp != matches[0])
@@ -964,12 +967,12 @@ rl_complete_internal (what_to_do)
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
- free (text);
if (matches == 0)
{
ding ();
FREE (saved_line_buffer);
+ free (text);
return 0;
}
@@ -998,6 +1001,7 @@ rl_complete_internal (what_to_do)
FREE (matches);
ding ();
FREE (saved_line_buffer);
+ FREE (text);
return 0;
}
else
@@ -1013,6 +1017,7 @@ rl_complete_internal (what_to_do)
}
}
}
+ free (text);
switch (what_to_do)
{
@@ -1020,7 +1025,7 @@ rl_complete_internal (what_to_do)
case '!':
/* Insert the first match with proper quoting. */
if (*matches[0])
- insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, quote_char);
+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
/* If there are more matches, ring the bell to indicate.
If we are in vi mode, Posix.2 says to not ring the bell.
@@ -1046,7 +1051,7 @@ rl_complete_internal (what_to_do)
break;
case '*':
- insert_all_matches (matches, start, quote_char);
+ insert_all_matches (matches, start, &quote_char);
break;
case '?':
@@ -1102,10 +1107,14 @@ stat_char (filename)
character = 0;
if (S_ISDIR (finfo.st_mode))
character = '/';
+#if defined (S_ISCHR)
else if (S_ISCHR (finfo.st_mode))
character = '%';
+#endif /* S_ISCHR */
+#if defined (S_ISBLK)
else if (S_ISBLK (finfo.st_mode))
character = '#';
+#endif /* S_ISBLK */
#if defined (S_ISLNK)
else if (S_ISLNK (finfo.st_mode))
character = '@';
@@ -1321,7 +1330,7 @@ filename_completion_function (text, state)
int state;
char *text;
{
- static DIR *directory;
+ static DIR *directory = (DIR *)NULL;
static char *filename = (char *)NULL;
static char *dirname = (char *)NULL;
static char *users_dirname = (char *)NULL;
@@ -1333,6 +1342,13 @@ filename_completion_function (text, state)
/* If we don't have any state, then do some initialization. */
if (state == 0)
{
+ /* If we were interrupted before closing the directory or reading
+ all of its contents, close it. */
+ if (directory)
+ {
+ closedir (directory);
+ directory = (DIR *)NULL;
+ }
FREE (dirname);
FREE (filename);
FREE (users_dirname);
diff --git a/contrib/libreadline/config.h.in b/contrib/libreadline/config.h.in
new file mode 100644
index 000000000000..45ed5b9db74a
--- /dev/null
+++ b/contrib/libreadline/config.h.in
@@ -0,0 +1,138 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+#undef VOID_SIGHANDLER
+
+/* Define if you have the lstat function. */
+#undef HAVE_LSTAT
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the tcgetattr function. */
+#undef HAVE_TCGETATTR
+
+/* Define if you have the strcoll function. */
+#undef HAVE_STRCOLL
+
+#undef STRCOLL_BROKEN
+
+/* Define if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/dir.h> header file. */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define if you have the <sys/ndir.h> header file. */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/pte.h> header file. */
+#undef HAVE_SYS_PTE_H
+
+/* Define if you have the <sys/ptem.h> header file. */
+#undef HAVE_SYS_PTEM_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/stream.h> header file. */
+#undef HAVE_SYS_STREAM_H
+
+/* Define if you have the <termcap.h> header file. */
+#undef HAVE_TERMCAP_H
+
+/* Define if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
+
+/* Define if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+#undef HAVE_LOCALE_H
+
+/* Definitions pulled in from aclocal.m4. */
+#undef VOID_SIGHANDLER
+
+#undef GWINSZ_IN_SYS_IOCTL
+
+#undef TIOCSTAT_IN_SYS_IOCTL
+
+#undef FIONREAD_IN_SYS_IOCTL
+
+#undef SPEED_T_IN_SYS_TYPES
+
+#undef HAVE_GETPW_DECLS
+
+#undef STRUCT_DIRENT_HAS_D_INO
+
+#undef STRUCT_DIRENT_HAS_D_FILENO
+
+#undef HAVE_BSD_SIGNALS
+
+#undef HAVE_POSIX_SIGNALS
+
+#undef HAVE_USG_SIGHOLD
+
+#undef MUST_REINSTALL_SIGHANDLERS
+
+#undef HAVE_POSIX_SIGSETJMP
+
+/* config.h.bot */
+/* modify settings or make new ones based on what autoconf tells us. */
+
+/* Ultrix botches type-ahead when switching from canonical to
+ non-canonical mode, at least through version 4.3 */
+#if !defined (HAVE_TERMIOS_H) || !defined (HAVE_TCGETATTR) || defined (ultrix)
+# define TERMIOS_MISSING
+#endif
+
+#if defined (STRCOLL_BROKEN)
+# undef HAVE_STRCOLL
+#endif
+
+#if defined (__STDC__) && defined (HAVE_STDARG_H)
+# define PREFER_STDARG
+# define USE_VARARGS
+#else
+# if defined (HAVE_VARARGS_H)
+# define PREFER_VARARGS
+# define USE_VARARGS
+# endif
+#endif
diff --git a/contrib/libreadline/configure b/contrib/libreadline/configure
new file mode 100755
index 000000000000..4b7479ddc194
--- /dev/null
+++ b/contrib/libreadline/configure
@@ -0,0 +1,2458 @@
+#! /bin/sh
+
+# From configure.in for Readline 2.1, version 2.04, from autoconf version 2.12
+LIBVERSION=2.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.12"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=readline.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+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'
+cross_compiling=$ac_cv_prog_cc_cross
+
+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
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in ./support $srcdir/./support; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in ./support $srcdir/./support" 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+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 :
+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:629: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`$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_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+# We want these before the checks, so the checks can modify their values.
+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:656: 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
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ 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
+
+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:685: 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}:"
+ ac_prog_rejected=no
+ for ac_dir in $PATH; 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
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+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
+
+ 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:733: 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'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 743 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+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:767: 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:772: 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
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:781: \"$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
+fi
+fi
+
+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:796: 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
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+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
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+
+# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
+test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:828: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 843 "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:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+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} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 860 "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:866: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+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=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
+echo "configure:890: 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 896 "configure"
+#include "confdefs.h"
+#include <sgtty.h>
+Autoconf TIOCGETP
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "$ac_pattern" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=yes
+else
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat > conftest.$ac_ext <<EOF
+#line 914 "configure"
+#include "confdefs.h"
+#include <termio.h>
+Autoconf TCGETA
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "$ac_pattern" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# 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:946: 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}:"
+ 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
+ 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"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+# 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:998: 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
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:1026: 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 1031 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:1048: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+
+echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
+echo "configure:1068: 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 1073 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if defined(S_ISBLK) && defined(S_IFDIR)
+# if S_ISBLK (S_IFDIR)
+You lose.
+# endif
+#endif
+
+#if defined(S_ISBLK) && defined(S_IFCHR)
+# if S_ISBLK (S_IFCHR)
+You lose.
+# endif
+#endif
+
+#if defined(S_ISLNK) && defined(S_IFREG)
+# if S_ISLNK (S_IFREG)
+You lose.
+# endif
+#endif
+
+#if defined(S_ISSOCK) && defined(S_IFREG)
+# if S_ISSOCK (S_IFREG)
+You lose.
+# endif
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "You lose" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_header_stat_broken=yes
+else
+ rm -rf conftest*
+ ac_cv_header_stat_broken=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_header_stat_broken" 1>&6
+if test $ac_cv_header_stat_broken = yes; then
+ cat >> confdefs.h <<\EOF
+#define STAT_MACROS_BROKEN 1
+EOF
+
+fi
+
+ac_header_dirent=no
+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:1128: 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 1133 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+ echo "$ac_t""no" 1>&6
+fi
+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:1166: 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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldir $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1174 "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
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -ldir"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:1207: 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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lx $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1215 "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
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -lx"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+
+for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1252: 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 1257 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
+echo "configure:1306: 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
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_strcoll_works=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1314 "configure"
+#include "confdefs.h"
+#include <string.h>
+main ()
+{
+ exit (strcoll ("abc", "def") >= 0 ||
+ strcoll ("ABC", "DEF") >= 0 ||
+ strcoll ("123", "456") >= 0);
+}
+EOF
+if { (eval echo configure:1324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_strcoll_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_strcoll_works=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_strcoll_works" 1>&6
+if test $ac_cv_func_strcoll_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STRCOLL 1
+EOF
+
+fi
+
+
+for ac_hdr in unistd.h stdlib.h varargs.h stdarg.h string.h \
+ sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
+ termcap.h termios.h termio.h sys/file.h locale.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1353: 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 1358 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
+echo "configure:1392: 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 1398 "configure"
+#include "confdefs.h"
+#include <signal.h>
+int main() {
+
+ sigset_t ss;
+ struct sigaction sa;
+ sigemptyset(&ss); sigsuspend(&ss);
+ sigaction(SIGINT, &sa, (struct sigaction *) 0);
+ sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
+
+; return 0; }
+EOF
+if { (eval echo configure:1411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ bash_cv_signal_vintage=posix
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+
+ cat > conftest.$ac_ext <<EOF
+#line 1420 "configure"
+#include "confdefs.h"
+#include <signal.h>
+int main() {
+
+ int mask = sigmask(SIGINT);
+ sigsetmask(mask); sigblock(mask); sigpause(mask);
+
+; return 0; }
+EOF
+if { (eval echo configure:1430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ bash_cv_signal_vintage=4.2bsd
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+
+ cat > conftest.$ac_ext <<EOF
+#line 1439 "configure"
+#include "confdefs.h"
+
+ #include <signal.h>
+ RETSIGTYPE foo() { }
+int main() {
+
+ int mask = sigmask(SIGINT);
+ sigset(SIGINT, foo); sigrelse(SIGINT);
+ sighold(SIGINT); sigpause(SIGINT);
+
+; return 0; }
+EOF
+if { (eval echo configure:1452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ bash_cv_signal_vintage=svr3
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_signal_vintage=v7
+
+fi
+rm -f conftest*
+
+fi
+rm -f conftest*
+
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$bash_cv_signal_vintage" 1>&6
+if test "$bash_cv_signal_vintage" = posix; then
+cat >> confdefs.h <<\EOF
+#define HAVE_POSIX_SIGNALS 1
+EOF
+
+elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
+cat >> confdefs.h <<\EOF
+#define HAVE_BSD_SIGNALS 1
+EOF
+
+elif test "$bash_cv_signal_vintage" = svr3; then
+cat >> confdefs.h <<\EOF
+#define HAVE_USG_SIGHOLD 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
+echo "configure:1493: 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
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot check signal handling if cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1501 "configure"
+#include "confdefs.h"
+
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+typedef RETSIGTYPE sigfunc();
+
+int nsigint;
+
+#ifdef HAVE_POSIX_SIGNALS
+sigfunc *
+set_signal_handler(sig, handler)
+ int sig;
+ sigfunc *handler;
+{
+ struct sigaction act, oact;
+ act.sa_handler = handler;
+ act.sa_flags = 0;
+ sigemptyset (&act.sa_mask);
+ sigemptyset (&oact.sa_mask);
+ sigaction (sig, &act, &oact);
+ return (oact.sa_handler);
+}
+#else
+#define set_signal_handler(s, h) signal(s, h)
+#endif
+
+RETSIGTYPE
+sigint(s)
+int s;
+{
+ nsigint++;
+}
+
+main()
+{
+ nsigint = 0;
+ set_signal_handler(SIGINT, sigint);
+ kill((int)getpid(), SIGINT);
+ kill((int)getpid(), SIGINT);
+ exit(nsigint != 2);
+}
+
+EOF
+if { (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ bash_cv_must_reinstall_sighandlers=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ bash_cv_must_reinstall_sighandlers=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$bash_cv_must_reinstall_sighandlers" 1>&6
+if test $bash_cv_must_reinstall_sighandlers = yes; then
+cat >> confdefs.h <<\EOF
+#define MUST_REINSTALL_SIGHANDLERS 1
+EOF
+
+fi
+
+
+
+echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
+echo "configure:1573: 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
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot check for sigsetjmp/siglongjmp if cross-compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1581 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#include <signal.h>
+#include <setjmp.h>
+
+main()
+{
+#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
+exit (1);
+#else
+
+int code;
+sigset_t set, oset;
+sigjmp_buf xx;
+
+/* get the mask */
+sigemptyset(&set);
+sigemptyset(&oset);
+sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
+sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
+
+/* save it */
+code = sigsetjmp(xx, 1);
+if (code)
+ exit(0); /* could get sigmask and compare to oset here. */
+
+/* change it */
+sigaddset(&set, SIGINT);
+sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
+
+/* and siglongjmp */
+siglongjmp(xx, 10);
+exit(1);
+#endif
+}
+EOF
+if { (eval echo configure:1622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ bash_cv_func_sigsetjmp=present
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ bash_cv_func_sigsetjmp=missing
+fi
+rm -fr conftest*
+fi
+
+
+fi
+
+echo "$ac_t""$bash_cv_func_sigsetjmp" 1>&6
+if test $bash_cv_func_sigsetjmp = present; then
+cat >> confdefs.h <<\EOF
+#define HAVE_POSIX_SIGSETJMP 1
+EOF
+
+fi
+
+echo $ac_n "checking for lstat""... $ac_c" 1>&6
+echo "configure:1646: 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 1651 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+int main() {
+ lstat("",(struct stat *)0);
+; return 0; }
+EOF
+if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ bash_cv_func_lstat=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_func_lstat=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_func_lstat" 1>&6
+if test $bash_cv_func_lstat = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LSTAT 1
+EOF
+
+fi
+
+echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
+echo "configure:1682: 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 1687 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <pwd.h>
+extern struct passwd *getpwent();
+int main() {
+struct passwd *z; z = getpwent();
+; return 0; }
+EOF
+if { (eval echo configure:1696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_can_redecl_getpw=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_can_redecl_getpw=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_can_redecl_getpw" 1>&6
+if test $bash_cv_can_redecl_getpw = no; then
+cat >> confdefs.h <<\EOF
+#define HAVE_GETPW_DECLS 1
+EOF
+
+fi
+
+
+echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
+echo "configure:1718: 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
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot check strcoll if cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1726 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#if defined (HAVE_LOCALE_H)
+#include <locale.h>
+#endif
+
+main(c, v)
+int c;
+char *v[];
+{
+ int r1, r2;
+ char *deflocale, *defcoll;
+
+#ifdef HAVE_SETLOCALE
+ deflocale = setlocale(LC_ALL, "");
+ defcoll = setlocale(LC_COLLATE, "");
+#endif
+
+#ifdef HAVE_STRCOLL
+ /* These two values are taken from tests/glob-test. */
+ r1 = strcoll("abd", "aXd");
+#else
+ r1 = 0;
+#endif
+ r2 = strcmp("abd", "aXd");
+
+ /* These two should both be greater than 0. It is permissible for
+ a system to return different values, as long as the sign is the
+ same. */
+
+ /* Exit with 1 (failure) if these two values are both > 0, since
+ this tests whether strcoll(3) is broken with respect to strcmp(3)
+ in the default locale. */
+ exit (r1 > 0 && r2 > 0);
+}
+
+EOF
+if { (eval echo configure:1765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ bash_cv_func_strcoll_broken=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ bash_cv_func_strcoll_broken=no
+fi
+rm -fr conftest*
+fi
+
+
+fi
+
+echo "$ac_t""$bash_cv_func_strcoll_broken" 1>&6
+if test $bash_cv_func_strcoll_broken = yes; then
+cat >> confdefs.h <<\EOF
+#define STRCOLL_BROKEN 1
+EOF
+
+fi
+
+
+echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
+echo "configure:1790: 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 1795 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C"
+#endif
+void (*signal ()) ();
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:1810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_void_sighandler=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_void_sighandler=no
+fi
+rm -f conftest*
+fi
+echo "$ac_t""$bash_cv_void_sighandler" 1>&6
+if test $bash_cv_void_sighandler = yes; then
+cat >> confdefs.h <<\EOF
+#define VOID_SIGHANDLER 1
+EOF
+
+fi
+
+echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:1830: 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 1835 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+int main() {
+int x = TIOCGWINSZ;
+; return 0; }
+EOF
+if { (eval echo configure:1843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_tiocgwinsz_in_ioctl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_tiocgwinsz_in_ioctl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_tiocgwinsz_in_ioctl" 1>&6
+if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
+cat >> confdefs.h <<\EOF
+#define GWINSZ_IN_SYS_IOCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:1864: 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 1869 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+int main() {
+int x = TIOCSTAT;
+; return 0; }
+EOF
+if { (eval echo configure:1877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_tiocstat_in_ioctl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_tiocstat_in_ioctl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_tiocstat_in_ioctl" 1>&6
+if test $bash_cv_tiocstat_in_ioctl = yes; then
+cat >> confdefs.h <<\EOF
+#define TIOCSTAT_IN_SYS_IOCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
+echo "configure:1898: 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 1903 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+int main() {
+int x = FIONREAD;
+; return 0; }
+EOF
+if { (eval echo configure:1911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_fionread_in_ioctl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_fionread_in_ioctl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_fionread_in_ioctl" 1>&6
+if test $bash_cv_fionread_in_ioctl = yes; then
+cat >> confdefs.h <<\EOF
+#define FIONREAD_IN_SYS_IOCTL 1
+EOF
+
+fi
+
+echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:1932: 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 1937 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+speed_t x;
+; return 0; }
+EOF
+if { (eval echo configure:1944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_speed_t_in_sys_types=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_speed_t_in_sys_types=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_speed_t_in_sys_types" 1>&6
+if test $bash_cv_speed_t_in_sys_types = yes; then
+cat >> confdefs.h <<\EOF
+#define SPEED_T_IN_SYS_TYPES 1
+EOF
+
+fi
+
+
+echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
+echo "configure:1966: 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 1971 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+
+int main() {
+
+struct dirent d; int z; z = d.d_ino;
+
+; return 0; }
+EOF
+if { (eval echo configure:2000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_dirent_has_dino=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_dirent_has_dino=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_dirent_has_dino" 1>&6
+if test $bash_cv_dirent_has_dino = yes; then
+cat >> confdefs.h <<\EOF
+#define STRUCT_DIRENT_HAS_D_INO 1
+EOF
+
+fi
+
+
+echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
+echo "configure:2022: 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 2027 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#if defined(HAVE_DIRENT_H)
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* SYSNDIR */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* SYSDIR */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif /* HAVE_DIRENT_H */
+
+int main() {
+
+struct dirent d; int z; z = d.d_fileno;
+
+; return 0; }
+EOF
+if { (eval echo configure:2056: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ bash_cv_dirent_has_d_fileno=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ bash_cv_dirent_has_d_fileno=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$bash_cv_dirent_has_d_fileno" 1>&6
+if test $bash_cv_dirent_has_d_fileno = yes; then
+cat >> confdefs.h <<\EOF
+#define STRUCT_DIRENT_HAS_D_FILENO 1
+EOF
+
+fi
+
+
+case "$host_cpu" in
+*cray*) LOCAL_CFLAGS=-DCRAY ;;
+esac
+
+case "$host_os" in
+isc*) LOCAL_CFLAGS=-Disc386 ;;
+esac
+
+
+
+
+
+
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# 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
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ 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"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile doc/Makefile examples/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@RANLIB@%$RANLIB%g
+s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
+s%@LOCAL_DEFS@%$LOCAL_DEFS%g
+s%@LIBVERSION@%$LIBVERSION%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile examples/Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+# Makefile uses this timestamp file to record whether config.h is up to date.
+echo > stamp-h
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/contrib/libreadline/configure.in b/contrib/libreadline/configure.in
new file mode 100644
index 000000000000..13152b87d307
--- /dev/null
+++ b/contrib/libreadline/configure.in
@@ -0,0 +1,82 @@
+dnl
+dnl Configure script for readline library
+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 2.1, version 2.04, from autoconf version] AC_ACVERSION)
+LIBVERSION=2.1
+
+AC_INIT(readline.h)
+AC_CONFIG_HEADER(config.h)
+
+dnl make sure we are using a recent autoconf version
+AC_PREREQ(2.10)
+
+AC_CONFIG_AUX_DIR(./support)
+
+AC_CANONICAL_HOST
+
+# We want these before the checks, so the checks can modify their values.
+test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
+
+AC_PROG_CC
+
+# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
+test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+
+AC_PROG_GCC_TRADITIONAL
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+
+AC_RETSIGTYPE
+
+AC_HEADER_STAT
+AC_HEADER_DIRENT
+
+AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
+
+AC_FUNC_STRCOLL
+
+AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h \
+ sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
+ termcap.h termios.h termio.h sys/file.h locale.h)
+
+BASH_SIGNAL_CHECK
+BASH_REINSTALL_SIGHANDLERS
+
+BASH_FUNC_POSIX_SETJMP
+BASH_FUNC_LSTAT
+BASH_CHECK_GETPW_FUNCS
+BASH_FUNC_STRCOLL
+
+BASH_TYPE_SIGHANDLER
+BASH_HAVE_TIOCGWINSZ
+BASH_HAVE_TIOCSTAT
+BASH_HAVE_FIONREAD
+BASH_MISC_SPEED_T
+BASH_STRUCT_DIRENT_D_INO
+BASH_STRUCT_DIRENT_D_FILENO
+
+case "$host_cpu" in
+*cray*) LOCAL_CFLAGS=-DCRAY ;;
+esac
+
+case "$host_os" in
+isc*) LOCAL_CFLAGS=-Disc386 ;;
+esac
+
+AC_SUBST(CFLAGS)
+AC_SUBST(LOCAL_CFLAGS)
+AC_SUBST(LOCAL_DEFS)
+
+AC_SUBST(host_cpu)
+AC_SUBST(host_os)
+
+AC_SUBST(LIBVERSION)
+
+AC_OUTPUT([Makefile doc/Makefile examples/Makefile],
+[
+# Makefile uses this timestamp file to record whether config.h is up to date.
+echo > stamp-h
+])
diff --git a/contrib/libreadline/display.c b/contrib/libreadline/display.c
index c0dff1f5bed4..c283f9a1bd95 100644
--- a/contrib/libreadline/display.c
+++ b/contrib/libreadline/display.c
@@ -25,20 +25,26 @@
# include <config.h>
#endif
-#include <stdio.h>
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
+#include "posixstat.h"
+
#if defined (HAVE_STDLIB_H)
# include <stdlib.h>
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#include "posixstat.h"
+#include <stdio.h>
+
+#if defined (__GO32__)
+# include <go32.h>
+# include <pc.h>
+#endif /* __GO32__ */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -69,7 +75,8 @@ extern void _rl_output_some_chars ();
extern int _rl_output_character_function ();
extern int _rl_backspace ();
-extern char *term_clreol, *term_im, *term_ic, *term_ei, *term_DC;
+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;
@@ -78,8 +85,9 @@ extern int terminal_can_insert, _rl_term_autowrap;
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 (), clear_to_eol (), space_to_eol ();
+static void update_line (), space_to_eol ();
static void delete_chars (), insert_some_chars ();
static void cr ();
@@ -302,7 +310,7 @@ rl_redisplay ()
register int in, out, c, linenum, cursor_linenum;
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
- int newlines, lpos;
+ int newlines, lpos, temp;
char *prompt_this_line;
if (!readline_echoing_p)
@@ -405,8 +413,19 @@ rl_redisplay ()
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
+ lpos = out - wrap_offset;
+
+ /* XXX - what if lpos is already >= screenwidth before we start drawing the
+ contents of the command line? */
+ while (lpos >= screenwidth)
+ {
+ temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
+ inv_lbreaks[++newlines] = temp;
+ lpos -= screenwidth;
+ }
- for (in = 0, lpos = out - wrap_offset; in < rl_end; in++)
+ lb_linenum = 0;
+ for (in = 0; in < rl_end; in++)
{
c = (unsigned char)rl_line_buffer[in];
@@ -432,8 +451,6 @@ rl_redisplay ()
if (lpos + 4 >= screenwidth)
{
- register int temp;
-
temp = screenwidth - lpos;
inv_lbreaks[++newlines] = out + temp;
lpos = 4 - temp;
@@ -557,7 +574,7 @@ rl_redisplay ()
{
nleft = screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
- clear_to_eol (nleft);
+ _rl_clear_to_eol (nleft);
}
/* Since the new first line is now visible, save its length. */
@@ -575,7 +592,7 @@ rl_redisplay ()
tt = VIS_CHARS (linenum);
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt);
- clear_to_eol
+ _rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : screenwidth);
}
}
@@ -710,7 +727,7 @@ rl_redisplay ()
t < visible_first_line_len)
{
nleft = screenwidth - t;
- clear_to_eol (nleft);
+ _rl_clear_to_eol (nleft);
}
visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
if (visible_first_line_len > screenwidth)
@@ -962,7 +979,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (_rl_term_autowrap && current_line < inv_botlin)
space_to_eol (lendiff);
else
- clear_to_eol (lendiff);
+ _rl_clear_to_eol (lendiff);
}
}
}
@@ -1293,16 +1310,14 @@ _rl_erase_at_end_of_line (l)
/* Clear to the end of the line. COUNT is the minimum
number of character spaces to clear, */
-static void
-clear_to_eol (count)
+void
+_rl_clear_to_eol (count)
int count;
{
#if !defined (__GO32__)
if (term_clreol)
- {
- tputs (term_clreol, 1, _rl_output_character_function);
- }
- else
+ tputs (term_clreol, 1, _rl_output_character_function);
+ else if (count)
#endif /* !__GO32__ */
space_to_eol (count);
}
@@ -1321,6 +1336,17 @@ space_to_eol (count)
_rl_last_c_pos += count;
}
+void
+_rl_clear_screen ()
+{
+#if !defined (__GO32__)
+ if (term_clrpag)
+ tputs (term_clrpag, 1, _rl_output_character_function);
+ else
+#endif /* !__GO32__ */
+ crlf ();
+}
+
/* Insert COUNT characters from STRING to the output stream. */
static void
insert_some_chars (string, count)
@@ -1420,7 +1446,7 @@ _rl_update_final ()
/* If the cursor is the only thing on an otherwise-blank last line,
compensate so we don't print an extra CRLF. */
if (_rl_vis_botlin && _rl_last_c_pos == 0 &&
- visible_line[inv_lbreaks[_rl_vis_botlin]+1] == 0)
+ visible_line[vis_lbreaks[_rl_vis_botlin]] == 0)
{
_rl_vis_botlin--;
full_lines = 1;
@@ -1432,7 +1458,7 @@ _rl_update_final ()
char *last_line;
last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
_rl_move_cursor_relative (screenwidth - 1, last_line);
- clear_to_eol (0);
+ _rl_clear_to_eol (0);
putc (last_line[screenwidth - 1], rl_outstream);
}
_rl_vis_botlin = 0;
diff --git a/contrib/libreadline/doc/Makefile.in b/contrib/libreadline/doc/Makefile.in
new file mode 100644
index 000000000000..bbbd5c3a4ad4
--- /dev/null
+++ b/contrib/libreadline/doc/Makefile.in
@@ -0,0 +1,123 @@
+# This makefile for Readline library documentation is in -*- text -*- mode.
+# Emacs likes it that way.
+top_srcdir = @top_srcdir@
+srcdir = @srcdir@
+
+prefix = @prefix@
+infodir = @infodir@
+
+mandir = @mandir@
+man3dir = $(mandir)/man3
+
+RM = rm -f
+
+TEXINPUTDIR = $(srcdir)
+
+MAKEINFO = 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@
+
+RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
+ $(srcdir)/rltech.texinfo
+HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
+ $(srcdir)/hstech.texinfo
+
+# This should be a program that converts troff to an ascii-readable format
+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
+TEXTOBJ = readline.0
+
+CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ)
+
+.SUFFIXES: .0 .3 .ps .txt .dvi
+
+.3.0:
+ $(RM) $@
+ -${NROFF} -man $< > $@
+
+all: info dvi html ps text
+nodvi: info html text
+
+readline.dvi: $(RLSRC)
+ TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texinfo
+ mv rlman.dvi readline.dvi
+
+readline.info: $(RLSRC)
+ $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
+
+history.dvi: ${HISTSRC}
+ TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
+ mv hist.dvi history.dvi
+
+history.info: ${HISTSRC}
+ $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/hist.texinfo
+
+readline.ps: readline.dvi
+ $(RM) $@
+ $(DVIPS) readline.dvi
+
+history.ps: history.dvi
+ $(RM) $@
+ $(DVIPS) history.dvi
+
+readline.html: ${RLSRC}
+ $(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
+ sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
+ sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
+ $(RM) rlman.html rlman_toc.html
+
+history.html: ${HISTSRC}
+ $(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
+ sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
+ sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
+ $(RM) hist.html hist_toc.html
+
+info: $(INFOOBJ)
+dvi: $(DVIOBJ)
+ps: $(PSOBJ)
+html: $(HTMLOBJ)
+text: $(TEXTOBJ)
+
+readline.0: $(srcdir)/readline.3
+
+clean:
+ $(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
+ *.fns *.kys *.tps *.vrs *.o core
+
+distclean: clean
+ $(RM) $(CREATED_DOCS)
+
+mostlyclean: clean
+
+maintainer-clean: clean
+ $(RM) $(CREATED_DOCS)
+
+installdirs: $(top_srcdir)/support/mkdirs
+ -$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
+
+install: installdirs info
+ ${INSTALL_DATA} readline.info $(infodir)/readline.info
+ ${INSTALL_DATA} history.info $(infodir)/history.info
+ 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
+ -${INSTALL_DATA} $(srcdir)/readline.3 $(man3dir)/readline.3
+
+uninstall:
+ $(RM) $(infodir)/readline.info
+ $(RM) $(infodir)/history.info
+ $(RM) $(man3dir)/readline.3
diff --git a/contrib/libreadline/doc/hstech.texinfo b/contrib/libreadline/doc/hstech.texinfo
index be4131843009..541009084075 100644
--- a/contrib/libreadline/doc/hstech.texinfo
+++ b/contrib/libreadline/doc/hstech.texinfo
@@ -415,6 +415,17 @@ If non-zero, single-quoted words are not scanned for the history expansion
character. The default value is 0.
@end deftypevar
+@deftypevar {Function *} history_inhibit_expansion_function
+This should be set to the address of a function that takes two arguments:
+a @code{char *} (@var{string}) and an integer index into that string (@var{i}).
+It should return a non-zero value if the history expansion starting at
+@var{string[i]} should not be performed; zero if the expansion should
+be done.
+It is intended for use by applications like Bash that use the history
+expansion character for additional purposes.
+By default, this variable is set to NULL.
+@end deftypevar
+
@node History Programming Example
@section History Programming Example
diff --git a/contrib/libreadline/doc/readline.3 b/contrib/libreadline/doc/readline.3
index e122cb7a7385..3d161689d2d4 100644
--- a/contrib/libreadline/doc/readline.3
+++ b/contrib/libreadline/doc/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Mon Jul 8 13:07:48 EDT 1996
+.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
-.TH READLINE 3 "1996 July 8" GNU
+.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -682,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new
argument. M\-\- starts a negative argument.
.TP
.B universal\-argument
-Each time this is executed, the argument count is multiplied by four.
+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
+.B universal\-argument
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed 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 initially one, so executing this function the
-first time makes the argument count four.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
.PD
.SS Completing
.PP
diff --git a/contrib/libreadline/doc/rltech.texinfo b/contrib/libreadline/doc/rltech.texinfo
index 6704d0e27a78..ea0d317d92e9 100644
--- a/contrib/libreadline/doc/rltech.texinfo
+++ b/contrib/libreadline/doc/rltech.texinfo
@@ -312,7 +312,7 @@ to get a character from the input stream. By default, it is set to
(@pxref{Utility Functions}).
@end deftypevar
-@deftypevar {Function *} rl_redisplay_function
+@deftypevar {VFunction *} rl_redisplay_function
If non-zero, @code{readline} will call indirectly through this pointer
to update the display with the current contents of the editing buffer.
By default, it is set to @code{rl_redisplay}, the default @code{readline}
@@ -417,6 +417,11 @@ Return the keymap matching @var{name}. @var{name} is one which would
be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
@end deftypefun
+@deftypefun {char *} rl_get_keymap_name (Keymap keymap)
+Return the name matching @var{keymap}. @var{name} is one which would
+be supplied in a @code{set keymap} inputrc line (@pxref{Readline Init File}).
+@end deftypefun
+
@node Binding Keys
@subsection Binding Keys
@@ -576,7 +581,7 @@ that text.
@node Redisplay
@subsection Redisplay
-@deftypefun int rl_redisplay ()
+@deftypefun void rl_redisplay ()
Change what's displayed on the screen to reflect the current contents
of @code{rl_line_buffer}.
@end deftypefun
@@ -650,6 +655,11 @@ before Readline attempts to read characters from the terminal with
@code{rl_read_key ()}.
@end deftypefun
+@deftypefun 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
+
@deftypefun int rl_initialize ()
Initialize or re-initialize Readline's internal state.
@end deftypefun
@@ -870,7 +880,7 @@ that does the initial simple matching selection algorithm (see
This is a pointer to the generator function for @code{completion_matches
()}. If the value of @code{rl_completion_entry_function} is
@code{(Function *)NULL} then the default filename generator function,
-@code{filename_entry_function ()}, is used.
+@code{filename_completion_function ()}, is used.
@end deftypevar
@node Completion Functions
@@ -1069,7 +1079,7 @@ by @code{rl_filename_quoting_function}.
@end deftypevar
@deftypevar int rl_inhibit_completion
-If this variable is non-zero, completion is inhibited. The completion
+If this variable is non-zero, completion is inhibit<ed. The completion
character will be inserted as any other bound to @code{self-insert}.
@end deftypevar
diff --git a/contrib/libreadline/doc/rluser.texinfo b/contrib/libreadline/doc/rluser.texinfo
index 65111f333d9e..f7d6fd87481e 100644
--- a/contrib/libreadline/doc/rluser.texinfo
+++ b/contrib/libreadline/doc/rluser.texinfo
@@ -605,31 +605,31 @@ Meta-Control-h: backward-kill-word Text after the function name is ignored
#
# Arrow keys in keypad mode
#
-#"\M-OD" backward-char
-#"\M-OC" forward-char
-#"\M-OA" previous-history
-#"\M-OB" next-history
+#"\M-OD": backward-char
+#"\M-OC": forward-char
+#"\M-OA": previous-history
+#"\M-OB": next-history
#
# Arrow keys in ANSI mode
#
-"\M-[D" backward-char
-"\M-[C" forward-char
-"\M-[A" previous-history
-"\M-[B" next-history
+"\M-[D": backward-char
+"\M-[C": forward-char
+"\M-[A": previous-history
+"\M-[B": next-history
#
# Arrow keys in 8 bit keypad mode
#
-#"\M-\C-OD" backward-char
-#"\M-\C-OC" forward-char
-#"\M-\C-OA" previous-history
-#"\M-\C-OB" next-history
+#"\M-\C-OD": backward-char
+#"\M-\C-OC": forward-char
+#"\M-\C-OA": previous-history
+#"\M-\C-OB": next-history
#
# Arrow keys in 8 bit ANSI mode
#
-#"\M-\C-[D" backward-char
-#"\M-\C-[C" forward-char
-#"\M-\C-[A" previous-history
-#"\M-\C-[B" next-history
+#"\M-\C-[D": backward-char
+#"\M-\C-[C": forward-char
+#"\M-\C-[A": previous-history
+#"\M-\C-[B": next-history
C-q: quoted-insert
@@ -921,10 +921,18 @@ Add this digit to the argument already accumulating, or start a new
argument. @key{M--} starts a negative argument.
@item universal-argument ()
-Each time this is executed, the argument count is multiplied by four.
+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 @code{universal-argument}
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed 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 initially one, so executing this function the
-first time makes the argument count four. By default, this is not
-bound to a key.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
+By default, this is not bound to a key.
@end ftable
@node Commands For Completion
@@ -1122,6 +1130,12 @@ word expansions.
@item history-expand-line (M-^)
Perform history expansion on the current line.
+@item alias-expand-line
+Perform alias expansion on the current line (@pxref{Aliases}).
+
+@item history-and-alias-expand-line
+Perform history and alias expansion on the current line.
+
@item insert-last-argument (M-., M-_)
A synonym for @code{yank-last-arg}.
diff --git a/contrib/libreadline/examples/Makefile.in b/contrib/libreadline/examples/Makefile.in
new file mode 100644
index 000000000000..8dd7f6237c22
--- /dev/null
+++ b/contrib/libreadline/examples/Makefile.in
@@ -0,0 +1,37 @@
+# This is the Makefile for the examples subdirectory of readline. -*- text -*-
+#
+srcdir = @srcdir@
+VPATH = .:@srcdir@
+top_srcdir = @top_srcdir@
+BUILD_DIR = .
+
+DEFS = @DEFS@
+CC = @CC@
+CFLAGS = @CFLAGS@
+LOCAL_CFLAGS = @LOCAL_CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I $(srcdir) -I $(top_srcdir) -I..
+
+CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
+LDFLAGS = -g -L..
+
+.c.o:
+ $(CC) $(CCFLAGS) -c $<
+
+EXECUTABLES = fileman rltest rl
+
+all: $(EXECUTABLES)
+
+rl: rl.o
+ $(CC) $(LDFLAGS) -o $@ rl.o -lreadline -ltermcap
+
+fileman: fileman.o
+ $(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
+
+rltest: rltest.o
+ $(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
+
+fileman.o: $(srcdir)/fileman.c
+rltest.o: $(srcdir)/rltest.c
+rl.o: $(srcdir)/rl.c
diff --git a/contrib/libreadline/examples/fileman.c b/contrib/libreadline/examples/fileman.c
index 8709120dfa14..0702a5badc76 100644
--- a/contrib/libreadline/examples/fileman.c
+++ b/contrib/libreadline/examples/fileman.c
@@ -1,15 +1,38 @@
/* 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>
+#endif
-#include <stdio.h>
#include <sys/types.h>
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
#include <sys/stat.h>
-#include <sys/errno.h>
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <stdio.h>
+#include <errno.h>
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else /* !HAVE_STRING_H */
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+
+#ifdef READLINE_LIBRARY
+# include "readline.h"
+# include "history.h"
+#else
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
extern char *getwd ();
extern char *xmalloc ();
@@ -54,7 +77,7 @@ int done;
char *
dupstr (s)
- int s;
+ char *s;
{
char *r;
@@ -304,7 +327,8 @@ com_stat (arg)
printf ("Statistics for `%s':\n", arg);
- printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
+ printf ("%s has %d link%s, and is %d byte%s in length.\n",
+ arg,
finfo.st_nlink,
(finfo.st_nlink == 1) ? "" : "s",
finfo.st_size,
diff --git a/contrib/libreadline/examples/rl.c b/contrib/libreadline/examples/rl.c
new file mode 100644
index 000000000000..6c2f34313ffd
--- /dev/null
+++ b/contrib/libreadline/examples/rl.c
@@ -0,0 +1,115 @@
+/*
+ * 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]
+ */
+
+/*
+ * 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 "posixstat.h"
+#include "readline.h"
+#include "history.h"
+
+extern int optind;
+extern char *optarg;
+
+extern char *strrchr();
+
+static char *progname;
+static char *deftext;
+
+static int
+set_deftext ()
+{
+ if (deftext)
+ {
+ rl_insert_text (deftext);
+ deftext = (char *)NULL;
+ rl_startup_hook = (Function *)NULL;
+ }
+}
+
+usage()
+{
+ fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
+ progname, progname);
+}
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char *temp, *prompt;
+ struct stat sb;
+ int done, opt, fd;
+ FILE *ifp;
+
+ progname = strrchr(argv[0], '/');
+ if (progname == 0)
+ progname = argv[0];
+ else
+ progname++;
+
+ /* defaults */
+ prompt = "readline$ ";
+ fd = 0;
+ deftext = (char *)0;
+
+ while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
+ {
+ switch (opt)
+ {
+ case 'p':
+ prompt = optarg;
+ break;
+ case 'u':
+ fd = atoi(optarg);
+ if (fd < 0)
+ {
+ fprintf (stderr, "%s: bad file descriptor `%s'\n", progname, optarg);
+ exit (2);
+ }
+ break;
+ case 'd':
+ deftext = optarg;
+ break;
+ default:
+ usage ();
+ exit (2);
+ }
+ }
+
+ if (fd != 0)
+ {
+ if (fstat (fd, &sb) < 0)
+ {
+ fprintf (stderr, "%s: %d: bad file descriptor\n", progname, fd);
+ exit (1);
+ }
+ ifp = fdopen (fd, "r");
+ rl_instream = ifp;
+ }
+
+ if (deftext && *deftext)
+ rl_startup_hook = set_deftext;
+
+ temp = readline (prompt);
+
+ /* Test for EOF. */
+ if (temp == 0)
+ exit (1);
+
+ puts (temp);
+ exit (0);
+}
diff --git a/contrib/libreadline/examples/rltest.c b/contrib/libreadline/examples/rltest.c
index 311629f30ac0..ff3ad5cc9ee9 100644
--- a/contrib/libreadline/examples/rltest.c
+++ b/contrib/libreadline/examples/rltest.c
@@ -4,10 +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"
+#include "readline.h"
+#include "history.h"
main ()
{
diff --git a/contrib/libreadline/funmap.c b/contrib/libreadline/funmap.c
index 6b7d351fa047..702fabd0c88a 100644
--- a/contrib/libreadline/funmap.c
+++ b/contrib/libreadline/funmap.c
@@ -76,6 +76,7 @@ static FUNMAP default_funmap[] = {
{ "do-lowercase-version", rl_do_lowercase_version },
{ "downcase-word", rl_downcase_word },
{ "dump-functions", rl_dump_functions },
+ { "dump-macros", rl_dump_macros },
{ "dump-variables", rl_dump_variables },
{ "emacs-editing-mode", rl_emacs_editing_mode },
{ "end-kbd-macro", rl_end_kbd_macro },
diff --git a/contrib/libreadline/histexpand.c b/contrib/libreadline/histexpand.c
index d916c7441d7d..de71d78aa81f 100644
--- a/contrib/libreadline/histexpand.c
+++ b/contrib/libreadline/histexpand.c
@@ -59,11 +59,7 @@ static char *history_find_word ();
extern int history_offset;
-#if defined (SHELL)
extern char *single_quote ();
-#else
-static char *single_quote ();
-#endif /* !SHELL */
static char *quote_breaks ();
extern char *xmalloc (), *xrealloc ();
@@ -91,6 +87,10 @@ char *history_no_expand_chars = " \t\n\r=";
The default is 0. */
int history_quotes_inhibit_expansion = 0;
+/* If set, this points to a function that is called to verify that a
+ particular history expansion should be performed. */
+Function *history_inhibit_expansion_function;
+
/* **************************************************************** */
/* */
/* History Expansion */
@@ -289,38 +289,6 @@ hist_string_extract_single_quoted (string, sindex)
*sindex = i;
}
-#if !defined (SHELL)
-/* Does shell-like quoting using single quotes. */
-static char *
-single_quote (string)
- char *string;
-{
- register int c;
- char *result, *r, *s;
-
- result = (char *)xmalloc (3 + (3 * strlen (string)));
- r = result;
- *r++ = '\'';
-
- for (s = string; s && (c = *s); s++)
- {
- *r++ = c;
-
- if (c == '\'')
- {
- *r++ = '\\'; /* insert escaped single quote */
- *r++ = '\'';
- *r++ = '\''; /* start new quoted string */
- }
- }
-
- *r++ = '\'';
- *r = '\0';
-
- return (result);
-}
-#endif /* !SHELL */
-
static char *
quote_breaks (s)
char *s;
@@ -888,19 +856,14 @@ history_expand (hstring, output)
{
if (!cc || member (cc, history_no_expand_chars))
continue;
-#if defined (SHELL)
- /* The shell uses ! as a pattern negation character
- in globbing [...] expressions, so let those pass
- without expansion. */
- else if (i > 0 && (string[i - 1] == '[') &&
- member (']', string + i + 1))
- continue;
- /* The shell uses ! as the indirect expansion character, so
- let those expansions pass as well. */
- else if (i > 1 && string[i - 1] == '{' && string[i - 2] == '$' &&
- member ('}', string + i + 1))
+ /* If the calling application has set
+ history_inhibit_expansion_function to a function that checks
+ for special cases that should not be history expanded,
+ call the function and skip the expansion if it returns a
+ non-zero value. */
+ else if (history_inhibit_expansion_function &&
+ (*history_inhibit_expansion_function) (string, i))
continue;
-#endif /* SHELL */
else
break;
}
diff --git a/contrib/libreadline/histfile.c b/contrib/libreadline/histfile.c
index 355d46ea50f7..c3de134a9694 100644
--- a/contrib/libreadline/histfile.c
+++ b/contrib/libreadline/histfile.c
@@ -52,6 +52,16 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
+#if defined (__EMX__)
+# 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. */
+# undef O_BINARY
+# define O_BINARY 0
+#endif /* !__EMX__ */
+
#include <errno.h>
#if !defined (errno)
extern int errno;
@@ -60,6 +70,9 @@ extern int errno;
#include "history.h"
#include "histlib.h"
+/* Functions imported from shell.c */
+extern char *get_env_value ();
+
extern char *xmalloc (), *xrealloc ();
/* Return the string that should be used in the place of this
@@ -77,7 +90,7 @@ history_filename (filename)
if (return_val)
return (return_val);
- home = getenv ("HOME");
+ home = get_env_value ("HOME");
if (home == 0)
{
@@ -121,7 +134,7 @@ read_history_range (filename, from, to)
struct stat finfo;
input = history_filename (filename);
- file = open (input, O_RDONLY, 0666);
+ file = open (input, O_RDONLY|O_BINARY, 0666);
if ((file < 0) || (fstat (file, &finfo) == -1))
goto error_and_exit;
@@ -194,11 +207,12 @@ history_truncate_file (fname, lines)
{
register int i;
int file, chars_read;
- char *buffer = (char *)NULL, *filename;
+ char *buffer, *filename;
struct stat finfo;
+ buffer = (char *)NULL;
filename = history_filename (fname);
- file = open (filename, O_RDONLY, 0666);
+ file = open (filename, O_RDONLY|O_BINARY, 0666);
if (file == -1 || fstat (file, &finfo) == -1)
goto truncate_exit;
@@ -232,7 +246,7 @@ history_truncate_file (fname, lines)
/* Write only if there are more lines in the file than we want to
truncate to. */
- if (i && ((file = open (filename, O_WRONLY|O_TRUNC, 0666)) != -1))
+ if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0666)) != -1))
{
write (file, buffer + i, finfo.st_size - i);
close (file);
@@ -255,10 +269,11 @@ history_do_write (filename, nelements, overwrite)
int nelements, overwrite;
{
register int i;
- char *output = history_filename (filename);
+ char *output;
int file, mode;
- mode = overwrite ? O_WRONLY | O_CREAT | O_TRUNC : O_WRONLY | O_APPEND;
+ mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
+ output = history_filename (filename);
if ((file = open (output, mode, 0666)) == -1)
{
diff --git a/contrib/libreadline/history.h b/contrib/libreadline/history.h
index 17ec8775117a..e49a341492f1 100644
--- a/contrib/libreadline/history.h
+++ b/contrib/libreadline/history.h
@@ -22,6 +22,14 @@
#ifndef _HISTORY_H_
#define _HISTORY_H_
+#if !defined (_FUNCTION_DEF)
+# define _FUNCTION_DEF
+typedef int Function ();
+typedef void VFunction ();
+typedef char *CPFunction ();
+typedef char **CPPFunction ();
+#endif
+
/* The structure used to store a history entry. */
typedef struct _hist_entry {
char *line;
@@ -207,4 +215,9 @@ extern char *history_no_expand_chars;
extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion;
+/* If set, this function is called to decide whether or not a particular
+ history expansion should be treated as a special case for the calling
+ application and not expanded. */
+extern Function *history_inhibit_expansion_function;
+
#endif /* !_HISTORY_H_ */
diff --git a/contrib/libreadline/isearch.c b/contrib/libreadline/isearch.c
index fa60fa498405..9639a63fd299 100644
--- a/contrib/libreadline/isearch.c
+++ b/contrib/libreadline/isearch.c
@@ -30,13 +30,19 @@
# include <config.h>
#endif
+#include <sys/types.h>
+
#include <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#include <sys/types.h>
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif
#include "rldefs.h"
#include "readline.h"
@@ -287,7 +293,8 @@ rl_search_history (direction, invoking_key)
rl_end = strlen (rl_line_buffer);
_rl_restore_prompt();
rl_clear_message ();
- free (allocated_line);
+ if (allocated_line)
+ free (allocated_line);
free (lines);
return 0;
@@ -403,7 +410,8 @@ rl_search_history (direction, invoking_key)
rl_point = line_index;
rl_clear_message ();
- free (allocated_line);
+ if (allocated_line)
+ free (allocated_line);
free (lines);
return 0;
diff --git a/contrib/libreadline/kill.c b/contrib/libreadline/kill.c
index 89f6b5570384..352f37deb502 100644
--- a/contrib/libreadline/kill.c
+++ b/contrib/libreadline/kill.c
@@ -53,6 +53,7 @@ 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 ();
@@ -384,7 +385,11 @@ int
rl_kill_region (count, ignore)
int count, ignore;
{
- return (region_kill_internal (1));
+ int r;
+
+ r = region_kill_internal (1);
+ _rl_fix_point (1);
+ return r;
}
/* Copy COUNT words to the kill ring. DIR says which direction we look
@@ -521,7 +526,7 @@ rl_yank_nth_arg (count, ignore)
inserts it right *after* rl_point. */
if (rl_editing_mode == vi_mode)
{
- rl_vi_append_mode ();
+ rl_vi_append_mode (1, ignore);
rl_insert_text (" ");
}
#endif /* VI_MODE */
diff --git a/contrib/libreadline/nls.c b/contrib/libreadline/nls.c
index fad520197c41..7a00a5f16513 100644
--- a/contrib/libreadline/nls.c
+++ b/contrib/libreadline/nls.c
@@ -25,6 +25,8 @@
# include <config.h>
#endif
+#include <sys/types.h>
+
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -46,7 +48,11 @@
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 ();
+
+#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
or LANG environment variable (using the first of those with a value),
@@ -69,6 +75,7 @@ static char *legal_lang_values[] =
static char *normalize_codeset ();
static char *find_codeset ();
+#endif /* !HAVE_SETLOCALE */
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
to decide the defaults for 8-bit character input and output. Returns
@@ -76,12 +83,33 @@ static char *find_codeset ();
int
_rl_init_eightbit ()
{
+/* If we have setlocale(3), just check the current LC_CTYPE category
+ value, and go into eight-bit mode if it's not C or POSIX. */
+#if defined (HAVE_SETLOCALE)
+ char *t;
+
+ /* Set the LC_CTYPE locale category from environment variables. */
+ t = setlocale (LC_CTYPE, "");
+ if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0))
+ {
+ _rl_meta_flag = 1;
+ _rl_convert_meta_chars_to_ascii = 0;
+ _rl_output_meta_chars = 1;
+ return (1);
+ }
+ else
+ return (0);
+
+#else /* !HAVE_SETLOCALE */
char *lspec, *t;
int i;
- lspec = getenv ("LC_ALL");
- if (lspec == 0) lspec = getenv ("LC_CTYPE");
- if (lspec == 0) lspec = getenv ("LANG");
+ /* We don't have setlocale. Finesse it. Check the environment for the
+ appropriate variables and set eight-bit mode if they have the right
+ values. */
+ lspec = get_env_value ("LC_ALL");
+ if (lspec == 0) lspec = get_env_value ("LC_CTYPE");
+ if (lspec == 0) lspec = get_env_value ("LANG");
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
return (0);
for (i = 0; t && legal_lang_values[i]; i++)
@@ -90,15 +118,15 @@ _rl_init_eightbit ()
_rl_meta_flag = 1;
_rl_convert_meta_chars_to_ascii = 0;
_rl_output_meta_chars = 1;
-#if defined (HAVE_SETLOCALE)
- setlocale (LC_CTYPE, lspec);
-#endif
break;
}
free (t);
return (legal_lang_values[i] ? 1 : 0);
+
+#endif /* !HAVE_SETLOCALE */
}
+#if !defined (HAVE_SETLOCALE)
static char *
normalize_codeset (codeset)
char *codeset;
@@ -196,3 +224,4 @@ find_codeset (name, lenp)
return result;
}
+#endif /* !HAVE_SETLOCALE */
diff --git a/contrib/libreadline/posixdir.h b/contrib/libreadline/posixdir.h
index 8b0e5bcb6ce2..7480a93d5dbe 100644
--- a/contrib/libreadline/posixdir.h
+++ b/contrib/libreadline/posixdir.h
@@ -42,7 +42,7 @@
# define D_NAMLEN(d) ((d)->d_namlen)
#endif /* !HAVE_DIRENT_H */
-#if defined (STRUCT_DIRENT_HAS_D_INO)
+#if defined (STRUCT_DIRENT_HAS_D_INO) && !defined (STRUCT_DIRENT_HAS_D_FILENO)
# define d_fileno d_ino
#endif
diff --git a/contrib/libreadline/posixjmp.h b/contrib/libreadline/posixjmp.h
new file mode 100644
index 000000000000..8703d17e9fbd
--- /dev/null
+++ b/contrib/libreadline/posixjmp.h
@@ -0,0 +1,20 @@
+/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+
+#ifndef _POSIXJMP_H_
+#define _POSIXJMP_H_
+
+#include <setjmp.h>
+
+/* This *must* be included *after* config.h */
+
+#if defined (HAVE_POSIX_SIGSETJMP)
+# define procenv_t sigjmp_buf
+# undef setjmp
+# define setjmp(x) sigsetjmp((x), 1)
+# undef longjmp
+# define longjmp(x, n) siglongjmp((x), (n))
+#else
+# define procenv_t jmp_buf
+#endif
+
+#endif /* _POSIXJMP_H_ */
diff --git a/contrib/libreadline/readline.3 b/contrib/libreadline/readline.3
index e122cb7a7385..3d161689d2d4 100644
--- a/contrib/libreadline/readline.3
+++ b/contrib/libreadline/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
-.\" Last Change: Mon Jul 8 13:07:48 EDT 1996
+.\" Last Change: Wed Feb 5 14:13:22 EST 1997
.\"
-.TH READLINE 3 "1996 July 8" GNU
+.TH READLINE 3 "1997 Feb 5" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -682,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new
argument. M\-\- starts a negative argument.
.TP
.B universal\-argument
-Each time this is executed, the argument count is multiplied by four.
+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
+.B universal\-argument
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed 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 initially one, so executing this function the
-first time makes the argument count four.
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
.PD
.SS Completing
.PP
diff --git a/contrib/libreadline/readline.c b/contrib/libreadline/readline.c
index d85789d59092..dcd8f817584a 100644
--- a/contrib/libreadline/readline.c
+++ b/contrib/libreadline/readline.c
@@ -49,17 +49,25 @@
#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
+#include "posixjmp.h"
/* System-specific feature definitions and include files. */
#include "rldefs.h"
-#include "tcap.h"
+#if defined (__EMX__)
+# define INCL_DOSPROCESS
+# include <os2.h>
+#endif /* __EMX__ */
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
+#ifndef RL_LIBRARY_VERSION
+# define RL_LIBRARY_VERSION "2.1-bash"
+#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
@@ -75,7 +83,6 @@ extern void _rl_get_screen_size ();
extern int _rl_enable_meta;
extern int _rl_term_autowrap;
-extern char *term_backspace, *term_clreol, *term_clrpag;
extern int screenwidth, screenheight, screenchars;
/* Variables and functions imported from rltty.c. */
@@ -99,9 +106,17 @@ 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_save_prompt ();
+extern void _rl_restore_prompt ();
extern void _rl_erase_at_end_of_line ();
extern void _rl_move_cursor_relative ();
@@ -153,6 +168,7 @@ static void readline_default_bindings ();
#endif /* !__GO32__ */
#if defined (__GO32__)
+# include <go32.h>
# include <pc.h>
# undef HANDLE_SIGNALS
#endif /* __GO32__ */
@@ -165,7 +181,7 @@ extern char *xmalloc (), *xrealloc ();
/* */
/* **************************************************************** */
-char *rl_library_version = "2.1";
+char *rl_library_version = RL_LIBRARY_VERSION;
/* A pointer to the keymap that is currently in use.
By default, it is the standard emacs keymap. */
@@ -174,6 +190,11 @@ Keymap _rl_keymap = emacs_standard_keymap;
/* The current style of editing. */
int rl_editing_mode = emacs_mode;
+/* Non-zero if we called this function from _rl_dispatch(). It's present
+ so functions can find out whether they were called from a key binding
+ or directly from an application. */
+int rl_dispatching;
+
/* Non-zero if the previous command was a kill command. */
int _rl_last_command_was_kill = 0;
@@ -208,7 +229,7 @@ int rl_done;
Function *rl_last_func = (Function *)NULL;
/* Top level environment for readline_internal (). */
-jmp_buf readline_top_level;
+procenv_t readline_top_level;
/* The streams we interact with. */
FILE *_rl_in_stream, *_rl_out_stream;
@@ -360,7 +381,7 @@ readline_internal_setup ()
(*rl_redisplay_function) ();
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
- rl_vi_insertion_mode ();
+ rl_vi_insertion_mode (1, 0);
#endif /* VI_MODE */
}
}
@@ -498,6 +519,14 @@ readline_internal ()
}
void
+_rl_init_line_state ()
+{
+ rl_point = rl_end = 0;
+ the_line = rl_line_buffer;
+ the_line[0] = 0;
+}
+
+void
_rl_set_the_line ()
{
the_line = rl_line_buffer;
@@ -551,12 +580,14 @@ _rl_dispatch (key, map)
_rl_suppress_redisplay = (map[key].function == rl_insert) && _rl_input_available ();
#endif
+ rl_dispatching = 1;
r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
+ rl_dispatching = 0;
/* If we have input pending, then the last command was a prefix
command. Don't change the state of rl_last_func. Otherwise,
remember the last command executed in this variable. */
- if (!rl_pending_input)
+ if (!rl_pending_input && map[key].function != rl_digit_argument)
rl_last_func = map[key].function;
}
else
@@ -603,7 +634,7 @@ _rl_dispatch (key, map)
/* */
/* **************************************************************** */
-/* Initliaze readline (and terminal if not already). */
+/* Initialize readline (and terminal if not already). */
int
rl_initialize ()
{
@@ -616,9 +647,7 @@ rl_initialize ()
}
/* Initalize the current line information. */
- rl_point = rl_end = 0;
- the_line = rl_line_buffer;
- the_line[0] = 0;
+ _rl_init_line_state ();
/* We aren't done yet. We haven't even gotten started yet! */
rl_done = 0;
@@ -643,12 +672,41 @@ rl_initialize ()
return 0;
}
+#if defined (__EMX__)
+static void
+_emx_build_environ ()
+{
+ TIB *tibp;
+ PIB *pibp;
+ char *t, **tp;
+ int c;
+
+ DosGetInfoBlocks (&tibp, &pibp);
+ t = pibp->pib_pchenv;
+ for (c = 1; *t; c++)
+ t += strlen (t) + 1;
+ tp = environ = (char **)xmalloc ((c + 1) * sizeof (char *));
+ t = pibp->pib_pchenv;
+ while (*t)
+ {
+ *tp++ = t;
+ t += strlen (t) + 1;
+ }
+ *tp = 0;
+}
+#endif /* __EMX__ */
+
/* Initialize the entire state of the world. */
static void
readline_initialize_everything ()
{
+#if defined (__EMX__)
+ if (environ == 0)
+ _emx_build_environ ();
+#endif
+
/* Find out if we are running in Emacs. */
- running_in_emacs = getenv ("EMACS") != (char *)0;
+ running_in_emacs = get_env_value ("EMACS") != (char *)0;
/* Set up input and output if they are not already set up. */
if (!rl_instream)
@@ -664,7 +722,7 @@ readline_initialize_everything ()
_rl_out_stream = rl_outstream;
/* Allocate data structures. */
- if (!rl_line_buffer)
+ if (rl_line_buffer == 0)
rl_line_buffer = xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
/* Initialize the terminal interface. */
@@ -773,45 +831,56 @@ bind_arrow_keys ()
static int
rl_digit_loop ()
{
- int key, c, sawminus;
+ int key, c, sawminus, sawdigits;
_rl_save_prompt ();
- sawminus = 0;
+ sawminus = sawdigits = 0;
while (1)
{
rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
key = c = rl_read_key ();
+ /* If we see a key bound to `universal-argument' after seeing digits,
+ it ends the argument but is otherwise ignored. */
if (_rl_keymap[c].type == ISFUNC &&
_rl_keymap[c].function == rl_universal_argument)
{
- rl_numeric_arg *= 4;
- continue;
- }
- c = UNMETA (c);
- if (_rl_digit_p (c))
- {
- rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
- rl_explicit_arg = 1;
- }
- else
- {
- if (c == '-' && rl_explicit_arg == 0)
+ if (sawdigits == 0)
{
- rl_numeric_arg = sawminus = 1;
- rl_arg_sign = -1;
+ rl_numeric_arg *= 4;
+ continue;
}
else
{
- /* Make M-- command equivalent to M--1 command. */
- if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
- rl_explicit_arg = 1;
+ key = rl_read_key ();
_rl_restore_prompt ();
rl_clear_message ();
return (_rl_dispatch (key, _rl_keymap));
}
}
+
+ c = UNMETA (c);
+
+ if (_rl_digit_p (c))
+ {
+ rl_numeric_arg = rl_explicit_arg ? (rl_numeric_arg * 10) + c - '0' : c - '0';
+ sawdigits = rl_explicit_arg = 1;
+ }
+ else if (c == '-' && rl_explicit_arg == 0)
+ {
+ rl_numeric_arg = sawminus = 1;
+ rl_arg_sign = -1;
+ }
+ else
+ {
+ /* Make M-- command equivalent to M--1 command. */
+ if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0)
+ rl_explicit_arg = 1;
+ _rl_restore_prompt ();
+ rl_clear_message ();
+ return (_rl_dispatch (key, _rl_keymap));
+ }
}
return 0;
@@ -936,6 +1005,28 @@ rl_delete_text (from, to)
return (diff);
}
+/* Fix up point so that it is within the line boundaries after killing
+ text. If FIX_MARK_TOO is non-zero, the mark is forced within line
+ boundaries also. */
+
+#define _RL_FIX_POINT(x) \
+ do { \
+ if (x > rl_end) \
+ x = rl_end; \
+ else if (x < 0) \
+ x = 0; \
+ } while (0)
+
+void
+_rl_fix_point (fix_mark_too)
+ int fix_mark_too;
+{
+ _RL_FIX_POINT (rl_point);
+ if (fix_mark_too)
+ _RL_FIX_POINT (rl_mark);
+}
+#undef _RL_FIX_POINT
+
/* **************************************************************** */
/* */
/* Readline character functions */
@@ -1153,8 +1244,7 @@ rl_refresh_line ()
memset (row_start + col, 0, (width - col) * 2);
}
#else /* !__GO32__ */
- if (term_clreol)
- tputs (term_clreol, 1, _rl_output_character_function);
+ _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
#endif /* !__GO32__ */
rl_forced_update_display ();
@@ -1176,13 +1266,7 @@ rl_clear_screen (count, key)
return 0;
}
-#if !defined (__GO32__)
- if (term_clrpag)
- tputs (term_clrpag, 1, _rl_output_character_function);
- else
-#endif /* !__GO32__ */
- crlf ();
-
+ _rl_clear_screen (); /* calls termcap function to clear screen */
rl_forced_update_display ();
rl_display_fixed = 1;
@@ -1321,8 +1405,11 @@ rl_newline (count, key)
rl_done = 1;
#if defined (VI_MODE)
- _rl_vi_done_inserting ();
- _rl_vi_reset_last ();
+ if (rl_editing_mode == vi_mode)
+ {
+ _rl_vi_done_inserting ();
+ _rl_vi_reset_last ();
+ }
#endif /* VI_MODE */
if (readline_echoing_p)
@@ -1632,10 +1719,7 @@ rl_transpose_chars (count, key)
rl_delete_text (rl_point, rl_point + 1);
rl_point += count;
- if (rl_point > rl_end)
- rl_point = rl_end;
- else if (rl_point < 0)
- rl_point = 0;
+ _rl_fix_point (0);
rl_insert_text (dummy);
rl_end_undo_group ();
@@ -1988,7 +2072,7 @@ rl_vi_editing_mode (count, key)
{
#if defined (VI_MODE)
rl_editing_mode = vi_mode;
- rl_vi_insertion_mode ();
+ rl_vi_insertion_mode (1, key);
#endif /* VI_MODE */
return 0;
}
diff --git a/contrib/libreadline/readline.h b/contrib/libreadline/readline.h
index 4f7d4982abdf..d6c1a5cce1e1 100644
--- a/contrib/libreadline/readline.h
+++ b/contrib/libreadline/readline.h
@@ -102,7 +102,7 @@ extern int
rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
-extern int rl_vi_check (), rl_vi_textmod_command ();
+extern int rl_vi_check ();
extern int
rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (),
rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
@@ -236,6 +236,10 @@ extern char *rl_library_version;
whatever was in argv[0]. It is used when parsing conditionals. */
extern char *rl_readline_name;
+/* The prompt readline uses. This is set from the argument to
+ readline (), and should not be assigned to directly. */
+extern char *rl_prompt;
+
/* The line buffer that is in use. */
extern char *rl_line_buffer;
@@ -248,6 +252,11 @@ extern int rl_done;
extern int rl_pending_input;
+/* Non-zero if we called this function from _rl_dispatch(). It's present
+ so functions can find out whether they were called from a key binding
+ or directly from an application. */
+int rl_dispatching;
+
/* The name of the terminal to use. */
extern char *rl_terminal_name;
@@ -370,6 +379,14 @@ extern int rl_completion_type;
default is a space. Nothing is added if this is '\0'. */
extern int rl_completion_append_character;
+/* Up to this many items will be displayed in response to a
+ possible-completions call. After that, we ask the user if she
+ is sure she wants to see them all. The default value is 100. */
+extern int rl_completion_query_items;
+
+/* If non-zero, then disallow duplicates in the matches. */
+extern int rl_ignore_completion_duplicates;
+
/* If this is non-zero, completion is (temporarily) inhibited, and the
completion character will be inserted as any other. */
extern int rl_inhibit_completion;
diff --git a/contrib/libreadline/rldefs.h b/contrib/libreadline/rldefs.h
index 5a9e62a75031..d4aced43e2a2 100644
--- a/contrib/libreadline/rldefs.h
+++ b/contrib/libreadline/rldefs.h
@@ -40,17 +40,6 @@
# endif
#endif
-#if defined (HAVE_SYS_STREAM_H)
-# include <sys/stream.h>
-#endif /* HAVE_SYS_STREAM_H */
-#if defined (HAVE_SYS_PTEM_H)
-# include <sys/ptem.h>
-# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
-#endif /* HAVE_SYS_PTEM_H */
-#if defined (HAVE_SYS_PTE_H)
-# include <sys/pte.h>
-#endif /* HAVE_SYS_PTE_H */
-
/* Posix macro to check file in statbuf for directory-ness.
This requires that <sys/stat.h> be included before this test. */
#if defined (S_IFDIR) && !defined (S_ISDIR)
diff --git a/contrib/libreadline/rltty.c b/contrib/libreadline/rltty.c
index d35eb6ae6196..8312963abcbf 100644
--- a/contrib/libreadline/rltty.c
+++ b/contrib/libreadline/rltty.c
@@ -53,6 +53,8 @@ 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
diff --git a/contrib/libreadline/rltty.h b/contrib/libreadline/rltty.h
index 3ee6b3f28f80..3e1370473aea 100644
--- a/contrib/libreadline/rltty.h
+++ b/contrib/libreadline/rltty.h
@@ -42,6 +42,18 @@
# include <sgtty.h>
#endif
+/* Stuff for `struct winsize' on various systems. */
+#if defined (HAVE_SYS_STREAM_H)
+# include <sys/stream.h>
+#endif /* HAVE_SYS_STREAM_H */
+#if defined (HAVE_SYS_PTEM_H)
+# include <sys/ptem.h>
+# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
+#endif /* HAVE_SYS_PTEM_H */
+#if defined (HAVE_SYS_PTE_H)
+# include <sys/pte.h>
+#endif /* HAVE_SYS_PTE_H */
+
/* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
it is not already defined. It is used both to determine if a
special character is disabled and to disable certain special
diff --git a/contrib/libreadline/search.c b/contrib/libreadline/search.c
index 05641a19f462..3024ee596772 100644
--- a/contrib/libreadline/search.c
+++ b/contrib/libreadline/search.c
@@ -33,11 +33,20 @@
# include <unistd.h>
#endif
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif
+
#include "rldefs.h"
#include "readline.h"
#include "history.h"
-#define abs(x) (((x) > 0) ? (x) : -(x))
+#ifdef abs
+# undef abs
+#endif
+#define abs(x) (((x) >= 0) ? (x) : -(x))
extern char *xmalloc (), *xrealloc ();
diff --git a/contrib/libreadline/shell.c b/contrib/libreadline/shell.c
new file mode 100644
index 000000000000..eb99c7276e39
--- /dev/null
+++ b/contrib/libreadline/shell.c
@@ -0,0 +1,129 @@
+/* shell.c -- readline utility functions that are normally provided by
+ bash when readline is linked as part of the shell. */
+
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ 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
+ (at your option) any later version.
+
+ The GNU Readline Library 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.
+
+ 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. */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+extern char *xmalloc (), *xrealloc ();
+
+#if !defined (SHELL)
+
+#ifdef savestring
+#undef savestring
+#endif
+
+/* Backwards compatibility, now that savestring has been removed from
+ all `public' readline header files. */
+char *
+savestring (s)
+ char *s;
+{
+ return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
+}
+
+/* Does shell-like quoting using single quotes. */
+char *
+single_quote (string)
+ char *string;
+{
+ register int c;
+ char *result, *r, *s;
+
+ result = (char *)xmalloc (3 + (3 * strlen (string)));
+ r = result;
+ *r++ = '\'';
+
+ for (s = string; s && (c = *s); s++)
+ {
+ *r++ = c;
+
+ if (c == '\'')
+ {
+ *r++ = '\\'; /* insert escaped single quote */
+ *r++ = '\'';
+ *r++ = '\''; /* start new quoted string */
+ }
+ }
+
+ *r++ = '\'';
+ *r = '\0';
+
+ return (result);
+}
+
+/* Set the environment variables LINES and COLUMNS to lines and cols,
+ respectively. */
+void
+set_lines_and_columns (lines, cols)
+ int lines, cols;
+{
+ char *b;
+
+#if defined (HAVE_PUTENV)
+ b = xmalloc (24);
+ sprintf (b, "LINES=%d", lines);
+ putenv (b);
+ b = xmalloc (24);
+ sprintf (b, "COLUMNS=%d", cols);
+ putenv (b);
+#else /* !HAVE_PUTENV */
+# if defined (HAVE_SETENV)
+ b = xmalloc (8);
+ sprintf (b, "%d", lines);
+ setenv ("LINES", b, 1);
+ b = xmalloc (8);
+ sprintf (b, "%d", cols);
+ setenv ("COLUMNS", b, 1);
+# endif /* HAVE_SETENV */
+#endif /* !HAVE_PUTENV */
+}
+
+char *
+get_env_value (varname)
+ char *varname;
+{
+ return ((char *)getenv (varname));
+}
+
+#else /* SHELL */
+extern char *get_string_value ();
+
+char *
+get_env_value (varname)
+ char *varname;
+{
+ return get_string_value (varname);
+}
+#endif /* SHELL */
diff --git a/contrib/libreadline/signals.c b/contrib/libreadline/signals.c
index 2fe79532d8d1..e19c22d36415 100644
--- a/contrib/libreadline/signals.c
+++ b/contrib/libreadline/signals.c
@@ -87,6 +87,14 @@ static SigHandler *rl_set_sighandler ();
/* */
/* **************************************************************** */
+/* If we're not being compiled as part of bash, initialize handlers for
+ and catch the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) and
+ SIGTERM. */
+#if !defined (SHELL)
+# define HANDLE_JOB_SIGNALS
+# define HANDLE_SIGTERM
+#endif /* !SHELL */
+
#if defined (HAVE_POSIX_SIGNALS)
typedef struct sigaction sighandler_cxt;
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
@@ -97,9 +105,13 @@ typedef struct { SigHandler *sa_handler; } sighandler_cxt;
static sighandler_cxt old_int, old_alrm;
-#if !defined (SHELL)
-static sighandler_cxt old_tstp, old_ttou, old_ttin, old_term;
-#endif /* !SHELL */
+#if defined (HANDLE_JOB_SIGNALS)
+static sighandler_cxt old_tstp, old_ttou, old_ttin;
+#endif /* HANDLE_JOB_SIGNALS */
+
+#if defined (HANDLE_SIGTERM)
+static sighandler_cxt old_term;
+#endif
#if defined (SIGWINCH)
static sighandler_cxt old_winch;
@@ -116,14 +128,16 @@ rl_signal_handler (sig)
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
-# endif /* HAVE_BSD_SIGNALS */
+# else /* !HAVE_BSD_SIGNALS */
+ sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
+# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
/* Since the signal will not be blocked while we are in the signal
handler, ignore it until rl_clear_signals resets the catcher. */
if (sig == SIGINT || sig == SIGALRM)
- rl_set_sighandler (sig, SIG_IGN, (sighandler_cxt *)NULL);
+ rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
switch (sig)
@@ -188,6 +202,16 @@ rl_handle_sigwinch (sig)
{
SigHandler *oh;
+#if defined (MUST_REINSTALL_SIGHANDLERS)
+ sighandler_cxt dummy_winch;
+
+ /* We don't want to change old_winch -- it holds the state of SIGWINCH
+ disposition set by the calling application. We need this state
+ because we call the application's SIGWINCH handler after updating
+ our own idea of the screen size. */
+ rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &dummy_winch);
+#endif
+
if (readline_echoing_p)
{
_rl_get_screen_size (fileno (rl_instream), 1);
@@ -265,7 +289,7 @@ rl_set_signals ()
rl_sigaction (SIGALRM, &old_alrm, &dummy);
#endif /* HAVE_POSIX_SIGNALS */
-#if !defined (SHELL)
+#if defined (HANDLE_JOB_SIGNALS)
#if defined (SIGTSTP)
oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
@@ -286,9 +310,12 @@ rl_set_signals ()
}
#endif /* SIGTTOU */
+#endif /* HANDLE_JOB_SIGNALS */
+
+#if defined (HANDLE_SIGTERM)
/* Handle SIGTERM if we're not being compiled as part of bash. */
rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
-#endif /* !SHELL */
+#endif /* HANDLE_SIGTERM */
#if defined (SIGWINCH)
rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
@@ -309,7 +336,7 @@ rl_clear_signals ()
rl_sigaction (SIGINT, &old_int, &dummy);
rl_sigaction (SIGALRM, &old_alrm, &dummy);
-#if !defined (SHELL)
+#if defined (HANDLE_JOB_SIGNALS)
#if defined (SIGTSTP)
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
@@ -320,9 +347,11 @@ rl_clear_signals ()
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
#endif /* SIGTTOU */
- rl_sigaction (SIGTERM, &old_term, &dummy);
+#endif /* HANDLE_JOB_SIGNALS */
-#endif /* !SHELL */
+#if defined (HANDLE_SIGTERM)
+ rl_sigaction (SIGTERM, &old_term, &dummy);
+#endif /* HANDLE_SIGTERM */
#if defined (SIGWINCH)
sigemptyset (&dummy.sa_mask);
diff --git a/contrib/libreadline/support/config.guess b/contrib/libreadline/support/config.guess
new file mode 100755
index 000000000000..69e6169fa777
--- /dev/null
+++ b/contrib/libreadline/support/config.guess
@@ -0,0 +1,927 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+#
+# This file 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 of the License, 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-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# 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
+ PATH=$PATH:/.attbin ; export PATH
+elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/usr/5bin
+fi
+
+UNAME=`(uname) 2>/dev/null` || UNAME=unknown
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
+case "$RELEASE" in
+"") RELEASE=0 ;;
+*) RELEASE=`expr "$RELEASE" + 0` ;;
+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
+
+# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
+# is contrary to all other versions of uname
+if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
+ UNAME=UNIX_SV
+fi
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ # Begin cases added for Bash
+ alpha:NetBSD:*:*)
+ echo alpha-dec-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OpenBSD:*:*)
+ echo alpha-dec-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ 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 ;;
+ sparc:OpenBSD:*:*)
+ echo sparc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ vax:NetBSD:*:*)
+ echo vax-dec-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ vax:OpenBSD:*:*)
+ echo vax-dec-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:machten:*:*)
+ echo mac68k-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ concurrent*:*:*:*)
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo concurrent-concurrent-sysv3
+ else
+ echo concurrent-concurrent-bsd
+ fi
+ exit 0 ;;
+ ppc*:SunOS:5.*:*)
+ echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sparc:UNIX_SV:4.*:*)
+ echo sparc-unknown-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ mips:UNIX_SV:4.*:*)
+ echo mips-mips-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ mips:OSF*1:*:*)
+ echo mips-mips-osf1
+ exit 0 ;;
+ mips:4.4BSD:*:*)
+ echo mips-mips-bsd4.4
+ exit 0 ;;
+ MIServer-S:SMP_DC.OSx:*:dcosx)
+ echo mips-pyramid-sysv4
+ exit 0 ;;
+ news*:NEWS*:*:*)
+ echo mips-sony-newsos${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:NEXTSTEP:*:*)
+ echo i386-next-nextstep${RELEASE}
+ exit 0 ;;
+ *680?0:NEXTSTEP:*:*)
+ echo m68k-next-nextstep${RELEASE}
+ exit 0 ;;
+ *370:AIX:*:*)
+ echo ibm370-ibm-aix
+ exit 0 ;;
+ ksr1:OSF*1:*:*)
+ echo ksr1-ksr-osf1
+ exit 0 ;;
+ esa:OSF*1:*:* | ESA:OSF*:*:*)
+ echo esa-ibm-osf1
+ exit 0 ;;
+ DNP*:DNIX:*:*)
+ echo m68k-dnix-sysv
+ exit 0 ;;
+ *3b2*:*:*:*)
+ echo we32k-att-sysv3
+ exit 0 ;;
+ *:QNX:*:42*)
+ echo i386-qssl-qnx`echo ${UNAME_VERSION}`
+ exit 0 ;;
+ # end cases added for Bash
+ alpha:OSF1:*:*)
+ # A Vn.n version is a released version.
+ # 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.
+ echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-cbm-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*: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
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # 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:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-atari-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-sun-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-apple-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ 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
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerux
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # 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 \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} 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
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
+ IBM_REV=4.1
+ elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
+ IBM_REV=4.1.1
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
+ 9000/8?? ) HP_ARCH=hppa1.0 ;;
+ 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
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} 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:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-pc-osf1mk
+ else
+ echo ${UNAME_MACHINE}-pc-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${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_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ 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:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ 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/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo i386-pc-cygwin32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # 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`
+ if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
+ echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
+ echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
+ elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
+ echo "powerpc-unknown-linux-gnu" ; exit 0
+ elif test "${UNAME_MACHINE}" = "alpha" ; then
+ echo alpha-unknown-linux-gnu ; exit 0
+ elif test "${UNAME_MACHINE}" = "sparc" ; then
+ echo sparc-unknown-linux-gnu ; exit 0
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
+ # useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ test ! -d /usr/lib/ldscripts/. \
+ && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+main(argc, argv)
+int argc;
+char *argv[];
+{
+#ifdef __ELF__
+ printf ("%s-pc-linux-gnu\n", argv[1]);
+#else
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
+#endif
+ 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
+ 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.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i[34]86:UNIX_SV:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ 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`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ 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
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-pc-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ *:LynxOS:*:*)
+ echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
+ 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
+ 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
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp9000) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#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);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+/* Begin cases added for Bash */
+#if defined (tahoe)
+ printf ("tahoe-cci-bsd\n"); exit (0);
+#endif
+
+#if defined (nec_ews)
+# if defined (SYSTYPE_SYSV)
+ printf ("ews4800-nec-sysv4\n"); exit 0;
+# else
+ printf ("ews4800-nec-bsd\n"); exit (0);
+# endif
+#endif
+
+#if defined (sony)
+# if defined (SYSTYPE_SYSV)
+ printf ("mips-sony-sysv4\n"); exit 0;
+# else
+ printf ("mips-sony-bsd\n"); exit (0);
+# endif
+#endif
+
+#if defined (ardent)
+ printf ("titan-ardent-bsd\n"); exit (0);
+#endif
+
+#if defined (stardent)
+ printf ("stardent-stardent-sysv\n"); exit (0);
+#endif
+
+#if defined (ibm032)
+ printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
+#endif
+
+#if defined (sequent) && defined (i386)
+ printf ("i386-sequent-bsd\n"); exit (0);
+#endif
+
+#if defined (qnx) && defined (i386)
+ printf ("i386-pc-qnx\n"); exit (0);
+#endif
+
+#if defined (gould)
+ printf ("gould-gould-bsd\n"); exit (0);
+#endif
+
+#if defined (unixpc)
+ printf ("unixpc-att-sysv\n"); exit (0);
+#endif
+
+#if defined (att386)
+ printf ("i386-att-sysv3\n"); exit (0);
+#endif
+
+#if defined (__m88k) && defined (__UMAXV__)
+ printf ("m88k-encore-sysv3\n"); exit (0);
+#endif
+
+#if defined (drs6000)
+ printf ("drs6000-icl-sysv4.2\n"); exit (0);
+#endif
+
+#if defined (clipper)
+ printf ("clipper-orion-bsd\n"); exit (0);
+#endif
+
+#if defined (is68k)
+ printf ("m68k-isi-bsd\n"); exit (0);
+#endif
+
+#if defined (luna88k)
+ printf ("luna88k-omron-bsd\n"); exit (0);
+#endif
+
+#if defined (butterfly) && defined (BFLY1)
+ printf ("butterfly-bbn-mach\n"); exit (0);
+#endif
+
+#if defined (tower32)
+ printf ("tower32-ncr-sysv4\n"); exit (0);
+#endif
+
+#if defined (MagicStation)
+ printf ("magicstation-unknown-bsd\n"); exit (0);
+#endif
+
+#if defined (scs)
+ printf ("symmetric-scs-bsd4.2\n"); exit (0);
+#endif
+
+#if defined (tandem)
+ printf ("tandem-tandem-sysv\n"); exit (0);
+#endif
+
+#if defined (cadmus)
+ printf ("cadmus-pcs-sysv\n"); exit (0);
+#endif
+
+#if defined (masscomp)
+ printf ("masscomp-masscomp-sysv3\n"); exit (0);
+#endif
+
+#if defined (hbullx20)
+ printf ("hbullx20-bull-sysv3\n"); exit (0);
+#endif
+
+/* End cases added for Bash */
+
+ exit (1);
+}
+EOF
+
+${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.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+# Begin cases added for Bash
+case "$UNAME" in
+uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
+esac
+
+if [ -d /usr/amiga ]; then
+ echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
+fi
+
+if [ -f /bin/fxc.info ]; then
+ echo fxc-alliant-concentrix
+ exit 0
+fi
+# end cases added for Bash
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/contrib/libreadline/support/config.sub b/contrib/libreadline/support/config.sub
new file mode 100755
index 000000000000..e800bb63f416
--- /dev/null
+++ b/contrib/libreadline/support/config.sub
@@ -0,0 +1,944 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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 of the License, 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-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+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 \
+ | alpha | we32k | ns16k | clipper | i370 | sh \
+ | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
+ | pdp11 | mips64el | mips64orion | mips64orionel \
+ | sparc | sparclet | sparclite | sparc64)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # 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)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ 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-* | alpha-* | 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 \
+ | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
+ | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
+ | *-convex)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigados)
+ basic_machine=m68k-cbm
+ os=-amigados
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ hbullx20-bull)
+ basic_machine=m68k-bull
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax | multimax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ 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)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ ibm032-*)
+ basic_machine=ibmrt-ibm
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[3456]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[3456]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[3456]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[3456]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ luna88k-omron* | m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magicstation*)
+ basic_machine=magicstation-unknown
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5)
+ basic_machine=i586-intel
+ ;;
+ pentiumpro | p6)
+ basic_machine=i686-intel
+ ;;
+ pentium-* | p5-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-*)
+ 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
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ 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
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# 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.
+ mips)
+ basic_machine=mips-mips
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -unixware* | svr4*)
+ os=-sysv4
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -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* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -linux-gnu* | -uxpv* | -qnx* | -powerux)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigados
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -lynxos*)
+ vendor=lynx
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/contrib/libreadline/support/install.sh b/contrib/libreadline/support/install.sh
new file mode 100755
index 000000000000..ea88212bb50b
--- /dev/null
+++ b/contrib/libreadline/support/install.sh
@@ -0,0 +1,235 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/contrib/libreadline/support/mkdirs b/contrib/libreadline/support/mkdirs
new file mode 100755
index 000000000000..b79d9716f464
--- /dev/null
+++ b/contrib/libreadline/support/mkdirs
@@ -0,0 +1,32 @@
+#! /bin/sh
+#
+# mkdirs - a work-alike for `mkdir -p'
+#
+# Chet Ramey
+# chet@po.cwru.edu
+
+for dir
+do
+
+ test -d "$dir" && continue
+
+ tomake=$dir
+ while test -n "$dir" ; do
+ # dir=${dir%/*}
+ # dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
+ if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
+ tomake="$dir $tomake"
+ else
+ dir=
+ fi
+ done
+
+ for d in $tomake
+ do
+ test -d "$d" && continue
+ echo mkdir "$d"
+ mkdir "$d"
+ done
+done
+
+exit 0
diff --git a/contrib/libreadline/support/mkdist b/contrib/libreadline/support/mkdist
new file mode 100755
index 000000000000..0d3d69405993
--- /dev/null
+++ b/contrib/libreadline/support/mkdist
@@ -0,0 +1,100 @@
+#! /bin/bash -
+#
+# mkdist - make a distribution directory from a master manifest file
+#
+# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version
+#
+# SRCDIR defaults to src
+# MANIFEST defaults to $SRCDIR/MANIFEST
+#
+
+SRCDIR=src
+ROOTNAME=bash
+
+usage()
+{
+ echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version 1>&2
+ exit 2
+}
+
+vmsg()
+{
+ if [ -n "$verbose" ]; then
+ echo mkdist: "$@"
+ fi
+}
+
+while getopts m:s:r:v name
+do
+ case $name in
+ m) MANIFEST=$OPTARG ;;
+ s) SRCDIR=$OPTARG ;;
+ r) ROOTNAME=$OPTARG ;;
+ v) verbose=yes ;;
+ ?) usage ;;
+ esac
+done
+
+: ${MANIFEST:=$SRCDIR/MANIFEST}
+
+vmsg using $MANIFEST
+
+shift $(( $OPTIND - 1 ))
+
+if [ $# -lt 1 ]; then
+ usage
+fi
+
+version=$1
+newdir=${ROOTNAME}-$version
+
+vmsg creating distribution for version $version in $newdir
+
+if [ ! -d $newdir ]; then
+ mkdir $newdir || { echo $0: cannot make directory $newdir 1>&2 ; exit 1; }
+fi
+
+dirmode=755
+filmode=644
+
+while read fname type mode
+do
+ [ -z "$fname" ] && continue
+
+ case "$fname" in
+ \#*) continue ;;
+ esac
+
+ case "$type" in
+ d) mkdir $newdir/$fname ;;
+ f) cp -p $SRCDIR/$fname $newdir/$fname ;;
+ *) echo "unknown file type $type" 1>&2 ;;
+ esac
+
+ if [ -n "$mode" ]; then
+ chmod $mode $newdir/$fname
+ fi
+
+done < $MANIFEST
+
+# cut off the `-alpha' in something like `2.0-alpha', leaving just the
+# numeric version
+#version=${version%%-*}
+
+#case "$version" in
+#*.*.*) vers=${version%.*} ;;
+#*.*) vers=${version} ;;
+#esac
+
+#echo $vers > $newdir/.distribution
+
+#case "$version" in
+#*.*.*) plevel=${version##*.} ;;
+#*) plevel=0 ;;
+#esac
+#[ -z "$plevel" ] && plevel=0
+#echo ${plevel} > $newdir/.patchlevel
+
+vmsg $newdir created
+
+exit 0
diff --git a/contrib/libreadline/tcap.h b/contrib/libreadline/tcap.h
index 06732880e0e5..acb2d76ab486 100644
--- a/contrib/libreadline/tcap.h
+++ b/contrib/libreadline/tcap.h
@@ -29,6 +29,9 @@
#endif
#if defined (HAVE_TERMCAP_H)
+# if defined (__linux__) && !defined (SPEED_T_IN_SYS_TYPES)
+# include "rltty.h"
+# endif
# include <termcap.h>
#else
diff --git a/contrib/libreadline/terminal.c b/contrib/libreadline/terminal.c
index 9ca9bc68ae10..5a8df892d8b0 100644
--- a/contrib/libreadline/terminal.c
+++ b/contrib/libreadline/terminal.c
@@ -53,11 +53,12 @@
/* System-specific feature definitions and include files. */
#include "rldefs.h"
-#include "tcap.h"
-
-#if defined (GWINSZ_IN_SYS_IOCTL)
+#if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
# include <sys/ioctl.h>
-#endif /* GWINSZ_IN_SYS_IOCTL */
+#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
+
+#include "rltty.h"
+#include "tcap.h"
/* Some standard library routines. */
#include "readline.h"
@@ -69,6 +70,13 @@ 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 ();
+
/* **************************************************************** */
/* */
/* Terminal and Termcap */
@@ -84,8 +92,10 @@ static int tcap_initialized;
static int dumb_term;
#if !defined (__linux__)
-/* If this causes problems, add back the `extern'. */
-/*extern*/ char PC, *BC, *UP;
+# if defined (__EMX__) || defined (NEED_EXTERN_PC)
+extern
+# endif /* __EMX__ || NEED_EXTERN_PC */
+char PC, *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
@@ -139,45 +149,6 @@ int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
-/* Re-initialize the terminal considering that the TERM/TERMCAP variable
- has changed. */
-int
-rl_reset_terminal (terminal_name)
- char *terminal_name;
-{
- _rl_init_terminal_io (terminal_name);
- return 0;
-}
-
-#if !defined (SHELL)
-static void
-set_lines_and_columns (lines, cols)
- int lines, cols;
-{
- char *b;
-
-#if defined (HAVE_PUTENV)
- b = xmalloc (24);
- sprintf (b, "LINES=%d", lines);
- putenv (b);
- b = xmalloc (24);
- sprintf (b, "COLUMNS=%d", cols);
- putenv (b);
-#else /* !HAVE_PUTENV */
-# if defined (HAVE_SETENV)
- b = xmalloc (8);
- sprintf (b, "%d", lines);
- setenv ("LINES", b, 1);
- b = xmalloc (8);
- sprintf (b, "%d", cols);
- setenv ("COLUMNS", b, 1);
-# endif /* HAVE_SETENV */
-#endif /* !HAVE_PUTENV */
-}
-#else /* SHELL */
-extern void set_lines_and_columns ();
-#endif /* SHELL */
-
/* 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
@@ -190,6 +161,9 @@ _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)
@@ -199,11 +173,17 @@ _rl_get_screen_size (tty, ignore_env)
}
#endif /* TIOCGWINSZ */
+#if defined (__EMX__)
+ _scrsize (sz);
+ screenwidth = sz[0];
+ screenheight = sz[1];
+#endif
+
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
is unset. */
if (screenwidth <= 0)
{
- if (ignore_env == 0 && (ss = getenv ("COLUMNS")))
+ if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
screenwidth = atoi (ss);
if (screenwidth <= 0 && term_string_buffer)
@@ -214,7 +194,7 @@ _rl_get_screen_size (tty, ignore_env)
is unset. */
if (screenheight <= 0)
{
- if (ignore_env == 0 && (ss = getenv ("LINES")))
+ if (ignore_env == 0 && (ss = get_env_value ("LINES")))
screenheight = atoi (ss);
if (screenheight <= 0 && term_string_buffer)
@@ -334,7 +314,7 @@ _rl_init_terminal_io (terminal_name)
int tty;
Keymap xkeymap;
- term = terminal_name ? terminal_name : getenv ("TERM");
+ term = terminal_name ? terminal_name : get_env_value ("TERM");
if (term_string_buffer == 0)
term_string_buffer = xmalloc (2032);
@@ -443,6 +423,16 @@ rl_get_termcap (cap)
return ((char *)NULL);
}
+/* Re-initialize the terminal considering that the TERM/TERMCAP variable
+ has changed. */
+int
+rl_reset_terminal (terminal_name)
+ char *terminal_name;
+{
+ _rl_init_terminal_io (terminal_name);
+ return 0;
+}
+
/* A function for the use of tputs () */
int
_rl_output_character_function (c)
@@ -536,7 +526,7 @@ outchar (c)
return putc (c, rl_outstream);
}
-int
+void
_rl_enable_meta_key ()
{
if (term_has_meta && term_mm)
diff --git a/contrib/libreadline/tilde.c b/contrib/libreadline/tilde.c
index 69f57688489e..1d38d9d461f3 100644
--- a/contrib/libreadline/tilde.c
+++ b/contrib/libreadline/tilde.c
@@ -23,6 +23,10 @@
# include <config.h>
#endif
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
#if defined (HAVE_STRING_H)
# include <string.h>
#else /* !HAVE_STRING_H */
@@ -40,6 +44,10 @@
#include "tilde.h"
+#ifdef SHELL
+#include "shell.h"
+#endif
+
#if !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid (), *getpwnam ();
#endif /* !HAVE_GETPW_DECLS */
@@ -78,6 +86,12 @@ static char *default_prefixes[] =
static char *default_suffixes[] =
{ " ", "\n", (char *)NULL };
+/* If non-null, this contains the address of a function that the application
+ wants called before trying the standard tilde expansions. The function
+ is called with the text sans tilde, and returns a malloc()'ed string
+ which is the expansion, or a NULL pointer if the expansion fails. */
+CPFunction *tilde_expansion_preexpansion_hook = (CPFunction *)NULL;
+
/* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
@@ -108,7 +122,7 @@ tilde_find_prefix (string, len)
string_len = strlen (string);
*len = 0;
- if (!*string || *string == '~')
+ if (*string == '\0' || *string == '~')
return (0);
if (prefixes)
@@ -135,13 +149,14 @@ tilde_find_suffix (string)
char *string;
{
register int i, j, string_len;
- register char **suffixes = tilde_additional_suffixes;
+ register char **suffixes;
+ suffixes = tilde_additional_suffixes;
string_len = strlen (string);
for (i = 0; i < string_len; i++)
{
- if (string[i] == '/' || !string[i])
+ if (string[i] == '/' /* || !string[i] */)
break;
for (j = 0; suffixes && suffixes[j]; j++)
@@ -153,16 +168,28 @@ tilde_find_suffix (string)
return (i);
}
+#if !defined (SHELL)
+static char *
+get_string_value (varname)
+ char *varname;
+{
+ return ((char *)getenv (varname));
+}
+#endif
+
/* Return a new string which is the result of tilde expanding STRING. */
char *
tilde_expand (string)
char *string;
{
- char *result, *tilde_expand_word ();
+ char *result;
int result_size, result_index;
- result_size = result_index = 0;
- result = (char *)NULL;
+ result_index = result_size = 0;
+ if (result = strchr (string, '~'))
+ result = xmalloc (result_size = (strlen (string) + 16));
+ else
+ result = xmalloc (result_size = strlen (string));
/* Scan through STRING expanding tildes as we come to them. */
while (1)
@@ -215,97 +242,143 @@ tilde_expand (string)
return (result);
}
+/* Take FNAME and return the tilde prefix we want expanded. If LENP is
+ non-null, the index of the end of the prefix into FNAME is returned in
+ the location it points to. */
+static char *
+isolate_tilde_prefix (fname, lenp)
+ char *fname;
+ int *lenp;
+{
+ char *ret;
+ int i;
+
+ ret = xmalloc (strlen (fname));
+ for (i = 1; fname[i] && fname[i] != '/'; i++)
+ ret[i - 1] = fname[i];
+ ret[i - 1] = '\0';
+ if (lenp)
+ *lenp = i;
+ return ret;
+}
+
+/* Return a string that is PREFIX concatenated with SUFFIX starting at
+ SUFFIND. */
+static char *
+glue_prefix_and_suffix (prefix, suffix, suffind)
+ char *prefix, *suffix;
+ int suffind;
+{
+ char *ret;
+ int plen, slen;
+
+ plen = (prefix && *prefix) ? strlen (prefix) : 0;
+ slen = strlen (suffix + suffind);
+ ret = xmalloc (plen + slen + 1);
+ if (prefix && *prefix)
+ strcpy (ret, prefix);
+ strcpy (ret + plen, suffix + suffind);
+ return ret;
+}
+
+static char *
+get_home_dir ()
+{
+ char *home_dir;
+
+#ifdef SHELL
+ home_dir = (char *)NULL;
+ if (current_user.home_dir == 0)
+ get_current_user_info ();
+ home_dir = current_user.home_dir;
+#else
+ struct passwd *entry;
+
+ home_dir = (char *)NULL;
+ entry = getpwuid (getuid ());
+ if (entry)
+ home_dir = entry->pw_dir;
+#endif
+ return (home_dir);
+}
+
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
- tilde. If there is no expansion, call tilde_expansion_failure_hook. */
+ tilde. If there is no expansion, call tilde_expansion_failure_hook.
+ This always returns a newly-allocated string, never static storage. */
char *
tilde_expand_word (filename)
char *filename;
{
- char *dirname;
- char *temp_name;
+ char *dirname, *expansion, *username;
+ int user_len;
+ struct passwd *user_entry;
- if (filename == (char *)0)
+ if (filename == 0)
return ((char *)NULL);
- dirname = savestring (filename);
-
- if (*dirname != '~')
- return (dirname);
+ if (*filename != '~')
+ return (savestring (filename));
- if (!dirname[1] || dirname[1] == '/')
+ /* A leading `~/' or a bare `~' is *always* translated to the value of
+ $HOME or the home directory of the current user, regardless of any
+ preexpansion hook. */
+ if (filename[1] == '\0' || filename[1] == '/')
{
- /* Prepend $HOME to the rest of the string. */
- char *temp_home = (char *)getenv ("HOME");
- int home_len;
+ /* Prefix $HOME to the rest of the string. */
+ expansion = get_string_value ("HOME");
/* If there is no HOME variable, look up the directory in
the password database. */
- if (!temp_home)
- {
- struct passwd *entry;
-
- entry = getpwuid (getuid ());
- if (entry)
- temp_home = entry->pw_dir;
- }
+ if (expansion == 0)
+ expansion = get_home_dir ();
- home_len = temp_home ? strlen (temp_home) : 0;
- temp_name = xmalloc (1 + strlen (dirname + 1) + home_len);
-
- if (temp_home)
- strcpy (temp_name, temp_home);
- strcpy (temp_name + home_len, dirname + 1);
- free (dirname);
- dirname = temp_name;
+ return (glue_prefix_and_suffix (expansion, filename, 1));
}
- else
- {
- char *username;
- struct passwd *user_entry;
- int i, len;
- username = xmalloc (strlen (dirname));
- for (i = 1; dirname[i] && dirname[i] != '/'; i++)
- username[i - 1] = dirname[i];
- username[i - 1] = '\0';
+ username = isolate_tilde_prefix (filename, &user_len);
- if ((user_entry = getpwnam (username)) == (struct passwd *)0)
+ if (tilde_expansion_preexpansion_hook)
+ {
+ expansion = (*tilde_expansion_preexpansion_hook) (username);
+ if (expansion)
{
- /* If the calling program has a special syntax for
- expanding tildes, and we couldn't find a standard
- expansion, then let them try. */
- if (tilde_expansion_failure_hook)
- {
- char *expansion;
-
- expansion = (*tilde_expansion_failure_hook) (username);
-
- if (expansion)
- {
- len = strlen (expansion);
- temp_name = xmalloc (1 + len + strlen (dirname + i));
- strcpy (temp_name, expansion);
- strcpy (temp_name + len, dirname + i);
- free (expansion);
- free (dirname);
- dirname = temp_name;
- }
- }
- /* We shouldn't report errors. */
+ dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+ free (username);
+ free (expansion);
+ return (dirname);
}
- else
+ }
+
+ /* No preexpansion hook, or the preexpansion hook failed. Look in the
+ password database. */
+ dirname = (char *)NULL;
+ user_entry = getpwnam (username);
+ if (user_entry == 0)
+ {
+ /* If the calling program has a special syntax for expanding tildes,
+ and we couldn't find a standard expansion, then let them try. */
+ if (tilde_expansion_failure_hook)
{
- len = strlen (user_entry->pw_dir);
- temp_name = xmalloc (1 + len + strlen (dirname + i));
- strcpy (temp_name, user_entry->pw_dir);
- strcpy (temp_name + len, dirname + i);
- free (dirname);
- dirname = temp_name;
+ expansion = (*tilde_expansion_failure_hook) (username);
+ if (expansion)
+ {
+ dirname = glue_prefix_and_suffix (expansion, filename, user_len);
+ free (expansion);
+ }
}
- endpwent ();
free (username);
+ /* If we don't have a failure hook, or if the failure hook did not
+ expand the tilde, return a copy of what we were passed. */
+ if (dirname == 0)
+ dirname = savestring (filename);
+ }
+ else
+ {
+ free (username);
+ dirname = glue_prefix_and_suffix (user_entry->pw_dir, filename, user_len);
}
+ endpwent ();
return (dirname);
}
diff --git a/contrib/libreadline/tilde.h b/contrib/libreadline/tilde.h
index 6f0898c73721..634b95449aa5 100644
--- a/contrib/libreadline/tilde.h
+++ b/contrib/libreadline/tilde.h
@@ -33,6 +33,12 @@ typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
+/* If non-null, this contains the address of a function that the application
+ wants called before trying the standard tilde expansions. The function
+ is called with the text sans tilde, and returns a malloc()'ed string
+ which is the expansion, or a NULL pointer if the expansion fails. */
+extern CPFunction *tilde_expansion_preexpansion_hook;
+
/* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
diff --git a/contrib/libreadline/undo.c b/contrib/libreadline/undo.c
index af7ccc35d7c2..28ebcc85b934 100644
--- a/contrib/libreadline/undo.c
+++ b/contrib/libreadline/undo.c
@@ -38,7 +38,6 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#include <setjmp.h>
#include <stdio.h>
/* System-specific feature definitions and include files. */
diff --git a/contrib/libreadline/util.c b/contrib/libreadline/util.c
index f63293af63e1..d96b29e8cdf8 100644
--- a/contrib/libreadline/util.c
+++ b/contrib/libreadline/util.c
@@ -25,11 +25,9 @@
# include <config.h>
#endif
-#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
-#include <setjmp.h>
-#include <ctype.h>
+#include "posixjmp.h"
#if defined (HAVE_UNISTD_H)
# include <unistd.h> /* for _POSIX_VERSION */
@@ -41,6 +39,9 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+#include <stdio.h>
+#include <ctype.h>
+
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -55,7 +56,7 @@
/* Pseudo-globals imported from readline.c */
extern int readline_echoing_p;
-extern jmp_buf readline_top_level;
+extern procenv_t readline_top_level;
extern int rl_line_buffer_len;
extern Function *rl_last_func;
@@ -243,20 +244,6 @@ _rl_qsort_string_compare (s1, s2)
#endif
}
-#if !defined (SHELL)
-#ifdef savestring
-#undef savestring
-#endif
-/* Backwards compatibility, now that savestring has been removed from
- all `public' readline header files. */
-char *
-savestring (s)
- char *s;
-{
- return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
-}
-#endif /* !SHELL */
-
/* Function equivalents for the macros defined in chartypes.h. */
#undef _rl_uppercase_p
int