summaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authorunknown <vva@genie.(none)>2002-11-19 18:26:53 +0400
committerunknown <vva@genie.(none)>2002-11-19 18:26:53 +0400
commit953f6c51fed3478cc3905d2ce15728e5c3e7f00c (patch)
tree6f25883717e7c6cfc40b292a86148e469567534c /readline
parent0fb3b8d9abc3eb2e3072c2f8681099e7db0a256e (diff)
downloadmariadb-git-953f6c51fed3478cc3905d2ce15728e5c3e7f00c.tar.gz
upgrade readline to version 4.3
client/completion_hash.cc: correct headers of functions for readline 4.3 (add const modifier to char*) client/completion_hash.h: correct headers of functions for readline 4.3 (add const modifier to char*) client/mysql.cc: correct functions for readline 4.3
Diffstat (limited to 'readline')
-rw-r--r--readline/COPYING4
-rw-r--r--readline/INSTALL283
-rw-r--r--readline/Makefile.am2
-rw-r--r--readline/README37
-rw-r--r--readline/ansi_stdlib.h21
-rw-r--r--readline/bind.c708
-rw-r--r--readline/callback.c68
-rw-r--r--readline/chardefs.h95
-rw-r--r--readline/complete.c646
-rwxr-xr-xreadline/configure6090
-rw-r--r--readline/configure.in105
-rw-r--r--readline/display.c1208
-rw-r--r--readline/emacs_keymap.c1294
-rw-r--r--readline/funmap.c55
-rw-r--r--readline/histexpand.c263
-rw-r--r--readline/histfile.c249
-rw-r--r--readline/histlib.h28
-rw-r--r--readline/history.c59
-rw-r--r--readline/history.h88
-rw-r--r--readline/histsearch.c25
-rw-r--r--readline/input.c365
-rw-r--r--readline/isearch.c265
-rw-r--r--readline/keymaps.c16
-rw-r--r--readline/keymaps.h45
-rw-r--r--readline/kill.c141
-rw-r--r--readline/macro.c86
-rw-r--r--readline/mbutil.c337
-rw-r--r--readline/misc.c496
-rw-r--r--readline/nls.c37
-rw-r--r--readline/parens.c67
-rw-r--r--readline/posixdir.h12
-rw-r--r--readline/posixjmp.h18
-rw-r--r--readline/posixstat.h4
-rw-r--r--readline/readline.c1770
-rw-r--r--readline/readline.h688
-rw-r--r--readline/rlconf.h11
-rw-r--r--readline/rldefs.h43
-rw-r--r--readline/rlmbutil.h108
-rw-r--r--readline/rlprivate.h284
-rw-r--r--readline/rlshell.h34
-rw-r--r--readline/rlstdc.h62
-rw-r--r--readline/rltty.c322
-rw-r--r--readline/rltty.h25
-rw-r--r--readline/rltypedefs.h88
-rw-r--r--readline/rlwinsize.h5
-rw-r--r--readline/search.c280
-rw-r--r--readline/shell.c96
-rw-r--r--readline/signals.c68
-rw-r--r--readline/tcap.h4
-rw-r--r--readline/terminal.c492
-rw-r--r--readline/text.c1540
-rw-r--r--readline/tilde.c124
-rw-r--r--readline/tilde.h45
-rw-r--r--readline/undo.c33
-rw-r--r--readline/util.c163
-rw-r--r--readline/vi_keymap.c1290
-rw-r--r--readline/vi_mode.c400
-rw-r--r--readline/xmalloc.c43
-rw-r--r--readline/xmalloc.h46
59 files changed, 14183 insertions, 7098 deletions
diff --git a/readline/COPYING b/readline/COPYING
index a43ea2126fb..1bf15263878 100644
--- a/readline/COPYING
+++ b/readline/COPYING
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Also add information on how to contact you by electronic and paper mail.
diff --git a/readline/INSTALL b/readline/INSTALL
index 95d84c820fb..adb27a9f222 100644
--- a/readline/INSTALL
+++ b/readline/INSTALL
@@ -1,73 +1,81 @@
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
+These are installation instructions for Readline-4.3.
+
+The simplest way to compile readline is:
+
+ 1. `cd' to the directory containing the readline source code and type
+ `./configure' to configure readline 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
+ Running `configure' takes some time. 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.
+ 2. Type `make' to compile readline and build the static readline
+ and history libraries. If supported, the shared readline and history
+ libraries will be built also. See below for instructions on compiling
+ the other parts of the distribution. Typing `make everything' will
+ cause the static and shared libraries (if supported) and the example
+ programs to be built.
- 4. Type `make install' to install the programs and any data files and
- documentation.
+ 3. Type `make install' to install the static readline and history
+ libraries, the readline include files, the documentation, and, if
+ supported, the shared readline and history libraries.
- 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
+ 4. You can remove the created libraries and object files from the
+ build directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile readline 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.
+ for the readline developers, and should be used with care.
+
+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 the build directory,
+and Makefiles in the `doc', `shlib', and `examples'
+subdirectories. It also creates a `config.h' file 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 readline, please try
+to figure out how `configure' could check whether to do them, and
+mail diffs or instructions to <bug-readline@gnu.org> 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 readline `configure.in' requires autoconf
+version 2.50 or newer.
Compilers and Options
=====================
- Some systems require unusual options for compilation or linking that
+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
+You can compile readline 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
@@ -75,80 +83,59 @@ 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.
+If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile readline for one architecture at a
+time in the source code directory. After you have installed
+readline 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.
+By default, `make install' will install the readline libraries in
+`/usr/local/lib', the include files in
+`/usr/local/include/readline', the man pages in `/usr/local/man',
+and the info files in `/usr/local/info'. You can specify an
+installation prefix other than `/usr/local' by giving `configure'
+the option `--prefix=PATH' or by supplying a value for the
+DESTDIR variable when running `make install'.
+
+You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.
+If you give `configure' the option `--exec-prefix=PATH', the
+readline Makefiles will use PATH as the prefix for installing the
+libraries. Documentation and other data files will still use the
+regular prefix.
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.
+There may be some features `configure' can not figure out
+automatically, but need to determine by the type of host readline
+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 (e.g., i386-unknown-freebsd4.2).
- 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.
+See the file `config.sub' for the possible values of each field.
Sharing Defaults
================
- If you want to set default values for `configure' scripts to share,
+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.
+A warning: the readline `configure' looks for a site script, but not
+all `configure' scripts do.
Operation Controls
==================
- `configure' recognizes the following options to control how it
+`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
@@ -174,3 +161,113 @@ operates.
`configure' also accepts some other, not widely useful, options.
+Optional Features
+=================
+
+The readline `configure' recognizes a single `--with-PACKAGE' option:
+
+`--with-curses'
+ This tells readline that it can find the termcap library functions
+ (tgetent, et al.) in the curses library, rather than a separate
+ termcap library. Readline uses the termcap functions, but does not
+ link with the termcap or curses library itself, allowing applications
+ which link with readline the to choose an appropriate library.
+ This option tells readline to link the example programs with the
+ curses library rather than libtermcap.
+
+`configure' also recognizes two `--enable-FEATURE' options:
+
+`--enable-shared'
+ Build the shared libraries by default on supported platforms. The
+ default is `yes'.
+
+`--enable-static'
+ Build the static libraries by default. The default is `yes'.
+
+Shared Libraries
+================
+
+There is support for building shared versions of the readline and
+history libraries. The configure script creates a Makefile in
+the `shlib' subdirectory, and typing `make shared' will cause
+shared versions of the readline and history libraries to be built
+on supported platforms.
+
+If `configure' is given the `--enable-shared' option, it will attempt
+to build the shared libraries by default on supported platforms.
+
+Configure calls the script support/shobj-conf to test whether or
+not shared library creation is supported and to generate the values
+of variables that are substituted into shlib/Makefile. If you
+try to build shared libraries on an unsupported platform, `make'
+will display a message asking you to update support/shobj-conf for
+your platform.
+
+If you need to update support/shobj-conf, you will need to create
+a `stanza' for your operating system and compiler. The script uses
+the value of host_os and ${CC} as determined by configure. For
+instance, FreeBSD 4.2 with any version of gcc is identified as
+`freebsd4.2-gcc*'.
+
+In the stanza for your operating system-compiler pair, you will need to
+define several variables. They are:
+
+SHOBJ_CC The C compiler used to compile source files into shareable
+ object files. This is normally set to the value of ${CC}
+ by configure, and should not need to be changed.
+
+SHOBJ_CFLAGS Flags to pass to the C compiler ($SHOBJ_CC) to create
+ position-independent code. If you are using gcc, this
+ should probably be set to `-fpic'.
+
+SHOBJ_LD The link editor to be used to create the shared library from
+ the object files created by $SHOBJ_CC. If you are using
+ gcc, a value of `gcc' will probably work.
+
+SHOBJ_LDFLAGS Flags to pass to SHOBJ_LD to enable shared object creation.
+ If you are using gcc, `-shared' may be all that is necessary.
+ These should be the flags needed for generic shared object
+ creation.
+
+SHLIB_XLDFLAGS Additional flags to pass to SHOBJ_LD for shared library
+ creation. Many systems use the -R option to the link
+ editor to embed a path within the library for run-time
+ library searches. A reasonable value for such systems would
+ be `-R$(libdir)'.
+
+SHLIB_LIBS Any additional libraries that shared libraries should be
+ linked against when they are created.
+
+SHLIB_LIBSUFF The suffix to add to `libreadline' and `libhistory' when
+ generating the filename of the shared library. Many systems
+ use `so'; HP-UX uses `sl'.
+
+SHLIB_LIBVERSION The string to append to the filename to indicate the version
+ of the shared library. It should begin with $(SHLIB_LIBSUFF),
+ and possibly include version information that allows the
+ run-time loader to load the version of the shared library
+ appropriate for a particular program. Systems using shared
+ libraries similar to SunOS 4.x use major and minor library
+ version numbers; for those systems a value of
+ `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' is appropriate.
+ Systems based on System V Release 4 don't use minor version
+ numbers; use `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' on those systems.
+ Other Unix versions use different schemes.
+
+SHLIB_STATUS Set this to `supported' when you have defined the other
+ necessary variables. Make uses this to determine whether
+ or not shared library creation should be attempted. If
+ shared libraries are not supported, this will be set to
+ `unsupported'.
+
+You should look at the existing stanzas in support/shobj-conf for ideas.
+
+Once you have updated support/shobj-conf, re-run configure and type
+`make shared' or `make'. The shared libraries will be created in the
+shlib subdirectory.
+
+If shared libraries are created, `make install' will install them.
+You may install only the shared libraries by running `make
+install-shared' from the top-level build directory. Running `make
+install' in the shlib subdirectory will also work. If you don't want
+to install any created shared libraries, run `make install-static'.
diff --git a/readline/Makefile.am b/readline/Makefile.am
index 37e97289e6b..e9c6b3b8d58 100644
--- a/readline/Makefile.am
+++ b/readline/Makefile.am
@@ -15,7 +15,7 @@ libreadline_a_SOURCES = readline.c funmap.c keymaps.c \
callback.c terminal.c xmalloc.c \
history.c histsearch.c histexpand.c \
histfile.c nls.c search.c \
- shell.c tilde.c
+ shell.c tilde.c misc.c text.c mbutil.c
pkginclude_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
diff --git a/readline/README b/readline/README
index 56565b2fb80..7aa939452fb 100644
--- a/readline/README
+++ b/readline/README
@@ -1,7 +1,7 @@
Introduction
============
-This is the Gnu Readline library, version 4.0.
+This is the Gnu Readline library, version 4.3.
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
@@ -16,8 +16,8 @@ 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.
+the [GNU] General 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
@@ -37,6 +37,9 @@ to customize and control the build process.
The file rlconf.h contains C preprocessor defines that enable and disable
certain Readline features.
+The special make target `everything' will build the static and shared
+libraries (if the target platform supports them) and the examples.
+
Examples
========
@@ -54,6 +57,9 @@ a Makefile in the `shlib' subdirectory, and typing `make shared'
will cause shared versions of the Readline and History libraries
to be built on supported platforms.
+If `configure' is given the `--enable-shared' option, it will attempt
+to build the shared libraries by default on supported platforms.
+
Configure calls the script support/shobj-conf to test whether or
not shared library creation is supported and to generate the values
of variables that are substituted into shlib/Makefile. If you
@@ -64,8 +70,8 @@ your platform.
If you need to update support/shobj-conf, you will need to create
a `stanza' for your operating system and compiler. The script uses
the value of host_os and ${CC} as determined by configure. For
-instance, FreeBSD 2.2.5 with any version of gcc is identified as
-`freebsd2.2.5-gcc*'.
+instance, FreeBSD 4.2 with any version of gcc is identified as
+`freebsd4.2-gcc*'.
In the stanza for your operating system-compiler pair, you will need to
define several variables. They are:
@@ -122,18 +128,21 @@ Once you have updated support/shobj-conf, re-run configure and type
`make shared'. The shared libraries will be created in the shlib
subdirectory.
-Since shared libraries are not created on all platforms, `make install'
-will not automatically install the shared libraries. To install them,
-change the current directory to shlib and type `make install'. Running
-`make install-shared' from the top-level build directory will also work.
+If shared libraries are created, `make install' will install them.
+You may install only the shared libraries by running `make
+install-shared' from the top-level build directory. Running `make
+install' in the shlib subdirectory will also work. If you don't want
+to install any created shared libraries, run `make install-static'.
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.
+The documentation for the Readline and History libraries appears in
+the `doc' subdirectory. There are three texinfo files and a
+Unix-style manual page describing the facilities available in the
+Readline library. The texinfo files include both user and
+programmer's manuals. HTML versions of the manuals appear in the
+`doc' subdirectory as well.
Reporting Bugs
==============
@@ -144,7 +153,7 @@ Bug reports for Readline should be sent to:
When reporting a bug, please include the following information:
- * the version number and release status of Readline (e.g., 4.0-release)
+ * the version number and release status of Readline (e.g., 4.2-release)
* the machine and OS that it is running on
* a list of the compilation flags or the contents of `config.h', if
appropriate
diff --git a/readline/ansi_stdlib.h b/readline/ansi_stdlib.h
index 52339da5d33..db13cd234bd 100644
--- a/readline/ansi_stdlib.h
+++ b/readline/ansi_stdlib.h
@@ -18,18 +18,31 @@
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
- Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_STDLIB_H_)
#define _STDLIB_H_ 1
/* String conversion functions. */
extern int atoi ();
-extern long int atol ();
+
+extern double atof ();
+extern double strtod ();
/* Memory allocation functions. */
-extern char *malloc ();
-extern char *realloc ();
+/* Generic pointer type. */
+#ifndef PTR_T
+
+#if defined (__STDC__)
+# define PTR_T void *
+#else
+# define PTR_T char *
+#endif
+
+#endif /* PTR_T */
+
+extern PTR_T malloc ();
+extern PTR_T realloc ();
extern void free ();
/* Other miscellaneous functions. */
diff --git a/readline/bind.c b/readline/bind.c
index f122bdf4860..324499acf8f 100644
--- a/readline/bind.c
+++ b/readline/bind.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -42,7 +42,6 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#include <signal.h>
#include <errno.h>
#if !defined (errno)
@@ -58,61 +57,27 @@ extern int errno;
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_bell_preference;
-extern int _rl_meta_flag;
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_complete_show_all;
-extern int _rl_complete_mark_directories;
-extern int _rl_print_completions_horizontally;
-extern int _rl_completion_case_fold;
-extern int _rl_enable_keypad;
-#if defined (PAREN_MATCHING)
-extern int rl_blink_matching_paren;
-#endif /* PAREN_MATCHING */
-#if defined (VISIBLE_STATS)
-extern int rl_visible_stats;
-#endif /* VISIBLE_STATS */
-extern int rl_complete_with_tilde_expansion;
-extern int rl_completion_query_items;
-extern int rl_inhibit_completion;
-extern char *_rl_comment_begin;
-extern unsigned char *_rl_isearch_terminators;
-
-extern int rl_explicit_arg;
-extern int rl_editing_mode;
-extern unsigned char _rl_parsing_conditionalized_out;
-extern Keymap _rl_keymap;
-
-extern char *possible_control_prefixes[], *possible_meta_prefixes[];
-
-/* Functions imported from funmap.c */
-extern char **rl_funmap_names ();
-extern int rl_add_funmap_entry ();
-
-/* Functions imported from util.c */
-extern char *_rl_strindex ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
/* Variables exported by this file. */
Keymap rl_binding_keymap;
-/* Forward declarations */
-void rl_set_keymap_from_edit_mode ();
+static char *_rl_read_file PARAMS((char *, size_t *));
+static void _rl_init_file_error PARAMS((const char *));
+static int _rl_read_init_file PARAMS((const char *, int));
+static int glean_key_from_name PARAMS((char *));
+static int substring_member_of_array PARAMS((char *, const char **));
-static int _rl_read_init_file (const char *filename, int include_level);
-static int glean_key_from_name ();
-static int substring_member_of_array ();
+static int currently_reading_init_file;
-extern char *xmalloc (), *xrealloc ();
+/* used only in this file */
+static int _rl_prefer_visible_bell = 1;
/* **************************************************************** */
/* */
@@ -120,13 +85,13 @@ extern char *xmalloc (), *xrealloc ();
/* */
/* **************************************************************** */
-/* rl_add_defun (char *name, Function *function, int key)
+/* rl_add_defun (char *name, rl_command_func_t *function, int key)
Add NAME to the list of named functions. Make FUNCTION be the function
that gets called. If KEY is not -1, then bind it. */
int
rl_add_defun (name, function, key)
- char *name;
- Function *function;
+ const char *name;
+ rl_command_func_t *function;
int key;
{
if (key != -1)
@@ -139,7 +104,7 @@ rl_add_defun (name, function, key)
int
rl_bind_key (key, function)
int key;
- Function *function;
+ rl_command_func_t *function;
{
if (key < 0)
return (key);
@@ -170,7 +135,7 @@ rl_bind_key (key, function)
int
rl_bind_key_in_map (key, function, map)
int key;
- Function *function;
+ rl_command_func_t *function;
Keymap map;
{
int result;
@@ -189,7 +154,7 @@ int
rl_unbind_key (key)
int key;
{
- return (rl_bind_key (key, (Function *)NULL));
+ return (rl_bind_key (key, (rl_command_func_t *)NULL));
}
/* Make KEY do nothing in MAP.
@@ -199,13 +164,13 @@ rl_unbind_key_in_map (key, map)
int key;
Keymap map;
{
- return (rl_bind_key_in_map (key, (Function *)NULL, map));
+ return (rl_bind_key_in_map (key, (rl_command_func_t *)NULL, map));
}
/* Unbind all keys bound to FUNCTION in MAP. */
int
rl_unbind_function_in_map (func, map)
- Function *func;
+ rl_command_func_t *func;
Keymap map;
{
register int i, rval;
@@ -214,7 +179,7 @@ rl_unbind_function_in_map (func, map)
{
if (map[i].type == ISFUNC && map[i].function == func)
{
- map[i].function = (Function *)NULL;
+ map[i].function = (rl_command_func_t *)NULL;
rval = 1;
}
}
@@ -223,10 +188,10 @@ rl_unbind_function_in_map (func, map)
int
rl_unbind_command_in_map (command, map)
- char *command;
+ const char *command;
Keymap map;
{
- Function *func;
+ rl_command_func_t *func;
func = rl_named_function (command);
if (func == 0)
@@ -239,8 +204,8 @@ rl_unbind_command_in_map (command, map)
place to do bindings is in MAP. */
int
rl_set_key (keyseq, function, map)
- char *keyseq;
- Function *function;
+ const char *keyseq;
+ rl_command_func_t *function;
Keymap map;
{
return (rl_generic_bind (ISFUNC, keyseq, (char *)function, map));
@@ -251,7 +216,7 @@ rl_set_key (keyseq, function, map)
necessary. The initial place to do bindings is in MAP. */
int
rl_macro_bind (keyseq, macro, map)
- char *keyseq, *macro;
+ const char *keyseq, *macro;
Keymap map;
{
char *macro_keys;
@@ -276,12 +241,16 @@ rl_macro_bind (keyseq, macro, map)
int
rl_generic_bind (type, keyseq, data, map)
int type;
- char *keyseq, *data;
+ const char *keyseq;
+ char *data;
Keymap map;
{
char *keys;
int keys_len;
register int i;
+ KEYMAP_ENTRY k;
+
+ k.function = 0;
/* If no keys to bind to, exit right away. */
if (!keyseq || !*keyseq)
@@ -291,7 +260,7 @@ rl_generic_bind (type, keyseq, data, map)
return -1;
}
- keys = xmalloc (1 + (2 * strlen (keyseq)));
+ keys = (char *)xmalloc (1 + (2 * strlen (keyseq)));
/* Translate the ASCII representation of KEYSEQ into an array of
characters. Stuff the characters into KEYS, and the length of
@@ -305,7 +274,12 @@ rl_generic_bind (type, keyseq, data, map)
/* Bind keys, making new keymaps as necessary. */
for (i = 0; i < keys_len; i++)
{
- int ic = (int) ((unsigned char)keys[i]);
+ unsigned char uc = keys[i];
+ int ic;
+
+ ic = uc;
+ if (ic < 0 || ic >= KEYMAP_SIZE)
+ return -1;
if (_rl_convert_meta_chars_to_ascii && META_CHAR (ic))
{
@@ -318,18 +292,40 @@ rl_generic_bind (type, keyseq, data, map)
{
if (map[ic].type != ISKMAP)
{
- if (map[ic].type == ISMACR)
- free ((char *)map[ic].function);
+ /* We allow subsequences of keys. If a keymap is being
+ created that will `shadow' an existing function or macro
+ key binding, we save that keybinding into the ANYOTHERKEY
+ index in the new map. The dispatch code will look there
+ to find the function to execute if the subsequence is not
+ matched. ANYOTHERKEY was chosen to be greater than
+ UCHAR_MAX. */
+ k = map[ic];
map[ic].type = ISKMAP;
map[ic].function = KEYMAP_TO_FUNCTION (rl_make_bare_keymap());
}
map = FUNCTION_TO_KEYMAP (map, ic);
+ /* The dispatch code will return this function if no matching
+ key sequence is found in the keymap. This (with a little
+ help from the dispatch code in readline.c) allows `a' to be
+ mapped to something, `abc' to be mapped to something else,
+ and the function bound to `a' to be executed when the user
+ types `abx', leaving `bx' in the input queue. */
+ if (k.function /* && k.type == ISFUNC */)
+ {
+ map[ANYOTHERKEY] = k;
+ k.function = 0;
+ }
}
else
{
if (map[ic].type == ISMACR)
free ((char *)map[ic].function);
+ else if (map[ic].type == ISKMAP)
+ {
+ map = FUNCTION_TO_KEYMAP (map, ic);
+ ic = ANYOTHERKEY;
+ }
map[ic].function = KEYMAP_TO_FUNCTION (data);
map[ic].type = type;
@@ -346,7 +342,8 @@ rl_generic_bind (type, keyseq, data, map)
non-zero if there was an error parsing SEQ. */
int
rl_translate_keyseq (seq, array, len)
- char *seq, *array;
+ const char *seq;
+ char *array;
int *len;
{
register int i, c, l, temp;
@@ -366,7 +363,7 @@ rl_translate_keyseq (seq, array, len)
/* Handle special case of backwards define. */
if (strncmp (&seq[i], "C-\\M-", 5) == 0)
{
- array[l++] = ESC;
+ array[l++] = ESC; /* ESC is meta-prefix */
i += 5;
array[l++] = CTRL (_rl_to_upper (seq[i]));
if (seq[i] == '\0')
@@ -375,7 +372,7 @@ rl_translate_keyseq (seq, array, len)
else if (c == 'M')
{
i++;
- array[l++] = ESC; /* XXX */
+ array[l++] = ESC; /* ESC is meta-prefix */
}
else if (c == 'C')
{
@@ -428,16 +425,16 @@ rl_translate_keyseq (seq, array, len)
for (temp = 2, c -= '0'; ISOCTAL (seq[i]) && temp--; i++)
c = (c * 8) + OCTVALUE (seq[i]);
i--; /* auto-increment in for loop */
- array[l++] = c % (largest_char + 1);
+ array[l++] = c & largest_char;
break;
case 'x':
i++;
- for (temp = 3, c = 0; isxdigit (seq[i]) && temp--; i++)
+ for (temp = 2, c = 0; ISXDIGIT ((unsigned char)seq[i]) && temp--; i++)
c = (c * 16) + HEXVALUE (seq[i]);
- if (temp == 3)
+ if (temp == 2)
c = 'x';
i--; /* auto-increment in for loop */
- array[l++] = c % (largest_char + 1);
+ array[l++] = c & largest_char;
break;
default: /* backslashes before non-special chars just add the char */
array[l++] = c;
@@ -507,7 +504,7 @@ _rl_untranslate_macro_value (seq)
char *ret, *r, *s;
int c;
- r = ret = xmalloc (7 * strlen (seq) + 1);
+ r = ret = (char *)xmalloc (7 * strlen (seq) + 1);
for (s = seq; *s; s++)
{
c = *s;
@@ -550,9 +547,9 @@ _rl_untranslate_macro_value (seq)
/* Return a pointer to the function that STRING represents.
If STRING doesn't have a matching function, then a NULL pointer
is returned. */
-Function *
+rl_command_func_t *
rl_named_function (string)
- char *string;
+ const char *string;
{
register int i;
@@ -561,7 +558,7 @@ rl_named_function (string)
for (i = 0; funmap[i]; i++)
if (_rl_stricmp (funmap[i]->name, string) == 0)
return (funmap[i]->function);
- return ((Function *)NULL);
+ return ((rl_command_func_t *)NULL);
}
/* Return the function (or macro) definition which would be invoked via
@@ -569,8 +566,11 @@ rl_named_function (string)
used. TYPE, if non-NULL, is a pointer to an int which will receive the
type of the object pointed to. One of ISFUNC (function), ISKMAP (keymap),
or ISMACR (macro). */
-Function *
-rl_function_of_keyseq (const char *keyseq, Keymap map, int *type)
+rl_command_func_t *
+rl_function_of_keyseq (keyseq, map, type)
+ const char *keyseq;
+ Keymap map;
+ int *type;
{
register int i;
@@ -579,7 +579,7 @@ rl_function_of_keyseq (const char *keyseq, Keymap map, int *type)
for (i = 0; keyseq && keyseq[i]; i++)
{
- int ic = keyseq[i];
+ unsigned char ic = keyseq[i];
if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii)
{
@@ -619,7 +619,7 @@ rl_function_of_keyseq (const char *keyseq, Keymap map, int *type)
return (map[ic].function);
}
}
- return ((Function *) NULL);
+ return ((rl_command_func_t *) NULL);
}
/* The last key bindings file read. */
@@ -664,29 +664,26 @@ _rl_read_file (filename, sizep)
i = read (file, buffer, file_size);
close (file);
-#if 0
- if (i < file_size)
-#else
if (i < 0)
-#endif
{
free (buffer);
return ((char *)NULL);
}
- buffer[file_size] = '\0';
+ buffer[i] = '\0';
if (sizep)
- *sizep = file_size;
+ *sizep = i;
+
return (buffer);
}
/* Re-read the current keybindings file. */
int
-rl_re_read_init_file (int count __attribute__((unused)),
- int ignore __attribute__((unused)))
+rl_re_read_init_file (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
{
int r;
- r = rl_read_init_file ((char *)NULL);
+ r = rl_read_init_file ((const char *)NULL);
rl_set_keymap_from_edit_mode ();
return r;
}
@@ -699,14 +696,15 @@ rl_re_read_init_file (int count __attribute__((unused)),
If the file existed and could be opened and read, 0 is returned,
otherwise errno is returned. */
int
-rl_read_init_file (const char *filename)
+rl_read_init_file (filename)
+ const char *filename;
{
/* Default the filename. */
if (filename == 0)
{
filename = last_readline_init_file;
if (filename == 0)
- filename = get_env_value ("INPUTRC");
+ filename = sh_get_env_value ("INPUTRC");
if (filename == 0)
filename = DEFAULT_INPUTRC;
}
@@ -714,11 +712,18 @@ rl_read_init_file (const char *filename)
if (*filename == 0)
filename = DEFAULT_INPUTRC;
+#if defined (__MSDOS__)
+ if (_rl_read_init_file (filename, 0) == 0)
+ return 0;
+ filename = "~/_inputrc";
+#endif
return (_rl_read_init_file (filename, 0));
}
static int
-_rl_read_init_file (const char *filename, int include_level)
+_rl_read_init_file (filename, include_level)
+ const char *filename;
+ int include_level;
{
register int i;
char *buffer, *openname, *line, *end;
@@ -733,13 +738,15 @@ _rl_read_init_file (const char *filename, int include_level)
if (buffer == 0)
return (errno);
-
+
if (include_level == 0 && filename != last_readline_init_file)
{
FREE (last_readline_init_file);
last_readline_init_file = savestring (filename);
}
+ currently_reading_init_file = 1;
+
/* Loop over the lines in the file. Lines that start with `#' are
comments; all other lines are commands for readline initialization. */
current_readline_init_lineno = 1;
@@ -750,6 +757,12 @@ _rl_read_init_file (const char *filename, int include_level)
/* Find the end of this line. */
for (i = 0; line + i != end && line[i] != '\n'; i++);
+#if defined (__CYGWIN__)
+ /* ``Be liberal in what you accept.'' */
+ if (line[i] == '\n' && line[i-1] == '\r')
+ line[i - 1] = '\0';
+#endif
+
/* Mark end of line. */
line[i] = '\0';
@@ -770,16 +783,19 @@ _rl_read_init_file (const char *filename, int include_level)
}
free (buffer);
+ currently_reading_init_file = 0;
return (0);
}
static void
_rl_init_file_error (msg)
- char *msg;
+ const char *msg;
{
- fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
- current_readline_init_lineno,
- msg);
+ if (currently_reading_init_file)
+ fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
+ current_readline_init_lineno, msg);
+ else
+ fprintf (stderr, "readline: %s\n", msg);
}
/* **************************************************************** */
@@ -788,6 +804,17 @@ _rl_init_file_error (msg)
/* */
/* **************************************************************** */
+typedef int _rl_parser_func_t PARAMS((char *));
+
+/* Things that mean `Control'. */
+const char *_rl_possible_control_prefixes[] = {
+ "Control-", "C-", "CTRL-", (const char *)NULL
+};
+
+const char *_rl_possible_meta_prefixes[] = {
+ "Meta", "M-", (const char *)NULL
+};
+
/* Conditionals. */
/* Calling programs set this to have their argv[0]. */
@@ -875,7 +902,7 @@ parser_if (args)
/* Invert the current parser state if there is anything on the stack. */
static int
parser_else (args)
-char *args __attribute__((unused));
+ char *args __attribute__((unused));
{
register int i;
@@ -900,7 +927,7 @@ char *args __attribute__((unused));
_rl_parsing_conditionalized_out from the stack. */
static int
parser_endif (args)
-char *args __attribute__((unused));
+ char *args __attribute__((unused));
{
if (if_stack_depth)
_rl_parsing_conditionalized_out = if_stack[--if_stack_depth];
@@ -927,7 +954,7 @@ parser_include (args)
e = strchr (args, '\n');
if (e)
*e = '\0';
- r = _rl_read_init_file (args, old_include_level + 1);
+ r = _rl_read_init_file ((const char *)args, old_include_level + 1);
current_readline_init_file = old_init_file;
current_readline_init_lineno = old_line_number;
@@ -935,17 +962,17 @@ parser_include (args)
return r;
}
-
+
/* Associate textual names with actual functions. */
static struct {
const char *name;
- Function *function;
+ _rl_parser_func_t *function;
} parser_directives [] = {
{ "if", parser_if },
{ "endif", parser_endif },
{ "else", parser_else },
{ "include", parser_include },
- { (char *)0x0, (Function *)0x0 }
+ { (char *)0x0, (_rl_parser_func_t *)0x0 }
};
/* Handle a parser directive. STATEMENT is the line of the directive
@@ -1070,7 +1097,7 @@ rl_parse_and_bind (string)
/* Make VAR point to start of variable name. */
while (*var && whitespace (*var)) var++;
- /* Make value point to start of value string. */
+ /* Make VALUE point to start of value string. */
value = var;
while (*value && !whitespace (*value)) value++;
if (*value)
@@ -1140,7 +1167,7 @@ rl_parse_and_bind (string)
char *seq;
register int j, k, passc;
- seq = xmalloc (1 + strlen (string));
+ seq = (char *)xmalloc (1 + strlen (string));
for (j = 1, k = passc = 0; string[j]; j++)
{
/* Allow backslash to quote characters, but leave them in place.
@@ -1189,23 +1216,23 @@ rl_parse_and_bind (string)
key = glean_key_from_name (kname);
/* Add in control and meta bits. */
- if (substring_member_of_array (string, possible_control_prefixes))
+ if (substring_member_of_array (string, _rl_possible_control_prefixes))
key = CTRL (_rl_to_upper (key));
- if (substring_member_of_array (string, possible_meta_prefixes))
+ if (substring_member_of_array (string, _rl_possible_meta_prefixes))
key = META (key);
/* Temporary. Handle old-style keyname with macro-binding. */
if (*funname == '\'' || *funname == '"')
{
- unsigned char useq[2];
+ char useq[2];
int fl = strlen (funname);
useq[0] = key; useq[1] = '\0';
if (fl && funname[fl - 1] == *funname)
funname[fl - 1] = '\0';
- rl_macro_bind ((char*) useq, &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. */
@@ -1227,154 +1254,278 @@ rl_parse_and_bind (string)
have one of two values; either "On" or 1 for truth, or "Off" or 0 for
false. */
+#define V_SPECIAL 0x1
+
static struct {
const char *name;
int *value;
+ int flags;
} boolean_varlist [] = {
-#if defined (PAREN_MATCHING)
- { "blink-matching-paren", &rl_blink_matching_paren },
-#endif
- { "completion-ignore-case", &_rl_completion_case_fold },
- { "convert-meta", &_rl_convert_meta_chars_to_ascii },
- { "disable-completion", &rl_inhibit_completion },
- { "enable-keypad", &_rl_enable_keypad },
- { "expand-tilde", &rl_complete_with_tilde_expansion },
- { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode },
- { "input-meta", &_rl_meta_flag },
- { "mark-directories", &_rl_complete_mark_directories },
- { "mark-modified-lines", &_rl_mark_modified_lines },
- { "meta-flag", &_rl_meta_flag },
- { "output-meta", &_rl_output_meta_chars },
- { "print-completions-horizontally", &_rl_print_completions_horizontally },
- { "show-all-if-ambiguous", &_rl_complete_show_all },
+ { "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
+ { "byte-oriented", &rl_byte_oriented, 0 },
+ { "completion-ignore-case", &_rl_completion_case_fold, 0 },
+ { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
+ { "disable-completion", &rl_inhibit_completion, 0 },
+ { "enable-keypad", &_rl_enable_keypad, 0 },
+ { "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
+ { "history-preserve-point", &_rl_history_preserve_point, 0 },
+ { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
+ { "input-meta", &_rl_meta_flag, 0 },
+ { "mark-directories", &_rl_complete_mark_directories, 0 },
+ { "mark-modified-lines", &_rl_mark_modified_lines, 0 },
+ { "mark-symlinked-directories", &_rl_complete_mark_symlink_dirs, 0 },
+ { "match-hidden-files", &_rl_match_hidden_files, 0 },
+ { "meta-flag", &_rl_meta_flag, 0 },
+ { "output-meta", &_rl_output_meta_chars, 0 },
+ { "page-completions", &_rl_page_completions, 0 },
+ { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
+ { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
+ { "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
#if defined (VISIBLE_STATS)
- { "visible-stats", &rl_visible_stats },
+ { "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */
- { (char *)NULL, (int *)NULL }
+ { (char *)NULL, (int *)NULL, 0 }
+};
+
+static int
+find_boolean_var (name)
+ const char *name;
+{
+ register int i;
+
+ for (i = 0; boolean_varlist[i].name; i++)
+ if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
+ return i;
+ return -1;
+}
+
+/* Hooks for handling special boolean variables, where a
+ function needs to be called or another variable needs
+ to be changed when they're changed. */
+static void
+hack_special_boolean_var (i)
+ int i;
+{
+ const char *name;
+
+ name = boolean_varlist[i].name;
+
+ if (_rl_stricmp (name, "blink-matching-paren") == 0)
+ _rl_enable_paren_matching (rl_blink_matching_paren);
+ else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
+ {
+ if (_rl_prefer_visible_bell)
+ _rl_bell_preference = VISIBLE_BELL;
+ else
+ _rl_bell_preference = AUDIBLE_BELL;
+ }
+}
+
+typedef int _rl_sv_func_t PARAMS((const char *));
+
+/* These *must* correspond to the array indices for the appropriate
+ string variable. (Though they're not used right now.) */
+#define V_BELLSTYLE 0
+#define V_COMBEGIN 1
+#define V_EDITMODE 2
+#define V_ISRCHTERM 3
+#define V_KEYMAP 4
+
+#define V_STRING 1
+#define V_INT 2
+
+/* Forward declarations */
+static int sv_bell_style PARAMS((const char *));
+static int sv_combegin PARAMS((const char *));
+static int sv_compquery PARAMS((const char *));
+static int sv_editmode PARAMS((const char *));
+static int sv_isrchterm PARAMS((const char *));
+static int sv_keymap PARAMS((const char *));
+
+static struct {
+ const char *name;
+ int flags;
+ _rl_sv_func_t *set_func;
+} string_varlist[] = {
+ { "bell-style", V_STRING, sv_bell_style },
+ { "comment-begin", V_STRING, sv_combegin },
+ { "completion-query-items", V_INT, sv_compquery },
+ { "editing-mode", V_STRING, sv_editmode },
+ { "isearch-terminators", V_STRING, sv_isrchterm },
+ { "keymap", V_STRING, sv_keymap },
+ { (char *)NULL, 0, 0 }
};
+static int
+find_string_var (name)
+ const char *name;
+{
+ register int i;
+
+ for (i = 0; string_varlist[i].name; i++)
+ if (_rl_stricmp (name, string_varlist[i].name) == 0)
+ return i;
+ return -1;
+}
+
+/* A boolean value that can appear in a `set variable' command is true if
+ the value is null or empty, `on' (case-insenstive), or "1". Any other
+ values result in 0 (false). */
+static int
+bool_to_int (value)
+ char *value;
+{
+ return (value == 0 || *value == '\0' ||
+ (_rl_stricmp (value, "on") == 0) ||
+ (value[0] == '1' && value[1] == '\0'));
+}
+
int
rl_variable_bind (name, value)
- char *name, *value;
+ const char *name, *value;
{
register int i;
+ int v;
/* Check for simple variables first. */
- for (i = 0; boolean_varlist[i].name; i++)
+ i = find_boolean_var (name);
+ if (i >= 0)
{
- if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
- {
- /* A variable is TRUE if the "value" is "on", "1" or "". */
- *boolean_varlist[i].value = *value == 0 ||
- _rl_stricmp (value, "on") == 0 ||
- (value[0] == '1' && value[1] == '\0');
- return 0;
- }
+ *boolean_varlist[i].value = bool_to_int (value);
+ if (boolean_varlist[i].flags & V_SPECIAL)
+ hack_special_boolean_var (i);
+ return 0;
}
- /* Not a boolean variable, so check for specials. */
+ i = find_string_var (name);
+
+ /* For the time being, unknown variable names or string names without a
+ handler function are simply ignored. */
+ if (i < 0 || string_varlist[i].set_func == 0)
+ return 0;
- /* Editing mode change? */
- if (_rl_stricmp (name, "editing-mode") == 0)
+ v = (*string_varlist[i].set_func) (value);
+ return v;
+}
+
+static int
+sv_editmode (value)
+ const char *value;
+{
+ if (_rl_strnicmp (value, "vi", 2) == 0)
{
- if (_rl_strnicmp (value, "vi", 2) == 0)
- {
#if defined (VI_MODE)
- _rl_keymap = vi_insertion_keymap;
- rl_editing_mode = vi_mode;
+ _rl_keymap = vi_insertion_keymap;
+ rl_editing_mode = vi_mode;
#endif /* VI_MODE */
- }
- else if (_rl_strnicmp (value, "emacs", 5) == 0)
- {
- _rl_keymap = emacs_standard_keymap;
- rl_editing_mode = emacs_mode;
- }
+ return 0;
}
-
- /* Comment string change? */
- else if (_rl_stricmp (name, "comment-begin") == 0)
+ else if (_rl_strnicmp (value, "emacs", 5) == 0)
{
- if (*value)
- {
- if (_rl_comment_begin)
- free (_rl_comment_begin);
-
- _rl_comment_begin = savestring (value);
- }
+ _rl_keymap = emacs_standard_keymap;
+ rl_editing_mode = emacs_mode;
+ return 0;
}
- else if (_rl_stricmp (name, "completion-query-items") == 0)
+ return 1;
+}
+
+static int
+sv_combegin (value)
+ const char *value;
+{
+ if (value && *value)
{
- int nval = 100;
- if (*value)
- {
- nval = atoi (value);
- if (nval < 0)
- nval = 0;
- }
- rl_completion_query_items = nval;
+ FREE (_rl_comment_begin);
+ _rl_comment_begin = savestring (value);
+ return 0;
}
- else if (_rl_stricmp (name, "keymap") == 0)
+ return 1;
+}
+
+static int
+sv_compquery (value)
+ const char *value;
+{
+ int nval = 100;
+
+ if (value && *value)
{
- Keymap kmap;
- kmap = rl_get_keymap_by_name (value);
- if (kmap)
- rl_set_keymap (kmap);
+ nval = atoi (value);
+ if (nval < 0)
+ nval = 0;
}
- else if (_rl_stricmp (name, "bell-style") == 0)
+ rl_completion_query_items = nval;
+ return 0;
+}
+
+static int
+sv_keymap (value)
+ const char *value;
+{
+ Keymap kmap;
+
+ kmap = rl_get_keymap_by_name (value);
+ if (kmap)
{
- if (!*value)
- _rl_bell_preference = AUDIBLE_BELL;
- else
- {
- if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
- _rl_bell_preference = NO_BELL;
- else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
- _rl_bell_preference = AUDIBLE_BELL;
- else if (_rl_stricmp (value, "visible") == 0)
- _rl_bell_preference = VISIBLE_BELL;
- }
+ rl_set_keymap (kmap);
+ return 0;
}
- else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
+ return 1;
+}
+
+static int
+sv_bell_style (value)
+ const char *value;
+{
+ if (value == 0 || *value == '\0')
+ _rl_bell_preference = AUDIBLE_BELL;
+ else if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
+ _rl_bell_preference = NO_BELL;
+ else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
+ _rl_bell_preference = AUDIBLE_BELL;
+ else if (_rl_stricmp (value, "visible") == 0)
+ _rl_bell_preference = VISIBLE_BELL;
+ else
+ return 1;
+ return 0;
+}
+
+static int
+sv_isrchterm (value)
+ const char *value;
+{
+ int beg, end, delim;
+ char *v;
+
+ if (value == 0)
+ return 1;
+
+ /* Isolate the value and translate it into a character string. */
+ v = savestring (value);
+ FREE (_rl_isearch_terminators);
+ if (v[0] == '"' || v[0] == '\'')
{
- /* Backwards compatibility. */
- if (*value && (_rl_stricmp (value, "on") == 0 ||
- (*value == '1' && !value[1])))
- _rl_bell_preference = VISIBLE_BELL;
- else
- _rl_bell_preference = AUDIBLE_BELL;
+ delim = v[0];
+ for (beg = end = 1; v[end] && v[end] != delim; end++)
+ ;
}
- else if (_rl_stricmp (name, "isearch-terminators") == 0)
+ else
{
- /* Isolate the value and translate it into a character string. */
- int beg, end;
- char *v;
+ for (beg = end = 0; whitespace (v[end]) == 0; end++)
+ ;
+ }
- v = savestring (value);
- FREE (_rl_isearch_terminators);
- if (v[0] == '"' || v[0] == '\'')
- {
- int delim = v[0];
- for (beg = end = 1; v[end] && v[end] != delim; end++)
- ;
- }
- else
- {
- for (beg = end = 0; whitespace (v[end]) == 0; end++)
- ;
- }
+ v[end] = '\0';
- v[end] = '\0';
- /* The value starts at v + beg. Translate it into a character string. */
- _rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
- rl_translate_keyseq (v + beg, (char*) _rl_isearch_terminators, &end);
- _rl_isearch_terminators[end] = '\0';
- free (v);
- }
+ /* The value starts at v + beg. Translate it into a character string. */
+ _rl_isearch_terminators = (char *)xmalloc (2 * strlen (v) + 1);
+ rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
+ _rl_isearch_terminators[end] = '\0';
- /* For the time being, unknown variable names are simply ignored. */
+ free (v);
return 0;
}
-
+
/* Return the character which matches NAME.
For example, `Space' returns ' '. */
@@ -1431,27 +1582,27 @@ static struct {
Keymap
rl_get_keymap_by_name (name)
- char *name;
+ const char *name;
{
register int i;
for (i = 0; keymap_names[i].name; i++)
- if (strcmp (name, keymap_names[i].name) == 0)
+ if (_rl_stricmp (name, keymap_names[i].name) == 0)
return (keymap_names[i].map);
return ((Keymap) NULL);
}
-const char *
+char *
rl_get_keymap_name (map)
Keymap map;
{
register int i;
for (i = 0; keymap_names[i].name; i++)
if (map == keymap_names[i].map)
- return (keymap_names[i].name);
+ return ((char *)keymap_names[i].name);
return ((char *)NULL);
}
-
+
void
rl_set_keymap (map)
Keymap map;
@@ -1477,17 +1628,18 @@ rl_set_keymap_from_edit_mode ()
#endif /* VI_MODE */
}
-const char *
+
+char *
rl_get_keymap_name_from_edit_mode ()
{
if (rl_editing_mode == emacs_mode)
- return "emacs";
+ return (char*)"emacs";
#if defined (VI_MODE)
else if (rl_editing_mode == vi_mode)
- return "vi";
+ return (char*)"vi";
#endif /* VI_MODE */
else
- return "none";
+ return (char*)"nope";
}
/* **************************************************************** */
@@ -1506,7 +1658,7 @@ void
rl_list_funmap_names ()
{
register int i;
- char **funmap_names;
+ const char **funmap_names;
funmap_names = rl_funmap_names ();
@@ -1533,17 +1685,18 @@ _rl_get_keyname (key)
pairs for possible inclusion in an inputrc file, we don't want to
do any special meta processing on KEY. */
-#if 0
+#if 1
+ /* XXX - Experimental */
/* We might want to do this, but the old version of the code did not. */
/* If this is an escape character, we don't want to do any more processing.
Just add the special ESC key sequence and return. */
if (c == ESC)
{
- keyseq[0] = '\\';
- keyseq[1] = 'e';
- keyseq[2] = '\0';
- return keyseq;
+ keyname[0] = '\\';
+ keyname[1] = 'e';
+ keyname[2] = '\0';
+ return keyname;
}
#endif
@@ -1596,7 +1749,7 @@ _rl_get_keyname (key)
sequences that are used to invoke FUNCTION in MAP. */
char **
rl_invoking_keyseqs_in_map (function, map)
- Function *function;
+ rl_command_func_t *function;
Keymap map;
{
register int key;
@@ -1625,7 +1778,7 @@ rl_invoking_keyseqs_in_map (function, map)
if (result_index + 2 > result_size)
{
result_size += 10;
- result = (char **) xrealloc (result, result_size * sizeof (char *));
+ result = (char **)xrealloc (result, result_size * sizeof (char *));
}
result[result_index++] = keyname;
@@ -1654,7 +1807,12 @@ rl_invoking_keyseqs_in_map (function, map)
char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
if (key == ESC)
+#if 0
sprintf (keyname, "\\e");
+#else
+ /* XXX - experimental */
+ sprintf (keyname, "\\M-");
+#endif
else if (CTRL_CHAR (key))
sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
else if (key == RUBOUT)
@@ -1670,14 +1828,14 @@ rl_invoking_keyseqs_in_map (function, map)
keyname[0] = (char) key;
keyname[1] = '\0';
}
-
+
strcat (keyname, seqs[i]);
free (seqs[i]);
if (result_index + 2 > result_size)
{
result_size += 10;
- result = (char **) xrealloc (result, result_size * sizeof (char *));
+ result = (char **)xrealloc (result, result_size * sizeof (char *));
}
result[result_index++] = keyname;
@@ -1696,7 +1854,7 @@ rl_invoking_keyseqs_in_map (function, map)
sequences that can be used to invoke FUNCTION using the current keymap. */
char **
rl_invoking_keyseqs (function)
- Function *function;
+ rl_command_func_t *function;
{
return (rl_invoking_keyseqs_in_map (function, _rl_keymap));
}
@@ -1709,8 +1867,8 @@ rl_function_dumper (print_readably)
int print_readably;
{
register int i;
- char **names;
- char *name;
+ const char **names;
+ const char *name;
names = rl_funmap_names ();
@@ -1718,7 +1876,7 @@ rl_function_dumper (print_readably)
for (i = 0; (name = names[i]); i++)
{
- Function *function;
+ rl_command_func_t *function;
char **invokers;
function = rl_named_function (name);
@@ -1775,8 +1933,8 @@ rl_function_dumper (print_readably)
rl_outstream. If an explicit argument is given, then print
the output in such a way that it can be read back in. */
int
-rl_dump_functions (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_dump_functions (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@@ -1801,11 +1959,8 @@ _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,
@@ -1815,9 +1970,7 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
keyname,
out ? out : "");
free (keyname);
-#if 1
free (out);
-#endif
break;
case ISFUNC:
break;
@@ -1825,7 +1978,7 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
prefix_len = prefix ? strlen (prefix) : 0;
if (key == ESC)
{
- keyname = xmalloc (3 + prefix_len);
+ keyname = (char *)xmalloc (3 + prefix_len);
if (prefix)
strcpy (keyname, prefix);
keyname[prefix_len] = '\\';
@@ -1837,7 +1990,7 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
keyname = _rl_get_keyname (key);
if (prefix)
{
- out = xmalloc (strlen (keyname) + prefix_len + 1);
+ out = (char *)xmalloc (strlen (keyname) + prefix_len + 1);
strcpy (out, prefix);
strcpy (out + prefix_len, keyname);
free (keyname);
@@ -1860,8 +2013,8 @@ rl_macro_dumper (print_readably)
}
int
-rl_dump_macros (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_dump_macros (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@@ -1907,7 +2060,7 @@ rl_variable_dumper (print_readably)
if (print_readably)
fprintf (rl_outstream, "set comment-begin %s\n", _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
else
- fprintf (rl_outstream, "comment-begin is set to `%s'\n", _rl_comment_begin ? _rl_comment_begin : "");
+ fprintf (rl_outstream, "comment-begin is set to `%s'\n", _rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
/* completion-query-items */
if (print_readably)
@@ -1921,15 +2074,6 @@ rl_variable_dumper (print_readably)
else
fprintf (rl_outstream, "editing-mode is set to `%s'\n", (rl_editing_mode == emacs_mode) ? "emacs" : "vi");
- /* keymap */
- kname = rl_get_keymap_name (_rl_keymap);
- if (kname == 0)
- kname = rl_get_keymap_name_from_edit_mode ();
- if (print_readably)
- fprintf (rl_outstream, "set keymap %s\n", kname ? kname : "none");
- else
- fprintf (rl_outstream, "keymap is set to `%s'\n", kname ? kname : "none");
-
/* isearch-terminators */
if (_rl_isearch_terminators)
{
@@ -1944,14 +2088,23 @@ rl_variable_dumper (print_readably)
free (disp);
}
+
+ /* keymap */
+ kname = rl_get_keymap_name (_rl_keymap);
+ if (kname == 0)
+ kname = rl_get_keymap_name_from_edit_mode ();
+ if (print_readably)
+ fprintf (rl_outstream, "set keymap %s\n", kname ? kname : "none");
+ else
+ fprintf (rl_outstream, "keymap is set to `%s'\n", kname ? kname : "none");
}
/* Print all of the current variables and their values to
rl_outstream. If an explicit argument is given, then print
the output in such a way that it can be read back in. */
int
-rl_dump_variables (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_dump_variables (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_dispatching)
fprintf (rl_outstream, "\r\n");
@@ -1960,18 +2113,24 @@ rl_dump_variables (int count __attribute__((unused)),
return (0);
}
-/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. */
+/* Bind key sequence KEYSEQ to DEFAULT_FUNC if KEYSEQ is unbound. Right
+ now, this is always used to attempt to bind the arrow keys, hence the
+ check for rl_vi_movement_mode. */
void
_rl_bind_if_unbound (keyseq, default_func)
- char *keyseq;
- Function *default_func;
+ const char *keyseq;
+ rl_command_func_t *default_func;
{
- Function *func;
+ rl_command_func_t *func;
if (keyseq)
{
func = rl_function_of_keyseq (keyseq, _rl_keymap, (int *)NULL);
+#if defined (VI_MODE)
+ if (!func || func == rl_do_lowercase_version || func == rl_vi_movement_mode)
+#else
if (!func || func == rl_do_lowercase_version)
+#endif
rl_set_key (keyseq, default_func, _rl_keymap);
}
}
@@ -1979,7 +2138,8 @@ _rl_bind_if_unbound (keyseq, default_func)
/* Return non-zero if any members of ARRAY are a substring in STRING. */
static int
substring_member_of_array (string, array)
- char *string, **array;
+ char *string;
+ const char **array;
{
while (*array)
{
diff --git a/readline/callback.c b/readline/callback.c
index 200f3cc37f9..a8f4323c929 100644
--- a/readline/callback.c
+++ b/readline/callback.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -29,22 +29,20 @@
#if defined (READLINE_CALLBACKS)
-#include <stdlib.h>
#include <sys/types.h>
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif
+
#include <stdio.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "readline.h"
-
-extern void readline_internal_setup ();
-extern char *readline_internal_teardown ();
-extern int readline_internal_char ();
-extern void _rl_init_line_state ();
-
-extern int _rl_meta_flag;
-extern char *rl_prompt;
-extern int rl_visible_prompt_length;
+#include "rlprivate.h"
/* **************************************************************** */
/* */
@@ -61,7 +59,7 @@ extern int rl_visible_prompt_length;
text read in at each end of line. The terminal is kept prepped and
signals handled all the time, except during calls to the user's function. */
-VFunction *rl_linefunc; /* user callback function */
+rl_vcpfunc_t *rl_linefunc; /* user callback function */
static int in_handler; /* terminal_prepped and signals set? */
/* Make sure the terminal is set up, initialize readline, and prompt. */
@@ -87,11 +85,10 @@ _rl_callback_newline ()
/* Install a readline handler, set up the terminal, and issue the prompt. */
void
rl_callback_handler_install (prompt, linefunc)
- char *prompt;
- VFunction *linefunc;
+ const char *prompt;
+ rl_vcpfunc_t *linefunc;
{
- rl_prompt = prompt;
- rl_visible_prompt_length = rl_prompt ? rl_expand_prompt (rl_prompt) : 0;
+ rl_set_prompt (prompt);
rl_linefunc = linefunc;
_rl_callback_newline ();
}
@@ -111,24 +108,33 @@ rl_callback_read_char ()
eof = readline_internal_char ();
- if (rl_done)
+ /* We loop in case some function has pushed input back with rl_execute_next. */
+ for (;;)
{
- line = readline_internal_teardown (eof);
+ if (rl_done)
+ {
+ line = readline_internal_teardown (eof);
- (*rl_deprep_term_function) ();
+ (*rl_deprep_term_function) ();
#if defined (HANDLE_SIGNALS)
- rl_clear_signals ();
+ rl_clear_signals ();
#endif
- 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 ();
+ 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 ();
+ }
+ if (rl_pending_input)
+ eof = readline_internal_char ();
+ else
+ break;
}
}
diff --git a/readline/chardefs.h b/readline/chardefs.h
index 740f14b185b..a537be220b0 100644
--- a/readline/chardefs.h
+++ b/readline/chardefs.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,21 +18,23 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _CHARDEFS_H_
#define _CHARDEFS_H_
-#ifndef _m_ctype_h
#include <ctype.h>
-#endif
#if defined (HAVE_CONFIG_H)
# if defined (HAVE_STRING_H)
+# if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)
+# include <memory.h>
+# endif
# include <string.h>
-# else
-# include <strings.h>
# endif /* HAVE_STRING_H */
+# if defined (HAVE_STRINGS_H)
+# include <strings.h>
+# endif /* HAVE_STRINGS_H */
#else
# include <string.h>
#endif /* !HAVE_CONFIG_H */
@@ -42,7 +44,10 @@
#endif
#ifdef CTRL
-#undef CTRL
+# undef CTRL
+#endif
+#ifdef UNCTRL
+# undef UNCTRL
#endif
/* Some character stuff. */
@@ -53,7 +58,7 @@
#define meta_character_bit 0x080 /* x0000000, must be on. */
#define largest_char 255 /* Largest character value. */
-#define CTRL_CHAR(c) ((c) < control_character_threshold && (c) >= 0)
+#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
#define CTRL(c) ((c) & control_character_mask)
@@ -62,32 +67,58 @@
#define UNMETA(c) ((c) & (~meta_character_bit))
#define UNCTRL(c) _rl_to_upper(((c)|control_character_bit))
-/* Old versions
-#define _rl_lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
-#define _rl_uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
-#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
-*/
+#if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII))
+# define IN_CTYPE_DOMAIN(c) 1
+#else
+# define IN_CTYPE_DOMAIN(c) isascii(c)
+#endif
+
+#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT)
+# define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
+#endif
+
+#define NON_NEGATIVE(c) ((unsigned char)(c) == (c))
-#define _rl_lowercase_p(c) (islower(c))
-#define _rl_uppercase_p(c) (isupper(c))
-#define _rl_digit_p(x) (isdigit (x))
+/* Some systems define these; we want our definitions. */
+#undef ISPRINT
-#define _rl_pure_alphabetic(c) (_rl_lowercase_p(c) || _rl_uppercase_p(c))
-#define ALPHABETIC(c) (_rl_lowercase_p(c) || _rl_uppercase_p(c) || _rl_digit_p(c))
+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
-/* Old versions
-# define _rl_to_upper(c) (_rl_lowercase_p(c) ? ((c) - 32) : (c))
-# define _rl_to_lower(c) (_rl_uppercase_p(c) ? ((c) + 32) : (c))
-*/
+#define _rl_lowercase_p(c) (NON_NEGATIVE(c) && ISLOWER(c))
+#define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c))
+#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
+
+#define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c))
+#define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c))
#ifndef _rl_to_upper
-# define _rl_to_upper(c) (islower(c) ? toupper(c) : (c))
-# define _rl_to_lower(c) (isupper(c) ? tolower(c) : (c))
+# define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c))
+# define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c))
#endif
#ifndef _rl_digit_value
-#define _rl_digit_value(x) ((x) - '0')
+# define _rl_digit_value(x) ((x) - '0')
+#endif
+
+#ifndef _rl_isident
+# define _rl_isident(c) (ISALNUM(c) || (c) == '_')
+#endif
+
+#ifndef ISOCTAL
+# define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
#endif
+#define OCTVALUE(c) ((c) - '0')
+
+#define HEXVALUE(c) \
+ (((c) >= 'a' && (c) <= 'f') \
+ ? (c)-'a'+10 \
+ : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')
#ifndef NEWLINE
#define NEWLINE '\n'
@@ -125,18 +156,4 @@
#endif
#define ESC CTRL('[')
-#ifndef ISOCTAL
-#define ISOCTAL(c) ((c) >= '0' && (c) <= '7')
-#endif
-#define OCTVALUE(c) ((c) - '0')
-
-#ifndef isxdigit
-# define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
-#endif
-
-#define HEXVALUE(c) \
- (((c) >= 'a' && (c) <= 'f') \
- ? (c)-'a'+10 \
- : (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')
-
#endif /* _CHARDEFS_H_ */
diff --git a/readline/complete.c b/readline/complete.c
index 8810ca06d5f..693550c9945 100644
--- a/readline/complete.c
+++ b/readline/complete.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -49,41 +49,39 @@ extern int errno;
#endif /* !errno */
#include <pwd.h>
-#if !defined (HAVE_GETPW_DECLS)
-extern struct passwd *getpwent ();
-#endif /* USG && !HAVE_GETPW_DECLS */
-
-/* ISC systems don't define getpwent() if _POSIX_SOURCE is defined. */
-#if defined (isc386) && defined (_POSIX_SOURCE)
-# if defined (__STDC__)
-extern struct passwd *getpwent (void);
-# else
-extern struct passwd *getpwent ();
-# endif /* !__STDC__ */
-#endif /* isc386 && _POSIX_SOURCE */
#include "posixdir.h"
#include "posixstat.h"
/* System-specific feature definitions and include files. */
#include "rldefs.h"
+#include "rlmbutil.h"
/* Some standard library routines. */
#include "readline.h"
+#include "xmalloc.h"
+#include "rlprivate.h"
-extern char *tilde_expand ();
-extern char *rl_copy_text ();
-extern void _rl_abort_internal ();
-extern int _rl_qsort_string_compare ();
-extern void _rl_replace_text ();
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
+
+#ifdef HAVE_LSTAT
+# define LSTAT lstat
+#else
+# define LSTAT stat
+#endif
-extern Function *rl_last_func;
-extern int rl_editing_mode;
-extern int screenwidth;
+/* Unix version of a hidden file. Could be different on other systems. */
+#define HIDDEN_FILE(fname) ((fname)[0] == '.')
-extern void _rl_move_vert ();
-extern int _rl_vis_botlin;
-extern int rl_display_fixed;
+/* Most systems don't declare getpwent in <pwd.h> if _POSIX_SOURCE is
+ defined. */
+#if !defined (HAVE_GETPW_DECLS) || defined (_POSIX_SOURCE)
+extern struct passwd *getpwent PARAMS((void));
+#endif /* !HAVE_GETPW_DECLS || _POSIX_SOURCE */
/* If non-zero, then this is the address of a function to call when
completing a word would normally display the list of possible matches.
@@ -92,30 +90,34 @@ extern int rl_display_fixed;
where MATCHES is the array of strings that matched, NUM_MATCHES is the
number of strings in that array, and MAX_LENGTH is the length of the
longest string in that array. */
-VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
-
-/* Forward declarations for functions defined and used in this file. */
-char *filename_completion_function (const char *text, int state);
-char **completion_matches ();
+rl_compdisp_func_t *rl_completion_display_matches_hook = (rl_compdisp_func_t *)NULL;
#if defined (VISIBLE_STATS)
# if !defined (X_OK)
# define X_OK 1
# endif
-static int stat_char ();
+static int stat_char PARAMS((char *));
#endif
-static char *rl_quote_filename ();
-static char *rl_strpbrk ();
+static char *rl_quote_filename PARAMS((char *, int, char *));
+
+static void set_completion_defaults PARAMS((int));
+static int get_y_or_n PARAMS((int));
+static int _rl_internal_pager PARAMS((int));
+static char *printable_part PARAMS((char *));
+static int print_filename PARAMS((char *, char *));
+
+static char **gen_completion_matches PARAMS((char *, int, int, rl_compentry_func_t *, int, int));
-static char **remove_duplicate_matches ();
-static void insert_match ();
-static int append_to_match ();
-static void insert_all_matches ();
-static void display_matches ();
-static int compute_lcd_of_matches ();
+static char **remove_duplicate_matches PARAMS((char **));
+static void insert_match PARAMS((char *, int, int, char *));
+static int append_to_match PARAMS((char *, int, int, int));
+static void insert_all_matches PARAMS((char **, int, char *));
+static void display_matches PARAMS((char **));
+static int compute_lcd_of_matches PARAMS((char **, int, const char *));
+static int postprocess_matches PARAMS((char ***, int));
-extern char *xmalloc (), *xrealloc ();
+static char *make_quoted_replacement PARAMS((char *, int, char *));
/* **************************************************************** */
/* */
@@ -131,12 +133,26 @@ int _rl_complete_show_all = 0;
/* If non-zero, completed directory names have a slash appended. */
int _rl_complete_mark_directories = 1;
+/* If non-zero, the symlinked directory completion behavior introduced in
+ readline-4.2a is disabled, and symlinks that point to directories have
+ a slash appended (subject to the value of _rl_complete_mark_directories).
+ This is user-settable via the mark-symlinked-directories variable. */
+int _rl_complete_mark_symlink_dirs = 0;
+
/* If non-zero, completions are printed horizontally in alphabetical order,
like `ls -x'. */
int _rl_print_completions_horizontally;
/* Non-zero means that case is not significant in filename completion. */
+#if defined (__MSDOS__) && !defined (__DJGPP__)
+int _rl_completion_case_fold = 1;
+#else
int _rl_completion_case_fold;
+#endif
+
+/* If non-zero, don't match hidden files (filenames beginning with a `.' on
+ Unix) when doing filename completion. */
+int _rl_match_hidden_files = 1;
/* Global variables available to applications using readline. */
@@ -150,15 +166,17 @@ int rl_visible_stats = 0;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
the address of a string (the current directory name) as an arg. */
-Function *rl_directory_completion_hook = (Function *)NULL;
+rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL;
+
+rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL;
/* Non-zero means readline completion functions perform tilde expansion. */
int rl_complete_with_tilde_expansion = 0;
/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_completion_function (), the default filename
+ NULL means to use rl_filename_completion_function (), the default filename
completer. */
-Function *rl_completion_entry_function = (Function *)NULL;
+rl_compentry_func_t *rl_completion_entry_function = (rl_compentry_func_t *)NULL;
/* Pointer to alternative function to create matches.
Function is called with TEXT, START, and END.
@@ -167,7 +185,7 @@ Function *rl_completion_entry_function = (Function *)NULL;
If this function exists and returns NULL then call the value of
rl_completion_entry_function to try to match, otherwise use the
array of strings returned. */
-CPPFunction *rl_attempted_completion_function = (CPPFunction *)NULL;
+rl_completion_func_t *rl_attempted_completion_function = (rl_completion_func_t *)NULL;
/* Non-zero means to suppress normal filename completion after the
user-specified completion function has been called. */
@@ -183,10 +201,12 @@ int rl_completion_type = 0;
she is sure she wants to see them all. */
int rl_completion_query_items = 100;
+int _rl_page_completions = 1;
+
/* The basic list of characters that signal a break between words for the
completer routine. The contents of this variable is what breaks words
in the shell, i.e. " \t\n\"\\'`@$><=" */
-const char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(";
+const char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{("; /* }) */
/* List of basic quoting characters. */
const char *rl_basic_quote_characters = "\"'";
@@ -194,21 +214,21 @@ const char *rl_basic_quote_characters = "\"'";
/* The list of characters that signal a break between words for
rl_complete_internal. The default list is the contents of
rl_basic_word_break_characters. */
-const char *rl_completer_word_break_characters = (char *)NULL;
+const char *rl_completer_word_break_characters = (const char *)NULL;
/* List of characters which can be used to quote a substring of the line.
Completion occurs on the entire substring, and within the substring
rl_completer_word_break_characters are treated as any other character,
unless they also appear within this list. */
-char *rl_completer_quote_characters = (char *)NULL;
+const char *rl_completer_quote_characters = (const char *)NULL;
/* List of characters that should be quoted in filenames by the completer. */
-char *rl_filename_quote_characters = (char *)NULL;
+const char *rl_filename_quote_characters = (const char *)NULL;
/* List of characters that are word break characters, but should be left
in TEXT when it is passed to the completion function. The shell uses
this to help determine what kind of completing to do. */
-char *rl_special_prefixes = (char *)NULL;
+const char *rl_special_prefixes = (const char *)NULL;
/* If non-zero, then disallow duplicates in the matches. */
int rl_ignore_completion_duplicates = 1;
@@ -234,29 +254,45 @@ int rl_filename_quoting_desired = 1;
the list of matches as required, but all elements of the array must be
free()'d if they are deleted. The main intent of this function is
to implement FIGNORE a la SunOS csh. */
-Function *rl_ignore_some_completions_function = (Function *)NULL;
+rl_compignore_func_t *rl_ignore_some_completions_function = (rl_compignore_func_t *)NULL;
/* Set to a function to quote a filename in an application-specific fashion.
Called with the text to quote, the type of match found (single or multiple)
and a pointer to the quoting character to be used, which the function can
reset if desired. */
-CPFunction *rl_filename_quoting_function = rl_quote_filename;
-
+rl_quote_func_t *rl_filename_quoting_function = rl_quote_filename;
+
/* Function to call to remove quoting characters from a filename. Called
before completion is attempted, so the embedded quotes do not interfere
with matching names in the file system. Readline doesn't do anything
with this; it's set only by applications. */
-CPFunction *rl_filename_dequoting_function = (CPFunction *)NULL;
+rl_dequote_func_t *rl_filename_dequoting_function = (rl_dequote_func_t *)NULL;
/* Function to call to decide whether or not a word break character is
quoted. If a character is quoted, it does not break words for the
completer. */
-Function *rl_char_is_quoted_p = (Function *)NULL;
+rl_linebuf_func_t *rl_char_is_quoted_p = (rl_linebuf_func_t *)NULL;
+
+/* If non-zero, the completion functions don't append anything except a
+ possible closing quote. This is set to 0 by rl_complete_internal and
+ may be changed by an application-specific completion function. */
+int rl_completion_suppress_append = 0;
/* Character appended to completed words when at the end of the line. The
default is a space. */
int rl_completion_append_character = ' ';
+/* If non-zero, a slash will be appended to completed filenames that are
+ symbolic links to directory names, subject to the value of the
+ mark-directories variable (which is user-settable). This exists so
+ that application completion functions can override the user's preference
+ (set via the mark-symlinked-directories variable) if appropriate.
+ It's set to the value of _rl_complete_mark_symlink_dirs in
+ rl_complete_internal before any application-specific completion
+ function is called, so without that function doing anything, the user's
+ preferences are honored. */
+int rl_completion_mark_symlink_dirs;
+
/* If non-zero, inhibit completion (temporarily). */
int rl_inhibit_completion;
@@ -273,13 +309,13 @@ static int completion_changed_buffer;
/* Complete the word at or before point. You have supplied the function
that does the initial simple matching selection algorithm (see
- completion_matches ()). The default is to do filename completion. */
+ rl_completion_matches ()). The default is to do filename completion. */
int
rl_complete (ignore, invoking_key)
int ignore, invoking_key;
{
if (rl_inhibit_completion)
- return (rl_insert (ignore, invoking_key));
+ return (_rl_insert_char (ignore, invoking_key));
else if (rl_last_func == rl_complete && !completion_changed_buffer)
return (rl_complete_internal ('?'));
else if (_rl_complete_show_all)
@@ -303,52 +339,90 @@ rl_insert_completions (ignore, invoking_key)
return (rl_complete_internal ('*'));
}
+/* Return the correct value to pass to rl_complete_internal performing
+ the same tests as rl_complete. This allows consecutive calls to an
+ application's completion function to list possible completions and for
+ an application-specific completion function to honor the
+ show-all-if-ambiguous readline variable. */
+int
+rl_completion_mode (cfunc)
+ rl_command_func_t *cfunc;
+{
+ if (rl_last_func == cfunc && !completion_changed_buffer)
+ return '?';
+ else if (_rl_complete_show_all)
+ return '!';
+ else
+ return TAB;
+}
+
/************************************/
/* */
/* Completion utility functions */
/* */
/************************************/
-/* Find the first occurrence in STRING1 of any character from STRING2.
- Return a pointer to the character in STRING1. */
-static char *
-rl_strpbrk (string1, string2)
- char *string1, *string2;
+/* Set default values for readline word completion. These are the variables
+ that application completion functions can change or inspect. */
+static void
+set_completion_defaults (what_to_do)
+ int what_to_do;
{
- register char *scan;
+ /* Only the completion entry function can change these. */
+ rl_filename_completion_desired = 0;
+ rl_filename_quoting_desired = 1;
+ rl_completion_type = what_to_do;
+ rl_completion_suppress_append = 0;
- for (; *string1; string1++)
- {
- for (scan = string2; *scan; scan++)
- {
- if (*string1 == *scan)
- {
- return (string1);
- }
- }
- }
- return ((char *)NULL);
+ /* The completion entry function may optionally change this. */
+ rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs;
}
/* The user must press "y" or "n". Non-zero return means "y" pressed. */
static int
-get_y_or_n ()
+get_y_or_n (for_pager)
+ int for_pager;
{
int c;
for (;;)
{
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
if (c == 'y' || c == 'Y' || c == ' ')
return (1);
if (c == 'n' || c == 'N' || c == RUBOUT)
return (0);
if (c == ABORT_CHAR)
_rl_abort_internal ();
- ding ();
+ if (for_pager && (c == NEWLINE || c == RETURN))
+ return (2);
+ if (for_pager && (c == 'q' || c == 'Q'))
+ return (0);
+ rl_ding ();
}
}
+static int
+_rl_internal_pager (lines)
+ int lines;
+{
+ int i;
+
+ fprintf (rl_outstream, "--More--");
+ fflush (rl_outstream);
+ i = get_y_or_n (1);
+ _rl_erase_entire_line ();
+ if (i == 0)
+ return -1;
+ else if (i == 2)
+ return (lines - 1);
+ else
+ return 0;
+}
+
#if defined (VISIBLE_STATS)
/* Return the character which best describes FILENAME.
`@' for symbolic links
@@ -409,15 +483,41 @@ stat_char (filename)
/* Return the portion of PATHNAME that should be output when listing
possible completions. If we are hacking filename completion, we
are only interested in the basename, the portion following the
- final slash. Otherwise, we return what we were passed. */
+ final slash. Otherwise, we return what we were passed. Since
+ printing empty strings is not very informative, if we're doing
+ filename completion, and the basename is the empty string, we look
+ for the previous slash and return the portion following that. If
+ there's no previous slash, we just return what we were passed. */
static char *
printable_part (pathname)
char *pathname;
{
- char *temp;
+ char *temp, *x;
- temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
- return (temp ? ++temp : pathname);
+ if (rl_filename_completion_desired == 0) /* don't need to do anything */
+ return (pathname);
+
+ temp = strrchr (pathname, '/');
+#if defined (__MSDOS__)
+ if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':')
+ temp = pathname + 1;
+#endif
+
+ if (temp == 0 || *temp == '\0')
+ return (pathname);
+ /* If the basename is NULL, we might have a pathname like '/usr/src/'.
+ Look for a previous slash and, if one is found, return the portion
+ following that slash. If there's no previous slash, just return the
+ pathname we were passed. */
+ else if (temp[1] == '\0')
+ {
+ for (x = temp - 1; x > pathname; x--)
+ if (*x == '/')
+ break;
+ return ((*x == '/') ? x + 1 : pathname);
+ }
+ else
+ return ++temp;
}
/* Output TO_PRINT to rl_outstream. If VISIBLE_STATS is defined and we
@@ -477,13 +577,18 @@ print_filename (to_print, full_pathname)
c = to_print[-1];
to_print[-1] = '\0';
- s = tilde_expand (full_pathname);
+ /* If setting the last slash in full_pathname to a NUL results in
+ full_pathname being the empty string, we are trying to complete
+ files in the root directory. If we pass a null string to the
+ bash directory completion hook, for example, it will expand it
+ to the current directory. We just want the `/'. */
+ s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
if (rl_directory_completion_hook)
(*rl_directory_completion_hook) (&s);
slen = strlen (s);
tlen = strlen (to_print);
- new_full_pathname = xmalloc (slen + tlen + 2);
+ new_full_pathname = (char *)xmalloc (slen + tlen + 2);
strcpy (new_full_pathname, s);
new_full_pathname[slen] = '/';
strcpy (new_full_pathname + slen + 1, to_print);
@@ -518,7 +623,7 @@ rl_quote_filename (s, rtype, qcp)
{
char *r;
- r = xmalloc (strlen (s) + 2);
+ r = (char *)xmalloc (strlen (s) + 2);
*r = *rl_completer_quote_characters;
strcpy (r + 1, s);
if (qcp)
@@ -529,7 +634,7 @@ rl_quote_filename (s, rtype, qcp)
/* Find the bounds of the current word for completion purposes, and leave
rl_point set to the end of the word. This function skips quoted
substrings (characters between matched pairs of characters in
- rl_completer_quote_characters. First we try to find an unclosed
+ rl_completer_quote_characters). First we try to find an unclosed
quoted substring on which to do matching. If one is not found, we use
the word break characters to find the boundaries of the current word.
We call an application-specific function to decide whether or not a
@@ -541,8 +646,8 @@ rl_quote_filename (s, rtype, qcp)
quote, or backslash) anywhere in the string. DP, if non-null, is set to
the value of the delimiter character that caused a word break. */
-static char
-find_completion_word (fp, dp)
+char
+_rl_find_completion_word (fp, dp)
int *fp, *dp;
{
int scan, end, found_quote, delimiter, pass_next, isbrk;
@@ -566,7 +671,11 @@ find_completion_word (fp, dp)
continue;
}
- if (rl_line_buffer[scan] == '\\')
+ /* Shell-like semantics for single quotes -- don't allow backslash
+ to quote anything in single quotes, especially not the closing
+ quote. If you don't like this, take out the check on the value
+ of quote_char. */
+ if (quote_char != '\'' && rl_line_buffer[scan] == '\\')
{
pass_next = 1;
found_quote |= RL_QF_BACKSLASH;
@@ -593,6 +702,8 @@ find_completion_word (fp, dp)
found_quote |= RL_QF_SINGLE_QUOTE;
else if (quote_char == '"')
found_quote |= RL_QF_DOUBLE_QUOTE;
+ else
+ found_quote |= RL_QF_OTHER_QUOTE;
}
}
}
@@ -602,7 +713,11 @@ find_completion_word (fp, dp)
/* We didn't find an unclosed quoted substring upon which to do
completion, so use the word break characters to find the
substring on which to complete. */
+#if defined (HANDLE_MULTIBYTE)
+ while (rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_ANY))
+#else
while (--rl_point)
+#endif
{
scan = rl_line_buffer[rl_point];
@@ -627,25 +742,31 @@ find_completion_word (fp, dp)
/* If there is an application-specific function to say whether or not
a character is quoted and we found a quote character, let that
function decide whether or not a character is a word break, even
- if it is found in rl_completer_word_break_characters. */
- if (rl_char_is_quoted_p)
- isbrk = (found_quote == 0 ||
- (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
- strchr (rl_completer_word_break_characters, scan) != 0;
- else
- isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
-
- if (isbrk)
+ if it is found in rl_completer_word_break_characters. Don't bother
+ if we're at the end of the line, though. */
+ if (scan)
{
- /* If the character that caused the word break was a quoting
- character, then remember it as the delimiter. */
- if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, scan) && (end - rl_point) > 1)
- delimiter = scan;
-
- /* If the character isn't needed to determine something special
- about what kind of completion to perform, then advance past it. */
- if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
- rl_point++;
+ if (rl_char_is_quoted_p)
+ isbrk = (found_quote == 0 ||
+ (*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
+ strchr (rl_completer_word_break_characters, scan) != 0;
+ else
+ isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
+
+ if (isbrk)
+ {
+ /* If the character that caused the word break was a quoting
+ character, then remember it as the delimiter. */
+ if (rl_basic_quote_characters &&
+ strchr (rl_basic_quote_characters, scan) &&
+ (end - rl_point) > 1)
+ delimiter = scan;
+
+ /* If the character isn't needed to determine something special
+ about what kind of completion to perform, then advance past it. */
+ if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
+ rl_point++;
+ }
}
if (fp)
@@ -660,7 +781,7 @@ static char **
gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
char *text;
int start, end;
- Function *our_func;
+ rl_compentry_func_t *our_func;
int found_quote, quote_char;
{
char **matches, *temp;
@@ -684,7 +805,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
filename dequoting function. */
temp = (char *)NULL;
- if (found_quote && our_func == (Function *)filename_completion_function &&
+ if (found_quote && our_func == rl_filename_completion_function &&
rl_filename_dequoting_function)
{
/* delete single and double quotes */
@@ -692,7 +813,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char)
text = temp; /* not freeing text is not a memory leak */
}
- matches = completion_matches (text, (CPFunction *)our_func);
+ matches = rl_completion_matches (text, our_func);
FREE (temp);
return matches;
}
@@ -715,7 +836,7 @@ remove_duplicate_matches (matches)
/* Sort the array without matches[0], since we need it to
stay in place no matter what. */
if (i)
- qsort (matches+1, i-1, sizeof (char *), _rl_qsort_string_compare);
+ qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
/* Remember the lowest common denominator for it may be unique. */
lowest_common = savestring (matches[0]);
@@ -764,10 +885,15 @@ static int
compute_lcd_of_matches (match_list, matches, text)
char **match_list;
int matches;
- char *text;
+ const char *text;
{
register int i, c1, c2, si;
int low; /* Count of max-matched characters. */
+#if defined (HANDLE_MULTIBYTE)
+ int v;
+ mbstate_t ps1, ps2;
+ wchar_t wc1, wc2;
+#endif
/* If only one match, just use that. Otherwise, compare each
member of the list with the next, finding out where they
@@ -781,12 +907,33 @@ compute_lcd_of_matches (match_list, matches, text)
for (i = 1, low = 100000; i < matches; i++)
{
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ memset (&ps1, 0, sizeof (mbstate_t));
+ memset (&ps2, 0, sizeof (mbstate_t));
+ }
+#endif
if (_rl_completion_case_fold)
{
for (si = 0;
(c1 = _rl_to_lower(match_list[i][si])) &&
(c2 = _rl_to_lower(match_list[i + 1][si]));
si++)
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ v = mbrtowc (&wc1, match_list[i]+si, strlen (match_list[i]+si), &ps1);
+ mbrtowc (&wc2, match_list[i+1]+si, strlen (match_list[i+1]+si), &ps2);
+ wc1 = towlower (wc1);
+ wc2 = towlower (wc2);
+ if (wc1 != wc2)
+ break;
+ else if (v > 1)
+ si += v - 1;
+ }
+ else
+#endif
if (c1 != c2)
break;
}
@@ -796,6 +943,17 @@ compute_lcd_of_matches (match_list, matches, text)
(c1 = match_list[i][si]) &&
(c2 = match_list[i + 1][si]);
si++)
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ mbstate_t ps_back = ps1;
+ if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2))
+ break;
+ else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1)
+ si += v - 1;
+ }
+ else
+#endif
if (c1 != c2)
break;
}
@@ -809,13 +967,42 @@ compute_lcd_of_matches (match_list, matches, text)
value of matches[0]. */
if (low == 0 && text && *text)
{
- match_list[0] = xmalloc (strlen (text) + 1);
+ match_list[0] = (char *)xmalloc (strlen (text) + 1);
strcpy (match_list[0], text);
}
else
{
- match_list[0] = xmalloc (low + 1);
- strncpy (match_list[0], match_list[1], low);
+ match_list[0] = (char *)xmalloc (low + 1);
+
+ /* XXX - this might need changes in the presence of multibyte chars */
+
+ /* If we are ignoring case, try to preserve the case of the string
+ the user typed in the face of multiple matches differing in case. */
+ if (_rl_completion_case_fold)
+ {
+ /* sort the list to get consistent answers. */
+ qsort (match_list+1, matches, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare);
+
+ si = strlen (text);
+ if (si <= low)
+ {
+ for (i = 1; i <= matches; i++)
+ if (strncmp (match_list[i], text, si) == 0)
+ {
+ strncpy (match_list[0], match_list[i], low);
+ break;
+ }
+ /* no casematch, use first entry */
+ if (i > matches)
+ strncpy (match_list[0], match_list[1], low);
+ }
+ else
+ /* otherwise, just use the text the user typed. */
+ strncpy (match_list[0], text, low);
+ }
+ else
+ strncpy (match_list[0], match_list[1], low);
+
match_list[0][low] = '\0';
}
@@ -832,6 +1019,9 @@ postprocess_matches (matchesp, matching_filenames)
matches = *matchesp;
+ if (matches == 0)
+ return 0;
+
/* It seems to me that in all the cases we handle we would like
to ignore duplicate possiblilities. Scan for the text to
insert being identical to the other completions. */
@@ -884,17 +1074,17 @@ rl_display_match_list (matches, len, max)
char **matches;
int len, max;
{
- int count, limit, printed_len;
+ int count, limit, printed_len, lines;
int i, j, k, l;
char *temp;
/* How many items of MAX length can we fit in the screen window? */
max += 2;
- limit = screenwidth / max;
- if (limit != 1 && (limit * max == screenwidth))
+ limit = _rl_screenwidth / max;
+ if (limit != 1 && (limit * max == _rl_screenwidth))
limit--;
- /* Avoid a possible floating exception. If max > screenwidth,
+ /* Avoid a possible floating exception. If max > _rl_screenwidth,
limit will be 0 and a divide-by-zero fault will result. */
if (limit == 0)
limit = 1;
@@ -908,10 +1098,11 @@ rl_display_match_list (matches, len, max)
/* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0)
- qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
+ qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
- crlf ();
+ rl_crlf ();
+ lines = 0;
if (_rl_print_completions_horizontally == 0)
{
/* Print the sorted items, up-and-down alphabetically, like ls. */
@@ -932,7 +1123,14 @@ rl_display_match_list (matches, len, max)
}
l += count;
}
- crlf ();
+ rl_crlf ();
+ lines++;
+ if (_rl_page_completions && lines >= (_rl_screenheight - 1) && i < count)
+ {
+ lines = _rl_internal_pager (lines);
+ if (lines < 0)
+ return;
+ }
}
}
else
@@ -946,13 +1144,22 @@ rl_display_match_list (matches, len, max)
if (matches[i+1])
{
if (i && (limit > 1) && (i % limit) == 0)
- crlf ();
+ {
+ rl_crlf ();
+ lines++;
+ if (_rl_page_completions && lines >= _rl_screenheight - 1)
+ {
+ lines = _rl_internal_pager (lines);
+ if (lines < 0)
+ return;
+ }
+ }
else
for (k = 0; k < max - printed_len; k++)
putc (' ', rl_outstream);
}
}
- crlf ();
+ rl_crlf ();
}
}
@@ -981,9 +1188,9 @@ display_matches (matches)
if (matches[1] == 0)
{
temp = printable_part (matches[0]);
- crlf ();
+ rl_crlf ();
print_filename (temp, matches[0]);
- crlf ();
+ rl_crlf ();
rl_forced_update_display ();
rl_display_fixed = 1;
@@ -1010,17 +1217,17 @@ display_matches (matches)
(*rl_completion_display_matches_hook) (matches, len, max);
return;
}
-
+
/* If there are many items, then ask the user if she really wants to
see them all. */
if (len >= rl_completion_query_items)
{
- crlf ();
+ rl_crlf ();
fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len);
fflush (rl_outstream);
- if (get_y_or_n () == 0)
+ if (get_y_or_n (0) == 0)
{
- crlf ();
+ rl_crlf ();
rl_forced_update_display ();
rl_display_fixed = 1;
@@ -1068,7 +1275,7 @@ make_quoted_replacement (match, mtype, qc)
This also checks whether the common prefix of several
matches needs to be quoted. */
should_quote = rl_filename_quote_characters
- ? (rl_strpbrk (match, rl_filename_quote_characters) != 0)
+ ? (_rl_strpbrk (match, rl_filename_quote_characters) != 0)
: 0;
do_replace = should_quote ? mtype : NO_MATCH;
@@ -1114,14 +1321,20 @@ insert_match (match, start, mtype, qc)
just-inserted match. If the user has specified that directories
should be marked by a trailing `/', append one of those instead. The
default trailing character is a space. Returns the number of characters
- appended. */
+ appended. If NONTRIVIAL_MATCH is set, we test for a symlink (if the OS
+ has them) and don't add a suffix for a symlink to a directory. A
+ nontrivial match is one that actually adds to the word being completed.
+ The variable rl_completion_mark_symlink_dirs controls this behavior
+ (it's initially set to the what the user has chosen, indicated by the
+ value of _rl_complete_mark_symlink_dirs, but may be modified by an
+ application's completion function). */
static int
-append_to_match (text, delimiter, quote_char)
+append_to_match (text, delimiter, quote_char, nontrivial_match)
char *text;
- int delimiter, quote_char;
+ int delimiter, quote_char, nontrivial_match;
{
char temp_string[4], *filename;
- int temp_string_index;
+ int temp_string_index, s;
struct stat finfo;
temp_string_index = 0;
@@ -1130,7 +1343,7 @@ append_to_match (text, delimiter, quote_char)
if (delimiter)
temp_string[temp_string_index++] = delimiter;
- else if (rl_completion_append_character)
+ else if (rl_completion_suppress_append == 0 && rl_completion_append_character)
temp_string[temp_string_index++] = rl_completion_append_character;
temp_string[temp_string_index++] = '\0';
@@ -1138,21 +1351,39 @@ append_to_match (text, delimiter, quote_char)
if (rl_filename_completion_desired)
{
filename = tilde_expand (text);
- if (stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode))
+ s = (nontrivial_match && rl_completion_mark_symlink_dirs == 0)
+ ? LSTAT (filename, &finfo)
+ : stat (filename, &finfo);
+ if (s == 0 && S_ISDIR (finfo.st_mode))
{
- if (_rl_complete_mark_directories && rl_line_buffer[rl_point] != '/')
- rl_insert_text ("/");
+ if (_rl_complete_mark_directories)
+ {
+ /* This is clumsy. Avoid putting in a double slash if point
+ is at the end of the line and the previous character is a
+ slash. */
+ if (rl_point && rl_line_buffer[rl_point] == '\0' && rl_line_buffer[rl_point - 1] == '/')
+ ;
+ else if (rl_line_buffer[rl_point] != '/')
+ rl_insert_text ("/");
+ }
}
+#ifdef S_ISLNK
+ /* Don't add anything if the filename is a symlink and resolves to a
+ directory. */
+ else if (s == 0 && S_ISLNK (finfo.st_mode) &&
+ stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode))
+ ;
+#endif
else
{
- if (rl_point == rl_end)
+ if (rl_point == rl_end && temp_string_index)
rl_insert_text (temp_string);
}
free (filename);
}
else
{
- if (rl_point == rl_end)
+ if (rl_point == rl_end && temp_string_index)
rl_insert_text (temp_string);
}
@@ -1198,12 +1429,15 @@ insert_all_matches (matches, point, qc)
rl_end_undo_group ();
}
-static void
-free_match_list (matches)
+void
+_rl_free_match_list (matches)
char **matches;
{
register int i;
+ if (matches == 0)
+ return;
+
for (i = 0; matches[i]; i++)
free (matches[i]);
free (matches);
@@ -1221,20 +1455,19 @@ rl_complete_internal (what_to_do)
int what_to_do;
{
char **matches;
- Function *our_func;
- int start, end, delimiter, found_quote, i;
+ rl_compentry_func_t *our_func;
+ int start, end, delimiter, found_quote, i, nontrivial_lcd;
char *text, *saved_line_buffer;
char quote_char;
- /* Only the completion entry function can change these. */
- rl_filename_completion_desired = 0;
- rl_filename_quoting_desired = 1;
- rl_completion_type = what_to_do;
+ RL_SETSTATE(RL_STATE_COMPLETING);
+
+ set_completion_defaults (what_to_do);
saved_line_buffer = rl_line_buffer ? savestring (rl_line_buffer) : (char *)NULL;
our_func = rl_completion_entry_function
? rl_completion_entry_function
- : (Function *)filename_completion_function;
+ : rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
end = rl_point;
@@ -1244,38 +1477,38 @@ rl_complete_internal (what_to_do)
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
- quote_char = find_completion_word (&found_quote, &delimiter);
+ quote_char = _rl_find_completion_word (&found_quote, &delimiter);
start = rl_point;
rl_point = end;
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
+ /* nontrivial_lcd is set if the common prefix adds something to the word
+ being completed. */
+ nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
free (text);
if (matches == 0)
{
- ding ();
+ rl_ding ();
FREE (saved_line_buffer);
+ completion_changed_buffer = 0;
+ RL_UNSETSTATE(RL_STATE_COMPLETING);
return (0);
}
-#if 0
- /* If we are matching filenames, our_func will have been set to
- filename_completion_function */
- i = our_func == (Function *)filename_completion_function;
-#else
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
- filename_completion_function does this. */
+ rl_filename_completion_function does this. */
i = rl_filename_completion_desired;
-#endif
if (postprocess_matches (&matches, i) == 0)
{
- ding ();
+ rl_ding ();
FREE (saved_line_buffer);
completion_changed_buffer = 0;
+ RL_UNSETSTATE(RL_STATE_COMPLETING);
return (0);
}
@@ -1303,10 +1536,10 @@ rl_complete_internal (what_to_do)
break;
}
else if (rl_editing_mode != vi_mode)
- ding (); /* There are other matches remaining. */
+ rl_ding (); /* There are other matches remaining. */
}
else
- append_to_match (matches[0], delimiter, quote_char);
+ append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
break;
@@ -1320,12 +1553,13 @@ rl_complete_internal (what_to_do)
default:
fprintf (stderr, "\r\nreadline: bad value %d for what_to_do in rl_complete\n", what_to_do);
- ding ();
+ rl_ding ();
FREE (saved_line_buffer);
+ RL_UNSETSTATE(RL_STATE_COMPLETING);
return 1;
}
- free_match_list (matches);
+ _rl_free_match_list (matches);
/* Check to see if the line has changed through all of this manipulation. */
if (saved_line_buffer)
@@ -1334,6 +1568,7 @@ rl_complete_internal (what_to_do)
free (saved_line_buffer);
}
+ RL_UNSETSTATE(RL_STATE_COMPLETING);
return 0;
}
@@ -1356,7 +1591,9 @@ rl_complete_internal (what_to_do)
when there are no more matches.
*/
char **
-completion_matches (const char *text, CPFunction *entry_function)
+rl_completion_matches (text, entry_function)
+ const char *text;
+ rl_compentry_func_t *entry_function;
{
/* Number of slots in match_list. */
int match_list_size;
@@ -1401,11 +1638,13 @@ completion_matches (const char *text, CPFunction *entry_function)
TEXT contains a partial username preceded by a random
character (usually `~'). */
char *
-username_completion_function (const char *text, int state)
+rl_username_completion_function (text, state)
+ const char *text;
+ int state;
{
-#if defined (__GO32__) || defined (__WIN__) || defined (__OPENNT)
+#if defined (__WIN32__) || defined (__OPENNT)
return (char *)NULL;
-#else /* !__GO32__ */
+#else /* !__WIN32__ && !__OPENNT) */
static char *username = (char *)NULL;
static struct passwd *entry;
static int namelen, first_char, first_char_loc;
@@ -1437,7 +1676,7 @@ username_completion_function (const char *text, int state)
}
else
{
- value = xmalloc (2 + strlen (entry->pw_name));
+ value = (char *)xmalloc (2 + strlen (entry->pw_name));
*value = *text;
@@ -1448,7 +1687,7 @@ username_completion_function (const char *text, int state)
return (value);
}
-#endif /* !__GO32__ */
+#endif /* !__WIN32__ && !__OPENNT */
}
/* Okay, now we write the entry_function for filename completion. In the
@@ -1456,7 +1695,9 @@ username_completion_function (const char *text, int state)
because of all the pathnames that must be followed when looking up the
completion for a command. */
char *
-filename_completion_function (const char *text, int state)
+rl_filename_completion_function (text, state)
+ const char *text;
+ int state;
{
static DIR *directory = (DIR *)NULL;
static char *filename = (char *)NULL;
@@ -1488,11 +1729,25 @@ filename_completion_function (const char *text, int state)
temp = strrchr (dirname, '/');
+#if defined (__MSDOS__)
+ /* special hack for //X/... */
+ if (dirname[0] == '/' && dirname[1] == '/' && ISALPHA ((unsigned char)dirname[2]) && dirname[3] == '/')
+ temp = strrchr (dirname + 3, '/');
+#endif
+
if (temp)
{
strcpy (filename, ++temp);
*temp = '\0';
}
+#if defined (__MSDOS__)
+ /* searches from current directory on the drive */
+ else if (ISALPHA ((unsigned char)dirname[0]) && dirname[1] == ':')
+ {
+ strcpy (filename, dirname + 2);
+ dirname[2] = '\0';
+ }
+#endif
else
{
dirname[0] = '.';
@@ -1511,6 +1766,9 @@ filename_completion_function (const char *text, int state)
dirname = temp;
}
+ if (rl_directory_rewrite_hook)
+ (*rl_directory_rewrite_hook) (&dirname);
+
if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&dirname))
{
free (users_dirname);
@@ -1534,10 +1792,14 @@ filename_completion_function (const char *text, int state)
entry = (struct dirent *)NULL;
while (directory && (entry = readdir (directory)))
{
- /* Special case for no filename.
- All entries except "." and ".." match. */
+ /* Special case for no filename. If the user has disabled the
+ `match-hidden-files' variable, skip filenames beginning with `.'.
+ All other entries except "." and ".." match. */
if (filename_len == 0)
{
+ if (_rl_match_hidden_files == 0 && HIDDEN_FILE (entry->d_name))
+ continue;
+
if (entry->d_name[0] != '.' ||
(entry->d_name[1] &&
(entry->d_name[1] != '.' || entry->d_name[2])))
@@ -1597,7 +1859,7 @@ filename_completion_function (const char *text, int state)
if (rl_complete_with_tilde_expansion && *users_dirname == '~')
{
dirlen = strlen (dirname);
- temp = xmalloc (2 + dirlen + D_NAMLEN (entry));
+ temp = (char *)xmalloc (2 + dirlen + D_NAMLEN (entry));
strcpy (temp, dirname);
/* Canonicalization cuts off any final slash present. We
may need to add it back. */
@@ -1610,8 +1872,11 @@ filename_completion_function (const char *text, int state)
else
{
dirlen = strlen (users_dirname);
- temp = xmalloc (1 + dirlen + D_NAMLEN (entry));
+ temp = (char *)xmalloc (2 + dirlen + D_NAMLEN (entry));
strcpy (temp, users_dirname);
+ /* Make sure that temp has a trailing slash here. */
+ if (users_dirname[dirlen - 1] != '/')
+ temp[dirlen++] = '/';
}
strcpy (temp + dirlen, entry->d_name);
@@ -1633,9 +1898,10 @@ filename_completion_function (const char *text, int state)
hit the end of the match list, we restore the original unmatched text,
ring the bell, and reset the counter to zero. */
int
-rl_menu_complete (int count, int ignore __attribute__((unused)))
+rl_menu_complete (count, ignore)
+ int count, ignore __attribute__((unused));
{
- Function *our_func;
+ rl_compentry_func_t *our_func;
int matching_filenames, found_quote;
static char *orig_text;
@@ -1653,23 +1919,17 @@ rl_menu_complete (int count, int ignore __attribute__((unused)))
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
- {
- for (match_list_index = 0; matches[match_list_index]; match_list_index++)
- free (matches[match_list_index]);
- free (matches);
- }
+ _rl_free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;
/* Only the completion entry function can change these. */
- rl_filename_completion_desired = 0;
- rl_filename_quoting_desired = 1;
- rl_completion_type = '%';
+ set_completion_defaults ('%');
our_func = rl_completion_entry_function
? rl_completion_entry_function
- : (Function *)filename_completion_function;
+ : rl_filename_completion_function;
/* We now look backwards for the start of a filename/variable word. */
orig_end = rl_point;
@@ -1679,7 +1939,7 @@ rl_menu_complete (int count, int ignore __attribute__((unused)))
if (rl_point)
/* This (possibly) changes rl_point. If it returns a non-zero char,
we know we have an open quote. */
- quote_char = find_completion_word (&found_quote, &delimiter);
+ quote_char = _rl_find_completion_word (&found_quote, &delimiter);
orig_start = rl_point;
rl_point = orig_end;
@@ -1688,19 +1948,14 @@ rl_menu_complete (int count, int ignore __attribute__((unused)))
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
-#if 0
- /* If we are matching filenames, our_func will have been set to
- filename_completion_function */
- matching_filenames = our_func == (Function *)filename_completion_function;
-#else
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
- filename_completion_function does this. */
+ rl_filename_completion_function does this. */
matching_filenames = rl_filename_completion_desired;
-#endif
+
if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0)
{
- ding ();
+ rl_ding ();
FREE (matches);
matches = (char **)0;
FREE (orig_text);
@@ -1721,7 +1976,7 @@ rl_menu_complete (int count, int ignore __attribute__((unused)))
if (matches == 0 || match_list_size == 0)
{
- ding ();
+ rl_ding ();
FREE (matches);
matches = (char **)0;
completion_changed_buffer = 0;
@@ -1734,13 +1989,14 @@ rl_menu_complete (int count, int ignore __attribute__((unused)))
if (match_list_index == 0 && match_list_size > 1)
{
- ding ();
+ rl_ding ();
insert_match (orig_text, orig_start, MULT_MATCH, &quote_char);
}
else
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
- append_to_match (matches[match_list_index], delimiter, quote_char);
+ append_to_match (matches[match_list_index], delimiter, quote_char,
+ strcmp (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
diff --git a/readline/configure b/readline/configure
index 454a177e35d..fc3769f50e8 100755
--- a/readline/configure
+++ b/readline/configure
@@ -1,119 +1,158 @@
#! /bin/sh
+# From configure.in for Readline 4.3, version 2.45, from autoconf version 2.52.
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by Autoconf 2.52 for readline 4.3.
+#
+# Report bugs to <bug-readline@gnu.org>.
+#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
-# From configure.in for Readline 4.0, version 2.14, from autoconf version 2.12
-LIBVERSION=4.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+# Name of the executable.
+as_me=`echo "$0" |sed 's,.*[\\/],,'`
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+as_executable_p="test -f"
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+# NLS nuisances.
+$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
+$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
+$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
+$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
+$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
+$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
+$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
+$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&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=
+# Initializations.
+#
ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
---with-curses use the curses library instead of the termcap library"
+cross_compiling=no
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+ac_unique_file="readline.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
exec_prefix=NONE
-host=NONE
no_create=
-nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
@@ -122,10 +161,15 @@ program_transform_name=s,x,x,
silent=
site=
srcdir=
-target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
@@ -139,16 +183,16 @@ 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
+# Identity of this package.
+PACKAGE_NAME='readline'
+PACKAGE_TARNAME='readline'
+PACKAGE_VERSION='4.3'
+PACKAGE_STRING='readline 4.3'
+PACKAGE_BUGREPORT='bug-readline@gnu.org'
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"
@@ -156,59 +200,59 @@ do
continue
fi
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case "$ac_option" in
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
-bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
+ bindir=$ac_optarg ;;
-build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
+ ac_prev=build_alias ;;
-build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
+ build_alias=$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" ;;
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
-datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
-datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
| --da=*)
- datadir="$ac_optarg" ;;
+ datadir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ ac_feature=`expr "x$ac_option" : 'x-*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" ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ 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/=.*//'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# 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
- *=*) ;;
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -217,95 +261,47 @@ do
-exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
| --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
| --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
+ 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 ;;
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
-host | --host | --hos | --ho)
- ac_prev=host ;;
+ ac_prev=host_alias ;;
-host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
+ host_alias=$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" ;;
+ includedir=$ac_optarg ;;
-infodir | --infodir | --infodi | --infod | --info | --inf)
ac_prev=infodir ;;
-infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
+ infodir=$ac_optarg ;;
-libdir | --libdir | --libdi | --libd)
ac_prev=libdir ;;
-libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
+ 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" ;;
+ libexecdir=$ac_optarg ;;
-localstatedir | --localstatedir | --localstatedi | --localstated \
| --localstate | --localstat | --localsta | --localst \
@@ -314,12 +310,12 @@ EOF
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
| --localstate=* | --localstat=* | --localsta=* | --localst=* \
| --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
+ localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
ac_prev=mandir ;;
-mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
+ mandir=$ac_optarg ;;
-nfp | --nfp | --nf)
# Obsolete; use --without-fp.
@@ -340,26 +336,26 @@ EOF
-oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
| --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
| --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
+ oldincludedir=$ac_optarg ;;
-prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
+ 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_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_suffix=$ac_optarg ;;
-program-transform-name | --program-transform-name \
| --program-transform-nam | --program-transform-na \
@@ -376,7 +372,7 @@ EOF
| --program-transfo=* | --program-transf=* \
| --program-trans=* | --program-tran=* \
| --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
+ program_transform_name=$ac_optarg ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
@@ -386,7 +382,7 @@ EOF
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
| --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
+ sbindir=$ac_optarg ;;
-sharedstatedir | --sharedstatedir | --sharedstatedi \
| --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -397,58 +393,57 @@ EOF
| --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
| --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
| --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
+ sharedstatedir=$ac_optarg ;;
-site | --site | --sit)
ac_prev=site ;;
-site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
+ site=$ac_optarg ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
+ 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" ;;
+ sysconfdir=$ac_optarg ;;
-target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
+ ac_prev=target_alias ;;
-target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
+ target_alias=$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 ;;
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# 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
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
*) ac_optarg=yes ;;
esac
- eval "with_${ac_package}='$ac_optarg'" ;;
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ ac_package=`expr "x$ac_option" : 'x-*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" ;;
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -459,98 +454,98 @@ EOF
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_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" ;;
+ x_libraries=$ac_optarg ;;
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
*)
- 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"
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$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
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 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
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
-# 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
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
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" ;;
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
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
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: should be removed in autoconf 3.0.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+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
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
-# 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
+test "$silent" = yes && exec 6>/dev/null
# 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%/[^/][^/]*$%%'`
+ 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
@@ -561,13 +556,316 @@ else
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; }
+ { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ { echo "$as_me: error: cannot find sources in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # 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
+\`configure' configures readline 4.3 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+EOF
+
+ cat <<EOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+EOF
+
+ cat <<\EOF
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST build programs to run on HOST [BUILD]
+EOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of readline 4.3:";;
+ esac
+ cat <<\EOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-shared build shared libraries [default=YES]
+ --enable-static build static libraries [default=YES]
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-curses use the curses library instead of the termcap
+ library
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <bug-readline@gnu.org>.
+EOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue
+ cd $ac_subdir
+ # A "../" for each directory in /$ac_subdir.
+ ac_dots=`echo $ac_subdir |
+ sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'`
+
+ case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_sub_srcdir=$srcdir ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_sub_srcdir=$srcdir/$ac_subdir ;;
+ *) # Relative path.
+ ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;;
+ esac
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_sub_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_sub_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_sub_srcdir/configure; then
+ echo
+ $SHELL $ac_sub_srcdir/configure --help=recursive
+ elif test -f $ac_sub_srcdir/configure.ac ||
+ test -f $ac_sub_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\EOF
+readline configure 4.3
+generated by GNU Autoconf 2.52
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+EOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<EOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by readline $as_me 4.3, which was
+generated by GNU Autoconf 2.52. Invocation command line was
+
+ $ $0 $@
+
+EOF
+{
+cat <<_ASUNAME
+## ---------- ##
+## Platform. ##
+## ---------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+PATH = $PATH
+
+_ASUNAME
+} >&5
+
+cat >&5 <<EOF
+## ------------ ##
+## Core tests. ##
+## ------------ ##
+
+EOF
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+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_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ ac_sep=" " ;;
+ *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg"
+ ac_sep=" " ;;
+ esac
+ # Get rid of the leading space.
+done
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ echo >&5
+ echo "## ----------------- ##" >&5
+ echo "## Cache variables. ##" >&5
+ echo "## ----------------- ##" >&5
+ echo >&5
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} >&5
+ sed "/^$/d" confdefs.h >conftest.log
+ if test -s conftest.log; then
+ echo >&5
+ echo "## ------------ ##" >&5
+ echo "## confdefs.h. ##" >&5
+ echo "## ------------ ##" >&5
+ echo >&5
+ cat conftest.log >&5
+ fi
+ (echo; echo) >&5
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal" >&5
+ echo "$as_me: exit $exit_status" >&5
+ rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+# 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
+
+# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
@@ -578,42 +876,107 @@ if test -z "$CONFIG_SITE"; then
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
+ { echo "$as_me:879: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ cat "$ac_site_file" >&5
. "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:890: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
else
- echo "creating cache $cache_file"
- > $cache_file
+ { echo "$as_me:898: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:914: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:918: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:924: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:926: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:928: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status. It doesn't matter if
+ # we pass some twice (in addition to the command line arguments).
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"`
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val"
+ ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:947: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:949: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
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
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+echo "#! $SHELL" >conftest.sh
+echo "exit 0" >>conftest.sh
+chmod +x conftest.sh
+if { (echo "$as_me:969: PATH=\".;.\"; conftest.sh") >&5
+ (PATH=".;."; conftest.sh) 2>&5
+ ac_status=$?
+ echo "$as_me:972: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ ac_path_separator=';'
else
- ac_n= ac_c='\c' ac_t=
+ ac_path_separator=:
fi
-
-
-
-
-
+PATH_SEPARATOR="$ac_path_separator"
+rm -f conftest.sh
ac_aux_dir=
for ac_dir in ./support $srcdir/./support; do
@@ -625,387 +988,1135 @@ for ac_dir in ./support $srcdir/./support; do
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -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; }
+ { { echo "$as_me:998: error: cannot find install-sh or install.sh in ./support $srcdir/./support" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in ./support $srcdir/./support" >&2;}
+ { (exit 1); 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.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+ac_config_headers="$ac_config_headers config.h"
+LIBVERSION=4.3
# 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:646: 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
-
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:1012: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:1016: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:1025: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:1029: error: $ac_config_sub $ac_cv_build_alias failed." >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:1034: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+echo "$as_me:1041: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:1050: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:1055: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
opt_curses=no
-opt_shared=no
# Check whether --with-curses or --without-curses was given.
if test "${with_curses+set}" = set; then
withval="$with_curses"
opt_curses=$withval
-fi
-
+fi;
if test "$opt_curses" = "yes"; then
prefer_curses=yes
fi
+opt_static_libs=yes
+opt_shared_libs=yes
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ opt_shared_libs=$enableval
+fi;
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ opt_static_libs=$enableval
+fi;
+
+echo ""
+echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
+echo ""
+
# 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.
+echo "$as_me:1095: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:1115: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:1119: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:1132: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="${ac_tool_prefix}gcc"
+echo "$as_me:1147: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1155: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1158: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:687: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:1167: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="gcc"
+echo "$as_me:1182: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1190: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1193: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:1206: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="${ac_tool_prefix}cc"
+echo "$as_me:1221: found $ac_dir/$ac_word" >&5
+break
+done
+
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:1229: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1232: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:1241: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
- echo "$ac_t""no" 1>&6
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="cc"
+echo "$as_me:1256: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1264: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1267: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+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:716: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:1280: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+fi
+ac_cv_prog_CC="cc"
+echo "$as_me:1300: found $ac_dir/$ac_word" >&5
+break
+done
+
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
+ if test $# != 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" "$@"
+ set dummy "$ac_dir/$ac_word" ${1+"$@"}
shift
ac_cv_prog_CC="$@"
fi
fi
fi
fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
+ echo "$as_me:1322: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:1325: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:1336: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+echo "$as_me:1351: found $ac_dir/$ac_word" >&5
+break
+done
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:1359: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:1362: result: no" >&5
+echo "${ECHO_T}no" >&6
+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
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:1375: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_CC="$ac_prog"
+echo "$as_me:1390: found $ac_dir/$ac_word" >&5
+break
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:1398: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:1401: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
-cat > conftest.$ac_ext <<EOF
-#line 774 "configure"
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+test -z "$CC" && { { echo "$as_me:1413: error: no acceptable cc found in \$PATH" >&5
+echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:1418:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:1421: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1424: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:1426: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1429: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:1431: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:1434: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line 1438 "configure"
#include "confdefs.h"
-main(){return(0);}
-EOF
-if { (eval echo configure:778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- 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
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:1454: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:1457: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:1460: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+for ac_file in `ls a.exe conftest.exe 2>/dev/null;
+ ls a.out conftest 2>/dev/null;
+ ls a.* conftest.* 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ a.out ) # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:1483: error: C compiler cannot create executables" >&5
+echo "$as_me: error: C compiler cannot create executables" >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:1489: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:1494: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:1500: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1503: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
else
- ac_cv_prog_cc_cross=yes
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:1510: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
fi
-rm -fr conftest*
+echo "$as_me:1518: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:1525: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:1527: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:1530: checking for executable suffix" >&5
+echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6
+if { (eval echo "$as_me:1532: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:1535: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:1551: error: cannot compute EXEEXT: cannot compile and link" >&5
+echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:1557: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:1563: checking for object suffix" >&5
+echo $ECHO_N "checking for object suffix... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1569 "configure"
+#include "confdefs.h"
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:798: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
+int
+main ()
+{
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:803: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:1581: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1584: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:1596: error: cannot compute OBJEXT: cannot compile" >&5
+echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:1603: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:1607: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_gcc=no
-fi
-fi
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1613 "configure"
+#include "confdefs.h"
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:827: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1628: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1631: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1634: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1637: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:1649: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:1655: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1661 "configure"
+#include "confdefs.h"
-fi
+int
+main ()
+{
-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
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1673: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1676: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1679: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1682: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:1692: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
CFLAGS="-O2"
+ else
+ CFLAGS=
fi
+fi
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1719: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1722: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1725: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1728: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1740 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1753: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1756: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1759: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1762: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1772 "configure"
+#include "confdefs.h"
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:1784: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:1787: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:1790: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:1793: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:855: checking how to run the C preprocessor" >&5
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:1825: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# 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
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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"
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
# On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 870 "configure"
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1846 "configure"
#include "confdefs.h"
#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:1851: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:1857: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1880 "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:1884: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:1890: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 887 "configure"
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:1927: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1937 "configure"
#include "confdefs.h"
#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:1942: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:1948: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
+ # Broken: fails on valid input.
+continue
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 1971 "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:1975: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:1981: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
- CPP="$ac_cv_prog_CPP"
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
else
- ac_cv_prog_CPP="$CPP"
+ { { echo "$as_me:2009: error: C preprocessor \"$CPP\" fails sanity check" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+ { (exit 1); exit 1; }; }
fi
-echo "$ac_t""$CPP" 1>&6
-ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:917: checking for minix/config.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+echo "$as_me:2020: checking for minix/config.h" >&5
+echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 922 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2026 "configure"
#include "confdefs.h"
#include <minix/config.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
+_ACEOF
+if { (eval echo "$as_me:2030: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2036: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_minix_config_h=yes
+else
+ echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ ac_cv_header_minix_config_h=no
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$as_me:2055: result: $ac_cv_header_minix_config_h" >&5
+echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6
+if test $ac_cv_header_minix_config_h = yes; then
MINIX=yes
else
- echo "$ac_t""no" 1>&6
-MINIX=
+ MINIX=
fi
if test "$MINIX" = yes; then
- cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\EOF
#define _POSIX_SOURCE 1
EOF
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define _POSIX_1_SOURCE 2
EOF
- cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define _MINIX 1
EOF
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"
-if test $ac_cv_prog_gcc = yes; then
- echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:970: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test $ac_cv_c_compiler_gnu = yes; then
+ echo "$as_me:2083: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_pattern="Autoconf.*'x'"
- cat > conftest.$ac_ext <<EOF
-#line 976 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2090 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
-EOF
+_ACEOF
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 994 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2105 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
-EOF
+_ACEOF
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
+echo "$as_me:2118: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
if test $ac_cv_prog_gcc_traditional = yes; then
CC="$CC -traditional"
fi
@@ -1018,28 +2129,38 @@ fi
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1026: checking for a BSD compatible install" >&5
+echo "$as_me:2137: checking for a BSD compatible install" >&5
+echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
for ac_dir in $PATH; do
+ IFS=$ac_save_IFS
# 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/*) ;;
+ case $ac_dir/ in
+ / | ./ | .// | /cC/* \
+ | /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
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if $as_executable_p "$ac_dir/$ac_prog"; then
if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ 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.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -1050,101 +2171,581 @@ else
;;
esac
done
- IFS="$ac_save_IFS"
fi
if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
+ 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"
+ INSTALL=$ac_install_sh
fi
fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:2186: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&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_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1078: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:2199: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_AR=""
+echo "$as_me:2214: found $ac_dir/$ac_word" >&5
+break
+done
+
+ test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
fi
fi
-AR="$ac_cv_prog_AR"
+AR=$ac_cv_prog_AR
if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
+ echo "$as_me:2223: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:2226: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
test -n "$ARFLAGS" || ARFLAGS="cr"
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1107: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:2234: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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=":"
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+echo "$as_me:2249: found $ac_dir/$ac_word" >&5
+break
+done
+
fi
fi
-RANLIB="$ac_cv_prog_RANLIB"
+RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
+ echo "$as_me:2257: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:2260: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:2269: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+ ac_save_IFS=$IFS; IFS=$ac_path_separator
+ac_dummy="$PATH"
+for ac_dir in $ac_dummy; do
+ IFS=$ac_save_IFS
+ test -z "$ac_dir" && ac_dir=.
+ $as_executable_p "$ac_dir/$ac_word" || continue
+ac_cv_prog_ac_ct_RANLIB="ranlib"
+echo "$as_me:2284: found $ac_dir/$ac_word" >&5
+break
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:2293: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- echo "$ac_t""no" 1>&6
+ echo "$as_me:2296: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
MAKE_SHELL=/bin/sh
+echo "$as_me:2307: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line 2315 "configure"
+#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2364: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2367: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2370: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2373: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:2390: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:2393: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+echo "$as_me:2398: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2404 "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2462: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2465: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2468: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2471: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_const=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2481: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo "$as_me:2491: checking for function prototypes" >&5
+echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6
+if test "$ac_cv_prog_cc_stdc" != no; then
+ echo "$as_me:2494: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\EOF
+#define PROTOTYPES 1
+EOF
+
+else
+ echo "$as_me:2502: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+echo "$as_me:2506: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2512 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+_ACEOF
+if { (eval echo "$as_me:2520: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:2526: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2548 "configure"
+#include "confdefs.h"
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2566 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2587 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:2613: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:2616: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:2618: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2621: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:2634: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:2650: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2656 "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2662: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2665: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2668: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2671: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2681: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+echo "$as_me:2691: checking whether char is unsigned" >&5
+echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6
+if test "${ac_cv_c_char_unsigned+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2697 "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+int _array_ [1 - 2 * !(((char) -1) < 0)]
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2709: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2712: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2715: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2718: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_char_unsigned=no
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_char_unsigned=yes
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2728: result: $ac_cv_c_char_unsigned" >&5
+echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6
+if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
+ cat >>confdefs.h <<\EOF
+#define __CHAR_UNSIGNED__ 1
+EOF
+
+fi
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1138: 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
+echo "$as_me:2737: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+if test "${ac_cv_type_signal+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1143 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2743 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
#ifdef signal
-#undef signal
+# undef signal
#endif
#ifdef __cplusplus
extern "C" void (*signal (int, void (*)(int)))(int);
@@ -1152,36 +2753,152 @@ extern "C" void (*signal (int, void (*)(int)))(int);
void (*signal ()) ();
#endif
-int main() {
+int
+main ()
+{
int i;
-; return 0; }
-EOF
-if { (eval echo configure:1160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2765: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2768: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2771: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2774: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_signal=int
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
+echo "$as_me:2784: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
+cat >>confdefs.h <<EOF
#define RETSIGTYPE $ac_cv_type_signal
EOF
+echo "$as_me:2791: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2797 "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2812: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2815: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2818: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2821: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_size_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2831: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<EOF
+#define size_t unsigned
+EOF
+
+fi
+echo "$as_me:2843: checking for ssize_t" >&5
+echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6
+if test "${ac_cv_type_ssize_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2849 "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+if ((ssize_t *) 0)
+ return 0;
+if (sizeof (ssize_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2864: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2867: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2870: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2873: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_ssize_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_ssize_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:2883: result: $ac_cv_type_ssize_t" >&5
+echo "${ECHO_T}$ac_cv_type_ssize_t" >&6
+if test $ac_cv_type_ssize_t = yes; then
+ :
+else
-echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:1180: checking whether stat file-mode macros are broken" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+cat >>confdefs.h <<EOF
+#define ssize_t int
+EOF
+
+fi
+
+echo "$as_me:2895: checking whether stat file-mode macros are broken" >&5
+echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6
+if test "${ac_cv_header_stat_broken+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1185 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2901 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -1210,408 +2927,516 @@ You lose.
# endif
#endif
-EOF
+_ACEOF
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
+echo "$as_me:2940: result: $ac_cv_header_stat_broken" >&5
+echo "${ECHO_T}$ac_cv_header_stat_broken" >&6
if test $ac_cv_header_stat_broken = yes; then
- cat >> confdefs.h <<\EOF
+
+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:1240: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1245 "configure"
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+echo "$as_me:2953: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 2959 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
-int main() {
-DIR *dirp = 0;
-; return 0; }
-EOF
-if { (eval echo configure:1253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=yes"
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:2974: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:2977: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:2980: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:2983: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_dirent_$ac_safe=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
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
+echo "$as_me:2993: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
EOF
- ac_header_dirent=$ac_hdr; break
-else
- echo "$ac_t""no" 1>&6
+
+ac_header_dirent=$ac_hdr; break
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:1278: 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
+ echo "$as_me:3006: checking for opendir in -ldir" >&5
+echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6
+if test "${ac_cv_lib_dir_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ldir $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1286 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3014 "configure"
#include "confdefs.h"
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* 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:1297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3033: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3036: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3039: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3042: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dir_opendir=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_dir_opendir=no
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$as_me:3053: result: $ac_cv_lib_dir_opendir" >&5
+echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6
+if test $ac_cv_lib_dir_opendir = yes; then
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:1319: 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
+ echo "$as_me:3060: checking for opendir in -lx" >&5
+echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6
+if test "${ac_cv_lib_x_opendir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lx $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1327 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 3068 "configure"
#include "confdefs.h"
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* 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:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ builtin and then its argument prototype would still apply. */
+char opendir ();
+int
+main ()
+{
+opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3087: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3090: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3093: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3096: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_x_opendir=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_x_opendir=no
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$as_me:3107: result: $ac_cv_lib_x_opendir" >&5
+echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6
+if test $ac_cv_lib_x_opendir = yes; then
LIBS="$LIBS -lx"
-else
- echo "$ac_t""no" 1>&6
fi
fi
-
-for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat
+for ac_func in lstat memmove putenv select setenv setlocale \
+ strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit
do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1364: 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
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:3119: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1369 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3125 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
+ which can conflict with char $ac_func (); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* 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() {
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+char (*f) ();
+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();
+f = $ac_func;
#endif
-; return 0; }
-EOF
-if { (eval echo configure:1392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3156: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3159: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3162: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3165: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
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
+echo "$as_me:3175: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
EOF
-
-else
- echo "$ac_t""no" 1>&6
+
fi
done
-
-echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:1418: 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
+echo "$as_me:3185: checking for working strcoll" >&5
+echo $ECHO_N "checking for working strcoll... $ECHO_C" >&6
+if test "${ac_cv_func_strcoll_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
ac_cv_func_strcoll_works=no
else
- cat > conftest.$ac_ext <<EOF
-#line 1426 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3194 "configure"
#include "confdefs.h"
-#include <string.h>
+$ac_includes_default
+int
main ()
{
- exit (strcoll ("abc", "def") >= 0 ||
- strcoll ("ABC", "DEF") >= 0 ||
- strcoll ("123", "456") >= 0);
+exit (strcoll ("abc", "def") >= 0 ||
+ strcoll ("ABC", "DEF") >= 0 ||
+ strcoll ("123", "456") >= 0)
+ ;
+ return 0;
}
-EOF
-if { (eval echo configure:1436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3208: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3211: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3213: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3216: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_strcoll_works=no
fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-
-echo "$ac_t""$ac_cv_func_strcoll_works" 1>&6
+echo "$as_me:3228: result: $ac_cv_func_strcoll_works" >&5
+echo "${ECHO_T}$ac_cv_func_strcoll_works" >&6
if test $ac_cv_func_strcoll_works = yes; then
- cat >> confdefs.h <<\EOF
+
+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
+for ac_header in unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
+ limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
+ termcap.h termios.h termio.h sys/file.h locale.h memory.h
do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1465: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1470 "configure"
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:3243: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3249 "configure"
#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1475: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:3253: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:3259: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
+ eval "$as_ac_Header=no"
fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
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
+echo "$as_me:3278: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 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:1504: 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
+echo "$as_me:3288: checking for type of signal functions" >&5
+echo $ECHO_N "checking for type of signal functions... $ECHO_C" >&6
+if test "${bash_cv_signal_vintage+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
-
- cat > conftest.$ac_ext <<EOF
-#line 1510 "configure"
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3295 "configure"
#include "confdefs.h"
#include <signal.h>
-int main() {
+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:1523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3313: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3316: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3319: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3322: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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 1532 "configure"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3330 "configure"
#include "confdefs.h"
#include <signal.h>
-int main() {
+int
+main ()
+{
int mask = sigmask(SIGINT);
sigsetmask(mask); sigblock(mask); sigpause(mask);
-
-; return 0; }
-EOF
-if { (eval echo configure:1542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3345: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3348: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3351: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3354: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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 1551 "configure"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3362 "configure"
#include "confdefs.h"
#include <signal.h>
RETSIGTYPE foo() { }
-int main() {
+int
+main ()
+{
int mask = sigmask(SIGINT);
sigset(SIGINT, foo); sigrelse(SIGINT);
sighold(SIGINT); sigpause(SIGINT);
-
-; return 0; }
-EOF
-if { (eval echo configure:1564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3380: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3383: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3386: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3389: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
-
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_signal_vintage=v7
+
fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-echo "$ac_t""$bash_cv_signal_vintage" 1>&6
+echo "$as_me:3408: result: $bash_cv_signal_vintage" >&5
+echo "${ECHO_T}$bash_cv_signal_vintage" >&6
if test "$bash_cv_signal_vintage" = posix; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define HAVE_POSIX_SIGNALS 1
EOF
elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define HAVE_BSD_SIGNALS 1
EOF
elif test "$bash_cv_signal_vintage" = svr3; then
-cat >> confdefs.h <<\EOF
+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:1605: 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
+echo "$as_me:3427: checking if signal handlers must be reinstalled when invoked" >&5
+echo $ECHO_N "checking if signal handlers must be reinstalled when invoked... $ECHO_C" >&6
+if test "${bash_cv_must_reinstall_sighandlers+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
- echo "configure: warning: cannot check signal handling if cross compiling -- defaulting to no" 1>&2
+ { echo "$as_me:3433: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5
+echo "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;}
bash_cv_must_reinstall_sighandlers=no
else
- cat > conftest.$ac_ext <<EOF
-#line 1615 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3439 "configure"
#include "confdefs.h"
#include <signal.h>
@@ -1657,43 +3482,51 @@ main()
exit(nsigint != 2);
}
-EOF
-if { (eval echo configure:1662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3487: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3490: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3492: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3495: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_must_reinstall_sighandlers=yes
fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$bash_cv_must_reinstall_sighandlers" 1>&6
+echo "$as_me:3508: result: $bash_cv_must_reinstall_sighandlers" >&5
+echo "${ECHO_T}$bash_cv_must_reinstall_sighandlers" >&6
if test $bash_cv_must_reinstall_sighandlers = yes; then
-cat >> confdefs.h <<\EOF
+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:1687: 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
+echo "$as_me:3517: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
+echo $ECHO_N "checking for presence of POSIX-style sigsetjmp/siglongjmp... $ECHO_C" >&6
+if test "${bash_cv_func_sigsetjmp+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
- echo "configure: warning: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" 1>&2
+ { echo "$as_me:3523: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&5
+echo "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" >&2;}
bash_cv_func_sigsetjmp=missing
else
- cat > conftest.$ac_ext <<EOF
-#line 1697 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3529 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
@@ -1733,115 +3566,100 @@ siglongjmp(xx, 10);
exit(1);
#endif
}
-EOF
-if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3571: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3574: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3576: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3579: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_func_sigsetjmp=missing
fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$bash_cv_func_sigsetjmp" 1>&6
+echo "$as_me:3592: result: $bash_cv_func_sigsetjmp" >&5
+echo "${ECHO_T}$bash_cv_func_sigsetjmp" >&6
if test $bash_cv_func_sigsetjmp = present; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define HAVE_POSIX_SIGSETJMP 1
EOF
fi
-echo $ac_n "checking for lstat""... $ac_c" 1>&6
-echo "configure:1761: checking for lstat" >&5
-if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:3601: checking for lstat" >&5
+echo $ECHO_N "checking for lstat... $ECHO_C" >&6
+if test "${bash_cv_func_lstat+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1766 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3607 "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:1776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
+int
+main ()
+{
+ lstat(".",(struct stat *)0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3622: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3625: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3628: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3631: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_func_lstat=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
-
-echo "$ac_t""$bash_cv_func_lstat" 1>&6
+echo "$as_me:3641: result: $bash_cv_func_lstat" >&5
+echo "${ECHO_T}$bash_cv_func_lstat" >&6
if test $bash_cv_func_lstat = yes; then
- cat >> confdefs.h <<\EOF
+ 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:1797: checking whether programs are able to redeclare getpw functions" >&5
-if eval "test \"`echo '$''{'bash_cv_can_redecl_getpw'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1802 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <pwd.h>
-extern struct passwd *getpwent();
-extern struct passwd *getpwuid();
-extern struct passwd *getpwnam();
-int main() {
-struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");
-; return 0; }
-EOF
-if { (eval echo configure:1813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- 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:1835: 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
+echo "$as_me:3650: checking whether or not strcoll and strcmp differ" >&5
+echo $ECHO_N "checking whether or not strcoll and strcmp differ... $ECHO_C" >&6
+if test "${bash_cv_func_strcoll_broken+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
- echo "configure: warning: cannot check strcoll if cross compiling -- defaulting to no" 1>&2
+ { echo "$as_me:3656: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5
+echo "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;}
bash_cv_func_strcoll_broken=no
else
- cat > conftest.$ac_ext <<EOF
-#line 1845 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3662 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -1879,274 +3697,476 @@ char *v[];
exit (r1 > 0 && r2 > 0);
}
-EOF
-if { (eval echo configure:1884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:3702: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3705: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:3707: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3710: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_func_strcoll_broken=no
fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
fi
-echo "$ac_t""$bash_cv_func_strcoll_broken" 1>&6
+echo "$as_me:3723: result: $bash_cv_func_strcoll_broken" >&5
+echo "${ECHO_T}$bash_cv_func_strcoll_broken" >&6
if test $bash_cv_func_strcoll_broken = yes; then
-cat >> confdefs.h <<\EOF
+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:1908: 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
+echo "$as_me:3732: checking whether getpw functions are declared in pwd.h" >&5
+echo $ECHO_N "checking whether getpw functions are declared in pwd.h... $ECHO_C" >&6
+if test "${bash_cv_getpw_declared+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1913 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3738 "configure"
#include "confdefs.h"
+
#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
-void (*signal ()) ();
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:1928: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bash_cv_void_sighandler=yes
+#include <pwd.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "getpwuid" >/dev/null 2>&1; then
+ bash_cv_getpw_declared=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bash_cv_void_sighandler=no
+ bash_cv_getpw_declared=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
+
+echo "$as_me:3758: result: $bash_cv_getpw_declared" >&5
+echo "${ECHO_T}$bash_cv_getpw_declared" >&6
+if test $bash_cv_getpw_declared = yes; then
+cat >>confdefs.h <<\EOF
+#define HAVE_GETPW_DECLS 1
EOF
fi
-echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:1948: checking for TIOCGWINSZ in sys/ioctl.h" >&5
-if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:3767: checking POSIX termios" >&5
+echo $ECHO_N "checking POSIX termios... $ECHO_C" >&6
+if test "${ac_cv_sys_posix_termios+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3773 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <termios.h>
+int
+main ()
+{
+/* SunOS 4.0.3 has termios.h but not the library calls. */
+ tcgetattr(0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:3788: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:3791: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:3794: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3797: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_posix_termios=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_sys_posix_termios=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:3807: result: $ac_cv_sys_posix_termios" >&5
+echo "${ECHO_T}$ac_cv_sys_posix_termios" >&6
+
+if test $ac_cv_sys_posix_termios = yes; then
+ echo "$as_me:3811: checking whether termios.h defines TIOCGWINSZ" >&5
+echo $ECHO_N "checking whether termios.h defines TIOCGWINSZ... $ECHO_C" >&6
+if test "${ac_cv_sys_tiocgwinsz_in_termios_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3817 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <termios.h>
+#ifdef TIOCGWINSZ
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ ac_cv_sys_tiocgwinsz_in_termios_h=yes
+else
+ ac_cv_sys_tiocgwinsz_in_termios_h=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:3835: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
+echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_termios_h" >&6
+
+fi
+if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
+ echo "$as_me:3840: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
+echo $ECHO_N "checking whether sys/ioctl.h defines TIOCGWINSZ... $ECHO_C" >&6
+if test "${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1953 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3846 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
-int main() {
-int x = TIOCGWINSZ;
-; return 0; }
-EOF
-if { (eval echo configure:1961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- bash_cv_tiocgwinsz_in_ioctl=yes
+#ifdef TIOCGWINSZ
+ yes
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bash_cv_tiocgwinsz_in_ioctl=no
+ ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no
fi
rm -f conftest*
+
fi
+echo "$as_me:3864: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
+echo "${ECHO_T}$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6
-echo "$ac_t""$bash_cv_tiocgwinsz_in_ioctl" 1>&6
-if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
-cat >> confdefs.h <<\EOF
+ if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
+
+cat >>confdefs.h <<\EOF
#define GWINSZ_IN_SYS_IOCTL 1
EOF
+ fi
+fi
+
+echo "$as_me:3876: checking whether signal handlers are of type void" >&5
+echo $ECHO_N "checking whether signal handlers are of type void... $ECHO_C" >&6
+if test "${bash_cv_void_sighandler+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3882 "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;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3902: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3905: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3908: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3911: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ bash_cv_void_sighandler=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_void_sighandler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:3921: result: $bash_cv_void_sighandler" >&5
+echo "${ECHO_T}$bash_cv_void_sighandler" >&6
+if test $bash_cv_void_sighandler = yes; then
+cat >>confdefs.h <<\EOF
+#define VOID_SIGHANDLER 1
+EOF
+
fi
-echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
-echo "configure:1982: checking for TIOCSTAT in sys/ioctl.h" >&5
-if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:3930: checking for TIOCSTAT in sys/ioctl.h" >&5
+echo $ECHO_N "checking for TIOCSTAT in sys/ioctl.h... $ECHO_C" >&6
+if test "${bash_cv_tiocstat_in_ioctl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 1987 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3936 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
-int main() {
+int
+main ()
+{
int x = TIOCSTAT;
-; return 0; }
-EOF
-if { (eval echo configure:1995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3949: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:3952: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:3955: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:3958: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_tiocstat_in_ioctl=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$bash_cv_tiocstat_in_ioctl" 1>&6
-if test $bash_cv_tiocstat_in_ioctl = yes; then
-cat >> confdefs.h <<\EOF
+echo "$as_me:3969: result: $bash_cv_tiocstat_in_ioctl" >&5
+echo "${ECHO_T}$bash_cv_tiocstat_in_ioctl" >&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:2016: 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
+echo "$as_me:3978: checking for FIONREAD in sys/ioctl.h" >&5
+echo $ECHO_N "checking for FIONREAD in sys/ioctl.h... $ECHO_C" >&6
+if test "${bash_cv_fionread_in_ioctl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2021 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 3984 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
-int main() {
+int
+main ()
+{
int x = FIONREAD;
-; return 0; }
-EOF
-if { (eval echo configure:2029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:3997: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4000: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4003: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4006: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_fionread_in_ioctl=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$bash_cv_fionread_in_ioctl" 1>&6
-if test $bash_cv_fionread_in_ioctl = yes; then
-cat >> confdefs.h <<\EOF
+echo "$as_me:4017: result: $bash_cv_fionread_in_ioctl" >&5
+echo "${ECHO_T}$bash_cv_fionread_in_ioctl" >&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:2050: 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
+echo "$as_me:4026: checking for speed_t in sys/types.h" >&5
+echo $ECHO_N "checking for speed_t in sys/types.h... $ECHO_C" >&6
+if test "${bash_cv_speed_t_in_sys_types+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2055 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4032 "configure"
#include "confdefs.h"
#include <sys/types.h>
-int main() {
+int
+main ()
+{
speed_t x;
-; return 0; }
-EOF
-if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4044: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4047: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4050: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4053: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_speed_t_in_sys_types=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
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
+echo "$as_me:4064: result: $bash_cv_speed_t_in_sys_types" >&5
+echo "${ECHO_T}$bash_cv_speed_t_in_sys_types" >&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 for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6
-echo "configure:2083: checking for struct winsize in sys/ioctl.h and termios.h" >&5
-if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:4073: checking for struct winsize in sys/ioctl.h and termios.h" >&5
+echo $ECHO_N "checking for struct winsize in sys/ioctl.h and termios.h... $ECHO_C" >&6
+if test "${bash_cv_struct_winsize_header+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2088 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4079 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
-int main() {
+int
+main ()
+{
struct winsize x;
-; return 0; }
-EOF
-if { (eval echo configure:2096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4092: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4095: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4098: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4101: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
bash_cv_struct_winsize_header=ioctl_h
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- cat > conftest.$ac_ext <<EOF
-#line 2104 "configure"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line 4108 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <termios.h>
-int main() {
+int
+main ()
+{
struct winsize x;
-; return 0; }
-EOF
-if { (eval echo configure:2112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4121: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4124: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4127: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4130: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
bash_cv_struct_winsize_header=termios_h
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- bash_cv_struct_winsize_header=other
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_struct_winsize_header=other
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
if test $bash_cv_struct_winsize_header = ioctl_h; then
- echo "$ac_t""sys/ioctl.h" 1>&6
- cat >> confdefs.h <<\EOF
+ echo "$as_me:4145: result: sys/ioctl.h" >&5
+echo "${ECHO_T}sys/ioctl.h" >&6
+ cat >>confdefs.h <<\EOF
#define STRUCT_WINSIZE_IN_SYS_IOCTL 1
EOF
elif test $bash_cv_struct_winsize_header = termios_h; then
- echo "$ac_t""termios.h" 1>&6
- cat >> confdefs.h <<\EOF
+ echo "$as_me:4152: result: termios.h" >&5
+echo "${ECHO_T}termios.h" >&6
+ cat >>confdefs.h <<\EOF
#define STRUCT_WINSIZE_IN_TERMIOS 1
EOF
else
- echo "$ac_t""not found" 1>&6
+ echo "$as_me:4159: result: not found" >&5
+echo "${ECHO_T}not found" >&6
fi
-
-echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
-echo "configure:2145: checking if struct dirent has a d_ino member" >&5
-if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:4163: checking if struct dirent has a d_ino member" >&5
+echo $ECHO_N "checking if struct dirent has a d_ino member... $ECHO_C" >&6
+if test "${bash_cv_dirent_has_dino+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2150 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4169 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2169,40 +4189,53 @@ else
# endif
#endif /* HAVE_DIRENT_H */
-int main() {
+int
+main ()
+{
struct dirent d; int z; z = d.d_ino;
-; return 0; }
-EOF
-if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4203: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4206: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4209: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4212: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_dirent_has_dino=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$bash_cv_dirent_has_dino" 1>&6
+echo "$as_me:4223: result: $bash_cv_dirent_has_dino" >&5
+echo "${ECHO_T}$bash_cv_dirent_has_dino" >&6
if test $bash_cv_dirent_has_dino = yes; then
-cat >> confdefs.h <<\EOF
+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:2201: 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
+echo "$as_me:4232: checking if struct dirent has a d_fileno member" >&5
+echo $ECHO_N "checking if struct dirent has a d_fileno member... $ECHO_C" >&6
+if test "${bash_cv_dirent_has_d_fileno+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2206 "configure"
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4238 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -2225,33 +4258,46 @@ else
# endif
#endif /* HAVE_DIRENT_H */
-int main() {
+int
+main ()
+{
struct dirent d; int z; z = d.d_fileno;
-; return 0; }
-EOF
-if { (eval echo configure:2235: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:4272: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:4275: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:4278: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4281: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
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
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_dirent_has_d_fileno=no
fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
fi
-echo "$ac_t""$bash_cv_dirent_has_d_fileno" 1>&6
+echo "$as_me:4292: result: $bash_cv_dirent_has_d_fileno" >&5
+echo "${ECHO_T}$bash_cv_dirent_has_d_fileno" >&6
if test $bash_cv_dirent_has_d_fileno = yes; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\EOF
#define STRUCT_DIRENT_HAS_D_FILENO 1
EOF
fi
-
case "$host_os" in
aix*) prefer_curses=yes ;;
esac
@@ -2259,128 +4305,224 @@ esac
if test "X$bash_cv_termcap_lib" = "X"; then
_bash_needmsg=yes
else
-echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2264: checking which library has the termcap functions" >&5
+echo "$as_me:4308: checking which library has the termcap functions" >&5
+echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6
_bash_needmsg=
fi
-if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+if test "${bash_cv_termcap_lib+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:2271: checking for tgetent in -ltermcap" >&5
-ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:4315: checking for tgetent in -ltermcap" >&5
+echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-ltermcap $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2279 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4323 "configure"
#include "confdefs.h"
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char tgetent();
-
-int main() {
-tgetent()
-; return 0; }
-EOF
-if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ builtin and then its argument prototype would still apply. */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4342: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4345: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4348: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4351: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_termcap_tgetent=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_termcap_tgetent=no
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$as_me:4362: result: $ac_cv_lib_termcap_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6
+if test $ac_cv_lib_termcap_tgetent = yes; then
bash_cv_termcap_lib=libtermcap
else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:2309: checking for tgetent in -lcurses" >&5
-ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:4367: checking for tgetent in -ltinfo" >&5
+echo $ECHO_N "checking for tgetent in -ltinfo... $ECHO_C" >&6
+if test "${ac_cv_lib_tinfo_tgetent+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
-LIBS="-lcurses $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2317 "configure"
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4375 "configure"
#include "confdefs.h"
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char tgetent();
-
-int main() {
-tgetent()
-; return 0; }
-EOF
-if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ builtin and then its argument prototype would still apply. */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4394: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4397: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4400: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4403: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_tinfo_tgetent=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_tinfo_tgetent=no
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:4414: result: $ac_cv_lib_tinfo_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_tinfo_tgetent" >&6
+if test $ac_cv_lib_tinfo_tgetent = yes; then
+ bash_cv_termcap_lib=libtinfo
+else
+ echo "$as_me:4419: checking for tgetent in -lcurses" >&5
+echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_curses_tgetent+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcurses $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4427 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4446: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4449: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4452: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4455: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_curses_tgetent=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_curses_tgetent=no
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:4466: result: $ac_cv_lib_curses_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6
+if test $ac_cv_lib_curses_tgetent = yes; then
bash_cv_termcap_lib=libcurses
else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:2347: checking for tgetent in -lncurses" >&5
-ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
+ echo "$as_me:4471: checking for tgetent in -lncurses" >&5
+echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6
+if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_LIBS="$LIBS"
+ ac_check_lib_save_LIBS=$LIBS
LIBS="-lncurses $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2355 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line 4479 "configure"
#include "confdefs.h"
+
/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char tgetent();
-
-int main() {
-tgetent()
-; return 0; }
-EOF
-if { (eval echo configure:2366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ builtin and then its argument prototype would still apply. */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4498: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4501: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4504: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4507: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ncurses_tgetent=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_ncurses_tgetent=no
fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$as_me:4518: result: $ac_cv_lib_ncurses_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6
+if test $ac_cv_lib_ncurses_tgetent = yes; then
bash_cv_termcap_lib=libncurses
else
- echo "$ac_t""no" 1>&6
-bash_cv_termcap_lib=gnutermcap
+ bash_cv_termcap_lib=gnutermcap
+fi
+
fi
fi
@@ -2390,10 +4532,11 @@ fi
fi
if test "X$_bash_needmsg" = "Xyes"; then
-echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
-echo "configure:2395: checking which library has the termcap functions" >&5
+echo "$as_me:4535: checking which library has the termcap functions" >&5
+echo $ECHO_N "checking which library has the termcap functions... $ECHO_C" >&6
fi
-echo "$ac_t""using $bash_cv_termcap_lib" 1>&6
+echo "$as_me:4538: result: using $bash_cv_termcap_lib" >&5
+echo "${ECHO_T}using $bash_cv_termcap_lib" >&6
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
LDFLAGS="$LDFLAGS -L./lib/termcap"
TERMCAP_LIB="./lib/termcap/libtermcap.a"
@@ -2401,6 +4544,9 @@ 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 = libtinfo; then
+TERMCAP_LIB=-ltinfo
+TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libncurses; then
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
@@ -2410,440 +4556,1310 @@ TERMCAP_DEP=
fi
if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
- TERMCAP_LIB=-ltermcap #default
+ if test "$prefer_curses" = yes; then
+ TERMCAP_LIB=-lcurses
+ else
+ TERMCAP_LIB=-ltermcap #default
+ fi
fi
-case "$host_cpu" in
-*cray*) LOCAL_CFLAGS=-DCRAY ;;
-esac
+for ac_header in wctype.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4569: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4575 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:4579: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:4585: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4604: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
-case "$host_os" in
-isc*) LOCAL_CFLAGS=-Disc386 ;;
-esac
+fi
+done
+
+for ac_header in wchar.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4617: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4623 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:4627: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:4633: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4652: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+for ac_header in langinfo.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:4665: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4671 "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:4675: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:4681: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_ext
+fi
+echo "$as_me:4700: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<EOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+EOF
+
+fi
+done
+
+echo "$as_me:4710: checking for mbsrtowcs" >&5
+echo $ECHO_N "checking for mbsrtowcs... $ECHO_C" >&6
+if test "${ac_cv_func_mbsrtowcs+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4716 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char mbsrtowcs (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char mbsrtowcs ();
+char (*f) ();
+
+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_mbsrtowcs) || defined (__stub___mbsrtowcs)
+choke me
+#else
+f = mbsrtowcs;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4747: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4750: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4753: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4756: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_mbsrtowcs=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_mbsrtowcs=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:4766: result: $ac_cv_func_mbsrtowcs" >&5
+echo "${ECHO_T}$ac_cv_func_mbsrtowcs" >&6
+if test $ac_cv_func_mbsrtowcs = yes; then
+ cat >>confdefs.h <<\EOF
+#define HAVE_MBSRTOWCS 1
+EOF
-# shared library configuration section
-#
-# Shared object configuration section. These values are generated by
-# ${srcdir}/support/shobj-conf
-#
-if test -f ${srcdir}/support/shobj-conf; then
- echo $ac_n "checking configuration for building shared libraries""... $ac_c" 1>&6
-echo "configure:2432: checking configuration for building shared libraries" >&5
- eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
-
-
-
-
-
-
-
-
-
-
-
-
- echo "$ac_t""$SHLIB_STATUS" 1>&6
fi
-BUILD_DIR=`pwd`
+echo "$as_me:4775: checking for wcwidth" >&5
+echo $ECHO_N "checking for wcwidth... $ECHO_C" >&6
+if test "${ac_cv_func_wcwidth+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4781 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char wcwidth (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char wcwidth ();
+char (*f) ();
+
+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_wcwidth) || defined (__stub___wcwidth)
+choke me
+#else
+f = wcwidth;
+#endif
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4812: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4815: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4818: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4821: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_wcwidth=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_wcwidth=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:4831: result: $ac_cv_func_wcwidth" >&5
+echo "${ECHO_T}$ac_cv_func_wcwidth" >&6
+if test $ac_cv_func_wcwidth = yes; then
+ cat >>confdefs.h <<\EOF
+#define HAVE_WCWIDTH 1
+EOF
+fi
+echo "$as_me:4840: checking for mbstate_t" >&5
+echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
+if test "${bash_cv_have_mbstate_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:4846: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4851 "configure"
+#include "confdefs.h"
+#include <wchar.h>
+int
+main ()
+{
+ mbstate_t ps;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:4863: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4866: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:4868: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4871: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ bash_cv_have_mbstate_t=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_have_mbstate_t=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:4883: result: $bash_cv_have_mbstate_t" >&5
+echo "${ECHO_T}$bash_cv_have_mbstate_t" >&6
+if test $bash_cv_have_mbstate_t = yes; then
+ cat >>confdefs.h <<\EOF
+#define HAVE_MBSTATE_T 1
+EOF
+fi
+echo "$as_me:4892: checking for nl_langinfo and CODESET" >&5
+echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6
+if test "${bash_cv_langinfo_codeset+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line 4898 "configure"
+#include "confdefs.h"
+#include <langinfo.h>
+int
+main ()
+{
+char* cs = nl_langinfo(CODESET);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:4910: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:4913: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:4916: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:4919: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ bash_cv_langinfo_codeset=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+bash_cv_langinfo_codeset=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:4929: result: $bash_cv_langinfo_codeset" >&5
+echo "${ECHO_T}$bash_cv_langinfo_codeset" >&6
+if test $bash_cv_langinfo_codeset = yes; then
+ cat >>confdefs.h <<\EOF
+#define HAVE_LANGINFO_CODESET 1
+EOF
+fi
+case "$host_cpu" in
+*cray*) LOCAL_CFLAGS=-DCRAY ;;
+*s390*) LOCAL_CFLAGS=-fsigned-char ;;
+esac
+case "$host_os" in
+isc*) LOCAL_CFLAGS=-Disc386 ;;
+esac
+# shared library configuration section
+#
+# Shared object configuration section. These values are generated by
+# ${srcdir}/support/shobj-conf
+#
+if test -f ${srcdir}/support/shobj-conf; then
+ echo "$as_me:4953: checking configuration for building shared libraries" >&5
+echo $ECHO_N "checking configuration for building shared libraries... $ECHO_C" >&6
+ eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+ echo "$as_me:4957: result: $SHLIB_STATUS" >&5
+echo "${ECHO_T}$SHLIB_STATUS" >&6
+ # SHLIB_STATUS is either `supported' or `unsupported'. If it's
+ # `unsupported', turn off any default shared library building
+ if test "$SHLIB_STATUS" = 'unsupported'; then
+ opt_shared_libs=no
+ fi
+ # shared library versioning
+ # quoted for m4 so I can use character classes
+ SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
+ SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
+fi
+if test "$opt_static_libs" = "yes"; then
+ STATIC_TARGET=static
+ STATIC_INSTALL_TARGET=install-static
+fi
+if test "$opt_shared_libs" = "yes"; then
+ SHARED_TARGET=shared
+ SHARED_INSTALL_TARGET=install-shared
+fi
+case "$host_os" in
+msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
+*) BUILD_DIR=`pwd` ;;
+esac
-trap '' 1 2 15
-cat > confcache <<\EOF
+ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile"
+ac_config_commands="$ac_config_commands default"
+cat >confcache <<\_ACEOF
# 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.
+# scripts and configure runs, see configure's option --config-cache.
+# 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.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
#
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overriden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
# 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
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if cmp -s $cache_file confcache; then :; else
if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
+ test "x$cache_file" != "x/dev/null" && 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.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
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
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:5068: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
# 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.
+# configure, is in config.log if it exists.
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+ac_cs_invocation="\$0 \$@"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Name of the executable.
+as_me=`echo "$0" |sed 's,.*[\\/],,'`
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+# NLS nuisances.
+$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
+$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
+$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
+$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
+$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
+$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
+$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
+$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; }
+
+exec 6>&1
+
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\EOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+EOF
+
+cat >>$CONFIG_STATUS <<EOF
+ac_cs_version="\\
+readline config.status 4.3
+configured by $0, generated by GNU Autoconf 2.52,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+EOF
+
+cat >>$CONFIG_STATUS <<\EOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
do
- case "\$ac_option" in
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ shift
+ set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
+ shift
+ ;;
+ -*);;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_need_defaults=false;;
+ esac
+
+ case $1 in
+ # Handling of the options.
+EOF
+cat >>$CONFIG_STATUS <<EOF
-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 ;;
+ echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
+ exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:5244: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ shift
+ CONFIG_FILES="$CONFIG_FILES $1"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $1"
+ ac_need_defaults=false;;
+
+ # This is an error.
+ -*) { { echo "$as_me:5263: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+exec 5>>config.log
+cat >&5 << _ACEOF
+
+## ----------------------- ##
+## Running config.status. ##
+## ----------------------- ##
+
+This file was extended by $as_me (readline 4.3) 2.52, executed with
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ > $ac_cs_invocation
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+
+_ACEOF
+EOF
+
+cat >>$CONFIG_STATUS <<\EOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+ "shlib/Makefile" ) CONFIG_FILES="$CONFIG_FILES shlib/Makefile" ;;
+ "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:5304: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
done
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=$TMPDIR/cs$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ { (exit 1); exit 1; }
+}
-trap 'rm -fr `echo "Makefile doc/Makefile examples/Makefile shlib/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%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@MAKE_SHELL@%$MAKE_SHELL%g
-s%@SHOBJ_CC@%$SHOBJ_CC%g
-s%@SHOBJ_CFLAGS@%$SHOBJ_CFLAGS%g
-s%@SHOBJ_LD@%$SHOBJ_LD%g
-s%@SHOBJ_LDFLAGS@%$SHOBJ_LDFLAGS%g
-s%@SHOBJ_XLDFLAGS@%$SHOBJ_XLDFLAGS%g
-s%@SHOBJ_LIBS@%$SHOBJ_LIBS%g
-s%@SHOBJ_STATUS@%$SHOBJ_STATUS%g
-s%@SHLIB_STATUS@%$SHLIB_STATUS%g
-s%@SHLIB_XLDFLAGS@%$SHLIB_XLDFLAGS%g
-s%@SHLIB_LIBSUFF@%$SHLIB_LIBSUFF%g
-s%@SHLIB_LIBVERSION@%$SHLIB_LIBVERSION%g
-s%@SHLIB_LIBS@%$SHLIB_LIBS%g
-s%@BUILD_DIR@%$BUILD_DIR%g
-s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
-s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g
-s%@LOCAL_DEFS@%$LOCAL_DEFS%g
-s%@ARFLAGS@%$ARFLAGS%g
-s%@LIBVERSION@%$LIBVERSION%g
-s%@TERMCAP_LIB@%$TERMCAP_LIB%g
+cat >>$CONFIG_STATUS <<EOF
+
+#
+# CONFIG_FILES section.
+#
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@DEFS@,$DEFS,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@AR@,$AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@MAKE_SHELL@,$MAKE_SHELL,;t t
+s,@SHOBJ_CC@,$SHOBJ_CC,;t t
+s,@SHOBJ_CFLAGS@,$SHOBJ_CFLAGS,;t t
+s,@SHOBJ_LD@,$SHOBJ_LD,;t t
+s,@SHOBJ_LDFLAGS@,$SHOBJ_LDFLAGS,;t t
+s,@SHOBJ_XLDFLAGS@,$SHOBJ_XLDFLAGS,;t t
+s,@SHOBJ_LIBS@,$SHOBJ_LIBS,;t t
+s,@SHOBJ_STATUS@,$SHOBJ_STATUS,;t t
+s,@SHLIB_STATUS@,$SHLIB_STATUS,;t t
+s,@SHLIB_XLDFLAGS@,$SHLIB_XLDFLAGS,;t t
+s,@SHLIB_LIBSUFF@,$SHLIB_LIBSUFF,;t t
+s,@SHLIB_LIBVERSION@,$SHLIB_LIBVERSION,;t t
+s,@SHLIB_LIBS@,$SHLIB_LIBS,;t t
+s,@SHLIB_MAJOR@,$SHLIB_MAJOR,;t t
+s,@SHLIB_MINOR@,$SHLIB_MINOR,;t t
+s,@STATIC_TARGET@,$STATIC_TARGET,;t t
+s,@SHARED_TARGET@,$SHARED_TARGET,;t t
+s,@STATIC_INSTALL_TARGET@,$STATIC_INSTALL_TARGET,;t t
+s,@SHARED_INSTALL_TARGET@,$SHARED_INSTALL_TARGET,;t t
+s,@BUILD_DIR@,$BUILD_DIR,;t t
+s,@LOCAL_CFLAGS@,$LOCAL_CFLAGS,;t t
+s,@LOCAL_LDFLAGS@,$LOCAL_LDFLAGS,;t t
+s,@LOCAL_DEFS@,$LOCAL_DEFS,;t t
+s,@ARFLAGS@,$ARFLAGS,;t t
+s,@LIBVERSION@,$LIBVERSION,;t t
+s,@TERMCAP_LIB@,$TERMCAP_LIB,;t t
CEOF
-EOF
-cat >> $CONFIG_STATUS <<\EOF
+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"
+ 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_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # 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" $tmp/subs.sed >$tmp/subs.frag
else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
+fi # test -n "$CONFIG_FILES"
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile examples/Makefile shlib/Makefile"}
EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+cat >>$CONFIG_STATUS <<\EOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# 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" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) 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%/[^/][^/]*$%%'`
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
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%^\./%%'`"
+ { case "$ac_dir" in
+ [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+ *) as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+ case $as_mkdir_dir in
+ # Skip DOS drivespec
+ ?:) as_incr_dir=$as_mkdir_dir ;;
+ *)
+ as_incr_dir=$as_incr_dir/$as_mkdir_dir
+ test -d "$as_incr_dir" || mkdir "$as_incr_dir"
+ ;;
+ esac
+done; }
+
+ 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'`
+ 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" ;;
+ case $srcdir in
+ .) ac_srcdir=.
+ if test -z "$ac_dots"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* )
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
*) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ ac_srcdir=$ac_dots$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_dots$srcdir ;;
esac
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_dots$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
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:5549: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated automatically by config.status. */
+ configure_input="Generated automatically from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:5567: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:5580: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+EOF
+cat >>$CONFIG_STATUS <<EOF
+ sed "$ac_vpsub
+$extrasub
+EOF
+cat >>$CONFIG_STATUS <<\EOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+EOF
+cat >>$CONFIG_STATUS <<\EOF
- 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*
+#
+# CONFIG_HEADER section.
+#
# 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_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without 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'
+ac_uD=',;t'
-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
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
# 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" ;;
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) 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
+ test x"$ac_file" != x- && { echo "$as_me:5641: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:5652: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:5665: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/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
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# 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.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\EOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
# 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]*%/* & */%
+cat >>conftest.undefs <<\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.
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # egrep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
-while :
+while grep . conftest.undefs >/dev/null
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
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$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
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
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
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\EOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated automatically by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated automatically by configure. */" >$tmp/config.h
else
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+ { echo "$as_me:5782: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
+ { case "$ac_dir" in
+ [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+ *) as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+ case $as_mkdir_dir in
+ # Skip DOS drivespec
+ ?:) as_incr_dir=$as_mkdir_dir ;;
+ *)
+ as_incr_dir=$as_incr_dir/$as_mkdir_dir
+ test -d "$as_incr_dir" || mkdir "$as_incr_dir"
+ ;;
+ esac
+done; }
+
+ fi
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
fi
- rm -f $ac_file
- mv conftest.h $ac_file
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
fi
-fi; done
-
+done
EOF
-cat >> $CONFIG_STATUS <<EOF
+cat >>$CONFIG_STATUS <<\EOF
-EOF
-cat >> $CONFIG_STATUS <<\EOF
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ case $ac_dest in
+ default )
# Makefile uses this timestamp file to record whether config.h is up to date.
echo > stamp-h
+ ;;
+ esac
+done
+EOF
-exit 0
+cat >>$CONFIG_STATUS <<\EOF
+
+{ (exit 0); 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
+ac_clean_files=$ac_clean_files_save
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
diff --git a/readline/configure.in b/readline/configure.in
index 240a3addc45..bc78f8a0f60 100644
--- a/readline/configure.in
+++ b/readline/configure.in
@@ -4,34 +4,49 @@ dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION([for Readline 4.0, version 2.14, from autoconf version] AC_ACVERSION)
-LIBVERSION=4.0
+AC_REVISION([for Readline 4.3, version 2.45, from autoconf version] AC_ACVERSION)
-AC_INIT(readline.h)
-AC_CONFIG_HEADER(config.h)
+AC_INIT(readline, 4.3, bug-readline@gnu.org)
dnl make sure we are using a recent autoconf version
-AC_PREREQ(2.10)
+AC_PREREQ(2.50)
+AC_CONFIG_SRCDIR(readline.h)
AC_CONFIG_AUX_DIR(./support)
+AC_CONFIG_HEADERS(config.h)
+
+dnl update the value of RL_READLINE_VERSION in readline.h when this changes
+LIBVERSION=4.3
AC_CANONICAL_HOST
dnl configure defaults
opt_curses=no
-opt_shared=no
dnl arguments to configure
-AC_ARG_WITH(curses, --with-curses use the curses library instead of the termcap library,opt_curses=$withval)
+AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
if test "$opt_curses" = "yes"; then
prefer_curses=yes
fi
+dnl option parsing for optional features
+opt_static_libs=yes
+opt_shared_libs=yes
+
+AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
+AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
+
+echo ""
+echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_vendor}-${host_os}"
+echo ""
+
# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
+AC_PROG_MAKE_SET
AC_PROG_CC
+dnl AC_AIX
AC_MINIX
# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
@@ -39,7 +54,7 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
-AC_CHECK_PROG(AR, ar, ar)
+AC_CHECK_PROG(AR, ar, , ar)
dnl Set default for ARFLAGS, since autoconf does not have a macro for it.
dnl This allows people to set it when running configure or make
test -n "$ARFLAGS" || ARFLAGS="cr"
@@ -48,32 +63,42 @@ AC_PROG_RANLIB
MAKE_SHELL=/bin/sh
AC_SUBST(MAKE_SHELL)
-AC_RETSIGTYPE
+AC_C_CONST
+AC_C_PROTOTYPES
+AC_C_CHAR_UNSIGNED
+
+AC_TYPE_SIGNAL
+
+AC_TYPE_SIZE_T
+AC_CHECK_TYPE(ssize_t, int)
AC_HEADER_STAT
AC_HEADER_DIRENT
-AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
+AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
+ strcasecmp strpbrk tcgetattr vsnprintf isascii isxdigit)
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)
+AC_CHECK_HEADERS(unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \
+ limits.h sys/ptem.h sys/pte.h sys/stream.h sys/select.h \
+ termcap.h termios.h termio.h sys/file.h locale.h memory.h )
-BASH_SIGNAL_CHECK
-BASH_REINSTALL_SIGHANDLERS
+BASH_SYS_SIGNAL_VINTAGE
+BASH_SYS_REINSTALL_SIGHANDLERS
BASH_FUNC_POSIX_SETJMP
BASH_FUNC_LSTAT
-BASH_CHECK_GETPW_FUNCS
BASH_FUNC_STRCOLL
+BASH_CHECK_GETPW_FUNCS
+
+AC_HEADER_TIOCGWINSZ
+
BASH_TYPE_SIGHANDLER
-BASH_HAVE_TIOCGWINSZ
BASH_HAVE_TIOCSTAT
BASH_HAVE_FIONREAD
-BASH_MISC_SPEED_T
+BASH_CHECK_SPEED_T
BASH_STRUCT_WINSIZE
BASH_STRUCT_DIRENT_D_INO
BASH_STRUCT_DIRENT_D_FILENO
@@ -84,11 +109,18 @@ aix*) prefer_curses=yes ;;
esac
BASH_CHECK_LIB_TERMCAP
if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
- TERMCAP_LIB=-ltermcap #default
+ if test "$prefer_curses" = yes; then
+ TERMCAP_LIB=-lcurses
+ else
+ TERMCAP_LIB=-ltermcap #default
+ fi
fi
+BASH_CHECK_MULTIBYTE
+
case "$host_cpu" in
*cray*) LOCAL_CFLAGS=-DCRAY ;;
+*s390*) LOCAL_CFLAGS=-fsigned-char ;;
esac
case "$host_os" in
@@ -102,7 +134,7 @@ esac
#
if test -f ${srcdir}/support/shobj-conf; then
AC_MSG_CHECKING(configuration for building shared libraries)
- eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
+ eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
AC_SUBST(SHOBJ_CC)
AC_SUBST(SHOBJ_CFLAGS)
AC_SUBST(SHOBJ_LD)
@@ -116,9 +148,40 @@ if test -f ${srcdir}/support/shobj-conf; then
AC_SUBST(SHLIB_LIBVERSION)
AC_SUBST(SHLIB_LIBS)
AC_MSG_RESULT($SHLIB_STATUS)
+
+ # SHLIB_STATUS is either `supported' or `unsupported'. If it's
+ # `unsupported', turn off any default shared library building
+ if test "$SHLIB_STATUS" = 'unsupported'; then
+ opt_shared_libs=no
+ fi
+
+ # shared library versioning
+ # quoted for m4 so I can use character classes
+ SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
+ SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
+ AC_SUBST(SHLIB_MAJOR)
+ AC_SUBST(SHLIB_MINOR)
+fi
+
+if test "$opt_static_libs" = "yes"; then
+ STATIC_TARGET=static
+ STATIC_INSTALL_TARGET=install-static
+fi
+if test "$opt_shared_libs" = "yes"; then
+ SHARED_TARGET=shared
+ SHARED_INSTALL_TARGET=install-shared
fi
-BUILD_DIR=`pwd`
+AC_SUBST(STATIC_TARGET)
+AC_SUBST(SHARED_TARGET)
+AC_SUBST(STATIC_INSTALL_TARGET)
+AC_SUBST(SHARED_INSTALL_TARGET)
+
+case "$host_os" in
+msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
+*) BUILD_DIR=`pwd` ;;
+esac
+
AC_SUBST(BUILD_DIR)
AC_SUBST(CFLAGS)
diff --git a/readline/display.c b/readline/display.c
index df9e212ac0c..180061b29ae 100644
--- a/readline/display.c
+++ b/readline/display.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -41,13 +41,9 @@
#include <stdio.h>
-#if defined (__GO32__)
-# include <go32.h>
-# include <pc.h>
-#endif /* __GO32__ */
-
/* System-specific feature definitions and include files. */
#include "rldefs.h"
+#include "rlmbutil.h"
/* Termcap library stuff. */
#include "tcap.h"
@@ -56,48 +52,32 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-/* Global and pseudo-global variables and functions
- imported from readline.c. */
-extern char *rl_prompt;
-extern int readline_echoing_p;
+#if defined (HACK_TERMCAP_MOTION)
+extern char *_rl_term_forward_char;
+#endif
-extern int _rl_output_meta_chars;
-extern int _rl_horizontal_scroll_mode;
-extern int _rl_mark_modified_lines;
-extern int _rl_prefer_visible_bell;
+static void update_line PARAMS((char *, char *, int, int, int, int));
+static void space_to_eol PARAMS((int));
+static void delete_chars PARAMS((int));
+static void insert_some_chars PARAMS((char *, int, int));
+static void cr PARAMS((void));
-/* Variables and functions imported from terminal.c */
-extern void _rl_output_some_chars ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
+#if defined (HANDLE_MULTIBYTE)
+static int _rl_col_width PARAMS((char *, int, int));
+static int *_rl_wrapped_line;
#else
-extern int _rl_output_character_function ();
+# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
#endif
-extern int _rl_backspace ();
-
-extern const char *term_clreol, *term_clrpag;
-extern const char *term_im, *term_ic, *term_ei, *term_DC;
-extern const char *term_up, *term_dc, *term_cr, *term_IC;
-extern int screenheight, screenwidth, screenchars;
-extern int terminal_can_insert, _rl_term_autowrap;
-
-/* Pseudo-global functions (local to the readline library) exported
- by this file. */
-void _rl_move_cursor_relative (), _rl_output_some_chars ();
-void _rl_move_vert ();
-void _rl_clear_to_eol (), _rl_clear_screen ();
-
-static void update_line (), space_to_eol ();
-static void delete_chars (), insert_some_chars ();
-static void cr ();
static int *inv_lbreaks, *vis_lbreaks;
-
-extern char *xmalloc (), *xrealloc ();
+static int inv_lbsize, vis_lbsize;
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. */
@@ -131,7 +111,7 @@ extern char *xmalloc (), *xrealloc ();
RL_DISPLAY_FIXED variable. This is good for efficiency. */
/* Application-specific redisplay function. */
-VFunction *rl_redisplay_function = rl_redisplay;
+rl_voidfunc_t *rl_redisplay_function = rl_redisplay;
/* Global variables declared here. */
/* What YOU turn on when you have handled all redisplay yourself. */
@@ -141,7 +121,7 @@ int _rl_suppress_redisplay = 0;
/* The stuff that gets printed out before the actual text of the line.
This is usually pointing to rl_prompt. */
-const char *rl_display_prompt = (char *)NULL;
+char *rl_display_prompt = (char *)NULL;
/* Pseudo-global variables declared here. */
/* The visible cursor position. If you print some text, adjust this. */
@@ -170,27 +150,40 @@ static int forced_display;
/* Default and initial buffer size. Can grow. */
static int line_size = 1024;
+/* Variables to keep track of the expanded prompt string, which may
+ include invisible characters. */
+
static char *local_prompt, *local_prompt_prefix;
-static int visible_length, prefix_length;
+static int prompt_visible_length, prompt_prefix_length;
/* The number of invisible characters in the line currently being
displayed on the screen. */
static int visible_wrap_offset;
-/* static so it can be shared between rl_redisplay and update_line */
+/* The number of invisible characters in the prompt string. Static so it
+ can be shared between rl_redisplay and update_line */
static int wrap_offset;
-/* The index of the last invisible_character in the prompt string. */
-static int last_invisible;
+/* The index of the last invisible character in the prompt string. */
+static int prompt_last_invisible;
/* The length (buffer offset) of the first line of the last (possibly
multi-line) buffer displayed on the screen. */
static int visible_first_line_len;
+/* Number of invisible characters on the first physical line of the prompt.
+ Only valid when the number of physical characters in the prompt exceeds
+ (or is equal to) _rl_screenwidth. */
+static int prompt_invis_chars_first_line;
+
+static int prompt_last_screen_line;
+
/* Expand the prompt string S and return the number of visible
characters in *LP, if LP is not null. This is currently more-or-less
a placeholder for expansion. LIP, if non-null is a place to store the
- index of the last invisible character in ther eturned string. */
+ index of the last invisible character in the returned string. NIFLP,
+ if non-zero, is a place to store the number of invisible characters in
+ the first prompt line. */
/* Current implementation:
\001 (^A) start non-visible characters
@@ -200,12 +193,12 @@ static int visible_first_line_len;
\002 are assumed to be `visible'. */
static char *
-expand_prompt (pmt, lp, lip)
+expand_prompt (pmt, lp, lip, niflp)
char *pmt;
- int *lp, *lip;
+ int *lp, *lip, *niflp;
{
char *r, *ret, *p;
- int l, rl, last, ignoring;
+ int l, rl, last, ignoring, ninvis, invfl;
/* Short-circuit if we can. */
if (strchr (pmt, RL_PROMPT_START_IGNORE) == 0)
@@ -217,9 +210,11 @@ expand_prompt (pmt, lp, lip)
}
l = strlen (pmt);
- r = ret = xmalloc (l + 1);
+ r = ret = (char *)xmalloc (l + 1);
+
+ invfl = 0; /* invisible chars in first line of prompt */
- for (rl = ignoring = last = 0, p = pmt; p && *p; p++)
+ for (rl = ignoring = last = ninvis = 0, p = pmt; p && *p; p++)
{
/* This code strips the invisible character string markers
RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */
@@ -239,14 +234,35 @@ expand_prompt (pmt, lp, lip)
*r++ = *p;
if (!ignoring)
rl++;
+ else
+ ninvis++;
+ if (rl == _rl_screenwidth)
+ invfl = ninvis;
}
}
+ if (rl < _rl_screenwidth)
+ invfl = ninvis;
+
*r = '\0';
if (lp)
*lp = rl;
if (lip)
*lip = last;
+ if (niflp)
+ *niflp = invfl;
+ return ret;
+}
+
+/* Just strip out RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE from
+ PMT and return the rest of PMT. */
+char *
+_rl_strip_prompt (pmt)
+ char *pmt;
+{
+ char *ret;
+
+ ret = expand_prompt (pmt, (int *)NULL, (int *)NULL, (int *)NULL);
return ret;
}
@@ -258,8 +274,8 @@ expand_prompt (pmt, lp, lip)
* (portion after the final newline)
* local_prompt_prefix = portion before last newline of rl_display_prompt,
* expanded via expand_prompt
- * visible_length = number of visible characters in local_prompt
- * prefix_length = number of visible characters in local_prompt_prefix
+ * prompt_visible_length = number of visible characters in local_prompt
+ * prompt_prefix_length = number of visible characters in local_prompt_prefix
*
* This function is called once per call to readline(). It may also be
* called arbitrarily to expand the primary prompt.
@@ -275,12 +291,11 @@ rl_expand_prompt (prompt)
int c;
/* Clear out any saved values. */
- if (local_prompt)
- free (local_prompt);
- if (local_prompt_prefix)
- free (local_prompt_prefix);
+ FREE (local_prompt);
+ FREE (local_prompt_prefix);
+
local_prompt = local_prompt_prefix = (char *)0;
- last_invisible = visible_length = 0;
+ prompt_last_invisible = prompt_visible_length = 0;
if (prompt == 0 || *prompt == 0)
return (0);
@@ -288,25 +303,77 @@ rl_expand_prompt (prompt)
p = strrchr (prompt, '\n');
if (!p)
{
- /* The prompt is only one line. */
- local_prompt = expand_prompt (prompt, &visible_length, &last_invisible);
+ /* The prompt is only one logical line, though it might wrap. */
+ local_prompt = expand_prompt (prompt, &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line);
local_prompt_prefix = (char *)0;
- return (visible_length);
+ return (prompt_visible_length);
}
else
{
/* The prompt spans multiple lines. */
t = ++p;
- local_prompt = expand_prompt (p, &visible_length, &last_invisible);
+ local_prompt = expand_prompt (p, &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
- local_prompt_prefix = expand_prompt (prompt, &prefix_length, (int *)NULL);
+ local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
+ (int *)NULL,
+ &prompt_invis_chars_first_line);
*t = c;
- return (prefix_length);
+ return (prompt_prefix_length);
}
}
+/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
+ arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
+ and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
+ increased. If the lines have already been allocated, this ensures that
+ they can hold at least MINSIZE characters. */
+static void
+init_line_structures (minsize)
+ int minsize;
+{
+ register int n;
+
+ if (invisible_line == 0) /* initialize it */
+ {
+ if (line_size < minsize)
+ line_size = minsize;
+ visible_line = (char *)xmalloc (line_size);
+ invisible_line = (char *)xmalloc (line_size);
+ }
+ else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
+ {
+ line_size *= 2;
+ if (line_size < minsize)
+ line_size = minsize;
+ visible_line = (char *)xrealloc (visible_line, line_size);
+ invisible_line = (char *)xrealloc (invisible_line, line_size);
+ }
+
+ for (n = minsize; n < line_size; n++)
+ {
+ visible_line[n] = 0;
+ invisible_line[n] = 1;
+ }
+
+ if (vis_lbreaks == 0)
+ {
+ /* should be enough. */
+ inv_lbsize = vis_lbsize = 256;
+ inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
+ vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
+#if defined (HANDLE_MULTIBYTE)
+ _rl_wrapped_line = (int *)xmalloc (vis_lbsize * sizeof (int));
+#endif
+ inv_lbreaks[0] = vis_lbreaks[0] = 0;
+ }
+}
+
/* Basic redisplay algorithm. */
void
rl_redisplay ()
@@ -315,29 +382,24 @@ rl_redisplay ()
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
int newlines, lpos, temp;
- const char *prompt_this_line;
+ char *prompt_this_line;
+#if defined (HANDLE_MULTIBYTE)
+ wchar_t wc;
+ size_t wc_bytes;
+ int wc_width;
+ mbstate_t ps;
+ int _rl_wrapped_multicolumn = 0;
+#endif
if (!readline_echoing_p)
return;
if (!rl_display_prompt)
- rl_display_prompt = "";
+ rl_display_prompt = (char*)"";
if (invisible_line == 0)
{
- visible_line = xmalloc (line_size);
- invisible_line = xmalloc (line_size);
- for (in = 0; in < line_size; in++)
- {
- visible_line[in] = 0;
- invisible_line[in] = 1;
- }
-
- /* should be enough, but then again, this is just for testing. */
- inv_lbreaks = (int *)malloc (256 * sizeof (int));
- vis_lbreaks = (int *)malloc (256 * sizeof (int));
- inv_lbreaks[0] = vis_lbreaks[0] = 0;
-
+ init_line_structures (0);
rl_on_new_line ();
}
@@ -377,14 +439,14 @@ rl_redisplay ()
if (temp >= line_size)
{
line_size = (temp + 1024) - (temp % 1024);
- visible_line = xrealloc (visible_line, line_size);
- line = invisible_line = xrealloc (invisible_line, line_size);
+ visible_line = (char *)xrealloc (visible_line, line_size);
+ line = invisible_line = (char *)xrealloc (invisible_line, line_size);
}
strncpy (line + out, local_prompt, local_len);
out += local_len;
}
line[out] = '\0';
- wrap_offset = local_len - visible_length;
+ wrap_offset = local_len - prompt_visible_length;
}
else
{
@@ -395,12 +457,13 @@ rl_redisplay ()
else
{
prompt_this_line++;
+ pmtlen = prompt_this_line - rl_display_prompt; /* temp var */
if (forced_display)
{
- _rl_output_some_chars (rl_display_prompt, prompt_this_line - rl_display_prompt);
+ _rl_output_some_chars (rl_display_prompt, pmtlen);
/* Make sure we are at column zero even after a newline,
regardless of the state of terminal output processing. */
- if (prompt_this_line[-2] != '\r')
+ if (pmtlen < 2 || prompt_this_line[-2] != '\r')
cr ();
}
}
@@ -410,55 +473,143 @@ rl_redisplay ()
if (temp >= line_size)
{
line_size = (temp + 1024) - (temp % 1024);
- visible_line = xrealloc (visible_line, line_size);
- line = invisible_line = xrealloc (invisible_line, line_size);
+ visible_line = (char *)xrealloc (visible_line, line_size);
+ line = invisible_line = (char *)xrealloc (invisible_line, line_size);
}
strncpy (line + out, prompt_this_line, pmtlen);
out += pmtlen;
line[out] = '\0';
- wrap_offset = 0;
+ wrap_offset = prompt_invis_chars_first_line = 0;
}
+#define CHECK_INV_LBREAKS() \
+ do { \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ } \
+ } while (0)
+
+#if defined (HANDLE_MULTIBYTE)
+#define CHECK_LPOS() \
+ do { \
+ lpos++; \
+ if (lpos >= _rl_screenwidth) \
+ { \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
+ } \
+ inv_lbreaks[++newlines] = out; \
+ _rl_wrapped_line[newlines] = _rl_wrapped_multicolumn; \
+ lpos = 0; \
+ } \
+ } while (0)
+#else
#define CHECK_LPOS() \
do { \
lpos++; \
- if (lpos >= screenwidth) \
+ if (lpos >= _rl_screenwidth) \
{ \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ } \
inv_lbreaks[++newlines] = out; \
lpos = 0; \
} \
} while (0)
+#endif
/* inv_lbreaks[i] is where line i starts in the buffer. */
inv_lbreaks[newlines = 0] = 0;
lpos = out - wrap_offset;
+#if defined (HANDLE_MULTIBYTE)
+ memset (_rl_wrapped_line, 0, vis_lbsize);
+#endif
+
+ /* prompt_invis_chars_first_line is the number of invisible characters in
+ the first physical line of the prompt.
+ wrap_offset - prompt_invis_chars_first_line is the number of invis
+ chars on the second line. */
- /* XXX - what if lpos is already >= screenwidth before we start drawing the
+ /* what if lpos is already >= _rl_screenwidth before we start drawing the
contents of the command line? */
- while (lpos >= screenwidth)
+ while (lpos >= _rl_screenwidth)
{
+ /* fix from Darin Johnson <darin@acuson.com> for prompt string with
+ invisible characters that is longer than the screen width. The
+ prompt_invis_chars_first_line variable could be made into an array
+ saying how many invisible characters there are per line, but that's
+ probably too much work for the benefit gained. How many people have
+ prompts that exceed two physical lines? */
+ temp = ((newlines + 1) * _rl_screenwidth) +
#if 0
- temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
+ ((newlines == 0) ? prompt_invis_chars_first_line : 0) +
#else
- /* XXX - possible fix from Darin Johnson <darin@acuson.com> for prompt
- string with invisible characters that is longer than the screen
- width. */
- temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0);
+ ((newlines == 0 && local_prompt_prefix == 0) ? prompt_invis_chars_first_line : 0) +
#endif
+ ((newlines == 1) ? wrap_offset : 0);
+
inv_lbreaks[++newlines] = temp;
- lpos -= screenwidth;
+ lpos -= _rl_screenwidth;
}
+ prompt_last_screen_line = newlines;
+
+ /* Draw the rest of the line (after the prompt) into invisible_line, keeping
+ track of where the cursor is (c_pos), the number of the line containing
+ the cursor (lb_linenum), the last line number (lb_botlin and inv_botlin).
+ It maintains an array of line breaks for display (inv_lbreaks).
+ This handles expanding tabs for display and displaying meta characters. */
lb_linenum = 0;
+#if defined (HANDLE_MULTIBYTE)
+ in = 0;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ memset (&ps, 0, sizeof (mbstate_t));
+ wc_bytes = mbrtowc (&wc, rl_line_buffer, rl_end, &ps);
+ }
+ else
+ wc_bytes = 1;
+ while (in < rl_end)
+#else
for (in = 0; in < rl_end; in++)
+#endif
{
c = (unsigned char)rl_line_buffer[in];
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ if (wc_bytes == (size_t)-1 || wc_bytes == (size_t)-2)
+ {
+ /* Byte sequence is invalid or shortened. Assume that the
+ first byte represents a character. */
+ wc_bytes = 1;
+ /* Assume that a character occupies a single column. */
+ wc_width = 1;
+ memset (&ps, 0, sizeof (mbstate_t));
+ }
+ else if (wc_bytes == (size_t)0)
+ break; /* Found '\0' */
+ else
+ {
+ temp = wcwidth (wc);
+ wc_width = (temp < 0) ? 1 : temp;
+ }
+ }
+#endif
+
if (out + 8 >= line_size) /* XXX - 8 for \t */
{
line_size *= 2;
- visible_line = xrealloc (visible_line, line_size);
- invisible_line = xrealloc (invisible_line, line_size);
+ visible_line = (char *)xrealloc (visible_line, line_size);
+ invisible_line = (char *)xrealloc (invisible_line, line_size);
line = invisible_line;
}
@@ -468,15 +619,20 @@ rl_redisplay ()
lb_linenum = newlines;
}
+#if defined (HANDLE_MULTIBYTE)
+ if (META_CHAR (c) && _rl_output_meta_chars == 0) /* XXX - clean up */
+#else
if (META_CHAR (c))
+#endif
{
if (_rl_output_meta_chars == 0)
{
sprintf (line + out, "\\%o", c);
- if (lpos + 4 >= screenwidth)
+ if (lpos + 4 >= _rl_screenwidth)
{
- temp = screenwidth - lpos;
+ temp = _rl_screenwidth - lpos;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp;
lpos = 4 - temp;
}
@@ -494,7 +650,7 @@ rl_redisplay ()
#if defined (DISPLAY_TABS)
else if (c == '\t')
{
- register int temp, newout;
+ register int newout;
#if 0
newout = (out | (int)7) + 1;
@@ -502,10 +658,11 @@ rl_redisplay ()
newout = out + 8 - lpos % 8;
#endif
temp = newout - out;
- if (lpos + temp >= screenwidth)
+ if (lpos + temp >= _rl_screenwidth)
{
register int temp2;
- temp2 = screenwidth - lpos;
+ temp2 = _rl_screenwidth - lpos;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp2;
lpos = temp - temp2;
while (out < newout)
@@ -519,9 +676,10 @@ rl_redisplay ()
}
}
#endif
- else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
+ else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
line[out++] = '\0'; /* XXX - sentinel */
+ CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
lpos = 0;
}
@@ -534,9 +692,52 @@ rl_redisplay ()
}
else
{
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ register int i;
+
+ _rl_wrapped_multicolumn = 0;
+
+ if (_rl_screenwidth < lpos + wc_width)
+ for (i = lpos; i < _rl_screenwidth; i++)
+ {
+ /* The space will be removed in update_line() */
+ line[out++] = ' ';
+ _rl_wrapped_multicolumn++;
+ CHECK_LPOS();
+ }
+ if (in == rl_point)
+ {
+ c_pos = out;
+ lb_linenum = newlines;
+ }
+ for (i = in; i < in+wc_bytes; i++)
+ line[out++] = rl_line_buffer[i];
+ for (i = 0; i < wc_width; i++)
+ CHECK_LPOS();
+ }
+ else
+ {
+ line[out++] = c;
+ CHECK_LPOS();
+ }
+#else
line[out++] = c;
CHECK_LPOS();
+#endif
}
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ in += wc_bytes;
+ wc_bytes = mbrtowc (&wc, rl_line_buffer + in, rl_end - in, &ps);
+ }
+ else
+ in++;
+#endif
+
}
line[out] = '\0';
if (c_pos < 0)
@@ -546,10 +747,12 @@ rl_redisplay ()
}
inv_botlin = lb_botlin = newlines;
+ CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
- /* C_POS == position in buffer where cursor should be placed. */
+ /* C_POS == position in buffer where cursor should be placed.
+ CURSOR_LINENUM == line number where the cursor should be placed. */
/* PWP: now is when things get a bit hairy. The visible and invisible
line buffers are really multiple lines, which would wrap every
@@ -560,7 +763,7 @@ rl_redisplay ()
otherwise, let long lines display in a single terminal line, and
horizontally scroll it. */
- if (_rl_horizontal_scroll_mode == 0 && term_up && *term_up)
+ if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
int nleft, pos, changed_screen_line;
@@ -571,8 +774,13 @@ rl_redisplay ()
/* If we have more than a screenful of material to display, then
only display a screenful. We should display the last screen,
not the first. */
- if (out >= screenchars)
- out = screenchars - 1;
+ if (out >= _rl_screenchars)
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
+ else
+ out = _rl_screenchars - 1;
+ }
/* The first line is at character position 0 in the buffer. The
second and subsequent lines start at inv_lbreaks[N], offset by
@@ -582,7 +790,7 @@ rl_redisplay ()
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
-#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
+#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? (char*)"" : VIS_CHARS(line)
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
/* For each line in the buffer, do the updating display. */
@@ -602,7 +810,7 @@ rl_redisplay ()
(wrap_offset > visible_wrap_offset) &&
(_rl_last_c_pos < visible_first_line_len))
{
- nleft = screenwidth + wrap_offset - _rl_last_c_pos;
+ nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
_rl_clear_to_eol (nleft);
}
@@ -623,7 +831,7 @@ rl_redisplay ()
_rl_move_vert (linenum);
_rl_move_cursor_relative (0, tt);
_rl_clear_to_eol
- ((linenum == _rl_vis_botlin) ? (int) strlen (tt) : screenwidth);
+ ((linenum == _rl_vis_botlin) ? (int)strlen (tt) : _rl_screenwidth);
}
}
_rl_vis_botlin = inv_botlin;
@@ -634,7 +842,7 @@ rl_redisplay ()
if (changed_screen_line)
{
_rl_move_vert (cursor_linenum);
- /* If we moved up to the line with the prompt using term_up,
+ /* If we moved up to the line with the prompt using _rl_term_up,
the physical cursor position on the screen stays the same,
but the buffer position needs to be adjusted to account
for invisible characters. */
@@ -647,14 +855,21 @@ rl_redisplay ()
the characters from the current cursor position. But we
only need to reprint it if the cursor is before the last
invisible character in the prompt string. */
- nleft = visible_length + wrap_offset;
+ nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
- _rl_last_c_pos <= last_invisible && local_prompt)
+ _rl_last_c_pos <= prompt_last_invisible && local_prompt)
{
- if (term_cr)
- tputs (term_cr, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ if (_rl_term_cr)
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
_rl_output_some_chars (local_prompt, nleft);
- _rl_last_c_pos = nleft;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = _rl_col_width(local_prompt, 0, nleft);
+ else
+ _rl_last_c_pos = nleft;
}
/* Where on that line? And where does that line start
@@ -670,10 +885,15 @@ rl_redisplay ()
if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos)
{
_rl_backspace (_rl_last_c_pos - nleft);
- _rl_last_c_pos = nleft;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = _rl_col_width (&visible_line[pos], 0, nleft);
+ else
+ _rl_last_c_pos = nleft;
}
- if (nleft != _rl_last_c_pos)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_move_cursor_relative (nleft, &invisible_line[pos]);
+ else if (nleft != _rl_last_c_pos)
_rl_move_cursor_relative (nleft, &invisible_line[pos]);
}
}
@@ -690,11 +910,11 @@ rl_redisplay ()
/* The number of characters that will be displayed before the cursor. */
ndisp = c_pos - wrap_offset;
- nleft = visible_length + wrap_offset;
+ nleft = prompt_visible_length + wrap_offset;
/* Where the new cursor position will be on the screen. This can be
longer than SCREENWIDTH; if it is, lmargin will be adjusted. */
phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset);
- t = screenwidth / 3;
+ t = _rl_screenwidth / 3;
/* If the number of characters had already exceeded the screenwidth,
last_lmargin will be > 0. */
@@ -702,7 +922,7 @@ rl_redisplay ()
/* If the number of characters to be displayed is more than the screen
width, compute the starting offset so that the cursor is about
two-thirds of the way across the screen. */
- if (phys_c_pos > screenwidth - 2)
+ if (phys_c_pos > _rl_screenwidth - 2)
{
lmargin = c_pos - (2 * t);
if (lmargin < 0)
@@ -712,7 +932,7 @@ rl_redisplay ()
if (wrap_offset && lmargin > 0 && lmargin < nleft)
lmargin = nleft;
}
- else if (ndisp < screenwidth - 2) /* XXX - was -1 */
+ else if (ndisp < _rl_screenwidth - 2) /* XXX - was -1 */
lmargin = 0;
else if (phys_c_pos < 1)
{
@@ -734,7 +954,7 @@ rl_redisplay ()
the whole line, indicate that with a special character at the
right edge of the screen. If LMARGIN is 0, we need to take the
wrap offset into account. */
- t = lmargin + M_OFFSET (lmargin, wrap_offset) + screenwidth;
+ t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth;
if (t < out)
line[t - 1] = '>';
@@ -744,8 +964,8 @@ rl_redisplay ()
update_line (&visible_line[last_lmargin],
&invisible_line[lmargin],
0,
- screenwidth + visible_wrap_offset,
- screenwidth + (lmargin ? 0 : wrap_offset),
+ _rl_screenwidth + visible_wrap_offset,
+ _rl_screenwidth + (lmargin ? 0 : wrap_offset),
0);
/* If the visible new line is shorter than the old, but the number
@@ -756,12 +976,12 @@ rl_redisplay ()
(_rl_last_c_pos == out) &&
t < visible_first_line_len)
{
- nleft = screenwidth - t;
+ nleft = _rl_screenwidth - t;
_rl_clear_to_eol (nleft);
}
visible_first_line_len = out - lmargin - M_OFFSET (lmargin, wrap_offset);
- if (visible_first_line_len > screenwidth)
- visible_first_line_len = screenwidth;
+ if (visible_first_line_len > _rl_screenwidth)
+ visible_first_line_len = _rl_screenwidth;
_rl_move_cursor_relative (c_pos - lmargin, &invisible_line[lmargin]);
last_lmargin = lmargin;
@@ -771,12 +991,18 @@ rl_redisplay ()
/* Swap visible and non-visible lines. */
{
- char *temp = visible_line;
- int *itemp = vis_lbreaks;
+ char *vtemp = visible_line;
+ int *itemp = vis_lbreaks, ntemp = vis_lbsize;
+
visible_line = invisible_line;
- invisible_line = temp;
+ invisible_line = vtemp;
+
vis_lbreaks = inv_lbreaks;
inv_lbreaks = itemp;
+
+ vis_lbsize = inv_lbsize;
+ inv_lbsize = ntemp;
+
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
are not displaying any invisible characters, so set visible_wrap_offset
@@ -812,6 +1038,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
int temp, lendiff, wsatend, od, nd;
int current_invis_chars;
+ int col_lendiff, col_temp;
+#if defined (HANDLE_MULTIBYTE)
+ mbstate_t ps_new, ps_old;
+ int new_offset, old_offset, tmp;
+#endif
/* If we're at the right edge of a terminal that supports xn, we're
ready to wrap around, so do so. This fixes problems with knowing
@@ -819,20 +1050,98 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
emulators. In this calculation, TEMP is the physical screen
position of the cursor. */
temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
- if (temp == screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
- && _rl_last_v_pos == current_line - 1)
+ if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
+ && _rl_last_v_pos == current_line - 1)
{
- if (new[0])
- putc (new[0], rl_outstream);
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ wchar_t wc;
+ mbstate_t ps;
+ int tempwidth, bytes;
+ size_t ret;
+
+ /* This fixes only double-column characters, but if the wrapped
+ character comsumes more than three columns, spaces will be
+ inserted in the string buffer. */
+ if (_rl_wrapped_line[current_line] > 0)
+ _rl_clear_to_eol (_rl_wrapped_line[current_line]);
+
+ memset (&ps, 0, sizeof (mbstate_t));
+ ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);
+ if (ret == (size_t)-1 || ret == (size_t)-2)
+ {
+ tempwidth = 1;
+ ret = 1;
+ }
+ else if (ret == 0)
+ tempwidth = 0;
+ else
+ tempwidth = wcwidth (wc);
+
+ if (tempwidth > 0)
+ {
+ int count;
+ bytes = ret;
+ for (count = 0; count < bytes; count++)
+ putc (new[count], rl_outstream);
+ _rl_last_c_pos = tempwidth;
+ _rl_last_v_pos++;
+ memset (&ps, 0, sizeof (mbstate_t));
+ ret = mbrtowc (&wc, old, MB_CUR_MAX, &ps);
+ if (ret != 0 && bytes != 0)
+ {
+ if (ret == (size_t)-1 || ret == (size_t)-2)
+ memmove (old+bytes, old+1, strlen (old+1));
+ else
+ memmove (old+bytes, old+ret, strlen (old+ret));
+ memcpy (old, new, bytes);
+ }
+ }
+ else
+ {
+ putc (' ', rl_outstream);
+ _rl_last_c_pos = 1;
+ _rl_last_v_pos++;
+ if (old[0] && new[0])
+ old[0] = new[0];
+ }
+ }
else
- putc (' ', rl_outstream);
- _rl_last_c_pos = 1; /* XXX */
- _rl_last_v_pos++;
- if (old[0] && new[0])
- old[0] = new[0];
+#endif
+ {
+ if (new[0])
+ putc (new[0], rl_outstream);
+ else
+ putc (' ', rl_outstream);
+ _rl_last_c_pos = 1; /* XXX */
+ _rl_last_v_pos++;
+ if (old[0] && new[0])
+ old[0] = new[0];
+ }
}
+
/* Find first difference. */
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ memset (&ps_new, 0, sizeof(mbstate_t));
+ memset (&ps_old, 0, sizeof(mbstate_t));
+
+ new_offset = old_offset = 0;
+ for (ofd = old, nfd = new;
+ (ofd - old < omax) && *ofd &&
+ _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); )
+ {
+ old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
+ new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
+ ofd = old + old_offset;
+ nfd = new + new_offset;
+ }
+ }
+ else
+#endif
for (ofd = old, nfd = new;
(ofd - old < omax) && *ofd && (*ofd == *nfd);
ofd++, nfd++)
@@ -849,6 +1158,33 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
return;
wsatend = 1; /* flag for trailing whitespace */
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY);
+ nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY);
+ while ((ols > ofd) && (nls > nfd))
+ {
+ memset (&ps_old, 0, sizeof (mbstate_t));
+ memset (&ps_new, 0, sizeof (mbstate_t));
+
+ _rl_adjust_point (old, ols - old, &ps_old);
+ _rl_adjust_point (new, nls - new, &ps_new);
+
+ if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0)
+ break;
+
+ if (*ols == ' ')
+ wsatend = 0;
+
+ ols = old + _rl_find_prev_mbchar (old, ols - old, MB_FIND_ANY);
+ nls = new + _rl_find_prev_mbchar (new, nls - new, MB_FIND_ANY);
+ }
+ }
+ else
+ {
+#endif /* HANDLE_MULTIBYTE */
ols = oe - 1; /* find last same */
nls = ne - 1;
while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
@@ -858,18 +1194,38 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
ols--;
nls--;
}
+#if defined (HANDLE_MULTIBYTE)
+ }
+#endif
if (wsatend)
{
ols = oe;
nls = ne;
}
+#if defined (HANDLE_MULTIBYTE)
+ /* This may not work for stateful encoding, but who cares? To handle
+ stateful encoding properly, we have to scan each string from the
+ beginning and compare. */
+ else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0)
+#else
else if (*ols != *nls)
+#endif
{
if (*ols) /* don't step past the NUL */
- ols++;
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ ols = old + _rl_find_next_mbchar (old, ols - old, 1, MB_FIND_ANY);
+ else
+ ols++;
+ }
if (*nls)
- nls++;
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ nls = new + _rl_find_next_mbchar (new, nls - new, 1, MB_FIND_ANY);
+ else
+ nls++;
+ }
}
/* count of invisible characters in the current invisible line. */
@@ -896,29 +1252,59 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
lendiff = local_prompt ? strlen (local_prompt) : 0;
od = ofd - old; /* index of first difference in visible line */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
- term_cr && lendiff > visible_length && _rl_last_c_pos > 0 &&
- od > lendiff && _rl_last_c_pos < last_invisible)
+ _rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
+ od >= lendiff && _rl_last_c_pos <= prompt_last_invisible)
{
- tputs (term_cr, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
_rl_output_some_chars (local_prompt, lendiff);
- _rl_last_c_pos = lendiff;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff);
+ else
+ _rl_last_c_pos = lendiff;
}
_rl_move_cursor_relative (od, old);
- /* if (len (new) > len (old)) */
+ /* if (len (new) > len (old))
+ lendiff == difference in buffer
+ col_lendiff == difference on screen
+ When not using multibyte characters, these are equal */
lendiff = (nls - nfd) - (ols - ofd);
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ col_lendiff = _rl_col_width (new, nfd - new, nls - new) - _rl_col_width (old, ofd - old, ols - old);
+ else
+ col_lendiff = lendiff;
/* If we are changing the number of invisible characters in a line, and
the spot of first difference is before the end of the invisible chars,
lendiff needs to be adjusted. */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
current_invis_chars != visible_wrap_offset)
- lendiff += visible_wrap_offset - current_invis_chars;
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ lendiff += visible_wrap_offset - current_invis_chars;
+ col_lendiff += visible_wrap_offset - current_invis_chars;
+ }
+ else
+ {
+ lendiff += visible_wrap_offset - current_invis_chars;
+ col_lendiff = lendiff;
+ }
+ }
/* Insert (diff (len (old), len (new)) ch. */
temp = ne - nfd;
- if (lendiff > 0)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ col_temp = _rl_col_width (new, nfd - new, ne - new);
+ else
+ col_temp = temp;
+
+ if (col_lendiff > 0) /* XXX - was lendiff */
{
/* Non-zero if we're increasing the number of lines. */
int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
@@ -926,17 +1312,17 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
use the terminal's capabilities. If we're growing the number
of lines, make sure we actually cause the new line to wrap
around on auto-wrapping terminals. */
- if (terminal_can_insert && ((2 * temp) >= lendiff || term_IC) && (!_rl_term_autowrap || !gl))
+ if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
{
- /* If lendiff > visible_length and _rl_last_c_pos == 0 and
+ /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
_rl_horizontal_scroll_mode == 1, inserting the characters with
- term_IC or term_ic will screw up the screen because of the
+ _rl_term_IC or _rl_term_ic will screw up the screen because of the
invisible characters. We need to just draw them. */
if (*ols && (!_rl_horizontal_scroll_mode || _rl_last_c_pos > 0 ||
- lendiff <= visible_length || !current_invis_chars))
+ lendiff <= prompt_visible_length || !current_invis_chars))
{
- insert_some_chars (nfd, lendiff);
- _rl_last_c_pos += lendiff;
+ insert_some_chars (nfd, lendiff, col_lendiff);
+ _rl_last_c_pos += col_lendiff;
}
else if (*ols == 0)
{
@@ -945,7 +1331,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* However, this screws up the rest of this block, which
assumes you've done the insert because you can. */
_rl_output_some_chars (nfd, lendiff);
- _rl_last_c_pos += lendiff;
+ _rl_last_c_pos += col_lendiff;
}
else
{
@@ -953,7 +1339,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
the end. We have invisible characters in this line. This
is a dumb update. */
_rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += temp;
+ _rl_last_c_pos += col_temp;
return;
}
/* Copy (new) chars to screen from first diff to last match. */
@@ -961,37 +1347,41 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if ((temp - lendiff) > 0)
{
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
- _rl_last_c_pos += temp - lendiff;
+#if 0
+ _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff) - col_lendiff;
+#else
+ _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
+#endif
}
}
else
{
/* cannot insert chars, write to EOL */
_rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += temp;
+ _rl_last_c_pos += col_temp;
}
}
else /* Delete characters from line. */
{
/* If possible and inexpensive to use terminal deletion, then do so. */
- if (term_dc && (2 * temp) >= -lendiff)
+ if (_rl_term_dc && (2 * col_temp) >= -col_lendiff)
{
/* If all we're doing is erasing the invisible characters in the
prompt string, don't bother. It screws up the assumptions
about what's on the screen. */
if (_rl_horizontal_scroll_mode && _rl_last_c_pos == 0 &&
-lendiff == visible_wrap_offset)
- lendiff = 0;
+ col_lendiff = 0;
- if (lendiff)
- delete_chars (-lendiff); /* delete (diff) characters */
+ if (col_lendiff)
+ delete_chars (-col_lendiff); /* delete (diff) characters */
/* Copy (new) chars to screen from first diff to last match */
temp = nls - nfd;
if (temp > 0)
{
_rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += temp;
+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
}
}
/* Otherwise, print over the existing material. */
@@ -1000,15 +1390,20 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (temp > 0)
{
_rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += temp;
+ _rl_last_c_pos += col_temp;
}
lendiff = (oe - old) - (ne - new);
- if (lendiff)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ col_lendiff = _rl_col_width (old, 0, oe - old) - _rl_col_width (new, 0, ne - new);
+ else
+ col_lendiff = lendiff;
+
+ if (col_lendiff)
{
if (_rl_term_autowrap && current_line < inv_botlin)
- space_to_eol (lendiff);
+ space_to_eol (col_lendiff);
else
- _rl_clear_to_eol (lendiff);
+ _rl_clear_to_eol (col_lendiff);
}
}
}
@@ -1029,6 +1424,61 @@ rl_on_new_line ()
return 0;
}
+/* Tell the update routines that we have moved onto a new line with the
+ prompt already displayed. Code originally from the version of readline
+ distributed with CLISP. */
+int
+rl_on_new_line_with_prompt ()
+{
+ int prompt_size, i, l, real_screenwidth, newlines;
+ char *prompt_last_line;
+
+ /* Initialize visible_line and invisible_line to ensure that they can hold
+ the already-displayed prompt. */
+ prompt_size = strlen (rl_prompt) + 1;
+ init_line_structures (prompt_size);
+
+ /* Make sure the line structures hold the already-displayed prompt for
+ redisplay. */
+ strcpy (visible_line, rl_prompt);
+ strcpy (invisible_line, rl_prompt);
+
+ /* If the prompt contains newlines, take the last tail. */
+ prompt_last_line = strrchr (rl_prompt, '\n');
+ if (!prompt_last_line)
+ prompt_last_line = rl_prompt;
+
+ l = strlen (prompt_last_line);
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = _rl_col_width (prompt_last_line, 0, l);
+ else
+ _rl_last_c_pos = l;
+
+ /* Dissect prompt_last_line into screen lines. Note that here we have
+ to use the real screenwidth. Readline's notion of screenwidth might be
+ one less, see terminal.c. */
+ real_screenwidth = _rl_screenwidth + (_rl_term_autowrap ? 0 : 1);
+ _rl_last_v_pos = l / real_screenwidth;
+ /* If the prompt length is a multiple of real_screenwidth, we don't know
+ whether the cursor is at the end of the last line, or already at the
+ beginning of the next line. Output a newline just to be safe. */
+ if (l > 0 && (l % real_screenwidth) == 0)
+ _rl_output_some_chars ("\n", 1);
+ last_lmargin = 0;
+
+ newlines = 0; i = 0;
+ while (i <= l)
+ {
+ _rl_vis_botlin = newlines;
+ vis_lbreaks[newlines++] = i;
+ i += real_screenwidth;
+ }
+ vis_lbreaks[newlines] = l;
+ visible_wrap_offset = 0;
+
+ return 0;
+}
+
/* Actually update the display, period. */
int
rl_forced_update_display ()
@@ -1052,24 +1502,31 @@ rl_forced_update_display ()
void
_rl_move_cursor_relative (new, data)
int new;
- char *data;
+ const char *data;
{
register int i;
/* If we don't have to do anything, then return. */
+#if defined (HANDLE_MULTIBYTE)
+ /* If we have multibyte characters, NEW is indexed by the buffer point in
+ a multibyte string, but _rl_last_c_pos is the display position. In
+ this case, NEW's display position is not obvious. */
+ if ((MB_CUR_MAX == 1 || rl_byte_oriented ) && _rl_last_c_pos == new) return;
+#else
if (_rl_last_c_pos == new) return;
+#endif
/* It may be faster to output a CR, and then move forwards instead
of moving backwards. */
/* i == current physical cursor position. */
i = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
if (new == 0 || CR_FASTER (new, _rl_last_c_pos) ||
- (_rl_term_autowrap && i == screenwidth))
+ (_rl_term_autowrap && i == _rl_screenwidth))
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
#else
- tputs (term_cr, 1, _rl_output_character_function);
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* !__MSDOS__ */
_rl_last_c_pos = 0;
}
@@ -1086,22 +1543,70 @@ _rl_move_cursor_relative (new, data)
That kind of control is for people who don't know what the
data is underneath the cursor. */
#if defined (HACK_TERMCAP_MOTION)
- extern char *term_forward_char;
-
- if (term_forward_char)
+ if (_rl_term_forward_char)
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int width;
+ width = _rl_col_width (data, _rl_last_c_pos, new);
+ for (i = 0; i < width; i++)
+ tputs (_rl_term_forward_char, 1, _rl_output_character_function);
+ }
+ else
+ {
+ for (i = _rl_last_c_pos; i < new; i++)
+ tputs (_rl_term_forward_char, 1, _rl_output_character_function);
+ }
+ }
+ else if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+ for (i = 0; i < new; i++)
+ putc (data[i], rl_outstream);
+ }
+ else
for (i = _rl_last_c_pos; i < new; i++)
- tputs (term_forward_char, 1, _rl_output_character_function);
+ putc (data[i], rl_outstream);
+
+#else /* !HACK_TERMCAP_MOTION */
+
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+ for (i = 0; i < new; i++)
+ putc (data[i], rl_outstream);
+ }
else
for (i = _rl_last_c_pos; i < new; i++)
putc (data[i], rl_outstream);
-#else
- for (i = _rl_last_c_pos; i < new; i++)
- putc (data[i], rl_outstream);
-#endif /* HACK_TERMCAP_MOTION */
+
+#endif /* !HACK_TERMCAP_MOTION */
+
}
+#if defined (HANDLE_MULTIBYTE)
+ /* NEW points to the buffer point, but _rl_last_c_pos is the display point.
+ The byte length of the string is probably bigger than the column width
+ of the string, which means that if NEW == _rl_last_c_pos, then NEW's
+ display point is less than _rl_last_c_pos. */
+ else if (_rl_last_c_pos >= new)
+#else
else if (_rl_last_c_pos > new)
- _rl_backspace (_rl_last_c_pos - new);
- _rl_last_c_pos = new;
+#endif
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+ for (i = 0; i < new; i++)
+ putc (data[i], rl_outstream);
+ }
+ else
+ _rl_backspace (_rl_last_c_pos - new);
+ }
+
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = _rl_col_width (data, 0, new);
+ else
+ _rl_last_c_pos = new;
}
/* PWP: move the cursor up or down. */
@@ -1111,32 +1616,27 @@ _rl_move_vert (to)
{
register int delta, i;
- if (_rl_last_v_pos == to || to > screenheight)
+ if (_rl_last_v_pos == to || to > _rl_screenheight)
return;
-#if defined (__GO32__)
- {
- int row, col;
-
- ScreenGetCursor (&row, &col);
- ScreenSetCursor ((row + to - _rl_last_v_pos), col);
- }
-#else /* !__GO32__ */
-
if ((delta = to - _rl_last_v_pos) > 0)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
- tputs (term_cr, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
}
else
{ /* delta < 0 */
- if (term_up && *term_up)
+ if (_rl_term_up && *_rl_term_up)
for (i = 0; i < -delta; i++)
- tputs (term_up, 1, _rl_output_character_function);
+ tputs (_rl_term_up, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
+
_rl_last_v_pos = to; /* Now TO is here */
}
@@ -1193,7 +1693,7 @@ rl_character_len (c, pos)
if (CTRL_CHAR (c) || c == RUBOUT)
return (2);
- return ((isprint (uc)) ? 1 : 2);
+ return ((ISPRINT (uc)) ? 1 : 2);
}
/* How to print things in the "echo-area". The prompt is treated as a
@@ -1220,7 +1720,12 @@ rl_message (va_alist)
format = va_arg (args, char *);
#endif
+#if defined (HAVE_VSNPRINTF)
+ vsnprintf (msg_buf, sizeof (msg_buf) - 1, format, args);
+#else
vsprintf (msg_buf, format, args);
+ msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
+#endif
va_end (args);
rl_display_prompt = msg_buf;
@@ -1229,9 +1734,12 @@ rl_message (va_alist)
}
#else /* !USE_VARARGS */
int
-rl_message (char *format, void *arg1, void *arg2)
+rl_message (format, arg1, arg2)
+ char *format;
+ int arg1, arg2;
{
sprintf (msg_buf, format, arg1, arg2);
+ msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
rl_display_prompt = msg_buf;
(*rl_redisplay_function) ();
return 0;
@@ -1252,7 +1760,7 @@ rl_reset_line_state ()
{
rl_on_new_line ();
- rl_display_prompt = rl_prompt ? rl_prompt : "";
+ rl_display_prompt = (char*)(rl_prompt ? rl_prompt : "");
forced_display = 1;
return 0;
}
@@ -1267,25 +1775,23 @@ rl_save_prompt ()
{
saved_local_prompt = local_prompt;
saved_local_prefix = local_prompt_prefix;
- saved_last_invisible = last_invisible;
- saved_visible_length = visible_length;
+ saved_last_invisible = prompt_last_invisible;
+ saved_visible_length = prompt_visible_length;
local_prompt = local_prompt_prefix = (char *)0;
- last_invisible = visible_length = 0;
+ prompt_last_invisible = prompt_visible_length = 0;
}
void
rl_restore_prompt ()
{
- if (local_prompt)
- free (local_prompt);
- if (local_prompt_prefix)
- free (local_prompt_prefix);
+ FREE (local_prompt);
+ FREE (local_prompt_prefix);
local_prompt = saved_local_prompt;
local_prompt_prefix = saved_local_prefix;
- last_invisible = saved_last_invisible;
- visible_length = saved_visible_length;
+ prompt_last_invisible = saved_last_invisible;
+ prompt_visible_length = saved_visible_length;
}
char *
@@ -1300,7 +1806,7 @@ _rl_make_prompt_for_search (pchar)
if (saved_local_prompt == 0)
{
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
- pmt = xmalloc (len + 2);
+ pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
@@ -1309,14 +1815,14 @@ _rl_make_prompt_for_search (pchar)
else
{
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
- pmt = xmalloc (len + 2);
+ pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, saved_local_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
local_prompt = savestring (pmt);
- last_invisible = saved_last_invisible;
- visible_length = saved_visible_length + 1;
+ prompt_last_invisible = saved_last_invisible;
+ prompt_visible_length = saved_visible_length + 1;
}
return pmt;
}
@@ -1343,11 +1849,9 @@ void
_rl_clear_to_eol (count)
int count;
{
-#if !defined (__GO32__)
- if (term_clreol)
- tputs (term_clreol, 1, _rl_output_character_function);
+ if (_rl_term_clreol)
+ tputs (_rl_term_clreol, 1, _rl_output_character_function);
else if (count)
-#endif /* !__GO32__ */
space_to_eol (count);
}
@@ -1368,39 +1872,29 @@ space_to_eol (count)
void
_rl_clear_screen ()
{
-#if !defined (__GO32__)
- if (term_clrpag)
- tputs (term_clrpag, 1, _rl_output_character_function);
+ if (_rl_term_clrpag)
+ tputs (_rl_term_clrpag, 1, _rl_output_character_function);
else
-#endif /* !__GO32__ */
- crlf ();
+ rl_crlf ();
}
-/* Insert COUNT characters from STRING to the output stream. */
+/* Insert COUNT characters from STRING to the output stream at column COL. */
static void
-insert_some_chars (string, count)
+insert_some_chars (string, count, col)
char *string;
- int count;
+ int count, col;
{
-#if defined (__GO32__)
- int row, col, width;
- char *row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
-
- memcpy (row_start + col + count, row_start + col, width - col - count);
-
- /* Place the text on the screen. */
- _rl_output_some_chars (string, count);
-#else /* !_GO32 */
+ /* DEBUGGING */
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ if (count != col)
+ fprintf(stderr, "readline: debug: insert_some_chars: count (%d) != col (%d)\n", count, col);
/* If IC is defined, then we do not have to "enter" insert mode. */
- if (term_IC)
+ if (_rl_term_IC)
{
char *buffer;
- buffer = tgoto (term_IC, 0, count);
+
+ buffer = tgoto (_rl_term_IC, 0, col);
tputs (buffer, 1, _rl_output_character_function);
_rl_output_some_chars (string, count);
}
@@ -1409,15 +1903,15 @@ insert_some_chars (string, count)
register int i;
/* If we have to turn on insert-mode, then do so. */
- if (term_im && *term_im)
- tputs (term_im, 1, _rl_output_character_function);
+ if (_rl_term_im && *_rl_term_im)
+ tputs (_rl_term_im, 1, _rl_output_character_function);
/* If there is a special command for inserting characters, then
use that first to open up the space. */
- if (term_ic && *term_ic)
+ if (_rl_term_ic && *_rl_term_ic)
{
- for (i = count; i--; )
- tputs (term_ic, 1, _rl_output_character_function);
+ for (i = col; i--; )
+ tputs (_rl_term_ic, 1, _rl_output_character_function);
}
/* Print the text. */
@@ -1425,10 +1919,9 @@ insert_some_chars (string, count)
/* If there is a string to turn off insert mode, we had best use
it now. */
- if (term_ei && *term_ei)
- tputs (term_ei, 1, _rl_output_character_function);
+ if (_rl_term_ei && *_rl_term_ei)
+ tputs (_rl_term_ei, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
}
/* Delete COUNT characters from the display line. */
@@ -1436,34 +1929,21 @@ static void
delete_chars (count)
int count;
{
-#if defined (__GO32__)
- int row, col, width;
- char *row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
-
- memcpy (row_start + col, row_start + col + count, width - col - count);
- memset (row_start + width - count, 0, count * 2);
-#else /* !_GO32 */
-
- if (count > screenwidth) /* XXX */
+ if (count > _rl_screenwidth) /* XXX */
return;
- if (term_DC && *term_DC)
+ if (_rl_term_DC && *_rl_term_DC)
{
char *buffer;
- buffer = tgoto (term_DC, count, count);
+ buffer = tgoto (_rl_term_DC, count, count);
tputs (buffer, count, _rl_output_character_function);
}
else
{
- if (term_dc && *term_dc)
+ if (_rl_term_dc && *_rl_term_dc)
while (count--)
- tputs (term_dc, 1, _rl_output_character_function);
+ tputs (_rl_term_dc, 1, _rl_output_character_function);
}
-#endif /* !__GO32__ */
}
void
@@ -1482,16 +1962,17 @@ _rl_update_final ()
}
_rl_move_vert (_rl_vis_botlin);
/* If we've wrapped lines, remove the final xterm line-wrap flag. */
- if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == screenwidth))
+ if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == _rl_screenwidth))
{
char *last_line;
- last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
- _rl_move_cursor_relative (screenwidth - 1, last_line);
+
+ last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
+ _rl_move_cursor_relative (_rl_screenwidth - 1, last_line);
_rl_clear_to_eol (0);
- putc (last_line[screenwidth - 1], rl_outstream);
+ putc (last_line[_rl_screenwidth - 1], rl_outstream);
}
_rl_vis_botlin = 0;
- crlf ();
+ rl_crlf ();
fflush (rl_outstream);
rl_display_fixed++;
}
@@ -1500,53 +1981,90 @@ _rl_update_final ()
static void
cr ()
{
- if (term_cr)
+ if (_rl_term_cr)
{
- tputs (term_cr, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
}
}
+/* Redraw the last line of a multi-line prompt that may possibly contain
+ terminal escape sequences. Called with the cursor at column 0 of the
+ line to draw the prompt on. */
+static void
+redraw_prompt (t)
+ char *t;
+{
+ char *oldp, *oldl, *oldlprefix;
+ int oldlen, oldlast, oldplen, oldninvis;
+
+ /* Geez, I should make this a struct. */
+ oldp = rl_display_prompt;
+ oldl = local_prompt;
+ oldlprefix = local_prompt_prefix;
+ oldlen = prompt_visible_length;
+ oldplen = prompt_prefix_length;
+ oldlast = prompt_last_invisible;
+ oldninvis = prompt_invis_chars_first_line;
+
+ rl_display_prompt = t;
+ local_prompt = expand_prompt (t, &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line);
+ local_prompt_prefix = (char *)NULL;
+ rl_forced_update_display ();
+
+ rl_display_prompt = oldp;
+ local_prompt = oldl;
+ local_prompt_prefix = oldlprefix;
+ prompt_visible_length = oldlen;
+ prompt_prefix_length = oldplen;
+ prompt_last_invisible = oldlast;
+ prompt_invis_chars_first_line = oldninvis;
+}
+
/* Redisplay the current line after a SIGWINCH is received. */
void
_rl_redisplay_after_sigwinch ()
{
- char *t, *oldl, *oldlprefix;
- const char *oldp;
+ char *t;
/* Clear the current line and put the cursor at column 0. Make sure
the right thing happens if we have wrapped to a new screen line. */
- if (term_cr)
+ if (_rl_term_cr)
{
- tputs (term_cr, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
_rl_last_c_pos = 0;
- if (term_clreol)
- tputs (term_clreol, 1, _rl_output_character_function);
+#if defined (__MSDOS__)
+ space_to_eol (_rl_screenwidth);
+ putc ('\r', rl_outstream);
+#else
+ if (_rl_term_clreol)
+ tputs (_rl_term_clreol, 1, _rl_output_character_function);
else
{
- space_to_eol (screenwidth);
- tputs (term_cr, 1, _rl_output_character_function);
+ space_to_eol (_rl_screenwidth);
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
}
+#endif
if (_rl_last_v_pos > 0)
_rl_move_vert (0);
}
else
- crlf ();
+ rl_crlf ();
/* Redraw only the last line of a multi-line prompt. */
t = strrchr (rl_display_prompt, '\n');
if (t)
- {
- oldp = rl_display_prompt;
- oldl = local_prompt;
- oldlprefix = local_prompt_prefix;
- rl_display_prompt = ++t;
- local_prompt = local_prompt_prefix = (char *)NULL;
- rl_forced_update_display ();
- rl_display_prompt = oldp;
- local_prompt = oldl;
- local_prompt_prefix = oldlprefix;
- }
+ redraw_prompt (++t);
else
rl_forced_update_display ();
}
@@ -1571,3 +2089,109 @@ _rl_erase_entire_line ()
cr ();
fflush (rl_outstream);
}
+
+/* return the `current display line' of the cursor -- the number of lines to
+ move up to get to the first screen line of the current readline line. */
+int
+_rl_current_display_line ()
+{
+ int ret, nleft;
+
+ /* Find out whether or not there might be invisible characters in the
+ editing buffer. */
+ if (rl_display_prompt == rl_prompt)
+ nleft = _rl_last_c_pos - _rl_screenwidth - rl_visible_prompt_length;
+ else
+ nleft = _rl_last_c_pos - _rl_screenwidth;
+
+ if (nleft > 0)
+ ret = 1 + nleft / _rl_screenwidth;
+ else
+ ret = 0;
+
+ return ret;
+}
+
+#if defined (HANDLE_MULTIBYTE)
+/* Calculate the number of screen columns occupied by STR from START to END.
+ In the case of multibyte characters with stateful encoding, we have to
+ scan from the beginning of the string to take the state into account. */
+static int
+_rl_col_width (str, start, end)
+ char *str;
+ int start, end;
+{
+ wchar_t wc;
+ mbstate_t ps = {0};
+ int tmp, point, width, max;
+
+ if (end <= start)
+ return 0;
+
+ point = 0;
+ max = end;
+
+ while (point < start)
+ {
+ tmp = mbrlen (str + point, max, &ps);
+ if ((size_t)tmp == (size_t)-1 || (size_t)tmp == (size_t)-2)
+ {
+ /* In this case, the bytes are invalid or too short to compose a
+ multibyte character, so we assume that the first byte represents
+ a single character. */
+ point++;
+ max--;
+
+ /* Clear the state of the byte sequence, because in this case the
+ effect of mbstate is undefined. */
+ memset (&ps, 0, sizeof (mbstate_t));
+ }
+ else if (tmp == 0)
+ break; /* Found '\0' */
+ else
+ {
+ point += tmp;
+ max -= tmp;
+ }
+ }
+
+ /* If START is not a byte that starts a character, then POINT will be
+ greater than START. In this case, assume that (POINT - START) gives
+ a byte count that is the number of columns of difference. */
+ width = point - start;
+
+ while (point < end)
+ {
+ tmp = mbrtowc (&wc, str + point, max, &ps);
+ if ((size_t)tmp == (size_t)-1 || (size_t)tmp == (size_t)-2)
+ {
+ /* In this case, the bytes are invalid or too short to compose a
+ multibyte character, so we assume that the first byte represents
+ a single character. */
+ point++;
+ max--;
+
+ /* and assume that the byte occupies a single column. */
+ width++;
+
+ /* Clear the state of the byte sequence, because in this case the
+ effect of mbstate is undefined. */
+ memset (&ps, 0, sizeof (mbstate_t));
+ }
+ else if (tmp == 0)
+ break; /* Found '\0' */
+ else
+ {
+ point += tmp;
+ max -= tmp;
+ tmp = wcwidth(wc);
+ width += (tmp >= 0) ? tmp : 1;
+ }
+ }
+
+ width += point - end;
+
+ return width;
+}
+#endif /* HANDLE_MULTIBYTE */
+
diff --git a/readline/emacs_keymap.c b/readline/emacs_keymap.c
index 4ba385843f6..ca9d1343b65 100644
--- a/readline/emacs_keymap.c
+++ b/readline/emacs_keymap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (BUFSIZ)
#include <stdio.h>
@@ -33,197 +33,185 @@
KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
/* Control keys. */
- { ISFUNC, rl_set_mark }, /* Control-@ */
- { ISFUNC, rl_beg_of_line }, /* Control-a */
- { ISFUNC, rl_backward }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, rl_delete }, /* Control-d */
- { ISFUNC, rl_end_of_line }, /* Control-e */
- { ISFUNC, rl_forward }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, rl_rubout }, /* Control-h */
- { ISFUNC, rl_complete }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, rl_clear_screen }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_get_next_history }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, rl_get_previous_history }, /* Control-p */
- { ISFUNC, rl_quoted_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISKMAP, (Function *)emacs_ctlx_keymap }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
- { ISKMAP, (Function *)emacs_meta_keymap }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, rl_char_search }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_undo_command }, /* Control-_ */
+ { ISFUNC, rl_set_mark }, /* Control-@ */
+ { ISFUNC, rl_beg_of_line }, /* Control-a */
+ { ISFUNC, rl_backward_char }, /* Control-b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
+ { ISFUNC, rl_delete }, /* Control-d */
+ { ISFUNC, rl_end_of_line }, /* Control-e */
+ { ISFUNC, rl_forward_char }, /* Control-f */
+ { ISFUNC, rl_abort }, /* Control-g */
+ { ISFUNC, rl_rubout }, /* Control-h */
+ { ISFUNC, rl_complete }, /* Control-i */
+ { ISFUNC, rl_newline }, /* Control-j */
+ { ISFUNC, rl_kill_line }, /* Control-k */
+ { ISFUNC, rl_clear_screen }, /* Control-l */
+ { ISFUNC, rl_newline }, /* Control-m */
+ { ISFUNC, rl_get_next_history }, /* Control-n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
+ { ISFUNC, rl_get_previous_history }, /* Control-p */
+ { ISFUNC, rl_quoted_insert }, /* Control-q */
+ { ISFUNC, rl_reverse_search_history }, /* Control-r */
+ { ISFUNC, rl_forward_search_history }, /* Control-s */
+ { ISFUNC, rl_transpose_chars }, /* Control-t */
+ { ISFUNC, rl_unix_line_discard }, /* Control-u */
+ { ISFUNC, rl_quoted_insert }, /* Control-v */
+ { ISFUNC, rl_unix_word_rubout }, /* Control-w */
+ { ISKMAP, (rl_command_func_t *)emacs_ctlx_keymap }, /* Control-x */
+ { ISFUNC, rl_yank }, /* Control-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
+ { ISKMAP, (rl_command_func_t *)emacs_meta_keymap }, /* Control-[ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
+ { ISFUNC, rl_char_search }, /* Control-] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
+ { ISFUNC, rl_undo_command }, /* Control-_ */
/* The start of printing characters. */
- { ISFUNC, rl_insert }, /* SPACE */
- { ISFUNC, rl_insert }, /* ! */
- { ISFUNC, rl_insert }, /* " */
- { ISFUNC, rl_insert }, /* # */
- { ISFUNC, rl_insert }, /* $ */
- { ISFUNC, rl_insert }, /* % */
- { ISFUNC, rl_insert }, /* & */
- { ISFUNC, rl_insert }, /* ' */
- { ISFUNC, rl_insert }, /* ( */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* ) */
-#else
- { ISFUNC, rl_insert }, /* ) */
-#endif /* !PAREN_MATCHING */
- { ISFUNC, rl_insert }, /* * */
- { ISFUNC, rl_insert }, /* + */
- { ISFUNC, rl_insert }, /* , */
- { ISFUNC, rl_insert }, /* - */
- { ISFUNC, rl_insert }, /* . */
- { ISFUNC, rl_insert }, /* / */
-
- /* Regular digits. */
- { ISFUNC, rl_insert }, /* 0 */
- { ISFUNC, rl_insert }, /* 1 */
- { ISFUNC, rl_insert }, /* 2 */
- { ISFUNC, rl_insert }, /* 3 */
- { ISFUNC, rl_insert }, /* 4 */
- { ISFUNC, rl_insert }, /* 5 */
- { ISFUNC, rl_insert }, /* 6 */
- { ISFUNC, rl_insert }, /* 7 */
- { ISFUNC, rl_insert }, /* 8 */
- { ISFUNC, rl_insert }, /* 9 */
+ { ISFUNC, rl_insert }, /* SPACE */
+ { ISFUNC, rl_insert }, /* ! */
+ { ISFUNC, rl_insert }, /* " */
+ { ISFUNC, rl_insert }, /* # */
+ { ISFUNC, rl_insert }, /* $ */
+ { ISFUNC, rl_insert }, /* % */
+ { ISFUNC, rl_insert }, /* & */
+ { ISFUNC, rl_insert }, /* ' */
+ { ISFUNC, rl_insert }, /* ( */
+ { ISFUNC, rl_insert }, /* ) */
+ { ISFUNC, rl_insert }, /* * */
+ { ISFUNC, rl_insert }, /* + */
+ { ISFUNC, rl_insert }, /* , */
+ { ISFUNC, rl_insert }, /* - */
+ { ISFUNC, rl_insert }, /* . */
+ { ISFUNC, rl_insert }, /* / */
+
+ /* Regular digits. */
+ { ISFUNC, rl_insert }, /* 0 */
+ { ISFUNC, rl_insert }, /* 1 */
+ { ISFUNC, rl_insert }, /* 2 */
+ { ISFUNC, rl_insert }, /* 3 */
+ { ISFUNC, rl_insert }, /* 4 */
+ { ISFUNC, rl_insert }, /* 5 */
+ { ISFUNC, rl_insert }, /* 6 */
+ { ISFUNC, rl_insert }, /* 7 */
+ { ISFUNC, rl_insert }, /* 8 */
+ { ISFUNC, rl_insert }, /* 9 */
/* A little more punctuation. */
- { ISFUNC, rl_insert }, /* : */
- { ISFUNC, rl_insert }, /* ; */
- { ISFUNC, rl_insert }, /* < */
- { ISFUNC, rl_insert }, /* = */
- { ISFUNC, rl_insert }, /* > */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* @ */
+ { ISFUNC, rl_insert }, /* : */
+ { ISFUNC, rl_insert }, /* ; */
+ { ISFUNC, rl_insert }, /* < */
+ { ISFUNC, rl_insert }, /* = */
+ { ISFUNC, rl_insert }, /* > */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* @ */
/* Uppercase alphabet. */
- { ISFUNC, rl_insert }, /* A */
- { ISFUNC, rl_insert }, /* B */
- { ISFUNC, rl_insert }, /* C */
- { ISFUNC, rl_insert }, /* D */
- { ISFUNC, rl_insert }, /* E */
- { ISFUNC, rl_insert }, /* F */
- { ISFUNC, rl_insert }, /* G */
- { ISFUNC, rl_insert }, /* H */
- { ISFUNC, rl_insert }, /* I */
- { ISFUNC, rl_insert }, /* J */
- { ISFUNC, rl_insert }, /* K */
- { ISFUNC, rl_insert }, /* L */
- { ISFUNC, rl_insert }, /* M */
- { ISFUNC, rl_insert }, /* N */
- { ISFUNC, rl_insert }, /* O */
- { ISFUNC, rl_insert }, /* P */
- { ISFUNC, rl_insert }, /* Q */
- { ISFUNC, rl_insert }, /* R */
- { ISFUNC, rl_insert }, /* S */
- { ISFUNC, rl_insert }, /* T */
- { ISFUNC, rl_insert }, /* U */
- { ISFUNC, rl_insert }, /* V */
- { ISFUNC, rl_insert }, /* W */
- { ISFUNC, rl_insert }, /* X */
- { ISFUNC, rl_insert }, /* Y */
- { ISFUNC, rl_insert }, /* Z */
+ { ISFUNC, rl_insert }, /* A */
+ { ISFUNC, rl_insert }, /* B */
+ { ISFUNC, rl_insert }, /* C */
+ { ISFUNC, rl_insert }, /* D */
+ { ISFUNC, rl_insert }, /* E */
+ { ISFUNC, rl_insert }, /* F */
+ { ISFUNC, rl_insert }, /* G */
+ { ISFUNC, rl_insert }, /* H */
+ { ISFUNC, rl_insert }, /* I */
+ { ISFUNC, rl_insert }, /* J */
+ { ISFUNC, rl_insert }, /* K */
+ { ISFUNC, rl_insert }, /* L */
+ { ISFUNC, rl_insert }, /* M */
+ { ISFUNC, rl_insert }, /* N */
+ { ISFUNC, rl_insert }, /* O */
+ { ISFUNC, rl_insert }, /* P */
+ { ISFUNC, rl_insert }, /* Q */
+ { ISFUNC, rl_insert }, /* R */
+ { ISFUNC, rl_insert }, /* S */
+ { ISFUNC, rl_insert }, /* T */
+ { ISFUNC, rl_insert }, /* U */
+ { ISFUNC, rl_insert }, /* V */
+ { ISFUNC, rl_insert }, /* W */
+ { ISFUNC, rl_insert }, /* X */
+ { ISFUNC, rl_insert }, /* Y */
+ { ISFUNC, rl_insert }, /* Z */
/* Some more punctuation. */
- { ISFUNC, rl_insert }, /* [ */
- { ISFUNC, rl_insert }, /* \ */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* ] */
-#else
- { ISFUNC, rl_insert }, /* ] */
-#endif /* !PAREN_MATCHING */
- { ISFUNC, rl_insert }, /* ^ */
- { ISFUNC, rl_insert }, /* _ */
- { ISFUNC, rl_insert }, /* ` */
+ { ISFUNC, rl_insert }, /* [ */
+ { ISFUNC, rl_insert }, /* \ */
+ { ISFUNC, rl_insert }, /* ] */
+ { ISFUNC, rl_insert }, /* ^ */
+ { ISFUNC, rl_insert }, /* _ */
+ { ISFUNC, rl_insert }, /* ` */
/* Lowercase alphabet. */
- { ISFUNC, rl_insert }, /* a */
- { ISFUNC, rl_insert }, /* b */
- { ISFUNC, rl_insert }, /* c */
- { ISFUNC, rl_insert }, /* d */
- { ISFUNC, rl_insert }, /* e */
- { ISFUNC, rl_insert }, /* f */
- { ISFUNC, rl_insert }, /* g */
- { ISFUNC, rl_insert }, /* h */
- { ISFUNC, rl_insert }, /* i */
- { ISFUNC, rl_insert }, /* j */
- { ISFUNC, rl_insert }, /* k */
- { ISFUNC, rl_insert }, /* l */
- { ISFUNC, rl_insert }, /* m */
- { ISFUNC, rl_insert }, /* n */
- { ISFUNC, rl_insert }, /* o */
- { ISFUNC, rl_insert }, /* p */
- { ISFUNC, rl_insert }, /* q */
- { ISFUNC, rl_insert }, /* r */
- { ISFUNC, rl_insert }, /* s */
- { ISFUNC, rl_insert }, /* t */
- { ISFUNC, rl_insert }, /* u */
- { ISFUNC, rl_insert }, /* v */
- { ISFUNC, rl_insert }, /* w */
- { ISFUNC, rl_insert }, /* x */
- { ISFUNC, rl_insert }, /* y */
- { ISFUNC, rl_insert }, /* z */
+ { ISFUNC, rl_insert }, /* a */
+ { ISFUNC, rl_insert }, /* b */
+ { ISFUNC, rl_insert }, /* c */
+ { ISFUNC, rl_insert }, /* d */
+ { ISFUNC, rl_insert }, /* e */
+ { ISFUNC, rl_insert }, /* f */
+ { ISFUNC, rl_insert }, /* g */
+ { ISFUNC, rl_insert }, /* h */
+ { ISFUNC, rl_insert }, /* i */
+ { ISFUNC, rl_insert }, /* j */
+ { ISFUNC, rl_insert }, /* k */
+ { ISFUNC, rl_insert }, /* l */
+ { ISFUNC, rl_insert }, /* m */
+ { ISFUNC, rl_insert }, /* n */
+ { ISFUNC, rl_insert }, /* o */
+ { ISFUNC, rl_insert }, /* p */
+ { ISFUNC, rl_insert }, /* q */
+ { ISFUNC, rl_insert }, /* r */
+ { ISFUNC, rl_insert }, /* s */
+ { ISFUNC, rl_insert }, /* t */
+ { ISFUNC, rl_insert }, /* u */
+ { ISFUNC, rl_insert }, /* v */
+ { ISFUNC, rl_insert }, /* w */
+ { ISFUNC, rl_insert }, /* x */
+ { ISFUNC, rl_insert }, /* y */
+ { ISFUNC, rl_insert }, /* z */
/* Final punctuation. */
- { ISFUNC, rl_insert }, /* { */
- { ISFUNC, rl_insert }, /* | */
-#if defined (PAREN_MATCHING)
- { ISFUNC, rl_insert_close }, /* } */
-#else
- { ISFUNC, rl_insert }, /* } */
-#endif /* !PAREN_MATCHING */
- { ISFUNC, rl_insert }, /* ~ */
- { ISFUNC, rl_rubout }, /* RUBOUT */
+ { ISFUNC, rl_insert }, /* { */
+ { ISFUNC, rl_insert }, /* | */
+ { ISFUNC, rl_insert }, /* } */
+ { ISFUNC, rl_insert }, /* ~ */
+ { ISFUNC, rl_rubout }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Pure 8-bit characters (128 - 159).
These might be used in some
character sets. */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* ? */
/* ISO Latin-1 characters (160 - 255) */
{ ISFUNC, rl_insert }, /* No-break space */
@@ -328,78 +316,78 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
/* Meta keys. Just like above, but the high bit is set. */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-a */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-b */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-c */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-d */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-e */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-f */
- { ISFUNC, rl_abort }, /* Meta-Control-g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-@ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-c */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-d */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-f */
+ { ISFUNC, rl_abort }, /* Meta-Control-g */
{ ISFUNC, rl_backward_kill_word }, /* Meta-Control-h */
- { ISFUNC, rl_tab_insert }, /* Meta-Control-i */
- { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-k */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-l */
- { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-n */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-o */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-p */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-q */
- { ISFUNC, rl_revert_line }, /* Meta-Control-r */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-s */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-t */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-u */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-v */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-w */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-x */
- { ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-z */
-
- { ISFUNC, rl_complete }, /* Meta-Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-\ */
+ { ISFUNC, rl_tab_insert }, /* Meta-Control-i */
+ { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-k */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-l */
+ { ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-o */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-q */
+ { ISFUNC, rl_revert_line }, /* Meta-Control-r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-s */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-t */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-x */
+ { ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-z */
+
+ { ISFUNC, rl_complete }, /* Meta-Control-[ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-\ */
{ ISFUNC, rl_backward_char_search }, /* Meta-Control-] */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-^ */
- { ISFUNC, (Function *)0x0 }, /* Meta-Control-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-^ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-_ */
/* The start of printing characters. */
- { ISFUNC, rl_set_mark }, /* Meta-SPACE */
- { ISFUNC, (Function *)0x0 }, /* Meta-! */
- { ISFUNC, (Function *)0x0 }, /* Meta-" */
- { ISFUNC, rl_insert_comment },/* Meta-# */
- { ISFUNC, (Function *)0x0 }, /* Meta-$ */
- { ISFUNC, (Function *)0x0 }, /* Meta-% */
- { ISFUNC, rl_tilde_expand }, /* Meta-& */
- { ISFUNC, (Function *)0x0 }, /* Meta-' */
- { ISFUNC, (Function *)0x0 }, /* Meta-( */
- { ISFUNC, (Function *)0x0 }, /* Meta-) */
+ { ISFUNC, rl_set_mark }, /* Meta-SPACE */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-! */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-" */
+ { ISFUNC, rl_insert_comment }, /* Meta-# */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-$ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-% */
+ { ISFUNC, rl_tilde_expand }, /* Meta-& */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-' */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-( */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-) */
{ ISFUNC, rl_insert_completions }, /* Meta-* */
- { ISFUNC, (Function *)0x0 }, /* Meta-+ */
- { ISFUNC, (Function *)0x0 }, /* Meta-, */
- { ISFUNC, rl_digit_argument }, /* Meta-- */
- { ISFUNC, rl_yank_last_arg}, /* Meta-. */
- { ISFUNC, (Function *)0x0 }, /* Meta-/ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-+ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-, */
+ { ISFUNC, rl_digit_argument }, /* Meta-- */
+ { ISFUNC, rl_yank_last_arg}, /* Meta-. */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-/ */
/* Regular digits. */
- { ISFUNC, rl_digit_argument }, /* Meta-0 */
- { ISFUNC, rl_digit_argument }, /* Meta-1 */
- { ISFUNC, rl_digit_argument }, /* Meta-2 */
- { ISFUNC, rl_digit_argument }, /* Meta-3 */
- { ISFUNC, rl_digit_argument }, /* Meta-4 */
- { ISFUNC, rl_digit_argument }, /* Meta-5 */
- { ISFUNC, rl_digit_argument }, /* Meta-6 */
- { ISFUNC, rl_digit_argument }, /* Meta-7 */
- { ISFUNC, rl_digit_argument }, /* Meta-8 */
- { ISFUNC, rl_digit_argument }, /* Meta-9 */
+ { ISFUNC, rl_digit_argument }, /* Meta-0 */
+ { ISFUNC, rl_digit_argument }, /* Meta-1 */
+ { ISFUNC, rl_digit_argument }, /* Meta-2 */
+ { ISFUNC, rl_digit_argument }, /* Meta-3 */
+ { ISFUNC, rl_digit_argument }, /* Meta-4 */
+ { ISFUNC, rl_digit_argument }, /* Meta-5 */
+ { ISFUNC, rl_digit_argument }, /* Meta-6 */
+ { ISFUNC, rl_digit_argument }, /* Meta-7 */
+ { ISFUNC, rl_digit_argument }, /* Meta-8 */
+ { ISFUNC, rl_digit_argument }, /* Meta-9 */
/* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-: */
- { ISFUNC, (Function *)0x0 }, /* Meta-; */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-: */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-; */
{ ISFUNC, rl_beginning_of_history }, /* Meta-< */
{ ISFUNC, rl_possible_completions }, /* Meta-= */
{ ISFUNC, rl_end_of_history }, /* Meta-> */
{ ISFUNC, rl_possible_completions }, /* Meta-? */
- { ISFUNC, (Function *)0x0 }, /* Meta-@ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-@ */
/* Uppercase alphabet. */
{ ISFUNC, rl_do_lowercase_version }, /* Meta-A */
@@ -430,456 +418,456 @@ KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
{ ISFUNC, rl_do_lowercase_version }, /* Meta-Z */
/* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-[ */ /* was rl_arrow_keys */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-[ */ /* was rl_arrow_keys */
{ ISFUNC, rl_delete_horizontal_space }, /* Meta-\ */
- { ISFUNC, (Function *)0x0 }, /* Meta-] */
- { ISFUNC, (Function *)0x0 }, /* Meta-^ */
- { ISFUNC, rl_yank_last_arg }, /* Meta-_ */
- { ISFUNC, (Function *)0x0 }, /* Meta-` */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-^ */
+ { ISFUNC, rl_yank_last_arg }, /* Meta-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-` */
/* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* Meta-a */
- { ISFUNC, rl_backward_word }, /* Meta-b */
- { ISFUNC, rl_capitalize_word }, /* Meta-c */
- { ISFUNC, rl_kill_word }, /* Meta-d */
- { ISFUNC, (Function *)0x0 }, /* Meta-e */
- { ISFUNC, rl_forward_word }, /* Meta-f */
- { ISFUNC, (Function *)0x0 }, /* Meta-g */
- { ISFUNC, (Function *)0x0 }, /* Meta-h */
- { ISFUNC, (Function *)0x0 }, /* Meta-i */
- { ISFUNC, (Function *)0x0 }, /* Meta-j */
- { ISFUNC, (Function *)0x0 }, /* Meta-k */
- { ISFUNC, rl_downcase_word }, /* Meta-l */
- { ISFUNC, (Function *)0x0 }, /* Meta-m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-a */
+ { ISFUNC, rl_backward_word }, /* Meta-b */
+ { ISFUNC, rl_capitalize_word }, /* Meta-c */
+ { ISFUNC, rl_kill_word }, /* Meta-d */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-e */
+ { ISFUNC, rl_forward_word }, /* Meta-f */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-h */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-i */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-j */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-k */
+ { ISFUNC, rl_downcase_word }, /* Meta-l */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-m */
{ ISFUNC, rl_noninc_forward_search }, /* Meta-n */
- { ISFUNC, (Function *)0x0 }, /* Meta-o */ /* was rl_arrow_keys */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-o */ /* was rl_arrow_keys */
{ ISFUNC, rl_noninc_reverse_search }, /* Meta-p */
- { ISFUNC, (Function *)0x0 }, /* Meta-q */
- { ISFUNC, rl_revert_line }, /* Meta-r */
- { ISFUNC, (Function *)0x0 }, /* Meta-s */
- { ISFUNC, rl_transpose_words }, /* Meta-t */
- { ISFUNC, rl_upcase_word }, /* Meta-u */
- { ISFUNC, (Function *)0x0 }, /* Meta-v */
- { ISFUNC, (Function *)0x0 }, /* Meta-w */
- { ISFUNC, (Function *)0x0 }, /* Meta-x */
- { ISFUNC, rl_yank_pop }, /* Meta-y */
- { ISFUNC, (Function *)0x0 }, /* Meta-z */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-q */
+ { ISFUNC, rl_revert_line }, /* Meta-r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-s */
+ { ISFUNC, rl_transpose_words }, /* Meta-t */
+ { ISFUNC, rl_upcase_word }, /* Meta-u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-x */
+ { ISFUNC, rl_yank_pop }, /* Meta-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-z */
/* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* Meta-{ */
- { ISFUNC, (Function *)0x0 }, /* Meta-| */
- { ISFUNC, (Function *)0x0 }, /* Meta-} */
- { ISFUNC, rl_tilde_expand }, /* Meta-~ */
- { ISFUNC, rl_backward_kill_word }, /* Meta-rubout */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-{ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-| */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-} */
+ { ISFUNC, rl_tilde_expand }, /* Meta-~ */
+ { ISFUNC, rl_backward_kill_word }, /* Meta-rubout */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 }
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
KEYMAP_ENTRY_ARRAY emacs_ctlx_keymap = {
/* Control keys. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, (Function *)0x0 }, /* Control-d */
- { ISFUNC, (Function *)0x0 }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, (Function *)0x0 }, /* Control-h */
- { ISFUNC, (Function *)0x0 }, /* Control-i */
- { ISFUNC, (Function *)0x0 }, /* Control-j */
- { ISFUNC, (Function *)0x0 }, /* Control-k */
- { ISFUNC, (Function *)0x0 }, /* Control-l */
- { ISFUNC, (Function *)0x0 }, /* Control-m */
- { ISFUNC, (Function *)0x0 }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, (Function *)0x0 }, /* Control-p */
- { ISFUNC, (Function *)0x0 }, /* Control-q */
- { ISFUNC, rl_re_read_init_file }, /* Control-r */
- { ISFUNC, (Function *)0x0 }, /* Control-s */
- { ISFUNC, (Function *)0x0 }, /* Control-t */
- { ISFUNC, rl_undo_command }, /* Control-u */
- { ISFUNC, (Function *)0x0 }, /* Control-v */
- { ISFUNC, (Function *)0x0 }, /* Control-w */
- { ISFUNC, rl_exchange_point_and_mark },/* Control-x */
- { ISFUNC, (Function *)0x0 }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
- { ISFUNC, (Function *)0x0 }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, (Function *)0x0 }, /* Control-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-d */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */
+ { ISFUNC, rl_abort }, /* Control-g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-h */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-i */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-j */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-k */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-l */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-q */
+ { ISFUNC, rl_re_read_init_file }, /* Control-r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-s */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-t */
+ { ISFUNC, rl_undo_command }, /* Control-u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-w */
+ { ISFUNC, rl_exchange_point_and_mark }, /* Control-x */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-[ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-_ */
/* The start of printing characters. */
- { ISFUNC, (Function *)0x0 }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, (Function *)0x0 }, /* # */
- { ISFUNC, (Function *)0x0 }, /* $ */
- { ISFUNC, (Function *)0x0 }, /* % */
- { ISFUNC, (Function *)0x0 }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, rl_start_kbd_macro }, /* ( */
- { ISFUNC, rl_end_kbd_macro }, /* ) */
- { ISFUNC, (Function *)0x0 }, /* * */
- { ISFUNC, (Function *)0x0 }, /* + */
- { ISFUNC, (Function *)0x0 }, /* , */
- { ISFUNC, (Function *)0x0 }, /* - */
- { ISFUNC, (Function *)0x0 }, /* . */
- { ISFUNC, (Function *)0x0 }, /* / */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* SPACE */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* " */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* # */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* $ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* % */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* & */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */
+ { ISFUNC, rl_start_kbd_macro }, /* ( */
+ { ISFUNC, rl_end_kbd_macro }, /* ) */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* * */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* + */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* , */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* - */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* . */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* / */
/* Regular digits. */
- { ISFUNC, (Function *)0x0 }, /* 0 */
- { ISFUNC, (Function *)0x0 }, /* 1 */
- { ISFUNC, (Function *)0x0 }, /* 2 */
- { ISFUNC, (Function *)0x0 }, /* 3 */
- { ISFUNC, (Function *)0x0 }, /* 4 */
- { ISFUNC, (Function *)0x0 }, /* 5 */
- { ISFUNC, (Function *)0x0 }, /* 6 */
- { ISFUNC, (Function *)0x0 }, /* 7 */
- { ISFUNC, (Function *)0x0 }, /* 8 */
- { ISFUNC, (Function *)0x0 }, /* 9 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 0 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 1 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 2 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 3 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 4 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 5 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 6 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 7 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 8 */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* 9 */
/* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, (Function *)0x0 }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, (Function *)0x0 }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, (Function *)0x0 }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* : */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ; */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* < */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* = */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* > */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ? */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */
/* Uppercase alphabet. */
- { ISFUNC, rl_do_lowercase_version }, /* A */
- { ISFUNC, rl_do_lowercase_version }, /* B */
- { ISFUNC, rl_do_lowercase_version }, /* C */
- { ISFUNC, rl_do_lowercase_version }, /* D */
- { ISFUNC, rl_do_lowercase_version }, /* E */
- { ISFUNC, rl_do_lowercase_version }, /* F */
- { ISFUNC, rl_do_lowercase_version }, /* G */
- { ISFUNC, rl_do_lowercase_version }, /* H */
- { ISFUNC, rl_do_lowercase_version }, /* I */
- { ISFUNC, rl_do_lowercase_version }, /* J */
- { ISFUNC, rl_do_lowercase_version }, /* K */
- { ISFUNC, rl_do_lowercase_version }, /* L */
- { ISFUNC, rl_do_lowercase_version }, /* M */
- { ISFUNC, rl_do_lowercase_version }, /* N */
- { ISFUNC, rl_do_lowercase_version }, /* O */
- { ISFUNC, rl_do_lowercase_version }, /* P */
- { ISFUNC, rl_do_lowercase_version }, /* Q */
- { ISFUNC, rl_do_lowercase_version }, /* R */
- { ISFUNC, rl_do_lowercase_version }, /* S */
- { ISFUNC, rl_do_lowercase_version }, /* T */
- { ISFUNC, rl_do_lowercase_version }, /* U */
- { ISFUNC, rl_do_lowercase_version }, /* V */
- { ISFUNC, rl_do_lowercase_version }, /* W */
- { ISFUNC, rl_do_lowercase_version }, /* X */
- { ISFUNC, rl_do_lowercase_version }, /* Y */
- { ISFUNC, rl_do_lowercase_version }, /* Z */
+ { ISFUNC, rl_do_lowercase_version }, /* A */
+ { ISFUNC, rl_do_lowercase_version }, /* B */
+ { ISFUNC, rl_do_lowercase_version }, /* C */
+ { ISFUNC, rl_do_lowercase_version }, /* D */
+ { ISFUNC, rl_do_lowercase_version }, /* E */
+ { ISFUNC, rl_do_lowercase_version }, /* F */
+ { ISFUNC, rl_do_lowercase_version }, /* G */
+ { ISFUNC, rl_do_lowercase_version }, /* H */
+ { ISFUNC, rl_do_lowercase_version }, /* I */
+ { ISFUNC, rl_do_lowercase_version }, /* J */
+ { ISFUNC, rl_do_lowercase_version }, /* K */
+ { ISFUNC, rl_do_lowercase_version }, /* L */
+ { ISFUNC, rl_do_lowercase_version }, /* M */
+ { ISFUNC, rl_do_lowercase_version }, /* N */
+ { ISFUNC, rl_do_lowercase_version }, /* O */
+ { ISFUNC, rl_do_lowercase_version }, /* P */
+ { ISFUNC, rl_do_lowercase_version }, /* Q */
+ { ISFUNC, rl_do_lowercase_version }, /* R */
+ { ISFUNC, rl_do_lowercase_version }, /* S */
+ { ISFUNC, rl_do_lowercase_version }, /* T */
+ { ISFUNC, rl_do_lowercase_version }, /* U */
+ { ISFUNC, rl_do_lowercase_version }, /* V */
+ { ISFUNC, rl_do_lowercase_version }, /* W */
+ { ISFUNC, rl_do_lowercase_version }, /* X */
+ { ISFUNC, rl_do_lowercase_version }, /* Y */
+ { ISFUNC, rl_do_lowercase_version }, /* Z */
/* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* [ */
- { ISFUNC, (Function *)0x0 }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, (Function *)0x0 }, /* ^ */
- { ISFUNC, (Function *)0x0 }, /* _ */
- { ISFUNC, (Function *)0x0 }, /* ` */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* [ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* \ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ^ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* _ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ` */
/* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* a */
- { ISFUNC, (Function *)0x0 }, /* b */
- { ISFUNC, (Function *)0x0 }, /* c */
- { ISFUNC, (Function *)0x0 }, /* d */
- { ISFUNC, rl_call_last_kbd_macro }, /* e */
- { ISFUNC, (Function *)0x0 }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, (Function *)0x0 }, /* h */
- { ISFUNC, (Function *)0x0 }, /* i */
- { ISFUNC, (Function *)0x0 }, /* j */
- { ISFUNC, (Function *)0x0 }, /* k */
- { ISFUNC, (Function *)0x0 }, /* l */
- { ISFUNC, (Function *)0x0 }, /* m */
- { ISFUNC, (Function *)0x0 }, /* n */
- { ISFUNC, (Function *)0x0 }, /* o */
- { ISFUNC, (Function *)0x0 }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, (Function *)0x0 }, /* r */
- { ISFUNC, (Function *)0x0 }, /* s */
- { ISFUNC, (Function *)0x0 }, /* t */
- { ISFUNC, (Function *)0x0 }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, (Function *)0x0 }, /* w */
- { ISFUNC, (Function *)0x0 }, /* x */
- { ISFUNC, (Function *)0x0 }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* c */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* d */
+ { ISFUNC, rl_call_last_kbd_macro }, /* e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* f */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* h */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* i */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* j */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* k */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* l */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* o */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* q */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* s */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* t */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* x */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* z */
/* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, (Function *)0x0 }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, (Function *)0x0 }, /* ~ */
- { ISFUNC, rl_backward_kill_line }, /* RUBOUT */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* { */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* | */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* } */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ~ */
+ { ISFUNC, rl_backward_kill_line }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 }
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
diff --git a/readline/funmap.c b/readline/funmap.c
index 472119bd80a..fe9a1da43d7 100644
--- a/readline/funmap.c
+++ b/readline/funmap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,15 +18,13 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
-extern char *xmalloc (), *xrealloc ();
-
#if !defined (BUFSIZ)
#include <stdio.h>
#endif /* BUFSIZ */
@@ -40,7 +38,15 @@ extern char *xmalloc (), *xrealloc ();
#include "rlconf.h"
#include "readline.h"
-extern int _rl_qsort_string_compare ();
+#include "xmalloc.h"
+
+#ifdef __STDC__
+typedef int QSFUNC (const void *, const void *);
+#else
+typedef int QSFUNC ();
+#endif
+
+extern int _rl_qsort_string_compare PARAMS((char **, char **));
FUNMAP **funmap;
static int funmap_size;
@@ -54,7 +60,8 @@ static FUNMAP default_funmap[] = {
{ "abort", rl_abort },
{ "accept-line", rl_newline },
{ "arrow-key-prefix", rl_arrow_keys },
- { "backward-char", rl_backward },
+ { "backward-byte", rl_backward_byte },
+ { "backward-char", rl_backward_char },
{ "backward-delete-char", rl_rubout },
{ "backward-kill-line", rl_backward_kill_line },
{ "backward-kill-word", rl_backward_kill_word },
@@ -85,7 +92,8 @@ static FUNMAP default_funmap[] = {
{ "end-of-line", rl_end_of_line },
{ "exchange-point-and-mark", rl_exchange_point_and_mark },
{ "forward-backward-delete-char", rl_rubout_or_delete },
- { "forward-char", rl_forward },
+ { "forward-byte", rl_forward_byte },
+ { "forward-char", rl_forward_char },
{ "forward-search-history", rl_forward_search_history },
{ "forward-word", rl_forward_word },
{ "history-search-backward", rl_history_search_backward },
@@ -102,7 +110,8 @@ static FUNMAP default_funmap[] = {
{ "non-incremental-reverse-search-history", rl_noninc_reverse_search },
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
-#ifdef __CYGWIN32__
+ { "overwrite-mode", rl_overwrite_mode },
+#ifdef __CYGWIN__
{ "paste-from-clipboard", rl_paste_from_clipboard },
#endif
{ "possible-completions", rl_possible_completions },
@@ -136,7 +145,6 @@ static FUNMAP default_funmap[] = {
{ "vi-arg-digit", rl_vi_arg_digit },
{ "vi-back-to-indent", rl_vi_back_to_indent },
{ "vi-bWord", rl_vi_bWord },
- { "vi-bracktype", rl_vi_bracktype },
{ "vi-bword", rl_vi_bword },
{ "vi-change-case", rl_vi_change_case },
{ "vi-change-char", rl_vi_change_char },
@@ -176,18 +184,20 @@ static FUNMAP default_funmap[] = {
{ "vi-yank-to", rl_vi_yank_to },
#endif /* VI_MODE */
- {(char *)NULL, (Function *)NULL }
+ {(char *)NULL, (rl_command_func_t *)NULL }
};
int
-rl_add_funmap_entry (const char *name, Function *function)
+rl_add_funmap_entry (name, function)
+ const char *name;
+ rl_command_func_t *function;
{
if (funmap_entry + 2 >= funmap_size)
{
funmap_size += 64;
funmap = (FUNMAP **)xrealloc (funmap, funmap_size * sizeof (FUNMAP *));
}
-
+
funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));
funmap[funmap_entry]->name = name;
funmap[funmap_entry]->function = function;
@@ -217,36 +227,27 @@ rl_initialize_funmap ()
/* Produce a NULL terminated array of known function names. The array
is sorted. The array itself is allocated, but not the strings inside.
You should free () the array when you done, but not the pointrs. */
-char **
+const char **
rl_funmap_names ()
{
- char **result;
+ const char **result;
int result_size, result_index;
/* Make sure that the function map has been initialized. */
rl_initialize_funmap ();
- for (result_index = result_size = 0, result = (char **)NULL; funmap[result_index]; result_index++)
+ for (result_index = result_size = 0, result = (const char **)NULL; funmap[result_index]; result_index++)
{
if (result_index + 2 > result_size)
{
result_size += 20;
- result = (char **)xrealloc (result, result_size * sizeof (char *));
+ result = (const char **)xrealloc (result, result_size * sizeof (char *));
}
- result[result_index] = (char*) funmap[result_index]->name;
+ result[result_index] = funmap[result_index]->name;
result[result_index + 1] = (char *)NULL;
}
- qsort (result, result_index, sizeof (char *), _rl_qsort_string_compare);
+ qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
return (result);
}
-
-/* Things that mean `Control'. */
-const char *possible_control_prefixes[] = {
- "Control-", "C-", "CTRL-", (char *)NULL
-};
-
-const char *possible_meta_prefixes[] = {
- "Meta", "M-", (char *)NULL
-};
diff --git a/readline/histexpand.c b/readline/histexpand.c
index f78838ef2ba..a98067956c2 100644
--- a/readline/histexpand.c
+++ b/readline/histexpand.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@@ -41,18 +41,21 @@
# include <unistd.h>
#endif
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
+#include "rlmbutil.h"
#include "history.h"
#include "histlib.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>"
#define HISTORY_QUOTE_CHARACTERS "\"'`"
+typedef int _hist_search_func_t PARAMS((const char *, int));
+
+extern int rl_byte_oriented; /* declared in mbutil.c */
+
static char error_pointer;
static char *subst_lhs;
@@ -60,15 +63,10 @@ static char *subst_rhs;
static int subst_lhs_len;
static int subst_rhs_len;
-static char *get_history_word_specifier ();
-static char *history_find_word ();
+static char *get_history_word_specifier PARAMS((char *, char *, int *));
+static char *history_find_word PARAMS((char *, int));
-extern int history_offset;
-
-extern char *single_quote ();
-static char *quote_breaks ();
-
-extern char *xmalloc (), *xrealloc ();
+static char *quote_breaks PARAMS((char *));
/* Variables exported by this file. */
/* The character that represents the start of a history expansion
@@ -87,15 +85,18 @@ char history_comment_char = '\0';
/* The list of characters which inhibit the expansion of text if found
immediately following history_expansion_char. */
-const char *history_no_expand_chars = " \t\n\r=";
+char *history_no_expand_chars = (char*)" \t\n\r=";
/* If set to a non-zero value, single quotes inhibit history expansion.
The default is 0. */
int history_quotes_inhibit_expansion = 0;
+/* Used to split words by history_tokenize_internal. */
+char *history_word_delimiters = (char*)HISTORY_WORD_DELIMITERS;
+
/* 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;
+rl_linebuf_func_t *history_inhibit_expansion_function;
/* **************************************************************** */
/* */
@@ -124,7 +125,7 @@ static char *search_match;
line = get_history_event ("!echo:p", &index, 0); */
char *
get_history_event (string, caller_index, delimiting_quote)
- char *string;
+ const char *string;
int *caller_index;
int delimiting_quote;
{
@@ -132,7 +133,7 @@ get_history_event (string, caller_index, delimiting_quote)
register char c;
HIST_ENTRY *entry;
int which, sign, local_index, substring_okay;
- Function *search_func;
+ _hist_search_func_t *search_func;
char *temp;
/* The event can be specified in a number of ways.
@@ -201,15 +202,33 @@ get_history_event (string, caller_index, delimiting_quote)
/* Only a closing `?' or a newline delimit a substring search string. */
for (local_index = i; (c = string[i]); i++)
- if ((!substring_okay && (whitespace (c) || c == ':' ||
- (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
- string[i] == delimiting_quote)) ||
- string[i] == '\n' ||
- (substring_okay && string[i] == '?'))
- break;
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int v;
+ mbstate_t ps;
+
+ memset (&ps, 0, sizeof (mbstate_t));
+ /* These produce warnings because we're passing a const string to a
+ function that takes a non-const string. */
+ _rl_adjust_point (string, i, &ps);
+ if ((v = _rl_get_char_len (string + i, &ps)) > 1)
+ {
+ i += v - 1;
+ continue;
+ }
+ }
+ else
+#endif /* HANDLE_MULTIBYTE */
+ if ((!substring_okay && (whitespace (c) || c == ':' ||
+ (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
+ string[i] == delimiting_quote)) ||
+ string[i] == '\n' ||
+ (substring_okay && string[i] == '?'))
+ break;
which = i - local_index;
- temp = xmalloc (1 + which);
+ temp = (char *)xmalloc (1 + which);
if (which)
strncpy (temp, string + local_index, which);
temp[which] = '\0';
@@ -249,7 +268,7 @@ get_history_event (string, caller_index, delimiting_quote)
{
entry = current_history ();
history_offset = history_length;
-
+
/* If this was a substring search, then remember the
string that we matched for word substitution. */
if (substring_okay)
@@ -311,7 +330,7 @@ quote_breaks (s)
len += 2;
}
- r = ret = xmalloc (len);
+ r = ret = (char *)xmalloc (len);
*r++ = '\'';
for (p = s; p && *p; )
{
@@ -376,7 +395,7 @@ hist_error(s, start, current, errtype)
break;
}
- temp = xmalloc (ll + elen + 3);
+ temp = (char *)xmalloc (ll + elen + 3);
strncpy (temp, s + start, ll);
temp[ll] = ':';
temp[ll + 1] = ' ';
@@ -402,17 +421,37 @@ get_subst_pattern (str, iptr, delimiter, is_rhs, lenptr)
int *iptr, delimiter, is_rhs, *lenptr;
{
register int si, i, j, k;
- char *s = (char *) NULL;
+ char *s;
+#if defined (HANDLE_MULTIBYTE)
+ mbstate_t ps;
+#endif
+ s = (char *)NULL;
i = *iptr;
+#if defined (HANDLE_MULTIBYTE)
+ memset (&ps, 0, sizeof (mbstate_t));
+ _rl_adjust_point (str, i, &ps);
+#endif
+
for (si = i; str[si] && str[si] != delimiter; si++)
- if (str[si] == '\\' && str[si + 1] == delimiter)
- si++;
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int v;
+ if ((v = _rl_get_char_len (str + si, &ps)) > 1)
+ si += v - 1;
+ else if (str[si] == '\\' && str[si + 1] == delimiter)
+ si++;
+ }
+ else
+#endif /* HANDLE_MULTIBYTE */
+ if (str[si] == '\\' && str[si + 1] == delimiter)
+ si++;
if (si > i || is_rhs)
{
- s = xmalloc (si - i + 1);
+ s = (char *)xmalloc (si - i + 1);
for (j = 0, k = i; k < si; j++, k++)
{
/* Remove a backslash quoting the search string delimiter. */
@@ -439,13 +478,13 @@ postproc_subst_rhs ()
char *new;
int i, j, new_size;
- new = xmalloc (new_size = subst_rhs_len + subst_lhs_len);
+ new = (char *)xmalloc (new_size = subst_rhs_len + subst_lhs_len);
for (i = j = 0; i < subst_rhs_len; i++)
{
if (subst_rhs[i] == '&')
{
if (j + subst_lhs_len >= new_size)
- new = xrealloc (new, (new_size = new_size * 2 + subst_lhs_len));
+ new = (char *)xrealloc (new, (new_size = new_size * 2 + subst_lhs_len));
strcpy (new + j, subst_lhs);
j += subst_lhs_len;
}
@@ -455,7 +494,7 @@ postproc_subst_rhs ()
if (subst_rhs[i] == '\\' && subst_rhs[i + 1] == '&')
i++;
if (j >= new_size)
- new = xrealloc (new, new_size *= 2);
+ new = (char *)xrealloc (new, new_size *= 2);
new[j++] = subst_rhs[i];
}
}
@@ -481,8 +520,13 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
int substitute_globally, want_quotes, print_only;
char *event, *temp, *result, *tstr, *t, c, *word_spec;
int result_len;
+#if defined (HANDLE_MULTIBYTE)
+ mbstate_t ps;
- result = xmalloc (result_len = 128);
+ memset (&ps, 0, sizeof (mbstate_t));
+#endif
+
+ result = (char *)xmalloc (result_len = 128);
i = start;
@@ -511,11 +555,24 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
quote, then this expansion takes place inside of the
quoted string. If we have to search for some text ("!foo"),
allow the delimiter to end the search string. */
- if (i && (string[i - 1] == '\'' || string[i - 1] == '"'))
- quoted_search_delimiter = string[i - 1];
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int c, l;
+ l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
+ c = string[l];
+ /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
+ if (i && (c == '\'' || c == '"'))
+ quoted_search_delimiter = c;
+ }
+ else
+#endif /* HANDLE_MULTIBYTE */
+ if (i && (string[i - 1] == '\'' || string[i - 1] == '"'))
+ quoted_search_delimiter = string[i - 1];
+
event = get_history_event (string, &i, quoted_search_delimiter);
}
-
+
if (event == 0)
{
*ret_string = hist_error (string, start, i, EVENT_NOT_FOUND);
@@ -625,13 +682,26 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
case '&':
case 's':
{
- char *new_event, *t;
+ char *new_event;
int delimiter, failed, si, l_temp;
if (c == 's')
{
if (i + 2 < (int)strlen (string))
- delimiter = string[i + 2];
+ {
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ _rl_adjust_point (string, i + 2, &ps);
+ if (_rl_get_char_len (string + i + 2, &ps) > 1)
+ delimiter = 0;
+ else
+ delimiter = string[i + 2];
+ }
+ else
+#endif /* HANDLE_MULTIBYTE */
+ delimiter = string[i + 2];
+ }
else
break; /* no search delimiter */
@@ -695,7 +765,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
if (STREQN (temp+si, subst_lhs, subst_lhs_len))
{
int len = subst_rhs_len - subst_lhs_len + l_temp;
- new_event = xmalloc (1 + len);
+ new_event = (char *)xmalloc (1 + len);
strncpy (new_event, temp, si);
strncpy (new_event + si, subst_rhs, subst_rhs_len);
strncpy (new_event + si + subst_rhs_len,
@@ -744,7 +814,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
char *x;
if (want_quotes == 'q')
- x = single_quote (temp);
+ x = sh_single_quote (temp);
else if (want_quotes == 'x')
x = quote_breaks (temp);
else
@@ -756,7 +826,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
n = strlen (temp);
if (n >= result_len)
- result = xrealloc (result, n + 2);
+ result = (char *)xrealloc (result, n + 2);
strcpy (result, temp);
free (temp);
@@ -787,7 +857,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
{ \
while (j >= result_len) \
result_len += 128; \
- result = xrealloc (result, result_len); \
+ result = (char *)xrealloc (result, result_len); \
} \
strcpy (result + j - sl, s); \
} \
@@ -797,7 +867,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
do \
{ \
if (j >= result_len - 1) \
- result = xrealloc (result, result_len += 64); \
+ result = (char *)xrealloc (result, result_len += 64); \
result[j++] = c; \
result[j] = '\0'; \
} \
@@ -816,9 +886,17 @@ history_expand (hstring, output)
int result_len;
char *result;
+#if defined (HANDLE_MULTIBYTE)
+ char mb[MB_LEN_MAX];
+ mbstate_t ps;
+#endif
+
/* Used when adding the string. */
char *temp;
+ if (output == 0)
+ return 0;
+
/* Setting the history expansion character to 0 inhibits all
history expansion. */
if (history_expansion_char == 0)
@@ -826,9 +904,9 @@ history_expand (hstring, output)
*output = savestring (hstring);
return (0);
}
-
+
/* Prepare the buffer for printing error messages. */
- result = xmalloc (result_len = 256);
+ result = (char *)xmalloc (result_len = 256);
result[0] = '\0';
only_printing = modified = 0;
@@ -845,7 +923,7 @@ history_expand (hstring, output)
that is the substitution that we do. */
if (hstring[0] == history_subst_char)
{
- string = xmalloc (l + 5);
+ string = (char *)xmalloc (l + 5);
string[0] = string[1] = history_expansion_char;
string[2] = ':';
@@ -855,6 +933,10 @@ history_expand (hstring, output)
}
else
{
+#if defined (HANDLE_MULTIBYTE)
+ memset (&ps, 0, sizeof (mbstate_t));
+#endif
+
string = hstring;
/* If not quick substitution, still maybe have to do expansion. */
@@ -862,13 +944,26 @@ history_expand (hstring, output)
is NOT an expansion. */
for (i = 0; string[i]; i++)
{
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int v;
+ v = _rl_get_char_len (string + i, &ps);
+ if (v > 1)
+ {
+ i += v - 1;
+ continue;
+ }
+ }
+#endif /* HANDLE_MULTIBYTE */
+
cc = string[i + 1];
- /* The history_comment_char, if set, appearing that the beginning
+ /* The history_comment_char, if set, appearing at the beginning
of a word signifies that the rest of the line should not have
history expansion performed on it.
Skip the rest of the line and break out of the loop. */
if (history_comment_char && string[i] == history_comment_char &&
- (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS)))
+ (i == 0 || member (string[i - 1], history_word_delimiters)))
{
while (string[i])
i++;
@@ -905,7 +1000,7 @@ history_expand (hstring, output)
i++;
}
}
-
+
if (string[i] != history_expansion_char)
{
free (result);
@@ -926,6 +1021,30 @@ history_expand (hstring, output)
continue;
}
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int k, c;
+
+ c = tchar;
+ memset (mb, 0, sizeof (mb));
+ for (k = 0; k < MB_LEN_MAX; k++)
+ {
+ mb[k] = (char)c;
+ memset (&ps, 0, sizeof (mbstate_t));
+ if (_rl_get_char_len (mb, &ps) == -2)
+ c = string[++i];
+ else
+ break;
+ }
+ if (strlen (mb) > 1)
+ {
+ ADD_STRING (mb);
+ break;
+ }
+ }
+#endif /* HANDLE_MULTIBYTE */
+
if (tchar == history_expansion_char)
tchar = -3;
else if (tchar == history_comment_char)
@@ -954,7 +1073,7 @@ history_expand (hstring, output)
hist_string_extract_single_quoted (string, &i);
slen = i - quote + 2;
- temp = xmalloc (slen);
+ temp = (char *)xmalloc (slen);
strncpy (temp, string + quote, slen);
temp[slen - 1] = '\0';
ADD_STRING (temp);
@@ -966,9 +1085,9 @@ history_expand (hstring, output)
}
case -2: /* history_comment_char */
- if (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS))
+ if (i == 0 || member (string[i - 1], history_word_delimiters))
{
- temp = xmalloc (l - i + 1);
+ temp = (char *)xmalloc (l - i + 1);
strcpy (temp, string + i);
ADD_STRING (temp);
free (temp);
@@ -1000,7 +1119,7 @@ history_expand (hstring, output)
{
if (result)
{
- temp = xmalloc (1 + strlen (result));
+ temp = (char *)xmalloc (1 + strlen (result));
strcpy (temp, result);
ADD_STRING (temp);
free (temp);
@@ -1134,7 +1253,14 @@ get_history_word_specifier (spec, from, caller_index)
i++;
last = '$';
}
- else if (!spec[i] || spec[i] == ':') /* could be modifier separator */
+#if 0
+ else if (!spec[i] || spec[i] == ':')
+ /* check against `:' because there could be a modifier separator */
+#else
+ else
+ /* csh seems to allow anything to terminate the word spec here,
+ leaving it as an abbreviation. */
+#endif
last = -1; /* x- abbreviates x-$ omitting word `$' */
}
@@ -1154,7 +1280,7 @@ get_history_word_specifier (spec, from, caller_index)
char *
history_arg_extract (first, last, string)
int first, last;
- char *string;
+ const char *string;
{
register int i, len;
char *result;
@@ -1190,7 +1316,7 @@ history_arg_extract (first, last, string)
{
for (size = 0, i = first; i < last; i++)
size += strlen (list[i]) + 1;
- result = xmalloc (size + 1);
+ result = (char *)xmalloc (size + 1);
result[0] = '\0';
for (i = first, offset = 0; i < last; i++)
@@ -1220,13 +1346,18 @@ history_arg_extract (first, last, string)
*INDP. */
static char **
history_tokenize_internal (string, wind, indp)
- char *string;
+ const char *string;
int wind, *indp;
{
char **result;
register int i, start, result_index, size;
int len, delimiter;
+ /* If we're searching for a string that's not part of a word (e.g., " "),
+ make sure we set *INDP to a reasonable value. */
+ if (indp && wind != -1)
+ *indp = -1;
+
/* Get a token, and stuff it into RESULT. The tokens are split
exactly where the shell would split them. */
for (i = result_index = size = 0, result = (char **)NULL; string[i]; )
@@ -1240,7 +1371,7 @@ history_tokenize_internal (string, wind, indp)
return (result);
start = i;
-
+
if (member (string[i], "()\n"))
{
i++;
@@ -1301,7 +1432,7 @@ history_tokenize_internal (string, wind, indp)
continue;
}
- if (!delimiter && (member (string[i], HISTORY_WORD_DELIMITERS)))
+ if (!delimiter && (member (string[i], history_word_delimiters)))
break;
if (!delimiter && member (string[i], HISTORY_QUOTE_CHARACTERS))
@@ -1318,7 +1449,7 @@ history_tokenize_internal (string, wind, indp)
len = i - start;
if (result_index + 2 >= size)
result = (char **)xrealloc (result, ((size += 10) * sizeof (char *)));
- result[result_index] = xmalloc (1 + len);
+ result[result_index] = (char *)xmalloc (1 + len);
strncpy (result[result_index], string + start, len);
result[result_index][len] = '\0';
result[++result_index] = (char *)NULL;
@@ -1331,7 +1462,7 @@ history_tokenize_internal (string, wind, indp)
parsed out of STRING. */
char **
history_tokenize (string)
- char *string;
+ const char *string;
{
return (history_tokenize_internal (string, -1, (int *)NULL));
}
@@ -1348,7 +1479,7 @@ history_find_word (line, ind)
int i, wind;
words = history_tokenize_internal (line, ind, &wind);
- if (wind == -1)
+ if (wind == -1 || words == 0)
return ((char *)NULL);
s = words[wind];
for (i = 0; i < wind; i++)
diff --git a/readline/histfile.c b/readline/histfile.c
index 1da45b00b58..60a91251b7a 100644
--- a/readline/histfile.c
+++ b/readline/histfile.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -35,7 +35,7 @@
#ifndef _MINIX
# include <sys/file.h>
#endif
-#include <sys/stat.h>
+#include "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_STDLIB_H)
@@ -48,21 +48,39 @@
# include <unistd.h>
#endif
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
+#if defined (__EMX__) || defined (__CYGWIN__)
+# undef HAVE_MMAP
+#endif
+
+#ifdef HAVE_MMAP
+# include <sys/mman.h>
+
+# ifdef MAP_FILE
+# define MAP_RFLAGS (MAP_FILE|MAP_PRIVATE)
+# define MAP_WFLAGS (MAP_FILE|MAP_SHARED)
+# else
+# define MAP_RFLAGS MAP_PRIVATE
+# define MAP_WFLAGS MAP_SHARED
+# endif
+
+# ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+# endif
+
+#endif /* HAVE_MMAP */
-#if defined (__EMX__)
+/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
+ on win 95/98/nt), we want to open files with O_BINARY mode so that there
+ is no \n -> \r\n conversion performed. On other systems, we don't want to
+ mess around with O_BINARY at all, so we ensure that it's defined to 0. */
+#if defined (__EMX__) || defined (__CYGWIN__)
# ifndef O_BINARY
# define O_BINARY 0
# endif
-#else /* !__EMX__ */
- /* If we're not compiling for __EMX__, we don't want this at all. Ever. */
+#else /* !__EMX__ && !__CYGWIN__ */
# undef O_BINARY
# define O_BINARY 0
-#endif /* !__EMX__ */
+#endif /* !__EMX__ && !__CYGWIN__ */
#include <errno.h>
#if !defined (errno)
@@ -72,17 +90,15 @@ extern int errno;
#include "history.h"
#include "histlib.h"
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlshell.h"
+#include "xmalloc.h"
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
filename to read_history (), or write_history (). */
static char *
history_filename (filename)
- char *filename;
+ const char *filename;
{
char *return_val;
const char *home;
@@ -92,8 +108,8 @@ history_filename (filename)
if (return_val)
return (return_val);
-
- home = get_env_value ("HOME");
+
+ home = sh_get_env_value ("HOME");
if (home == 0)
{
@@ -103,10 +119,14 @@ history_filename (filename)
else
home_len = strlen (home);
- return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
+ return_val = (char *)xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
strcpy (return_val, home);
return_val[home_len] = '/';
+#if defined (__MSDOS__)
+ strcpy (return_val + home_len + 1, "_history");
+#else
strcpy (return_val + home_len + 1, ".history");
+#endif
return (return_val);
}
@@ -116,7 +136,7 @@ history_filename (filename)
successful, or errno if not. */
int
read_history (filename)
- char *filename;
+ const char *filename;
{
return (read_history_range (filename, 0, -1));
}
@@ -128,13 +148,14 @@ read_history (filename)
~/.history. Returns 0 if successful, or errno if not. */
int
read_history_range (filename, from, to)
- char *filename;
+ const char *filename;
int from, to;
{
- char *input, *buffer;
- int file, current_line;
+ register char *line_start, *line_end;
+ char *input, *buffer, *bufend;
+ int file, current_line, chars_read;
struct stat finfo;
- size_t line_start, line_end, file_size;
+ size_t file_size;
buffer = (char *)NULL;
input = history_filename (filename);
@@ -150,57 +171,67 @@ read_history_range (filename, from, to)
{
#if defined (EFBIG)
errno = EFBIG;
+#elif defined (EOVERFLOW)
+ errno = EOVERFLOW;
#endif
goto error_and_exit;
}
- buffer = xmalloc (file_size + 1);
-#if 0
- if (read (file, buffer, file_size) != file_size)
+#ifdef HAVE_MMAP
+ /* We map read/write and private so we can change newlines to NULs without
+ affecting the underlying object. */
+ buffer = (char *)mmap (0, file_size, PROT_READ|PROT_WRITE, MAP_RFLAGS, file, 0);
+ if ((void *)buffer == MAP_FAILED)
+ goto error_and_exit;
+ chars_read = file_size;
#else
- if (read (file, buffer, file_size) < 0)
+ buffer = (char *)malloc (file_size + 1);
+ if (buffer == 0)
+ goto error_and_exit;
+
+ chars_read = read (file, buffer, file_size);
#endif
+ if (chars_read < 0)
{
error_and_exit:
+ chars_read = errno;
if (file >= 0)
close (file);
FREE (input);
+#ifndef HAVE_MMAP
FREE (buffer);
+#endif
- return (errno);
+ return (chars_read);
}
close (file);
/* Set TO to larger than end of file if negative. */
if (to < 0)
- to = file_size;
+ to = chars_read;
/* Start at beginning of file, work to end. */
- line_start = line_end = current_line = 0;
+ bufend = buffer + chars_read;
+ current_line = 0;
/* Skip lines until we are at FROM. */
- while (line_start < file_size && current_line < from)
- {
- for (line_end = line_start; line_end < file_size; line_end++)
- if (buffer[line_end] == '\n')
- {
- current_line++;
- line_start = line_end + 1;
- if (current_line == from)
- break;
- }
- }
+ for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
+ if (*line_end == '\n')
+ {
+ current_line++;
+ line_start = line_end + 1;
+ }
/* If there are lines left to gobble, then gobble them now. */
- for (line_end = line_start; line_end < file_size; line_end++)
- if (buffer[line_end] == '\n')
+ for (line_end = line_start; line_end < bufend; line_end++)
+ if (*line_end == '\n')
{
- buffer[line_end] = '\0';
+ *line_end = '\0';
- if (buffer[line_start])
- add_history (buffer + line_start);
+ if (*line_start)
+ add_history (line_start);
current_line++;
@@ -211,30 +242,52 @@ read_history_range (filename, from, to)
}
FREE (input);
+#ifndef HAVE_MMAP
FREE (buffer);
+#else
+ munmap (buffer, file_size);
+#endif
return (0);
}
/* Truncate the history file FNAME, leaving only LINES trailing lines.
- If FNAME is NULL, then use ~/.history. */
+ If FNAME is NULL, then use ~/.history. Returns 0 on success, errno
+ on failure. */
int
history_truncate_file (fname, lines)
- char *fname;
+ const char *fname;
int lines;
{
- register int i;
- int file, chars_read;
- char *buffer, *filename;
+ char *buffer, *filename, *bp;
+ int file, chars_read, rv;
struct stat finfo;
size_t file_size;
buffer = (char *)NULL;
filename = history_filename (fname);
file = open (filename, O_RDONLY|O_BINARY, 0666);
+ rv = 0;
+ /* Don't try to truncate non-regular files. */
if (file == -1 || fstat (file, &finfo) == -1)
- goto truncate_exit;
+ {
+ rv = errno;
+ if (file != -1)
+ close (file);
+ goto truncate_exit;
+ }
+
+ if (S_ISREG (finfo.st_mode) == 0)
+ {
+ close (file);
+#ifdef EFTYPE
+ rv = EFTYPE;
+#else
+ rv = EINVAL;
+#endif
+ goto truncate_exit;
+ }
file_size = (size_t)finfo.st_size;
@@ -243,23 +296,36 @@ history_truncate_file (fname, lines)
{
close (file);
#if defined (EFBIG)
- errno = EFBIG;
+ rv = errno = EFBIG;
+#elif defined (EOVERFLOW)
+ rv = errno = EOVERFLOW;
+#else
+ rv = errno = EINVAL;
#endif
goto truncate_exit;
}
- buffer = xmalloc (file_size + 1);
+ buffer = (char *)malloc (file_size + 1);
+ if (buffer == 0)
+ {
+ close (file);
+ goto truncate_exit;
+ }
+
chars_read = read (file, buffer, file_size);
close (file);
if (chars_read <= 0)
- goto truncate_exit;
+ {
+ rv = (chars_read < 0) ? errno : 0;
+ goto truncate_exit;
+ }
/* Count backwards from the end of buffer until we have passed
LINES lines. */
- for (i = chars_read - 1; lines && i; i--)
+ for (bp = buffer + chars_read - 1; lines && bp > buffer; bp--)
{
- if (buffer[i] == '\n')
+ if (*bp == '\n')
lines--;
}
@@ -268,22 +334,22 @@ history_truncate_file (fname, lines)
anything. It's the first line if we don't find a newline between
the current value of i and 0. Otherwise, write from the start of
this line until the end of the buffer. */
- for ( ; i; i--)
- if (buffer[i] == '\n')
+ for ( ; bp > buffer; bp--)
+ if (*bp == '\n')
{
- i++;
+ bp++;
break;
}
/* 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|O_BINARY, 0600)) != -1))
+ if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
- write (file, buffer + i, file_size - i);
+ write (file, bp, chars_read - (bp - buffer));
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
- ftruncate (file, file_size - i);
+ ftruncate (file, chars_read - (bp - buffer));
#endif
close (file);
@@ -294,7 +360,7 @@ history_truncate_file (fname, lines)
FREE (buffer);
free (filename);
- return 0;
+ return rv;
}
/* Workhorse function for writing history. Writes NELEMENT entries
@@ -302,15 +368,21 @@ history_truncate_file (fname, lines)
wish to replace FILENAME with the entries. */
static int
history_do_write (filename, nelements, overwrite)
- char *filename;
+ const char *filename;
int nelements, overwrite;
{
register int i;
char *output;
- int file, mode;
+ int file, mode, rv;
+ size_t cursize;
+#ifdef HAVE_MMAP
+ mode = overwrite ? O_RDWR|O_CREAT|O_TRUNC|O_BINARY : O_RDWR|O_APPEND|O_BINARY;
+#else
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
+#endif
output = history_filename (filename);
+ rv = 0;
if ((file = open (output, mode, 0600)) == -1)
{
@@ -318,6 +390,10 @@ history_do_write (filename, nelements, overwrite)
return (errno);
}
+#ifdef HAVE_MMAP
+ cursize = overwrite ? 0 : lseek (file, 0, SEEK_END);
+#endif
+
if (nelements > history_length)
nelements = history_length;
@@ -335,7 +411,28 @@ history_do_write (filename, nelements, overwrite)
buffer_size += 1 + strlen (the_history[i]->line);
/* Allocate the buffer, and fill it. */
- buffer = xmalloc (buffer_size);
+#ifdef HAVE_MMAP
+ if (ftruncate (file, buffer_size+cursize) == -1)
+ goto mmap_error;
+ buffer = (char *)mmap (0, buffer_size, PROT_READ|PROT_WRITE, MAP_WFLAGS, file, cursize);
+ if ((void *)buffer == MAP_FAILED)
+ {
+mmap_error:
+ rv = errno;
+ FREE (output);
+ close (file);
+ return rv;
+ }
+#else
+ buffer = (char *)malloc (buffer_size);
+ if (buffer == 0)
+ {
+ rv = errno;
+ FREE (output);
+ close (file);
+ return rv;
+ }
+#endif
for (j = 0, i = history_length - nelements; i < history_length; i++)
{
@@ -344,15 +441,21 @@ history_do_write (filename, nelements, overwrite)
buffer[j++] = '\n';
}
- write (file, buffer, buffer_size);
+#ifdef HAVE_MMAP
+ if (msync (buffer, buffer_size, 0) != 0 || munmap (buffer, buffer_size) != 0)
+ rv = errno;
+#else
+ if (write (file, buffer, buffer_size) < 0)
+ rv = errno;
free (buffer);
+#endif
}
close (file);
FREE (output);
- return (0);
+ return (rv);
}
/* Append NELEMENT entries to FILENAME. The entries appended are from
@@ -360,7 +463,7 @@ history_do_write (filename, nelements, overwrite)
int
append_history (nelements, filename)
int nelements;
- char *filename;
+ const char *filename;
{
return (history_do_write (filename, nelements, HISTORY_APPEND));
}
@@ -370,7 +473,7 @@ append_history (nelements, filename)
are as in read_history ().*/
int
write_history (filename)
- char *filename;
+ const char *filename;
{
return (history_do_write (filename, history_length, HISTORY_OVERWRITE));
}
diff --git a/readline/histlib.h b/readline/histlib.h
index 422cf5974db..c39af71814c 100644
--- a/readline/histlib.h
+++ b/readline/histlib.h
@@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -17,27 +17,24 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_
-/* Function pointers can be declared as (Function *)foo. */
-#if !defined (_FUNCTION_DEF)
-# define _FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
-#endif /* _FUNCTION_DEF */
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else
+# include <strings.h>
+#endif /* !HAVE_STRING_H */
+#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n) (((n) == 0) ? (1) \
+ : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#endif
#ifndef savestring
-# ifndef strcpy
-extern char *strcpy ();
-# endif
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#endif
@@ -79,4 +76,7 @@ extern char *strchr ();
#define HISTORY_APPEND 0
#define HISTORY_OVERWRITE 1
+/* Some variable definitions shared across history source files. */
+extern int history_offset;
+
#endif /* !_HISTLIB_H_ */
diff --git a/readline/history.c b/readline/history.c
index 804ffddcd89..4242f33efe1 100644
--- a/readline/history.c
+++ b/readline/history.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@@ -44,16 +44,10 @@
# include <unistd.h>
#endif
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
-
#include "history.h"
#include "histlib.h"
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
@@ -71,9 +65,13 @@ static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
history that we save. */
static int history_stifled;
+/* The current number of slots allocated to the input_history. */
+static int history_size;
+
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
entries to remember. */
-int max_input_history;
+int history_max_entries;
+int max_input_history; /* backwards compatibility */
/* The current location of the interactive history pointer. Just makes
life easier for outside callers. */
@@ -82,9 +80,6 @@ int history_offset;
/* The number of strings currently stored in the history list. */
int history_length;
-/* The current number of slots allocated to the input_history. */
-static int history_size;
-
/* The logical `base' of the history array. It defaults to 1. */
int history_base = 1;
@@ -134,9 +129,7 @@ history_total_bytes ()
{
register int i, result;
- result = 0;
-
- for (i = 0; the_history && the_history[i]; i++)
+ for (i = result = 0; the_history && the_history[i]; i++)
result += strlen (the_history[i]->line);
return (result);
@@ -161,7 +154,7 @@ history_set_pos (pos)
history_offset = pos;
return (1);
}
-
+
/* Return the current history array. The caller has to be carefull, since this
is the actual array of data, and could be bashed or made corrupt easily.
The array is terminated with a NULL pointer. */
@@ -217,16 +210,16 @@ history_get (offset)
is set to NULL. */
void
add_history (string)
- char *string;
+ const char *string;
{
HIST_ENTRY *temp;
- if (history_stifled && (history_length == max_input_history))
+ if (history_stifled && (history_length == history_max_entries))
{
register int i;
/* If the history is stifled, and history_length is zero,
- and it equals max_input_history, we don't save items. */
+ and it equals history_max_entries, we don't save items. */
if (history_length == 0)
return;
@@ -277,15 +270,15 @@ add_history (string)
HIST_ENTRY *
replace_history_entry (which, line, data)
int which;
- char *line;
+ const char *line;
histdata_t data;
{
- HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- HIST_ENTRY *old_value;
+ HIST_ENTRY *temp, *old_value;
if (which >= history_length)
return ((HIST_ENTRY *)NULL);
+ temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
old_value = the_history[which];
temp->line = savestring (line);
@@ -303,12 +296,12 @@ remove_history (which)
int which;
{
HIST_ENTRY *return_value;
+ register int i;
if (which >= history_length || !history_length)
return_value = (HIST_ENTRY *)NULL;
else
{
- register int i;
return_value = the_history[which];
for (i = which; i < history_length; i++)
@@ -325,13 +318,13 @@ void
stifle_history (max)
int max;
{
+ register int i, j;
+
if (max < 0)
max = 0;
if (history_length > max)
{
- register int i, j;
-
/* This loses because we cannot free the data. */
for (i = 0, j = history_length - max; i < j; i++)
{
@@ -347,22 +340,22 @@ stifle_history (max)
}
history_stifled = 1;
- max_input_history = max;
+ max_input_history = history_max_entries = max;
}
-/* Stop stifling the history. This returns the previous amount the
- history was stifled by. The value is positive if the history was
- stifled, negative if it wasn't. */
+/* Stop stifling the history. This returns the previous maximum
+ number of history entries. The value is positive if the history
+ was stifled, negative if it wasn't. */
int
unstifle_history ()
{
if (history_stifled)
{
history_stifled = 0;
- return (-max_input_history);
+ return (history_max_entries);
}
-
- return (max_input_history);
+ else
+ return (-history_max_entries);
}
int
diff --git a/readline/history.h b/readline/history.h
index 88bf471bb62..58b5de4655f 100644
--- a/readline/history.h
+++ b/readline/history.h
@@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _HISTORY_H_
#define _HISTORY_H_
@@ -28,16 +28,10 @@ extern "C" {
#if defined READLINE_LIBRARY
# include "rlstdc.h"
+# include "rltypedefs.h"
#else
# include <readline/rlstdc.h>
-#endif
-
-#if !defined (_FUNCTION_DEF)
-# define _FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
+# include <readline/rltypedefs.h>
#endif
#ifdef __STDC__
@@ -68,81 +62,81 @@ typedef struct _hist_state {
/* Begin a session in which the history functions might be used. This
just initializes the interactive variables. */
-extern void using_history __P((void));
+extern void using_history PARAMS((void));
/* Return the current HISTORY_STATE of the history. */
-extern HISTORY_STATE *history_get_history_state __P((void));
+extern HISTORY_STATE *history_get_history_state PARAMS((void));
/* Set the state of the current history array to STATE. */
-extern void history_set_history_state __P((HISTORY_STATE *));
+extern void history_set_history_state PARAMS((HISTORY_STATE *));
/* Manage the history list. */
/* Place STRING at the end of the history list.
The associated data field (if any) is set to NULL. */
-extern void add_history __P((char *));
+extern void add_history PARAMS((const char *));
/* A reasonably useless function, only here for completeness. WHICH
is the magic number that tells us which element to delete. The
elements are numbered from 0. */
-extern HIST_ENTRY *remove_history __P((int));
+extern HIST_ENTRY *remove_history PARAMS((int));
/* Make the history entry at WHICH have LINE and DATA. This returns
the old entry so you can dispose of the data. In the case of an
invalid WHICH, a NULL pointer is returned. */
-extern HIST_ENTRY *replace_history_entry __P((int, char *, histdata_t));
+extern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t));
/* Clear the history list and start over. */
-extern void clear_history __P((void));
+extern void clear_history PARAMS((void));
/* Stifle the history list, remembering only MAX number of entries. */
-extern void stifle_history __P((int));
+extern void stifle_history PARAMS((int));
/* Stop stifling the history. This returns the previous amount the
history was stifled by. The value is positive if the history was
stifled, negative if it wasn't. */
-extern int unstifle_history __P((void));
+extern int unstifle_history PARAMS((void));
/* Return 1 if the history is stifled, 0 if it is not. */
-extern int history_is_stifled __P((void));
+extern int history_is_stifled PARAMS((void));
/* Information about the history list. */
/* Return a NULL terminated array of HIST_ENTRY which is the current input
history. Element 0 of this list is the beginning of time. If there
is no history, return NULL. */
-extern HIST_ENTRY **history_list __P((void));
+extern HIST_ENTRY **history_list PARAMS((void));
/* Returns the number which says what history element we are now
looking at. */
-extern int where_history __P((void));
-
+extern int where_history PARAMS((void));
+
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
-HIST_ENTRY *current_history __P((void));
+extern HIST_ENTRY *current_history PARAMS((void));
/* Return the history entry which is logically at OFFSET in the history
array. OFFSET is relative to history_base. */
-extern HIST_ENTRY *history_get __P((int));
+extern HIST_ENTRY *history_get PARAMS((int));
/* Return the number of bytes that the primary history entries are using.
This just adds up the lengths of the_history->lines. */
-extern int history_total_bytes __P((void));
+extern int history_total_bytes PARAMS((void));
/* Moving around the history list. */
/* Set the position in the history list to POS. */
-int history_set_pos __P((int));
+extern int history_set_pos PARAMS((int));
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry, return
a NULL pointer. */
-extern HIST_ENTRY *previous_history __P((void));
+extern HIST_ENTRY *previous_history PARAMS((void));
/* Move history_offset forward to the next item in the input_history,
and return the a pointer to that entry. If there is no next entry,
return a NULL pointer. */
-extern HIST_ENTRY *next_history __P((void));
+extern HIST_ENTRY *next_history PARAMS((void));
/* Searching the history list. */
@@ -152,45 +146,45 @@ extern HIST_ENTRY *next_history __P((void));
current_history () is the history entry, and the value of this function
is the offset in the line of that history entry that the string was
found in. Otherwise, nothing is changed, and a -1 is returned. */
-extern int history_search __P((char *, int));
+extern int history_search PARAMS((const char *, int));
/* Search the history for STRING, starting at history_offset.
The search is anchored: matching lines must begin with string.
DIRECTION is as in history_search(). */
-extern int history_search_prefix __P((char *, int));
+extern int history_search_prefix PARAMS((const char *, int));
/* Search for STRING in the history list, starting at POS, an
absolute index into the list. DIR, if negative, says to search
backwards from POS, else forwards.
Returns the absolute index of the history element where STRING
was found, or -1 otherwise. */
-extern int history_search_pos __P((char *, int, int));
+extern int history_search_pos PARAMS((const char *, int, int));
/* Managing the history file. */
/* Add the contents of FILENAME to the history list, a line at a time.
If FILENAME is NULL, then read from ~/.history. Returns 0 if
successful, or errno if not. */
-extern int read_history __P((char *));
+extern int read_history PARAMS((const char *));
/* Read a range of lines from FILENAME, adding them to the history list.
Start reading at the FROM'th line and end at the TO'th. If FROM
is zero, start at the beginning. If TO is less than FROM, read
until the end of the file. If FILENAME is NULL, then read from
~/.history. Returns 0 if successful, or errno if not. */
-extern int read_history_range __P((char *, int, int));
+extern int read_history_range PARAMS((const char *, int, int));
/* Write the current history to FILENAME. If FILENAME is NULL,
then write the history list to ~/.history. Values returned
are as in read_history (). */
-extern int write_history __P((char *));
+extern int write_history PARAMS((const char *));
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */
-int append_history __P((int, char *));
+extern int append_history PARAMS((int, const char *));
/* Truncate the history file, leaving only the last NLINES lines. */
-extern int history_truncate_file __P((char *, int));
+extern int history_truncate_file PARAMS((const char *, int));
/* History expansion. */
@@ -206,12 +200,12 @@ extern int history_truncate_file __P((char *, int));
If an error ocurred in expansion, then OUTPUT contains a descriptive
error message. */
-extern int history_expand __P((char *, char **));
+extern int history_expand PARAMS((char *, char **));
/* Extract a string segment consisting of the FIRST through LAST
arguments present in STRING. Arguments are broken up as in
the shell. */
-extern char *history_arg_extract __P((int, int, char *));
+extern char *history_arg_extract PARAMS((int, int, const char *));
/* Return the text of the history event beginning at the current
offset into STRING. Pass STRING with *INDEX equal to the
@@ -219,27 +213,31 @@ extern char *history_arg_extract __P((int, int, char *));
DELIMITING_QUOTE is a character that is allowed to end the string
specification for what to search for in addition to the normal
characters `:', ` ', `\t', `\n', and sometimes `?'. */
-extern char *get_history_event __P((char *, int *, int));
+extern char *get_history_event PARAMS((const char *, int *, int));
/* Return an array of tokens, much as the shell might. The tokens are
parsed out of STRING. */
-extern char **history_tokenize __P((char *));
+extern char **history_tokenize PARAMS((const char *));
/* Exported history variables. */
extern int history_base;
extern int history_length;
-extern int max_input_history;
+extern int history_max_entries;
extern char history_expansion_char;
extern char history_subst_char;
+extern char *history_word_delimiters;
extern char history_comment_char;
-extern const char *history_no_expand_chars;
-extern const char *history_search_delimiter_chars;
+extern char *history_no_expand_chars;
+extern char *history_search_delimiter_chars;
extern int history_quotes_inhibit_expansion;
+/* Backwards compatibility */
+extern int max_input_history;
+
/* 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;
+extern rl_linebuf_func_t *history_inhibit_expansion_function;
#ifdef __cplusplus
}
diff --git a/readline/histsearch.c b/readline/histsearch.c
index eb17e9332e8..d94fd6cd9c6 100644
--- a/readline/histsearch.c
+++ b/readline/histsearch.c
@@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@@ -32,27 +32,22 @@
#else
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+
#if defined (HAVE_UNISTD_H)
# ifdef _MINIX
# include <sys/types.h>
# endif
# include <unistd.h>
#endif
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* !HAVE_STRING_H */
#include "history.h"
#include "histlib.h"
-/* Variables imported from other history library files. */
-extern int history_offset;
-
/* The list of alternate characters that can delimit a history search
string. */
-const char *history_search_delimiter_chars = (char *)NULL;
+char *history_search_delimiter_chars = (char *)NULL;
+
+static int history_search_internal PARAMS((const char *, int, int));
/* Search the history for STRING, starting at history_offset.
If DIRECTION < 0, then the search is through previous entries, else
@@ -66,7 +61,7 @@ const char *history_search_delimiter_chars = (char *)NULL;
static int
history_search_internal (string, direction, anchored)
- char *string;
+ const char *string;
int direction, anchored;
{
register int i, reverse;
@@ -162,7 +157,7 @@ history_search_internal (string, direction, anchored)
/* Do a non-anchored search for STRING through the history in DIRECTION. */
int
history_search (string, direction)
- char *string;
+ const char *string;
int direction;
{
return (history_search_internal (string, direction, NON_ANCHORED_SEARCH));
@@ -171,7 +166,7 @@ history_search (string, direction)
/* Do an anchored search for string through the history in DIRECTION. */
int
history_search_prefix (string, direction)
- char *string;
+ const char *string;
int direction;
{
return (history_search_internal (string, direction, ANCHORED_SEARCH));
@@ -182,7 +177,7 @@ history_search_prefix (string, direction)
which point to begin searching. */
int
history_search_pos (string, dir, pos)
- char *string;
+ const char *string;
int dir, pos;
{
int ret, old;
diff --git a/readline/input.c b/readline/input.c
index ea1342969b0..1442c5ef155 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -42,7 +42,7 @@
#endif /* HAVE_STDLIB_H */
#if defined (HAVE_SELECT)
-# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX) || defined(TIME_WITH_SYS_TIME)
+# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
# include <sys/time.h>
# endif
#endif /* HAVE_SELECT */
@@ -63,48 +63,31 @@ extern int errno;
/* System-specific feature definitions and include files. */
#include "rldefs.h"
+#include "rlmbutil.h"
/* Some standard library routines. */
#include "readline.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
-/* Functions imported from other files in the library. */
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-extern void _rl_vi_set_last ();
-extern int _rl_vi_textmod_command ();
-#endif /* VI_MODE */
-
-extern FILE *rl_instream, *rl_outstream;
-extern Function *rl_last_func;
-extern int rl_key_sequence_length;
-extern int rl_pending_input;
-extern int rl_editing_mode;
-
-extern Keymap _rl_keymap;
-
-extern int _rl_convert_meta_chars_to_ascii;
-
-#if defined (__GO32__)
-# include <pc.h>
-#endif /* __GO32__ */
-
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
-Function *rl_event_hook = (Function *)NULL;
+rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL;
+
+rl_getc_func_t *rl_getc_function = rl_getc;
-Function *rl_getc_function = rl_getc;
+static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */
+
+static int ibuffer_space PARAMS((void));
+static int rl_get_char PARAMS((int *));
+static int rl_gather_tyi PARAMS((void));
/* **************************************************************** */
/* */
@@ -156,8 +139,8 @@ rl_get_char (key)
/* Stuff KEY into the *front* of the input buffer.
Returns non-zero if successful, zero if there is
no space left in the buffer. */
-static int
-rl_unget_char (key)
+int
+_rl_unget_char (key)
int key;
{
if (ibuffer_space ())
@@ -171,33 +154,12 @@ rl_unget_char (key)
return (0);
}
-#if defined(__EMX__)
-int waiting_char = -1;
-#endif
-
-/* If a character is available to be read, then read it
- and stuff it into IBUFFER. Otherwise, just return. */
-static void
+/* If a character is available to be read, then read it and stuff it into
+ IBUFFER. Otherwise, just return. Returns number of characters read
+ (0 if none available) and -1 on error (EIO). */
+static int
rl_gather_tyi ()
{
-#if defined (__EMX__)
- if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1 && ibuffer_space ())
- {
- int i;
- i = (*rl_getc_function) (rl_instream);
- rl_stuff_char (i);
- }
-#elif defined (__GO32__)
- char input;
-
- if (isatty (0) && kbhit () && ibuffer_space ())
- {
- int i;
- i = (*rl_getc_function) (rl_instream);
- rl_stuff_char (i);
- }
-#else /* !__GO32__ */
-
int tty;
register int tem, result;
int chars_avail;
@@ -215,14 +177,18 @@ rl_gather_tyi ()
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
- timeout.tv_usec = 100000; /* 0.1 seconds */
- if (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) <= 0)
- return; /* Nothing to read. */
+ timeout.tv_usec = _keyboard_input_timeout;
+ result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout);
+ if (result <= 0)
+ return 0; /* Nothing to read. */
#endif
result = -1;
#if defined (FIONREAD)
+ errno = 0;
result = ioctl (tty, FIONREAD, &chars_avail);
+ if (result == -1 && errno == EIO)
+ return -1;
#endif
#if defined (O_NDELAY)
@@ -235,14 +201,14 @@ rl_gather_tyi ()
fcntl (tty, F_SETFL, tem);
if (chars_avail == -1 && errno == EAGAIN)
- return;
+ return 0;
}
#endif /* O_NDELAY */
/* If there's nothing available, don't waste time trying to read
something. */
if (chars_avail <= 0)
- return;
+ return 0;
tem = ibuffer_space ();
@@ -266,23 +232,36 @@ rl_gather_tyi ()
if (chars_avail)
rl_stuff_char (input);
}
-#endif /* !__GO32__ */
+
+ return 1;
+}
+
+int
+rl_set_keyboard_input_timeout (u)
+ int u;
+{
+ int o;
+
+ o = _keyboard_input_timeout;
+ if (u > 0)
+ _keyboard_input_timeout = u;
+ return (o);
}
/* Is there input available to be read on the readline input file
- descriptor? Only works if the system has select(2) or FIONREAD. */
+ descriptor? Only works if the system has select(2) or FIONREAD.
+ Uses the value of _keyboard_input_timeout as the timeout; if another
+ readline function wants to specify a timeout and not leave it up to
+ the user, it should use _rl_input_queued(timeout_value_in_microseconds)
+ instead. */
int
_rl_input_available ()
{
-#if defined (__EMX__)
- if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1)
- return 1;
-#else /* __EMX__ */
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
-#if defined(FIONREAD)
+#if !defined (HAVE_SELECT) && defined(FIONREAD)
int chars_avail;
#endif
int tty;
@@ -295,28 +274,41 @@ _rl_input_available ()
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
timeout.tv_sec = 0;
- timeout.tv_usec = 100000; /* 0.1 seconds */
+ timeout.tv_usec = _keyboard_input_timeout;
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
-#endif
+#else
#if defined (FIONREAD)
if (ioctl (tty, FIONREAD, &chars_avail) == 0)
return (chars_avail);
#endif
-#endif /* !__EMX__ */
+
+#endif
return 0;
}
+int
+_rl_input_queued (t)
+ int t;
+{
+ int old_timeout, r;
+
+ old_timeout = rl_set_keyboard_input_timeout (t);
+ r = _rl_input_available ();
+ rl_set_keyboard_input_timeout (old_timeout);
+ return r;
+}
+
void
_rl_insert_typein (c)
int c;
-{
+{
int key, t, i;
char *string;
i = key = 0;
- string = xmalloc (ibuffer_len + 1);
+ string = (char *)xmalloc (ibuffer_len + 1);
string[i++] = (char) c;
while ((t = rl_get_char (&key)) &&
@@ -325,7 +317,7 @@ _rl_insert_typein (c)
string[i++] = key;
if (t)
- rl_unget_char (key);
+ _rl_unget_char (key);
string[i] = '\0';
rl_insert_text (string);
@@ -345,6 +337,7 @@ rl_stuff_char (key)
{
key = NEWLINE;
rl_pending_input = EOF;
+ RL_SETSTATE (RL_STATE_INPUTPENDING);
}
ibuffer[push_index++] = key;
if (push_index >= ibuffer_len)
@@ -359,6 +352,16 @@ rl_execute_next (c)
int c;
{
rl_pending_input = c;
+ RL_SETSTATE (RL_STATE_INPUTPENDING);
+ return 0;
+}
+
+/* Clear any pending input pushed with rl_execute_next() */
+int
+rl_clear_pending_input ()
+{
+ rl_pending_input = 0;
+ RL_UNSETSTATE (RL_STATE_INPUTPENDING);
return 0;
}
@@ -379,7 +382,7 @@ rl_read_key ()
if (rl_pending_input)
{
c = rl_pending_input;
- rl_pending_input = 0;
+ rl_clear_pending_input ();
}
else
{
@@ -393,7 +396,13 @@ rl_read_key ()
while (rl_event_hook && rl_get_char (&c) == 0)
{
(*rl_event_hook) ();
- rl_gather_tyi ();
+ if (rl_done) /* XXX - experimental */
+ return ('\n');
+ if (rl_gather_tyi () < 0) /* XXX - EIO */
+ {
+ rl_done = 1;
+ return ('\n');
+ }
}
}
else
@@ -410,96 +419,9 @@ int
rl_getc (stream)
FILE *stream;
{
- int result, flags;
+ int result;
unsigned char c;
-#if defined (__EMX__)
- if (isatty (0))
- {
- int key;
-
- if (waiting_char != -1)
- {
- key = waiting_char;
- waiting_char = -1;
- }
- else
- {
-#ifdef __RSXNT__
- pc_flush();
-#endif
- key = _read_kbd(0, 1, 0);
- }
-
- while (key == 0)
- {
- key |= (_read_kbd(0, 1, 0) << 8);
- /* printf("<%04X> ", key);
- fflush(stdout); */
-
- switch (key)
- {
- case 0x4B00: /* left arrow */
- key = 'B' - 64;
- break;
- case 0x4D00: /* right arrow */
- key = 'F' - 64;
- break;
- case 0x7300: /* ctrl left arrow */
- key = 27;
- waiting_char = 'B';
- break;
- case 0x7400: /* ctrl right arrow */
- key = 27;
- waiting_char = 'F';
- break;
- case 0x4800: /* up arrow */
- key = 'P' - 64;
- break;
- case 0x5000: /* down arrow */
- key = 'N' - 64;
- break;
- case 0x8D00: /* ctrl up arrow */
- key = 'R' - 64;
- break;
- case 0x9100: /* ctrl down arrow */
- key = 'S' - 64;
- break;
- case 0x4700: /* home key */
- key = 'A' - 64;
- break;
- case 0x4F00: /* end key */
- key = 'E' - 64;
- break;
- case 0x7700: /* ctrl home key */
- key = 27;
- waiting_char = '<';
- break;
- case 0x7500: /* ctrl end key */
- key = 27;
- waiting_char = '>';
- break;
- case 0x5300: /* delete key */
- key = 'D' - 64;
- break;
- case 0x5200: /* insert key */
- key = 'V' - 64;
- break;
- default: /* ignore all other special keys, read next */
- key = _read_kbd(0, 1, 0);
- break;
- }
- }
-
- return (key & 0xFF);
- }
-#endif /* __EMX__ */
-
-#if defined (__GO32__)
- if (isatty (0))
- return (getkey () & 0x7F);
-#endif /* __GO32__ */
-
while (1)
{
result = read (fileno (stream), &c, sizeof (unsigned char));
@@ -518,40 +440,101 @@ rl_getc (stream)
#endif
#if defined (EWOULDBLOCK)
- if (errno == EWOULDBLOCK)
+# define X_EWOULDBLOCK EWOULDBLOCK
+#else
+# define X_EWOULDBLOCK -99
+#endif
+
+#if defined (EAGAIN)
+# define X_EAGAIN EAGAIN
+#else
+# define X_EAGAIN -99
+#endif
+
+ if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
{
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
+ if (sh_unset_nodelay_mode (fileno (stream)) < 0)
return (EOF);
- if (flags & O_NDELAY)
- {
- flags &= ~O_NDELAY;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
continue;
}
-#endif /* EWOULDBLOCK */
-#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
- if (errno == EAGAIN)
- {
- if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
- return (EOF);
- if (flags & O_NONBLOCK)
- {
- flags &= ~O_NONBLOCK;
- fcntl (fileno (stream), F_SETFL, flags);
- continue;
- }
- }
-#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
+#undef X_EWOULDBLOCK
+#undef X_EAGAIN
-#if !defined (__GO32__)
/* If the error that we received was SIGINT, then try again,
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
return (EOF);
-#endif /* !__GO32__ */
}
}
+
+#if defined (HANDLE_MULTIBYTE)
+/* read multibyte char */
+int
+_rl_read_mbchar (mbchar, size)
+ char *mbchar;
+ int size;
+{
+ int mb_len = 0;
+ size_t mbchar_bytes_length;
+ wchar_t wc;
+ mbstate_t ps, ps_back;
+
+ memset(&ps, 0, sizeof (mbstate_t));
+ memset(&ps_back, 0, sizeof (mbstate_t));
+
+ while (mb_len < size)
+ {
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ mbchar[mb_len++] = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
+ if (mbchar_bytes_length == (size_t)(-1))
+ break; /* invalid byte sequence for the current locale */
+ else if (mbchar_bytes_length == (size_t)(-2))
+ {
+ /* shorted bytes */
+ ps = ps_back;
+ continue;
+ }
+ else if (mbchar_bytes_length > (size_t)(0))
+ break;
+ }
+
+ return mb_len;
+}
+
+/* Read a multibyte-character string whose first character is FIRST into
+ the buffer MB of length MBLEN. Returns the last character read, which
+ may be FIRST. Used by the search functions, among others. Very similar
+ to _rl_read_mbchar. */
+int
+_rl_read_mbstring (first, mb, mblen)
+ int first;
+ char *mb;
+ int mblen;
+{
+ int i, c;
+ mbstate_t ps;
+
+ c = first;
+ memset (mb, 0, mblen);
+ for (i = 0; i < mblen; i++)
+ {
+ mb[i] = (char)c;
+ memset (&ps, 0, sizeof (mbstate_t));
+ if (_rl_get_char_len (mb, &ps) == -2)
+ {
+ /* Read more for multibyte character */
+ RL_SETSTATE (RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE (RL_STATE_MOREINPUT);
+ }
+ else
+ break;
+ }
+ return c;
+}
+#endif /* HANDLE_MULTIBYTE */
diff --git a/readline/isearch.c b/readline/isearch.c
index a4a294b6b20..c0604ce703c 100644
--- a/readline/isearch.c
+++ b/readline/isearch.c
@@ -4,7 +4,7 @@
/* */
/* **************************************************************** */
-/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
This file contains the Readline Library (the Library), a set of
routines for providing Emacs style line input to programs that ask
@@ -12,7 +12,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -23,7 +23,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -45,32 +45,33 @@
#endif
#include "rldefs.h"
+#include "rlmbutil.h"
+
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
/* Variables exported to other files in the readline library. */
-unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
+char *_rl_isearch_terminators = (char *)NULL;
/* Variables imported from other files in the readline library. */
-extern Keymap _rl_keymap;
-extern HIST_ENTRY *saved_line_for_history;
-extern int rl_line_buffer_len;
-extern int rl_point, rl_end;
-extern char *rl_line_buffer;
-
-extern int rl_execute_next ();
-extern void rl_extend_line_buffer ();
-
-extern int _rl_input_available ();
+extern HIST_ENTRY *_rl_saved_line_for_history;
-extern char *xmalloc (), *xrealloc ();
-
-static int rl_search_history ();
+/* Forward declarations */
+static int rl_search_history PARAMS((int, int));
/* Last line found by the current incremental search, so we don't `find'
identical lines many times in a row. */
static char *prev_line_found;
+/* Last search string and its length. */
+static char *last_isearch_string;
+static int last_isearch_string_len;
+
+static char default_isearch_terminators[] = "\033\012";
+
/* Search backwards through the history looking for a string which is typed
interactively. Start with the current line. */
int
@@ -97,15 +98,14 @@ rl_forward_search_history (sign, key)
static void
rl_display_search (search_string, reverse_p, where)
char *search_string;
- int reverse_p;
- int where __attribute__((unused));
+ int reverse_p, where __attribute__((unused));
{
char *message;
int msglen, searchlen;
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
- message = xmalloc (searchlen + 33);
+ message = (char *)xmalloc (searchlen + 33);
msglen = 0;
#if defined (NOTDEF)
@@ -135,7 +135,7 @@ rl_display_search (search_string, reverse_p, where)
strcpy (message + msglen, "': ");
- rl_message ("%s", message, 0);
+ rl_message ("%s", message);
free (message);
(*rl_redisplay_function) ();
}
@@ -145,7 +145,8 @@ rl_display_search (search_string, reverse_p, where)
DIRECTION is which direction to search; >= 0 means forward, < 0 means
backwards. */
static int
-rl_search_history (int direction, int invoking_key __attribute__((unused)))
+rl_search_history (direction, invoking_key)
+ int direction, invoking_key __attribute__((unused));
{
/* The string that the user types in to search for. */
char *search_string;
@@ -166,8 +167,12 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
HIST_ENTRY **hlist;
register int i;
- int orig_point, orig_line, last_found_line;
+ int orig_point, orig_mark, orig_line, last_found_line;
int c, found, failed, sline_len;
+ int n, wstart, wlen;
+#if defined (HANDLE_MULTIBYTE)
+ char mb[MB_LEN_MAX];
+#endif
/* The line currently being searched. */
char *sline;
@@ -181,19 +186,21 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
/* The list of characters which terminate the search, but are not
subsequently executed. If the variable isearch-terminators has
been set, we use that value, otherwise we use ESC and C-J. */
- unsigned char *isearch_terminators;
+ char *isearch_terminators;
+ RL_SETSTATE(RL_STATE_ISEARCH);
orig_point = rl_point;
+ orig_mark = rl_mark;
last_found_line = orig_line = where_history ();
reverse = direction < 0;
hlist = history_list ();
allocated_line = (char *)NULL;
isearch_terminators = _rl_isearch_terminators ? _rl_isearch_terminators
- : (unsigned char *)"\033\012";
+ : default_isearch_terminators;
/* Create an arrary of pointers to the lines that we want to search. */
- maybe_replace_line ();
+ rl_maybe_replace_line ();
i = 0;
if (hlist)
for (i = 0; hlist[i]; i++);
@@ -204,12 +211,12 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
for (i = 0; i < hlen; i++)
lines[i] = hlist[i]->line;
- if (saved_line_for_history)
- lines[i] = saved_line_for_history->line;
+ if (_rl_saved_line_for_history)
+ lines[i] = _rl_saved_line_for_history->line;
else
{
/* Keep track of this so we can free it. */
- allocated_line = xmalloc (1 + strlen (rl_line_buffer));
+ allocated_line = (char *)xmalloc (1 + strlen (rl_line_buffer));
strcpy (allocated_line, &rl_line_buffer[0]);
lines[i] = allocated_line;
}
@@ -222,7 +229,7 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
rl_save_prompt ();
/* Initialize search parameters. */
- search_string = xmalloc (search_string_size = 128);
+ search_string = (char *)xmalloc (search_string_size = 128);
*search_string = '\0';
search_string_index = 0;
prev_line_found = (char *)0; /* XXX */
@@ -239,12 +246,20 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
found = failed = 0;
for (;;)
{
- Function *f = (Function *)NULL;
+ rl_command_func_t *f = (rl_command_func_t *)NULL;
/* Read a key and decide how to proceed. */
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
- if (_rl_keymap[c].type == ISFUNC)
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ c = _rl_read_mbstring (c, mb, MB_LEN_MAX);
+#endif
+
+ /* Translate the keys we do something with to opcodes. */
+ if (c >= 0 && _rl_keymap[c].type == ISFUNC)
{
f = _rl_keymap[c].function;
@@ -252,34 +267,56 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
c = reverse ? -1 : -2;
else if (f == rl_forward_search_history)
c = !reverse ? -1 : -2;
+ else if (f == rl_rubout)
+ c = -3;
+ else if (c == CTRL ('G'))
+ c = -4;
+ else if (c == CTRL ('W')) /* XXX */
+ c = -5;
+ else if (c == CTRL ('Y')) /* XXX */
+ c = -6;
}
-#if 0
- /* Let NEWLINE (^J) terminate the search for people who don't like
- using ESC. ^M can still be used to terminate the search and
- immediately execute the command. */
- if (c == ESC || c == NEWLINE)
-#else
/* The characters in isearch_terminators (set from the user-settable
variable isearch-terminators) are used to terminate the search but
not subsequently execute the character as a command. The default
value is "\033\012" (ESC and C-J). */
- if (strchr((char*) isearch_terminators, c))
-#endif
+ if (strchr (isearch_terminators, c))
{
/* ESC still terminates the search, but if there is pending
input or if input arrives within 0.1 seconds (on systems
with select(2)) it is used as a prefix character
with rl_execute_next. WATCH OUT FOR THIS! This is intended
to allow the arrow keys to be used like ^F and ^B are used
- to terminate the search and execute the movement command. */
- if (c == ESC && _rl_input_available ()) /* XXX */
+ to terminate the search and execute the movement command.
+ XXX - since _rl_input_available depends on the application-
+ settable keyboard timeout value, this could alternatively
+ use _rl_input_queued(100000) */
+ if (c == ESC && _rl_input_available ())
rl_execute_next (ESC);
break;
}
- if (c >= 0 && (CTRL_CHAR (c) || META_CHAR (c) || c == RUBOUT) && c != CTRL ('G'))
+#define ENDSRCH_CHAR(c) \
+ ((CTRL_CHAR (c) || META_CHAR (c) || (c) == RUBOUT) && ((c) != CTRL ('G')))
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
+ if (c >= 0 && strlen (mb) == 1 && ENDSRCH_CHAR (c))
+ {
+ /* This sets rl_pending_input to c; it will be picked up the next
+ time rl_read_key is called. */
+ rl_execute_next (c);
+ break;
+ }
+ }
+ else
+#endif
+ if (c >= 0 && ENDSRCH_CHAR (c))
+ {
+ /* This sets rl_pending_input to c; it will be picked up the next
+ time rl_read_key is called. */
rl_execute_next (c);
break;
}
@@ -288,13 +325,24 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
{
case -1:
if (search_string_index == 0)
- continue;
+ {
+ if (last_isearch_string)
+ {
+ search_string_size = 64 + last_isearch_string_len;
+ search_string = (char *)xrealloc (search_string, search_string_size);
+ strcpy (search_string, last_isearch_string);
+ search_string_index = last_isearch_string_len;
+ rl_display_search (search_string, reverse, -1);
+ break;
+ }
+ continue;
+ }
else if (reverse)
--line_index;
else if (line_index != sline_len)
++line_index;
else
- ding ();
+ rl_ding ();
break;
/* switch directions */
@@ -303,40 +351,96 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
reverse = direction < 0;
break;
- case CTRL ('G'):
- strcpy (rl_line_buffer, lines[orig_line]);
+ /* delete character from search string. */
+ case -3: /* C-H, DEL */
+ /* This is tricky. To do this right, we need to keep a
+ stack of search positions for the current search, with
+ sentinels marking the beginning and end. But this will
+ do until we have a real isearch-undo. */
+ if (search_string_index == 0)
+ rl_ding ();
+ else
+ search_string[--search_string_index] = '\0';
+
+ break;
+
+ case -4: /* C-G */
+ rl_replace_line (lines[orig_line], 0);
rl_point = orig_point;
- rl_end = strlen (rl_line_buffer);
+ rl_mark = orig_mark;
rl_restore_prompt();
rl_clear_message ();
if (allocated_line)
free (allocated_line);
free (lines);
+ RL_UNSETSTATE(RL_STATE_ISEARCH);
return 0;
-#if 0
- /* delete character from search string. */
- case -3:
- if (search_string_index == 0)
- ding ();
- else
+ case -5: /* C-W */
+ /* skip over portion of line we already matched */
+ wstart = rl_point + search_string_index;
+ if (wstart >= rl_end)
+ {
+ rl_ding ();
+ break;
+ }
+
+ /* if not in a word, move to one. */
+ if (rl_alphabetic(rl_line_buffer[wstart]) == 0)
+ {
+ rl_ding ();
+ break;
+ }
+ n = wstart;
+ while (n < rl_end && rl_alphabetic(rl_line_buffer[n]))
+ n++;
+ wlen = n - wstart + 1;
+ if (search_string_index + wlen + 1 >= search_string_size)
{
- search_string[--search_string_index] = '\0';
- /* This is tricky. To do this right, we need to keep a
- stack of search positions for the current search, with
- sentinels marking the beginning and end. */
+ search_string_size += wlen + 1;
+ search_string = (char *)xrealloc (search_string, search_string_size);
}
+ for (; wstart < n; wstart++)
+ search_string[search_string_index++] = rl_line_buffer[wstart];
+ search_string[search_string_index] = '\0';
+ break;
+
+ case -6: /* C-Y */
+ /* skip over portion of line we already matched */
+ wstart = rl_point + search_string_index;
+ if (wstart >= rl_end)
+ {
+ rl_ding ();
+ break;
+ }
+ n = rl_end - wstart + 1;
+ if (search_string_index + n + 1 >= search_string_size)
+ {
+ search_string_size += n + 1;
+ search_string = (char *)xrealloc (search_string, search_string_size);
+ }
+ for (n = wstart; n < rl_end; n++)
+ search_string[search_string_index++] = rl_line_buffer[n];
+ search_string[search_string_index] = '\0';
break;
-#endif
default:
/* Add character to search string and continue search. */
if (search_string_index + 2 >= search_string_size)
{
search_string_size += 128;
- search_string = xrealloc (search_string, search_string_size);
+ search_string = (char *)xrealloc (search_string, search_string_size);
+ }
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ int j, l;
+ for (j = 0, l = strlen (mb); j < l; )
+ search_string[search_string_index++] = mb[j++];
}
- search_string[search_string_index++] = c;
+ else
+#endif
+ search_string[search_string_index++] = c;
search_string[search_string_index] = '\0';
break;
}
@@ -391,7 +495,7 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
if (failed)
{
/* We cannot find the search string. Ding the bell. */
- ding ();
+ rl_ding ();
i = last_found_line;
continue; /* XXX - was break */
}
@@ -401,17 +505,9 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
the location. */
if (found)
{
- int line_len;
-
prev_line_found = lines[i];
- line_len = strlen (lines[i]);
-
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
-
- strcpy (rl_line_buffer, lines[i]);
+ rl_replace_line (lines[i], 0);
rl_point = line_index;
- rl_end = line_len;
last_found_line = i;
rl_display_search (search_string, reverse, (i == orig_line) ? -1 : i);
}
@@ -427,23 +523,38 @@ rl_search_history (int direction, int invoking_key __attribute__((unused)))
rl_restore_prompt ();
- /* Free the search string. */
- free (search_string);
+ /* Save the search string for possible later use. */
+ FREE (last_isearch_string);
+ last_isearch_string = search_string;
+ last_isearch_string_len = search_string_index;
if (last_found_line < orig_line)
rl_get_previous_history (orig_line - last_found_line, 0);
else
rl_get_next_history (last_found_line - orig_line, 0);
- /* If the string was not found, put point at the end of the line. */
+ /* If the string was not found, put point at the end of the last matching
+ line. If last_found_line == orig_line, we didn't find any matching
+ history lines at all, so put point back in its original position. */
if (line_index < 0)
- line_index = strlen (rl_line_buffer);
+ {
+ if (last_found_line == orig_line)
+ line_index = orig_point;
+ else
+ line_index = strlen (rl_line_buffer);
+ rl_mark = orig_mark;
+ }
+
rl_point = line_index;
+ /* Don't worry about where to put the mark here; rl_get_previous_history
+ and rl_get_next_history take care of it. */
+
rl_clear_message ();
- if (allocated_line)
- free (allocated_line);
+ FREE (allocated_line);
free (lines);
+ RL_UNSETSTATE(RL_STATE_ISEARCH);
+
return 0;
}
diff --git a/readline/keymaps.c b/readline/keymaps.c
index c73666bf273..12506d3aab2 100644
--- a/readline/keymaps.c
+++ b/readline/keymaps.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -30,18 +30,18 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
+#include <stdio.h> /* for FILE * definition for readline.h */
+
+#include "readline.h"
#include "rlconf.h"
-#include "keymaps.h"
+
#include "emacs_keymap.c"
#if defined (VI_MODE)
#include "vi_keymap.c"
#endif
-extern int rl_do_lowercase_version ();
-extern int rl_rubout (), rl_insert ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -61,7 +61,7 @@ rl_make_bare_keymap ()
for (i = 0; i < KEYMAP_SIZE; i++)
{
keymap[i].type = ISFUNC;
- keymap[i].function = (Function *)NULL;
+ keymap[i].function = (rl_command_func_t *)NULL;
}
for (i = 'A'; i < ('Z' + 1); i++)
diff --git a/readline/keymaps.h b/readline/keymaps.h
index 5dff46f56c2..66fa2a5ec14 100644
--- a/readline/keymaps.h
+++ b/readline/keymaps.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,25 +18,23 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
# include "chardefs.h"
+# include "rltypedefs.h"
#else
# include <readline/rlstdc.h>
# include <readline/chardefs.h>
-#endif
-
-#if !defined (_FUNCTION_DEF)
-# define _FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
+# include <readline/rltypedefs.h>
#endif
/* A keymap contains one entry for each key in the ASCII set.
@@ -46,16 +44,17 @@ typedef char **CPPFunction ();
TYPE says which kind of thing FUNCTION is. */
typedef struct _keymap_entry {
char type;
- Function *function;
+ rl_command_func_t *function;
} KEYMAP_ENTRY;
/* This must be large enough to hold bindings for all of the characters
in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
- and so on). */
-#define KEYMAP_SIZE 256
+ and so on) plus one for subsequence matching. */
+#define KEYMAP_SIZE 257
+#define ANYOTHERKEY KEYMAP_SIZE-1
/* I wanted to make the above structure contain a union of:
- union { Function *function; struct _keymap_entry *keymap; } value;
+ union { rl_command_func_t *function; struct _keymap_entry *keymap; } value;
but this made it impossible for me to create a static array.
Maybe I need C lessons. */
@@ -72,29 +71,33 @@ extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
/* Return a new, empty keymap.
Free it with free() when you are done. */
-extern Keymap rl_make_bare_keymap __P((void));
+extern Keymap rl_make_bare_keymap PARAMS((void));
/* Return a new keymap which is a copy of MAP. */
-extern Keymap rl_copy_keymap __P((Keymap));
+extern Keymap rl_copy_keymap PARAMS((Keymap));
/* Return a new keymap with the printing characters bound to rl_insert,
the lowercase Meta characters bound to run their equivalents, and
the Meta digits bound to produce numeric arguments. */
-extern Keymap rl_make_keymap __P((void));
+extern Keymap rl_make_keymap PARAMS((void));
/* Free the storage associated with a keymap. */
-extern void rl_discard_keymap __P((Keymap));
+extern void rl_discard_keymap PARAMS((Keymap));
/* These functions actually appear in bind.c */
/* Return the keymap corresponding to a given name. Names look like
`emacs' or `emacs-meta' or `vi-insert'. */
-extern Keymap rl_get_keymap_by_name __P((char *));
+extern Keymap rl_get_keymap_by_name PARAMS((const char *));
/* Return the current keymap. */
-extern Keymap rl_get_keymap __P((void));
+extern Keymap rl_get_keymap PARAMS((void));
/* Set the current keymap to MAP. */
-extern void rl_set_keymap __P((Keymap));
+extern void rl_set_keymap PARAMS((Keymap));
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _KEYMAPS_H_ */
diff --git a/readline/kill.c b/readline/kill.c
index 78387e138c2..f8c6961bbd3 100644
--- a/readline/kill.c
+++ b/readline/kill.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,17 +46,8 @@
#include "readline.h"
#include "history.h"
-extern int _rl_last_command_was_kill;
-extern int rl_editing_mode;
-extern int rl_explicit_arg;
-extern Function *rl_last_func;
-
-extern void _rl_init_argument ();
-extern int _rl_set_mark_at_pos ();
-extern void _rl_fix_point ();
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlprivate.h"
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -79,10 +70,16 @@ static int rl_kill_index;
/* How many slots we have in the kill ring. */
static int rl_kill_ring_length;
+static int _rl_copy_to_kill_ring PARAMS((char *, int));
+static int region_kill_internal PARAMS((int));
+static int _rl_copy_word_as_kill PARAMS((int, int));
+static int rl_yank_nth_arg_internal PARAMS((int, int, int));
+
/* How to say that you only want to save a certain amount
of kill material. */
int
-rl_set_retained_kills (int num __attribute__((unused)))
+rl_set_retained_kills (num)
+ int num __attribute__((unused));
{
return 0;
}
@@ -137,7 +134,7 @@ _rl_copy_to_kill_ring (text, append)
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
old = rl_kill_ring[slot];
- new = xmalloc (1 + strlen (old) + strlen (text));
+ new = (char *)xmalloc (1 + strlen (old) + strlen (text));
if (append)
{
@@ -204,18 +201,21 @@ int
rl_kill_word (count, key)
int count, key;
{
- int orig_point = rl_point;
+ int orig_point;
if (count < 0)
return (rl_backward_kill_word (-count, key));
else
{
+ orig_point = rl_point;
rl_forward_word (count, key);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
@@ -225,16 +225,20 @@ int
rl_backward_kill_word (count, ignore)
int count, ignore;
{
- int orig_point = rl_point;
+ int orig_point;
if (count < 0)
return (rl_kill_word (-count, ignore));
else
{
+ orig_point = rl_point;
rl_backward_word (count, ignore);
if (rl_point != orig_point)
rl_kill_text (orig_point, rl_point);
+
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
@@ -245,16 +249,19 @@ int
rl_kill_line (direction, ignore)
int direction, ignore;
{
- int orig_point = rl_point;
+ int orig_point;
if (direction < 0)
return (rl_backward_kill_line (1, ignore));
else
{
+ orig_point = rl_point;
rl_end_of_line (1, ignore);
if (orig_point != rl_point)
rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
@@ -265,18 +272,22 @@ int
rl_backward_kill_line (direction, ignore)
int direction, ignore;
{
- int orig_point = rl_point;
+ int orig_point;
if (direction < 0)
return (rl_kill_line (1, ignore));
else
{
if (!rl_point)
- ding ();
+ rl_ding ();
else
{
+ orig_point = rl_point;
rl_beg_of_line (1, ignore);
- rl_kill_text (orig_point, rl_point);
+ if (rl_point != orig_point)
+ rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
}
return 0;
@@ -284,12 +295,13 @@ rl_backward_kill_line (direction, ignore)
/* Kill the whole line, no matter where point is. */
int
-rl_kill_full_line (int count __attribute__((unused)),
- int ignore __attribute__((unused)))
+rl_kill_full_line (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
{
rl_begin_undo_group ();
rl_point = 0;
rl_kill_text (rl_point, rl_end);
+ rl_mark = 0;
rl_end_undo_group ();
return 0;
}
@@ -301,12 +313,13 @@ rl_kill_full_line (int count __attribute__((unused)),
/* This does what C-w does in Unix. We can't prevent people from
using behaviour that they expect. */
int
-rl_unix_word_rubout (int count, int key __attribute__((unused)))
+rl_unix_word_rubout (count, key)
+ int count, key __attribute__((unused));
{
int orig_point;
if (rl_point == 0)
- ding ();
+ rl_ding ();
else
{
orig_point = rl_point;
@@ -323,6 +336,8 @@ rl_unix_word_rubout (int count, int key __attribute__((unused)))
}
rl_kill_text (orig_point, rl_point);
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
@@ -334,15 +349,17 @@ rl_unix_word_rubout (int count, int key __attribute__((unused)))
into the line at all, and if you aren't, then you know what you are
doing. */
int
-rl_unix_line_discard (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_unix_line_discard (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (rl_point == 0)
- ding ();
+ rl_ding ();
else
{
rl_kill_text (rl_point, 0);
rl_point = 0;
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = rl_point;
}
return 0;
}
@@ -355,38 +372,37 @@ region_kill_internal (delete)
{
char *text;
- if (rl_mark == rl_point)
+ if (rl_mark != rl_point)
{
- _rl_last_command_was_kill++;
- return 0;
+ text = rl_copy_text (rl_point, rl_mark);
+ if (delete)
+ rl_delete_text (rl_point, rl_mark);
+ _rl_copy_to_kill_ring (text, rl_point < rl_mark);
}
- text = rl_copy_text (rl_point, rl_mark);
- if (delete)
- rl_delete_text (rl_point, rl_mark);
- _rl_copy_to_kill_ring (text, rl_point < rl_mark);
-
_rl_last_command_was_kill++;
return 0;
}
/* Copy the text in the region to the kill ring. */
int
-rl_copy_region_to_kill (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_copy_region_to_kill (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
{
return (region_kill_internal (0));
}
/* Kill the text between the point and mark. */
int
-rl_kill_region (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_kill_region (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
{
- int r;
+ int r, npoint;
+ npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
_rl_fix_point (1);
+ rl_point = npoint;
return r;
}
@@ -440,11 +456,11 @@ rl_copy_backward_word (count, key)
return (_rl_copy_word_as_kill (count, -1));
}
-
+
/* Yank back the last killed text. This ignores arguments. */
int
-rl_yank (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_yank (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
{
if (rl_kill_ring == 0)
{
@@ -462,8 +478,8 @@ rl_yank (int count __attribute__((unused)),
delete that text from the line, rotate the index down, and
yank back some other text. */
int
-rl_yank_pop (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_yank_pop (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
int l, n;
@@ -501,7 +517,9 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
{
register HIST_ENTRY *entry;
char *arg;
- int i;
+ int i, pos;
+
+ pos = where_history ();
if (history_skip)
{
@@ -510,30 +528,26 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
}
entry = previous_history ();
- if (entry)
- {
- if (history_skip)
- {
- for (i = 0; i < history_skip; i++)
- next_history ();
- }
- next_history ();
- }
- else
+
+ history_set_pos (pos);
+
+ if (entry == 0)
{
- ding ();
+ rl_ding ();
return -1;
}
arg = history_arg_extract (count, count, entry->line);
if (!arg || !*arg)
{
- ding ();
+ rl_ding ();
return -1;
}
rl_begin_undo_group ();
+ _rl_set_mark_at_pos (rl_point);
+
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
@@ -590,7 +604,7 @@ rl_yank_last_arg (count, key)
if (history_skip < 0)
history_skip = 0;
}
-
+
if (explicit_arg_p)
retval = rl_yank_nth_arg_internal (count_passed, key, history_skip);
else
@@ -601,7 +615,7 @@ rl_yank_last_arg (count, key)
}
/* A special paste command for users of Cygnus's cygwin32. */
-#if defined (__CYGWIN32__)
+#if defined (__CYGWIN__)
#include <windows.h>
int
@@ -621,12 +635,13 @@ rl_paste_from_clipboard (count, key)
if (ptr)
{
len = ptr - data;
- ptr = xmalloc (len + 1);
+ ptr = (char *)xmalloc (len + 1);
ptr[len] = '\0';
strncpy (ptr, data, len);
}
else
ptr = data;
+ _rl_set_mark_at_pos (rl_point);
rl_insert_text (ptr);
if (ptr != data)
free (ptr);
@@ -634,4 +649,4 @@ rl_paste_from_clipboard (count, key)
}
return (0);
}
-#endif /* __CYGWIN32__ */
+#endif /* __CYGWIN__ */
diff --git a/readline/macro.c b/readline/macro.c
index b4d7835c631..7ab4b6ca657 100644
--- a/readline/macro.c
+++ b/readline/macro.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,19 +46,8 @@
#include "readline.h"
#include "history.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
-/* Forward definitions. */
-void _rl_push_executing_macro (), _rl_pop_executing_macro ();
-void _rl_add_macro_char ();
-
-/* Extern declarations. */
-extern int rl_explicit_arg;
-extern int rl_key_sequence_length;
-
-extern void _rl_abort_internal ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlprivate.h"
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -66,12 +55,9 @@ extern char *xmalloc (), *xrealloc ();
/* */
/* **************************************************************** */
-/* Non-zero means to save keys that we dispatch on in a kbd macro. */
-int _rl_defining_kbd_macro = 0;
-
/* The currently executing macro string. If this is non-zero,
then it is a malloc ()'ed string where input is coming from. */
-char *_rl_executing_macro = (char *)NULL;
+char *rl_executing_macro = (char *)NULL;
/* The offset in the above string to the next character to be read. */
static int executing_macro_index;
@@ -90,7 +76,7 @@ static int current_macro_index;
It is a linked list of string/index for each saved macro. */
struct saved_macro {
struct saved_macro *next;
- const char *string;
+ char *string;
int sindex;
};
@@ -100,11 +86,13 @@ static struct saved_macro *macro_list = (struct saved_macro *)NULL;
/* Set up to read subsequent input from STRING.
STRING is free ()'ed when we are done with it. */
void
-_rl_with_macro_input (const char *string)
+_rl_with_macro_input (string)
+ char *string;
{
_rl_push_executing_macro ();
- _rl_executing_macro = (char*) string;
+ rl_executing_macro = string;
executing_macro_index = 0;
+ RL_SETSTATE(RL_STATE_MACROINPUT);
}
/* Return the next character available from a macro, or 0 if
@@ -112,16 +100,16 @@ _rl_with_macro_input (const char *string)
int
_rl_next_macro_key ()
{
- if (_rl_executing_macro == 0)
+ if (rl_executing_macro == 0)
return (0);
- if (_rl_executing_macro[executing_macro_index] == 0)
+ if (rl_executing_macro[executing_macro_index] == 0)
{
_rl_pop_executing_macro ();
return (_rl_next_macro_key ());
}
- return (_rl_executing_macro[executing_macro_index++]);
+ return (rl_executing_macro[executing_macro_index++]);
}
/* Save the currently executing macro on a stack of saved macros. */
@@ -133,7 +121,7 @@ _rl_push_executing_macro ()
saver = (struct saved_macro *)xmalloc (sizeof (struct saved_macro));
saver->next = macro_list;
saver->sindex = executing_macro_index;
- saver->string = _rl_executing_macro;
+ saver->string = rl_executing_macro;
macro_list = saver;
}
@@ -145,20 +133,21 @@ _rl_pop_executing_macro ()
{
struct saved_macro *macro;
- if (_rl_executing_macro)
- free (_rl_executing_macro);
-
- _rl_executing_macro = (char *)NULL;
+ FREE (rl_executing_macro);
+ rl_executing_macro = (char *)NULL;
executing_macro_index = 0;
if (macro_list)
{
macro = macro_list;
- _rl_executing_macro = (char*) macro_list->string;
+ rl_executing_macro = macro_list->string;
executing_macro_index = macro_list->sindex;
macro_list = macro_list->next;
free (macro);
}
+
+ if (rl_executing_macro == 0)
+ RL_UNSETSTATE(RL_STATE_MACROINPUT);
}
/* Add a character to the macro being built. */
@@ -169,9 +158,9 @@ _rl_add_macro_char (c)
if (current_macro_index + 1 >= current_macro_size)
{
if (current_macro == 0)
- current_macro = xmalloc (current_macro_size = 25);
+ current_macro = (char *)xmalloc (current_macro_size = 25);
else
- current_macro = xrealloc (current_macro, current_macro_size += 25);
+ current_macro = (char *)xrealloc (current_macro, current_macro_size += 25);
}
current_macro[current_macro_index++] = c;
@@ -188,14 +177,11 @@ _rl_kill_kbd_macro ()
}
current_macro_size = current_macro_index = 0;
- if (_rl_executing_macro)
- {
- free (_rl_executing_macro);
- _rl_executing_macro = (char *) NULL;
- }
+ FREE (rl_executing_macro);
+ rl_executing_macro = (char *) NULL;
executing_macro_index = 0;
- _rl_defining_kbd_macro = 0;
+ RL_UNSETSTATE(RL_STATE_MACRODEF);
}
/* Begin defining a keyboard macro.
@@ -205,10 +191,10 @@ _rl_kill_kbd_macro ()
definition to the end of the existing macro, and start by
re-executing the existing macro. */
int
-rl_start_kbd_macro (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_start_kbd_macro (ignore1, ignore2)
+ int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
{
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
{
_rl_abort_internal ();
return -1;
@@ -222,7 +208,7 @@ rl_start_kbd_macro (int count __attribute__((unused)),
else
current_macro_index = 0;
- _rl_defining_kbd_macro = 1;
+ RL_SETSTATE(RL_STATE_MACRODEF);
return 0;
}
@@ -230,9 +216,10 @@ rl_start_kbd_macro (int count __attribute__((unused)),
A numeric argument says to execute the macro right now,
that many times, counting the definition as the first time. */
int
-rl_end_kbd_macro (int count, int ignore __attribute__((unused)))
+rl_end_kbd_macro (count, ignore)
+ int count, ignore __attribute__((unused));
{
- if (_rl_defining_kbd_macro == 0)
+ if (RL_ISSTATE (RL_STATE_MACRODEF) == 0)
{
_rl_abort_internal ();
return -1;
@@ -241,7 +228,7 @@ rl_end_kbd_macro (int count, int ignore __attribute__((unused)))
current_macro_index -= rl_key_sequence_length - 1;
current_macro[current_macro_index] = '\0';
- _rl_defining_kbd_macro = 0;
+ RL_UNSETSTATE(RL_STATE_MACRODEF);
return (rl_call_last_kbd_macro (--count, 0));
}
@@ -249,14 +236,15 @@ rl_end_kbd_macro (int count, int ignore __attribute__((unused)))
/* Execute the most recently defined keyboard macro.
COUNT says how many times to execute it. */
int
-rl_call_last_kbd_macro (int count, int key __attribute__((unused)))
+rl_call_last_kbd_macro (count, ignore)
+ int count, ignore __attribute__((unused));
{
if (current_macro == 0)
_rl_abort_internal ();
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
{
- ding (); /* no recursive macros */
+ rl_ding (); /* no recursive macros */
current_macro[--current_macro_index] = '\0'; /* erase this char */
return 0;
}
diff --git a/readline/mbutil.c b/readline/mbutil.c
new file mode 100644
index 00000000000..1b7342bfc0b
--- /dev/null
+++ b/readline/mbutil.c
@@ -0,0 +1,337 @@
+/* mbutil.c -- readline multibyte character utility functions */
+
+/* Copyright (C) 2001 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#define READLINE_LIBRARY
+
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include "posixjmp.h"
+
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h> /* for _POSIX_VERSION */
+#endif /* HAVE_UNISTD_H */
+
+#if defined (HAVE_STDLIB_H)
+# include <stdlib.h>
+#else
+# include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+#include <stdio.h>
+#include <ctype.h>
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+#include "rlmbutil.h"
+
+#if defined (TIOCSTAT_IN_SYS_IOCTL)
+# include <sys/ioctl.h>
+#endif /* TIOCSTAT_IN_SYS_IOCTL */
+
+/* Some standard library routines. */
+#include "readline.h"
+
+#include "rlprivate.h"
+#include "xmalloc.h"
+
+/* Declared here so it can be shared between the readline and history
+ libraries. */
+#if defined (HANDLE_MULTIBYTE)
+int rl_byte_oriented = 0;
+#else
+int rl_byte_oriented = 1;
+#endif
+
+/* **************************************************************** */
+/* */
+/* Multibyte Character Utility Functions */
+/* */
+/* **************************************************************** */
+
+#if defined(HANDLE_MULTIBYTE)
+
+static int
+_rl_find_next_mbchar_internal (string, seed, count, find_non_zero)
+ char *string;
+ int seed, count, find_non_zero;
+{
+ size_t tmp = 0;
+ mbstate_t ps;
+ int point = 0;
+ wchar_t wc;
+
+ memset(&ps, 0, sizeof (mbstate_t));
+ if (seed < 0)
+ seed = 0;
+ if (count <= 0)
+ return seed;
+
+ point = seed + _rl_adjust_point(string, seed, &ps);
+ /* if this is true, means that seed was not pointed character
+ started byte. So correct the point and consume count */
+ if (seed < point)
+ count --;
+
+ while (count > 0)
+ {
+ tmp = mbrtowc (&wc, string+point, strlen(string + point), &ps);
+ if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2)
+ {
+ /* invalid bytes. asume a byte represents a character */
+ point++;
+ count--;
+ /* reset states. */
+ memset(&ps, 0, sizeof(mbstate_t));
+ }
+ else if (tmp == (size_t)0)
+ /* found '\0' char */
+ break;
+ else
+ {
+ /* valid bytes */
+ point += tmp;
+ if (find_non_zero)
+ {
+ if (wcwidth (wc) == 0)
+ continue;
+ else
+ count--;
+ }
+ else
+ count--;
+ }
+ }
+
+ if (find_non_zero)
+ {
+ tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
+ while (wcwidth (wc) == 0)
+ {
+ point += tmp;
+ tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
+ if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2))
+ break;
+ }
+ }
+ return point;
+}
+
+static int
+_rl_find_prev_mbchar_internal (string, seed, find_non_zero)
+ char *string;
+ int seed, find_non_zero;
+{
+ mbstate_t ps;
+ int prev, non_zero_prev, point, length;
+ size_t tmp;
+ wchar_t wc;
+
+ memset(&ps, 0, sizeof(mbstate_t));
+ length = strlen(string);
+
+ if (seed < 0)
+ return 0;
+ else if (length < seed)
+ return length;
+
+ prev = non_zero_prev = point = 0;
+ while (point < seed)
+ {
+ tmp = mbrtowc (&wc, string + point, length - point, &ps);
+ if ((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2)
+ {
+ /* in this case, bytes are invalid or shorted to compose
+ multibyte char, so assume that the first byte represents
+ a single character anyway. */
+ tmp = 1;
+ /* clear the state of the byte sequence, because
+ in this case effect of mbstate is undefined */
+ memset(&ps, 0, sizeof (mbstate_t));
+ }
+ else if (tmp == 0)
+ break; /* Found '\0' char. Can this happen? */
+ else
+ {
+ if (find_non_zero)
+ {
+ if (wcwidth (wc) != 0)
+ prev = point;
+ }
+ else
+ prev = point;
+ }
+
+ point += tmp;
+ }
+
+ return prev;
+}
+
+/* return the number of bytes parsed from the multibyte sequence starting
+ at src, if a non-L'\0' wide character was recognized. It returns 0,
+ if a L'\0' wide character was recognized. It returns (size_t)(-1),
+ if an invalid multibyte sequence was encountered. It returns (size_t)(-2)
+ if it couldn't parse a complete multibyte character. */
+int
+_rl_get_char_len (src, ps)
+ char *src;
+ mbstate_t *ps;
+{
+ size_t tmp;
+
+ tmp = mbrlen((const char *)src, (size_t)strlen (src), ps);
+ if (tmp == (size_t)(-2))
+ {
+ /* shorted to compose multibyte char */
+ memset (ps, 0, sizeof(mbstate_t));
+ return -2;
+ }
+ else if (tmp == (size_t)(-1))
+ {
+ /* invalid to compose multibyte char */
+ /* initialize the conversion state */
+ memset (ps, 0, sizeof(mbstate_t));
+ return -1;
+ }
+ else if (tmp == (size_t)0)
+ return 0;
+ else
+ return (int)tmp;
+}
+
+/* compare the specified two characters. If the characters matched,
+ return 1. Otherwise return 0. */
+int
+_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
+ char *buf1, *buf2;
+ mbstate_t *ps1, *ps2;
+ int pos1, pos2;
+{
+ int i, w1, w2;
+
+ if ((w1 = _rl_get_char_len (&buf1[pos1], ps1)) <= 0 ||
+ (w2 = _rl_get_char_len (&buf2[pos2], ps2)) <= 0 ||
+ (w1 != w2) ||
+ (buf1[pos1] != buf2[pos2]))
+ return 0;
+
+ for (i = 1; i < w1; i++)
+ if (buf1[pos1+i] != buf2[pos2+i])
+ return 0;
+
+ return 1;
+}
+
+/* adjust pointed byte and find mbstate of the point of string.
+ adjusted point will be point <= adjusted_point, and returns
+ differences of the byte(adjusted_point - point).
+ if point is invalied (point < 0 || more than string length),
+ it returns -1 */
+int
+_rl_adjust_point(string, point, ps)
+ char *string;
+ int point;
+ mbstate_t *ps;
+{
+ size_t tmp = 0;
+ int length;
+ int pos = 0;
+
+ length = strlen(string);
+ if (point < 0)
+ return -1;
+ if (length < point)
+ return -1;
+
+ while (pos < point)
+ {
+ tmp = mbrlen (string + pos, length - pos, ps);
+ if((size_t)(tmp) == (size_t)-1 || (size_t)(tmp) == (size_t)-2)
+ {
+ /* in this case, bytes are invalid or shorted to compose
+ multibyte char, so assume that the first byte represents
+ a single character anyway. */
+ pos++;
+ /* clear the state of the byte sequence, because
+ in this case effect of mbstate is undefined */
+ memset (ps, 0, sizeof (mbstate_t));
+ }
+ else
+ pos += tmp;
+ }
+
+ return (pos - point);
+}
+
+int
+_rl_is_mbchar_matched (string, seed, end, mbchar, length)
+ char *string;
+ int seed, end;
+ char *mbchar;
+ int length;
+{
+ int i;
+
+ if ((end - seed) < length)
+ return 0;
+
+ for (i = 0; i < length; i++)
+ if (string[seed + i] != mbchar[i])
+ return 0;
+ return 1;
+}
+#endif /* HANDLE_MULTIBYTE */
+
+/* Find next `count' characters started byte point of the specified seed.
+ If flags is MB_FIND_NONZERO, we look for non-zero-width multibyte
+ characters. */
+#undef _rl_find_next_mbchar
+int
+_rl_find_next_mbchar (string, seed, count, flags)
+ char *string __attribute__((unused));
+ int seed, count, flags __attribute__((unused));
+{
+#if defined (HANDLE_MULTIBYTE)
+ return _rl_find_next_mbchar_internal (string, seed, count, flags);
+#else
+ return (seed + count);
+#endif
+}
+
+/* Find previous character started byte point of the specified seed.
+ Returned point will be point <= seed. If flags is MB_FIND_NONZERO,
+ we look for non-zero-width multibyte characters. */
+#undef _rl_find_prev_mbchar
+int
+_rl_find_prev_mbchar (string, seed, flags)
+ char *string __attribute__((unused));
+ int seed, flags __attribute__((unused));
+{
+#if defined (HANDLE_MULTIBYTE)
+ return _rl_find_prev_mbchar_internal (string, seed, flags);
+#else
+ return ((seed == 0) ? seed : seed - 1);
+#endif
+}
diff --git a/readline/misc.c b/readline/misc.c
new file mode 100644
index 00000000000..94ad433473b
--- /dev/null
+++ b/readline/misc.c
@@ -0,0 +1,496 @@
+/* misc.c -- miscellaneous bindable readline functions. */
+
+/* Copyright (C) 1987-2002 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 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 */
+
+#if defined (HAVE_LOCALE_H)
+# include <locale.h>
+#endif
+
+#include <stdio.h>
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+#include "rlmbutil.h"
+
+/* Some standard library routines. */
+#include "readline.h"
+#include "history.h"
+
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
+static int rl_digit_loop PARAMS((void));
+static void _rl_history_set_point PARAMS((void));
+
+/* Forward declarations used in this file */
+void _rl_free_history_entry PARAMS((HIST_ENTRY *));
+
+/* If non-zero, rl_get_previous_history and rl_get_next_history attempt
+ to preserve the value of rl_point from line to line. */
+int _rl_history_preserve_point = 0;
+
+/* Saved target point for when _rl_history_preserve_point is set. Special
+ value of -1 means that point is at the end of the line. */
+int _rl_history_saved_point = -1;
+
+/* **************************************************************** */
+/* */
+/* Numeric Arguments */
+/* */
+/* **************************************************************** */
+
+/* Handle C-u style numeric args, as well as M--, and M-digits. */
+static int
+rl_digit_loop ()
+{
+ int key, c, sawminus, sawdigits;
+
+ rl_save_prompt ();
+
+ RL_SETSTATE(RL_STATE_NUMERICARG);
+ sawminus = sawdigits = 0;
+ while (1)
+ {
+ if (rl_numeric_arg > 1000000)
+ {
+ sawdigits = rl_explicit_arg = rl_numeric_arg = 0;
+ rl_ding ();
+ rl_restore_prompt ();
+ rl_clear_message ();
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ return 1;
+ }
+ rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ key = c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (c < 0)
+ {
+ _rl_abort_internal ();
+ return -1;
+ }
+
+ /* 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)
+ {
+ if (sawdigits == 0)
+ {
+ rl_numeric_arg *= 4;
+ continue;
+ }
+ else
+ {
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ key = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ rl_restore_prompt ();
+ rl_clear_message ();
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ 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 ();
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ return (_rl_dispatch (key, _rl_keymap));
+ }
+ }
+
+ /*NOTREACHED*/
+}
+
+/* Add the current digit to the argument in progress. */
+int
+rl_digit_argument (ignore, key)
+ int ignore __attribute__((unused)), key;
+{
+ rl_execute_next (key);
+ return (rl_digit_loop ());
+}
+
+/* What to do when you abort reading an argument. */
+int
+rl_discard_argument ()
+{
+ rl_ding ();
+ rl_clear_message ();
+ _rl_init_argument ();
+ return 0;
+}
+
+/* Create a default argument. */
+int
+_rl_init_argument ()
+{
+ rl_numeric_arg = rl_arg_sign = 1;
+ rl_explicit_arg = 0;
+ return 0;
+}
+
+/* C-u, universal argument. Multiply the current argument by 4.
+ Read a key. If the key has nothing to do with arguments, then
+ dispatch on it. If the key is the abort character then abort. */
+int
+rl_universal_argument (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_numeric_arg *= 4;
+ return (rl_digit_loop ());
+}
+
+/* **************************************************************** */
+/* */
+/* History Utilities */
+/* */
+/* **************************************************************** */
+
+/* We already have a history library, and that is what we use to control
+ the history features of readline. This is our local interface to
+ the history mechanism. */
+
+/* While we are editing the history, this is the saved
+ version of the original line. */
+HIST_ENTRY *_rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+
+/* Set the history pointer back to the last entry in the history. */
+void
+_rl_start_using_history ()
+{
+ using_history ();
+ if (_rl_saved_line_for_history)
+ _rl_free_history_entry (_rl_saved_line_for_history);
+
+ _rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+}
+
+/* Free the contents (and containing structure) of a HIST_ENTRY. */
+void
+_rl_free_history_entry (entry)
+ HIST_ENTRY *entry;
+{
+ if (entry == 0)
+ return;
+ if (entry->line)
+ free (entry->line);
+ free (entry);
+}
+
+/* Perhaps put back the current line if it has changed. */
+int
+rl_maybe_replace_line ()
+{
+ HIST_ENTRY *temp;
+
+ temp = current_history ();
+ /* If the current line has changed, save the changes. */
+ if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
+ {
+ temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
+ free (temp->line);
+ free (temp);
+ }
+ return 0;
+}
+
+/* Restore the _rl_saved_line_for_history if there is one. */
+int
+rl_maybe_unsave_line ()
+{
+ if (_rl_saved_line_for_history)
+ {
+ rl_replace_line (_rl_saved_line_for_history->line, 0);
+ rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data;
+ _rl_free_history_entry (_rl_saved_line_for_history);
+ _rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+ rl_point = rl_end; /* rl_replace_line sets rl_end */
+ }
+ else
+ rl_ding ();
+ return 0;
+}
+
+/* Save the current line in _rl_saved_line_for_history. */
+int
+rl_maybe_save_line ()
+{
+ if (_rl_saved_line_for_history == 0)
+ {
+ _rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
+ _rl_saved_line_for_history->line = savestring (rl_line_buffer);
+ _rl_saved_line_for_history->data = (char *)rl_undo_list;
+ }
+ return 0;
+}
+
+int
+_rl_free_saved_history_line ()
+{
+ if (_rl_saved_line_for_history)
+ {
+ _rl_free_history_entry (_rl_saved_line_for_history);
+ _rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+ }
+ return 0;
+}
+
+static void
+_rl_history_set_point ()
+{
+ rl_point = (_rl_history_preserve_point && _rl_history_saved_point != -1)
+ ? _rl_history_saved_point
+ : rl_end;
+ if (rl_point > rl_end)
+ rl_point = rl_end;
+
+#if defined (VI_MODE)
+ if (rl_editing_mode == vi_mode)
+ rl_point = 0;
+#endif /* VI_MODE */
+
+ if (rl_editing_mode == emacs_mode)
+ rl_mark = (rl_point == rl_end ? 0 : rl_end);
+}
+
+void
+rl_replace_from_history (entry, flags)
+ HIST_ENTRY *entry;
+ int flags __attribute__((unused)); /* currently unused */
+{
+ rl_replace_line (entry->line, 0);
+ rl_undo_list = (UNDO_LIST *)entry->data;
+ rl_point = rl_end;
+ rl_mark = 0;
+
+#if defined (VI_MODE)
+ if (rl_editing_mode == vi_mode)
+ {
+ rl_point = 0;
+ rl_mark = rl_end;
+ }
+#endif
+}
+
+/* **************************************************************** */
+/* */
+/* History Commands */
+/* */
+/* **************************************************************** */
+
+/* Meta-< goes to the start of the history. */
+int
+rl_beginning_of_history (count, key)
+ int count __attribute__((unused)), key;
+{
+ return (rl_get_previous_history (1 + where_history (), key));
+}
+
+/* Meta-> goes to the end of the history. (The current line). */
+int
+rl_end_of_history (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_maybe_replace_line ();
+ using_history ();
+ rl_maybe_unsave_line ();
+ return 0;
+}
+
+/* Move down to the next history line. */
+int
+rl_get_next_history (count, key)
+ int count, key;
+{
+ HIST_ENTRY *temp;
+
+ if (count < 0)
+ return (rl_get_previous_history (-count, key));
+
+ if (count == 0)
+ return 0;
+
+ rl_maybe_replace_line ();
+
+ /* either not saved by rl_newline or at end of line, so set appropriately. */
+ if (_rl_history_saved_point == -1 && (rl_point || rl_end))
+ _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
+
+ temp = (HIST_ENTRY *)NULL;
+ while (count)
+ {
+ temp = next_history ();
+ if (!temp)
+ break;
+ --count;
+ }
+
+ if (temp == 0)
+ rl_maybe_unsave_line ();
+ else
+ {
+ rl_replace_from_history (temp, 0);
+ _rl_history_set_point ();
+ }
+ return 0;
+}
+
+/* Get the previous item out of our interactive history, making it the current
+ line. If there is no previous history, just ding. */
+int
+rl_get_previous_history (count, key)
+ int count, key;
+{
+ HIST_ENTRY *old_temp, *temp;
+
+ if (count < 0)
+ return (rl_get_next_history (-count, key));
+
+ if (count == 0)
+ return 0;
+
+ /* either not saved by rl_newline or at end of line, so set appropriately. */
+ if (_rl_history_saved_point == -1 && (rl_point || rl_end))
+ _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
+
+ /* If we don't have a line saved, then save this one. */
+ rl_maybe_save_line ();
+
+ /* If the current line has changed, save the changes. */
+ rl_maybe_replace_line ();
+
+ temp = old_temp = (HIST_ENTRY *)NULL;
+ while (count)
+ {
+ temp = previous_history ();
+ if (temp == 0)
+ break;
+
+ old_temp = temp;
+ --count;
+ }
+
+ /* If there was a large argument, and we moved back to the start of the
+ history, that is not an error. So use the last value found. */
+ if (!temp && old_temp)
+ temp = old_temp;
+
+ if (temp == 0)
+ rl_ding ();
+ else
+ {
+ rl_replace_from_history (temp, 0);
+ _rl_history_set_point ();
+ }
+ return 0;
+}
+
+/* **************************************************************** */
+/* */
+/* Editing Modes */
+/* */
+/* **************************************************************** */
+/* How to toggle back and forth between editing modes. */
+int
+rl_vi_editing_mode (count, key)
+ int count __attribute__((unused)), key;
+{
+#if defined (VI_MODE)
+ _rl_set_insert_mode (RL_IM_INSERT, 1); /* vi mode ignores insert mode */
+ rl_editing_mode = vi_mode;
+ rl_vi_insertion_mode (1, key);
+#endif /* VI_MODE */
+
+ return 0;
+}
+
+int
+rl_emacs_editing_mode (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_editing_mode = emacs_mode;
+ _rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */
+ _rl_keymap = emacs_standard_keymap;
+ return 0;
+}
+
+/* Function for the rest of the library to use to set insert/overwrite mode. */
+void
+_rl_set_insert_mode (im, force)
+ int im, force __attribute__((unused));
+{
+#ifdef CURSOR_MODE
+ _rl_set_cursor (im, force);
+#endif
+
+ rl_insert_mode = im;
+}
+
+/* Toggle overwrite mode. A positive explicit argument selects overwrite
+ mode. A negative or zero explicit argument selects insert mode. */
+int
+rl_overwrite_mode (count, key)
+ int count, key __attribute__((unused));
+{
+ if (rl_explicit_arg == 0)
+ _rl_set_insert_mode (rl_insert_mode ^ 1, 0);
+ else if (count > 0)
+ _rl_set_insert_mode (RL_IM_OVERWRITE, 0);
+ else
+ _rl_set_insert_mode (RL_IM_INSERT, 0);
+
+ return 0;
+}
diff --git a/readline/nls.c b/readline/nls.c
index f2d413d59d5..706c8195c10 100644
--- a/readline/nls.c
+++ b/readline/nls.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -27,6 +27,8 @@
#include <sys/types.h>
+#include <stdio.h>
+
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -44,13 +46,9 @@
#include <ctype.h>
#include "rldefs.h"
-
-extern int _rl_convert_meta_chars_to_ascii;
-extern int _rl_output_meta_chars;
-extern int _rl_meta_flag;
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
+#include "readline.h"
+#include "rlshell.h"
+#include "rlprivate.h"
#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
@@ -70,12 +68,11 @@ static char *legal_lang_values[] =
"iso88599",
"iso885910",
"koi8r",
- "koi8-r",
0
};
-static char *normalize_codeset ();
-static char *find_codeset ();
+static char *normalize_codeset PARAMS((char *));
+static char *find_codeset PARAMS((char *, size_t *));
#endif /* !HAVE_SETLOCALE */
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
@@ -108,9 +105,9 @@ _rl_init_eightbit ()
/* 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");
+ lspec = sh_get_env_value ("LC_ALL");
+ if (lspec == 0) lspec = sh_get_env_value ("LC_CTYPE");
+ if (lspec == 0) lspec = sh_get_env_value ("LANG");
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
return (0);
for (i = 0; t && legal_lang_values[i]; i++)
@@ -144,10 +141,10 @@ normalize_codeset (codeset)
all_digits = 1;
for (len = 0, i = 0; i < namelen; i++)
{
- if (isalnum (codeset[i]))
+ if (ISALNUM ((unsigned char)codeset[i]))
{
len++;
- all_digits &= isdigit (codeset[i]);
+ all_digits &= _rl_digit_p (codeset[i]);
}
}
@@ -165,9 +162,9 @@ normalize_codeset (codeset)
}
for (i = 0; i < namelen; i++)
- if (isalpha (codeset[i]))
- *wp++ = (isupper (codeset[i])) ? tolower (codeset[i]) : codeset[i];
- else if (isdigit (codeset[i]))
+ if (ISALPHA ((unsigned char)codeset[i]))
+ *wp++ = _rl_to_lower (codeset[i]);
+ else if (_rl_digit_p (codeset[i]))
*wp++ = codeset[i];
*wp = '\0';
diff --git a/readline/parens.c b/readline/parens.c
index a500c0afac7..54ef1f3695f 100644
--- a/readline/parens.c
+++ b/readline/parens.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,23 +18,11 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "rlconf.h"
-#if !defined (PAREN_MATCHING)
-extern int rl_insert ();
-
-int
-rl_insert_close (count, invoking_key)
- int count, invoking_key;
-{
- return (rl_insert (count, invoking_key));
-}
-
-#else /* PAREN_MATCHING */
-
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@@ -42,6 +30,10 @@ rl_insert_close (count, invoking_key)
#include <stdio.h>
#include <sys/types.h>
+#if defined (HAVE_UNISTD_H)
+# include <unistd.h>
+#endif
+
#if defined (FD_SET) && !defined (HAVE_SELECT)
# define HAVE_SELECT
#endif
@@ -64,8 +56,9 @@ extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#include "readline.h"
+#include "rlprivate.h"
-extern int rl_explicit_arg;
+static int find_matching_open PARAMS((char *, int, int));
/* Non-zero means try to blink the matching open parenthesis when the
close parenthesis is inserted. */
@@ -75,14 +68,46 @@ int rl_blink_matching_paren = 1;
int rl_blink_matching_paren = 0;
#endif /* !HAVE_SELECT */
-static int find_matching_open ();
+static int _paren_blink_usec = 500000;
+
+/* Change emacs_standard_keymap to have bindings for paren matching when
+ ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */
+void
+_rl_enable_paren_matching (on_or_off)
+ int on_or_off;
+{
+ if (on_or_off)
+ { /* ([{ */
+ rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap);
+ rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap);
+ rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap);
+ }
+ else
+ { /* ([{ */
+ rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap);
+ rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap);
+ rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap);
+ }
+}
+
+int
+rl_set_paren_blink_timeout (u)
+ int u;
+{
+ int o;
+
+ o = _paren_blink_usec;
+ if (u > 0)
+ _paren_blink_usec = u;
+ return (o);
+}
int
rl_insert_close (count, invoking_key)
int count, invoking_key;
{
if (rl_explicit_arg || !rl_blink_matching_paren)
- rl_insert (count, invoking_key);
+ _rl_insert_char (count, invoking_key);
else
{
#if defined (HAVE_SELECT)
@@ -90,7 +115,7 @@ rl_insert_close (count, invoking_key)
struct timeval timer;
fd_set readfds;
- rl_insert (1, invoking_key);
+ _rl_insert_char (1, invoking_key);
(*rl_redisplay_function) ();
match_point =
find_matching_open (rl_line_buffer, rl_point - 2, invoking_key);
@@ -102,7 +127,7 @@ rl_insert_close (count, invoking_key)
FD_ZERO (&readfds);
FD_SET (fileno (rl_instream), &readfds);
timer.tv_sec = 0;
- timer.tv_usec = 500000;
+ timer.tv_usec = _paren_blink_usec;
orig_point = rl_point;
rl_point = match_point;
@@ -110,7 +135,7 @@ rl_insert_close (count, invoking_key)
ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
rl_point = orig_point;
#else /* !HAVE_SELECT */
- rl_insert (count, invoking_key);
+ _rl_insert_char (count, invoking_key);
#endif /* !HAVE_SELECT */
}
return 0;
@@ -152,5 +177,3 @@ find_matching_open (string, from, closer)
}
return (i);
}
-
-#endif /* PAREN_MATCHING */
diff --git a/readline/posixdir.h b/readline/posixdir.h
index 7480a93d5db..505e27954f1 100644
--- a/readline/posixdir.h
+++ b/readline/posixdir.h
@@ -6,7 +6,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
@@ -46,4 +46,12 @@
# define d_fileno d_ino
#endif
+#if defined (_POSIX_SOURCE) && (!defined (STRUCT_DIRENT_HAS_D_INO) || defined (BROKEN_DIRENT_D_INO))
+/* Posix does not require that the d_ino field be present, and some
+ systems do not provide it. */
+# define REAL_DIR_ENTRY(dp) 1
+#else
+# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
+#endif /* _POSIX_SOURCE */
+
#endif /* !_POSIXDIR_H_ */
diff --git a/readline/posixjmp.h b/readline/posixjmp.h
index 1347cc07ebc..b52aa00332b 100644
--- a/readline/posixjmp.h
+++ b/readline/posixjmp.h
@@ -1,5 +1,23 @@
/* posixjmp.h -- wrapper for setjmp.h with changes for POSIX systems. */
+/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
+
+ This file is part of GNU Bash, the Bourne Again SHell.
+
+ Bash is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ Bash is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Bash; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
#ifndef _POSIXJMP_H_
#define _POSIXJMP_H_
diff --git a/readline/posixstat.h b/readline/posixstat.h
index bfce8c04fef..c93b52887e9 100644
--- a/readline/posixstat.h
+++ b/readline/posixstat.h
@@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* This file should be included instead of <sys/stat.h>.
It relies on the local sys/stat.h to work though. */
diff --git a/readline/readline.c b/readline/readline.c
index 1da73250773..28801f19dfc 100644
--- a/readline/readline.c
+++ b/readline/readline.c
@@ -1,14 +1,14 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2002 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
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -47,12 +47,12 @@
# include <locale.h>
#endif
-#include <signal.h>
#include <stdio.h>
#include "posixjmp.h"
/* System-specific feature definitions and include files. */
#include "rldefs.h"
+#include "rlmbutil.h"
#if defined (__EMX__)
# define INCL_DOSPROCESS
@@ -63,117 +63,28 @@
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#ifndef RL_LIBRARY_VERSION
-# define RL_LIBRARY_VERSION "4.0"
+# define RL_LIBRARY_VERSION "4.3"
#endif
-/* Evaluates its arguments multiple times. */
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
-/* NOTE: Functions and variables prefixed with `_rl_' are
- pseudo-global: they are global so they can be shared
- between files in the readline library, but are not intended
- to be visible to readline callers. */
-
-/* Variables and functions imported from terminal.c */
-extern int _rl_init_terminal_io ();
-extern void _rl_enable_meta_key ();
-#ifdef _MINIX
-extern void _rl_output_character_function ();
-#else
-extern int _rl_output_character_function ();
+#ifndef RL_READLINE_VERSION
+# define RL_READLINE_VERSION 0x0403
#endif
-extern int _rl_enable_meta;
-extern int _rl_term_autowrap;
-extern int screenwidth, screenheight, screenchars;
-
-/* Variables and functions imported from rltty.c. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-extern void rltty_set_default_bindings ();
-
-/* Functions imported from util.c. */
-extern void _rl_abort_internal ();
-extern void rl_extend_line_buffer ();
-extern int alphabetic ();
-
-/* Functions imported from bind.c. */
-extern void _rl_bind_if_unbound ();
-
-/* Functions imported from input.c. */
-extern int _rl_any_typein ();
-extern void _rl_insert_typein ();
-extern int rl_read_key ();
-
-/* Functions imported from nls.c */
-extern int _rl_init_eightbit ();
-
-/* Functions imported from shell.c */
-extern char *get_env_value ();
-
-/* External redisplay functions and variables from display.c */
-extern void _rl_move_vert ();
-extern void _rl_update_final ();
-extern void _rl_clear_to_eol ();
-extern void _rl_clear_screen ();
-extern void _rl_erase_entire_line ();
-
-extern void _rl_erase_at_end_of_line ();
-extern void _rl_move_cursor_relative ();
-
-extern int _rl_vis_botlin;
-extern int _rl_last_c_pos;
-extern int _rl_horizontal_scroll_mode;
-extern int rl_display_fixed;
-extern int _rl_suppress_redisplay;
-extern char *rl_display_prompt;
-
-/* Variables imported from complete.c. */
-extern const char *rl_completer_word_break_characters;
-extern const char *rl_basic_word_break_characters;
-extern int rl_completion_query_items;
-extern int rl_complete_with_tilde_expansion;
-
-/* Variables and functions from macro.c. */
-extern void _rl_add_macro_char ();
-extern void _rl_with_macro_input ();
-extern int _rl_next_macro_key ();
-extern int _rl_defining_kbd_macro;
-
-#if defined (VI_MODE)
-/* Functions imported from vi_mode.c. */
-extern void _rl_vi_set_last ();
-extern void _rl_vi_reset_last ();
-extern void _rl_vi_done_inserting ();
-extern int _rl_vi_textmod_command ();
-extern void _rl_vi_initialize_line ();
-#endif /* VI_MODE */
-
-extern UNDO_LIST *rl_undo_list;
-extern int _rl_doing_an_undo;
+extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
/* Forward declarations used in this file. */
-void _rl_free_history_entry ();
-
-int _rl_dispatch ();
-int _rl_init_argument ();
-
-static char *readline_internal ();
-static void readline_initialize_everything ();
-static void start_using_history ();
-static void bind_arrow_keys ();
-
-#if !defined (__GO32__)
-static void readline_default_bindings ();
-#endif /* !__GO32__ */
+static char *readline_internal PARAMS((void));
+static void readline_initialize_everything PARAMS((void));
-#if defined (__GO32__)
-# include <go32.h>
-# include <pc.h>
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
+static void bind_arrow_keys_internal PARAMS((Keymap));
+static void bind_arrow_keys PARAMS((void));
-extern char *xmalloc (), *xrealloc ();
+static void readline_default_bindings PARAMS((void));
/* **************************************************************** */
/* */
@@ -183,6 +94,11 @@ extern char *xmalloc (), *xrealloc ();
const char *rl_library_version = RL_LIBRARY_VERSION;
+int rl_readline_version = RL_READLINE_VERSION;
+
+/* True if this is `real' readline as opposed to some stub substitute. */
+int rl_gnu_readline_p = 1;
+
/* A pointer to the keymap that is currently in use.
By default, it is the standard emacs keymap. */
Keymap _rl_keymap = emacs_standard_keymap;
@@ -190,6 +106,9 @@ Keymap _rl_keymap = emacs_standard_keymap;
/* The current style of editing. */
int rl_editing_mode = emacs_mode;
+/* The current insert mode: input (the default) or overwrite */
+int rl_insert_mode = RL_IM_DEFAULT;
+
/* 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. */
@@ -210,8 +129,13 @@ int rl_arg_sign = 1;
/* Non-zero means we have been called at least once before. */
static int rl_initialized;
+#if 0
/* If non-zero, this program is running in an EMACS buffer. */
static int running_in_emacs;
+#endif
+
+/* Flags word encapsulating the current readline state. */
+int rl_readline_state = RL_STATE_NONE;
/* The current offset in the current input line. */
int rl_point;
@@ -226,7 +150,7 @@ int rl_end;
int rl_done;
/* The last function executed by readline. */
-Function *rl_last_func = (Function *)NULL;
+rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;
/* Top level environment for readline_internal (). */
procenv_t readline_top_level;
@@ -238,24 +162,31 @@ FILE *_rl_in_stream, *_rl_out_stream;
FILE *rl_instream = (FILE *)NULL;
FILE *rl_outstream = (FILE *)NULL;
-/* Non-zero means echo characters as they are read. */
-int readline_echoing_p = 1;
+/* Non-zero means echo characters as they are read. Defaults to no echo;
+ set to 1 if there is a controlling terminal, we can get its attributes,
+ and the attributes include `echo'. Look at rltty.c:prepare_terminal_settings
+ for the code that sets it. */
+int readline_echoing_p = 0;
/* Current prompt. */
-char *rl_prompt;
+char *rl_prompt = (char *)NULL;
int rl_visible_prompt_length = 0;
+/* Set to non-zero by calling application if it has already printed rl_prompt
+ and does not want readline to do it the first time. */
+int rl_already_prompted = 0;
+
/* The number of characters read in order to type this complete command. */
int rl_key_sequence_length = 0;
/* If non-zero, then this is the address of a function to call just
before readline_internal_setup () prints the first prompt. */
-Function *rl_startup_hook = (Function *)NULL;
+rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL;
/* If non-zero, this is the address of a function to call just before
readline_internal_setup () returns and readline_internal starts
reading input characters. */
-Function *rl_pre_input_hook = (Function *)NULL;
+rl_hook_func_t *rl_pre_input_hook = (rl_hook_func_t *)NULL;
/* What we use internally. You should always refer to RL_LINE_BUFFER. */
static char *the_line;
@@ -268,7 +199,7 @@ int _rl_eof_char = CTRL ('D');
int rl_pending_input = 0;
/* Pointer to a useful terminal name. */
-char *rl_terminal_name = (char *)NULL;
+const char *rl_terminal_name = (const char *)NULL;
/* Non-zero means to always use horizontal scrolling in line display. */
int _rl_horizontal_scroll_mode = 0;
@@ -280,7 +211,7 @@ int _rl_mark_modified_lines = 0;
/* The style of `bell' notification preferred. This can be set to NO_BELL,
AUDIBLE_BELL, or VISIBLE_BELL. */
int _rl_bell_preference = AUDIBLE_BELL;
-
+
/* String inserted into the line by rl_insert_comment (). */
char *_rl_comment_begin;
@@ -290,11 +221,15 @@ Keymap rl_executing_keymap;
/* Non-zero means to erase entire line, including prompt, on empty input lines. */
int rl_erase_empty_line = 0;
+/* Non-zero means to read only this many characters rather than up to a
+ character bound to accept-line. */
+int rl_num_chars_to_read;
+
/* Line buffer and maintenence. */
char *rl_line_buffer = (char *)NULL;
int rl_line_buffer_len = 0;
-/* Forward declarations used by the display and termcap code. */
+/* Forward declarations used by the display, termcap, and history code. */
/* **************************************************************** */
/* */
@@ -324,24 +259,35 @@ int _rl_output_meta_chars = 0;
/* Non-zero means treat 0200 bit in terminal input as Meta bit. */
int _rl_meta_flag = 0; /* Forward declaration */
+/* Set up the prompt and expand it. Called from readline() and
+ rl_callback_handler_install (). */
+int
+rl_set_prompt (prompt)
+ const char *prompt;
+{
+ FREE (rl_prompt);
+ rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
+
+ rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
+ return 0;
+}
+
/* Read a line of input. Prompt with PROMPT. An empty PROMPT means
none. A return value of NULL means that EOF was encountered. */
char *
readline (prompt)
- char *prompt;
+ const char *prompt;
{
char *value;
- rl_prompt = prompt;
-
/* If we are at EOF return a NULL string. */
if (rl_pending_input == EOF)
{
- rl_pending_input = 0;
+ rl_clear_pending_input ();
return ((char *)NULL);
}
- rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
+ rl_set_prompt (prompt);
rl_initialize ();
(*rl_prep_term_function) (_rl_meta_flag);
@@ -369,29 +315,40 @@ readline (prompt)
STATIC_CALLBACK void
readline_internal_setup ()
{
+ char *nprompt;
+
_rl_in_stream = rl_instream;
_rl_out_stream = rl_outstream;
if (rl_startup_hook)
(*rl_startup_hook) ();
- if (readline_echoing_p == 0)
+ /* If we're not echoing, we still want to at least print a prompt, because
+ rl_redisplay will not do it for us. If the calling application has a
+ custom redisplay function, though, let that function handle it. */
+ if (readline_echoing_p == 0 && rl_redisplay_function == rl_redisplay)
{
- if (rl_prompt)
+ if (rl_prompt && rl_already_prompted == 0)
{
- fprintf (_rl_out_stream, "%s", rl_prompt);
+ nprompt = _rl_strip_prompt (rl_prompt);
+ fprintf (_rl_out_stream, "%s", nprompt);
fflush (_rl_out_stream);
+ free (nprompt);
}
}
else
{
- rl_on_new_line ();
+ if (rl_prompt && rl_already_prompted)
+ rl_on_new_line_with_prompt ();
+ else
+ rl_on_new_line ();
(*rl_redisplay_function) ();
+ }
+
#if defined (VI_MODE)
- if (rl_editing_mode == vi_mode)
- rl_vi_insertion_mode (1, 0);
+ if (rl_editing_mode == vi_mode)
+ rl_vi_insertion_mode (1, 0);
#endif /* VI_MODE */
- }
if (rl_pre_input_hook)
(*rl_pre_input_hook) ();
@@ -422,7 +379,10 @@ readline_internal_teardown (eof)
/* At any rate, it is highly likely that this line has an undo list. Get
rid of it now. */
if (rl_undo_list)
- free_undo_list ();
+ rl_free_undo_list ();
+
+ /* Restore normal cursor, if available. */
+ _rl_set_insert_mode (RL_IM_INSERT, 0);
return (eof ? (char *)NULL : savestring (the_line));
}
@@ -458,7 +418,9 @@ readline_internal_charloop ()
rl_key_sequence_length = 0;
}
+ RL_SETSTATE(RL_STATE_READCMD);
c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_READCMD);
/* EOF typed to a non-blank line is a <NL>. */
if (c == EOF && rl_end)
@@ -469,6 +431,7 @@ readline_internal_charloop ()
if (((c == _rl_eof_char && lastc != c) || c == EOF) && !rl_end)
{
#if defined (READLINE_CALLBACKS)
+ RL_SETSTATE(RL_STATE_DONE);
return (rl_done = 1);
#else
eof_found = 1;
@@ -477,7 +440,7 @@ readline_internal_charloop ()
}
lastc = c;
- _rl_dispatch (c, _rl_keymap);
+ _rl_dispatch ((unsigned char)c, _rl_keymap);
/* If there was no change in _rl_last_command_was_kill, then no kill
has taken place. Note that if input is pending we are reading
@@ -492,6 +455,12 @@ readline_internal_charloop ()
rl_vi_check ();
#endif /* VI_MODE */
+ if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
+ {
+ (*rl_redisplay_function) ();
+ rl_newline (1, '\n');
+ }
+
if (rl_done == 0)
(*rl_redisplay_function) ();
@@ -538,7 +507,7 @@ readline_internal ()
void
_rl_init_line_state ()
{
- rl_point = rl_end = 0;
+ rl_point = rl_end = rl_mark = 0;
the_line = rl_line_buffer;
the_line[0] = 0;
}
@@ -557,15 +526,24 @@ _rl_dispatch (key, map)
register int key;
Keymap map;
{
+ return _rl_dispatch_subseq (key, map, 0);
+}
+
+int
+_rl_dispatch_subseq (key, map, got_subseq)
+ register int key;
+ Keymap map;
+ int got_subseq;
+{
int r, newkey;
char *macro;
- Function *func;
+ rl_command_func_t *func;
if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii)
{
if (map[ESC].type == ISKMAP)
{
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
_rl_add_macro_char (ESC);
map = FUNCTION_TO_KEYMAP (map, ESC);
key = UNMETA (key);
@@ -573,11 +551,11 @@ _rl_dispatch (key, map)
return (_rl_dispatch (key, map));
}
else
- ding ();
+ rl_ding ();
return 0;
}
- if (_rl_defining_kbd_macro)
+ if (RL_ISSTATE (RL_STATE_MACRODEF))
_rl_add_macro_char (key);
r = 0;
@@ -585,7 +563,7 @@ _rl_dispatch (key, map)
{
case ISFUNC:
func = map[key].function;
- if (func != (Function *)NULL)
+ if (func)
{
/* Special case rl_do_lowercase_version (). */
if (func == rl_do_lowercase_version)
@@ -598,15 +576,34 @@ _rl_dispatch (key, map)
#endif
rl_dispatching = 1;
+ RL_SETSTATE(RL_STATE_DISPATCHING);
r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
+ RL_UNSETSTATE(RL_STATE_DISPATCHING);
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 && map[key].function != rl_digit_argument)
+ if (rl_pending_input == 0 && map[key].function != rl_digit_argument)
rl_last_func = map[key].function;
}
+ else if (map[ANYOTHERKEY].function)
+ {
+ /* OK, there's no function bound in this map, but there is a
+ shadow function that was overridden when the current keymap
+ was created. Return -2 to note that. */
+ _rl_unget_char (key);
+ return -2;
+ }
+ else if (got_subseq)
+ {
+ /* Return -1 to note that we're in a subsequence, but we don't
+ have a matching key, nor was one overridden. This means
+ we need to back up the recursion chain and find the last
+ subsequence that is bound to a function. */
+ _rl_unget_char (key);
+ return -1;
+ }
else
{
_rl_abort_internal ();
@@ -615,11 +612,59 @@ _rl_dispatch (key, map)
break;
case ISKMAP:
- if (map[key].function != (Function *)NULL)
+ if (map[key].function != 0)
{
+#if defined (VI_MODE)
+ /* The only way this test will be true is if a subsequence has been
+ bound starting with ESC, generally the arrow keys. What we do is
+ check whether there's input in the queue, which there generally
+ will be if an arrow key has been pressed, and, if there's not,
+ just dispatch to (what we assume is) rl_vi_movement_mode right
+ away. This is essentially an input test with a zero timeout. */
+ if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap
+ && _rl_input_queued (0) == 0)
+ return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)));
+#endif
+
rl_key_sequence_length++;
+
+ if (key == ESC)
+ RL_SETSTATE(RL_STATE_METANEXT);
+ RL_SETSTATE(RL_STATE_MOREINPUT);
newkey = rl_read_key ();
- r = _rl_dispatch (newkey, FUNCTION_TO_KEYMAP (map, key));
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (key == ESC)
+ RL_UNSETSTATE(RL_STATE_METANEXT);
+
+ if (newkey < 0)
+ {
+ _rl_abort_internal ();
+ return -1;
+ }
+
+ r = _rl_dispatch_subseq (newkey, FUNCTION_TO_KEYMAP (map, key), got_subseq || map[ANYOTHERKEY].function);
+
+ if (r == -2)
+ /* We didn't match anything, and the keymap we're indexed into
+ shadowed a function previously bound to that prefix. Call
+ the function. The recursive call to _rl_dispatch_subseq has
+ already taken care of pushing any necessary input back onto
+ the input queue with _rl_unget_char. */
+ r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key));
+ else if (r && map[ANYOTHERKEY].function)
+ {
+ /* We didn't match (r is probably -1), so return something to
+ tell the caller that it should try ANYOTHERKEY for an
+ overridden function. */
+ _rl_unget_char (key);
+ return -2;
+ }
+ else if (r && got_subseq)
+ {
+ /* OK, back up the chain. */
+ _rl_unget_char (key);
+ return -1;
+ }
}
else
{
@@ -629,7 +674,7 @@ _rl_dispatch (key, map)
break;
case ISMACR:
- if (map[key].function != (Function *)NULL)
+ if (map[key].function != 0)
{
macro = savestring ((char *)map[key].function);
_rl_with_macro_input (macro);
@@ -659,8 +704,11 @@ rl_initialize ()
terminal and data structures. */
if (!rl_initialized)
{
+ RL_SETSTATE(RL_STATE_INITIALIZING);
readline_initialize_everything ();
+ RL_UNSETSTATE(RL_STATE_INITIALIZING);
rl_initialized++;
+ RL_SETSTATE(RL_STATE_INITIALIZED);
}
/* Initalize the current line information. */
@@ -668,15 +716,16 @@ rl_initialize ()
/* We aren't done yet. We haven't even gotten started yet! */
rl_done = 0;
+ RL_UNSETSTATE(RL_STATE_DONE);
/* Tell the history routines what is going on. */
- start_using_history ();
+ _rl_start_using_history ();
/* Make the display buffer match the state of the line. */
rl_reset_line_state ();
/* No such function typed yet. */
- rl_last_func = (Function *)NULL;
+ rl_last_func = (rl_command_func_t *)NULL;
/* Parsing of key-bindings begins in an enabled state. */
_rl_parsing_conditionalized_out = 0;
@@ -686,9 +735,13 @@ rl_initialize ()
_rl_vi_initialize_line ();
#endif
+ /* Each line starts in insert mode (the default). */
+ _rl_set_insert_mode (RL_IM_DEFAULT, 1);
+
return 0;
}
+#if 0
#if defined (__EMX__)
static void
_emx_build_environ ()
@@ -712,18 +765,23 @@ _emx_build_environ ()
*tp = 0;
}
#endif /* __EMX__ */
+#endif
/* Initialize the entire state of the world. */
static void
readline_initialize_everything ()
{
+#if 0
#if defined (__EMX__)
if (environ == 0)
_emx_build_environ ();
#endif
+#endif
- /* Find out if we are running in Emacs. */
- running_in_emacs = get_env_value ("EMACS") != (char *)0;
+#if 0
+ /* Find out if we are running in Emacs -- UNUSED. */
+ running_in_emacs = sh_get_env_value ("EMACS") != (char *)0;
+#endif
/* Set up input and output if they are not already set up. */
if (!rl_instream)
@@ -740,30 +798,30 @@ readline_initialize_everything ()
/* Allocate data structures. */
if (rl_line_buffer == 0)
- rl_line_buffer = xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
+ rl_line_buffer = (char *)xmalloc (rl_line_buffer_len = DEFAULT_BUFFER_SIZE);
/* Initialize the terminal interface. */
- _rl_init_terminal_io ((char *)NULL);
+ if (rl_terminal_name == 0)
+ rl_terminal_name = sh_get_env_value ("TERM");
+ _rl_init_terminal_io (rl_terminal_name);
-#if !defined (__GO32__)
/* Bind tty characters to readline functions. */
readline_default_bindings ();
-#endif /* !__GO32__ */
/* Initialize the function names. */
rl_initialize_funmap ();
/* Decide whether we should automatically go into eight-bit mode. */
_rl_init_eightbit ();
-
+
/* Read in the init file. */
rl_read_init_file ((char *)NULL);
/* XXX */
if (_rl_horizontal_scroll_mode && _rl_term_autowrap)
{
- screenwidth--;
- screenchars -= screenheight;
+ _rl_screenwidth--;
+ _rl_screenchars -= _rl_screenheight;
}
/* Override the effect of any `set keymap' assignments in the
@@ -789,1367 +847,127 @@ readline_initialize_everything ()
static void
readline_default_bindings ()
{
- rltty_set_default_bindings (_rl_keymap);
-}
-
-static void
-bind_arrow_keys_internal ()
-{
- Function *f;
-
- f = rl_function_of_keyseq ("\033[A", _rl_keymap, (int *)NULL);
- if (!f || f == rl_do_lowercase_version)
- {
- _rl_bind_if_unbound ("\033[A", rl_get_previous_history);
- _rl_bind_if_unbound ("\033[B", rl_get_next_history);
- _rl_bind_if_unbound ("\033[C", rl_forward);
- _rl_bind_if_unbound ("\033[D", rl_backward);
- }
-
- f = rl_function_of_keyseq ("\033OA", _rl_keymap, (int *)NULL);
- if (!f || f == rl_do_lowercase_version)
- {
- _rl_bind_if_unbound ("\033OA", rl_get_previous_history);
- _rl_bind_if_unbound ("\033OB", rl_get_next_history);
- _rl_bind_if_unbound ("\033OC", rl_forward);
- _rl_bind_if_unbound ("\033OD", rl_backward);
- }
+ rl_tty_set_default_bindings (_rl_keymap);
}
-/* Try and bind the common arrow key prefix after giving termcap and
- the inputrc file a chance to bind them and create `real' keymaps
- for the arrow key prefix. */
+/* Bind some common arrow key sequences in MAP. */
static void
-bind_arrow_keys ()
+bind_arrow_keys_internal (map)
+ Keymap map;
{
Keymap xkeymap;
xkeymap = _rl_keymap;
+ _rl_keymap = map;
- _rl_keymap = emacs_standard_keymap;
- bind_arrow_keys_internal ();
-
-#if defined (VI_MODE)
- _rl_keymap = vi_movement_keymap;
- bind_arrow_keys_internal ();
-#endif
-
- _rl_keymap = xkeymap;
-}
-
-
-/* **************************************************************** */
-/* */
-/* Numeric Arguments */
-/* */
-/* **************************************************************** */
-
-/* Handle C-u style numeric args, as well as M--, and M-digits. */
-static int
-rl_digit_loop ()
-{
- int key, c, sawminus, sawdigits;
-
- rl_save_prompt ();
-
- sawminus = sawdigits = 0;
- while (1)
- {
- if (rl_numeric_arg > 1000000)
- {
- sawdigits = rl_explicit_arg = rl_numeric_arg = 0;
- ding ();
- rl_restore_prompt ();
- rl_clear_message ();
- return 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)
- {
- if (sawdigits == 0)
- {
- rl_numeric_arg *= 4;
- continue;
- }
- else
- {
- 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;
-}
-
-/* Add the current digit to the argument in progress. */
-int
-rl_digit_argument (ignore, key)
- int ignore __attribute__((unused)), key;
-{
- rl_pending_input = key;
- return (rl_digit_loop ());
-}
-
-/* What to do when you abort reading an argument. */
-int
-rl_discard_argument ()
-{
- ding ();
- rl_clear_message ();
- _rl_init_argument ();
- return 0;
-}
-
-/* Create a default argument. */
-int
-_rl_init_argument ()
-{
- rl_numeric_arg = rl_arg_sign = 1;
- rl_explicit_arg = 0;
- return 0;
-}
-
-/* C-u, universal argument. Multiply the current argument by 4.
- Read a key. If the key has nothing to do with arguments, then
- dispatch on it. If the key is the abort character then abort. */
-int
-rl_universal_argument (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- rl_numeric_arg *= 4;
- return (rl_digit_loop ());
-}
-
-/* **************************************************************** */
-/* */
-/* Insert and Delete */
-/* */
-/* **************************************************************** */
-
-/* Insert a string of text into the line at point. This is the only
- way that you should do insertion. rl_insert () calls this
- function. */
-int
-rl_insert_text (const char *string)
-{
- register int i, l = strlen (string);
-
- if (rl_end + l >= rl_line_buffer_len)
- rl_extend_line_buffer (rl_end + l);
-
- for (i = rl_end; i >= rl_point; i--)
- the_line[i + l] = the_line[i];
- strncpy (the_line + rl_point, string, l);
-
- /* Remember how to undo this if we aren't undoing something. */
- if (!_rl_doing_an_undo)
- {
- /* If possible and desirable, concatenate the undos. */
- if ((l == 1) &&
- rl_undo_list &&
- (rl_undo_list->what == UNDO_INSERT) &&
- (rl_undo_list->end == rl_point) &&
- (rl_undo_list->end - rl_undo_list->start < 20))
- rl_undo_list->end++;
- else
- rl_add_undo (UNDO_INSERT, rl_point, rl_point + l, (char *)NULL);
- }
- rl_point += l;
- rl_end += l;
- the_line[rl_end] = '\0';
- return l;
-}
-
-/* Delete the string between FROM and TO. FROM is
- inclusive, TO is not. */
-int
-rl_delete_text (from, to)
- int from, to;
-{
- register char *text;
- register int diff, i;
-
- /* Fix it if the caller is confused. */
- if (from > to)
- SWAP (from, to);
-
- /* fix boundaries */
- if (to > rl_end)
- {
- to = rl_end;
- if (from > to)
- from = to;
- }
-
- text = rl_copy_text (from, to);
-
- /* Some versions of strncpy() can't handle overlapping arguments. */
- diff = to - from;
- for (i = from; i < rl_end - diff; i++)
- the_line[i] = the_line[i + diff];
-
- /* Remember how to undo this delete. */
- if (_rl_doing_an_undo == 0)
- rl_add_undo (UNDO_DELETE, from, to, text);
- else
- free (text);
-
- rl_end -= diff;
- the_line[rl_end] = '\0';
- 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
-
-void
-_rl_replace_text (text, start, end)
- char *text;
- int start, end;
-{
- rl_begin_undo_group ();
- rl_delete_text (start, end + 1);
- rl_point = start;
- rl_insert_text (text);
- rl_end_undo_group ();
-}
-
-/* **************************************************************** */
-/* */
-/* Readline character functions */
-/* */
-/* **************************************************************** */
-
-/* This is not a gap editor, just a stupid line input routine. No hair
- is involved in writing any of the functions, and none should be. */
-
-/* Note that:
-
- rl_end is the place in the string that we would place '\0';
- i.e., it is always safe to place '\0' there.
-
- rl_point is the place in the string where the cursor is. Sometimes
- this is the same as rl_end.
-
- Any command that is called interactively receives two arguments.
- The first is a count: the numeric arg pased to this command.
- The second is the key which invoked this command.
-*/
-
-/* **************************************************************** */
-/* */
-/* Movement Commands */
-/* */
-/* **************************************************************** */
-
-/* Note that if you `optimize' the display for these functions, you cannot
- use said functions in other functions which do not do optimizing display.
- I.e., you will have to update the data base for rl_redisplay, and you
- might as well let rl_redisplay do that job. */
-
-/* Move forward COUNT characters. */
-int
-rl_forward (count, key)
- int count, key;
-{
- if (count < 0)
- rl_backward (-count, key);
- else if (count > 0)
- {
- int end = rl_point + count;
-#if defined (VI_MODE)
- int lend = rl_end - (rl_editing_mode == vi_mode);
-#else
- int lend = rl_end;
+#if defined (__MSDOS__)
+ _rl_bind_if_unbound ("\033[0A", rl_get_previous_history);
+ _rl_bind_if_unbound ("\033[0B", rl_backward_char);
+ _rl_bind_if_unbound ("\033[0C", rl_forward_char);
+ _rl_bind_if_unbound ("\033[0D", rl_get_next_history);
#endif
- if (end > lend)
- {
- rl_point = lend;
- ding ();
- }
- else
- rl_point = end;
- }
- return 0;
-}
+ _rl_bind_if_unbound ("\033[A", rl_get_previous_history);
+ _rl_bind_if_unbound ("\033[B", rl_get_next_history);
+ _rl_bind_if_unbound ("\033[C", rl_forward_char);
+ _rl_bind_if_unbound ("\033[D", rl_backward_char);
+ _rl_bind_if_unbound ("\033[H", rl_beg_of_line);
+ _rl_bind_if_unbound ("\033[F", rl_end_of_line);
-/* Move backward COUNT characters. */
-int
-rl_backward (count, key)
- int count, key;
-{
- if (count < 0)
- rl_forward (-count, key);
- else if (count > 0)
- {
- if (rl_point < count)
- {
- rl_point = 0;
- ding ();
- }
- else
- rl_point -= count;
- }
- return 0;
-}
-
-/* Move to the beginning of the line. */
-int
-rl_beg_of_line (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- rl_point = 0;
- return 0;
-}
-
-/* Move to the end of the line. */
-int
-rl_end_of_line (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- rl_point = rl_end;
- return 0;
-}
-
-/* Move forward a word. We do what Emacs does. */
-int
-rl_forward_word (count, key)
- int count, key;
-{
- int c;
-
- if (count < 0)
- {
- rl_backward_word (-count, key);
- return 0;
- }
-
- while (count)
- {
- if (rl_point == rl_end)
- return 0;
-
- /* If we are not in a word, move forward until we are in one.
- Then, move forward until we hit a non-alphabetic character. */
- c = the_line[rl_point];
- if (alphabetic (c) == 0)
- {
- while (++rl_point < rl_end)
- {
- c = the_line[rl_point];
- if (alphabetic (c))
- break;
- }
- }
- if (rl_point == rl_end)
- return 0;
- while (++rl_point < rl_end)
- {
- c = the_line[rl_point];
- if (alphabetic (c) == 0)
- break;
- }
- --count;
- }
- return 0;
-}
-
-/* Move backward a word. We do what Emacs does. */
-int
-rl_backward_word (count, key)
- int count, key;
-{
- int c;
+ _rl_bind_if_unbound ("\033OA", rl_get_previous_history);
+ _rl_bind_if_unbound ("\033OB", rl_get_next_history);
+ _rl_bind_if_unbound ("\033OC", rl_forward_char);
+ _rl_bind_if_unbound ("\033OD", rl_backward_char);
+ _rl_bind_if_unbound ("\033OH", rl_beg_of_line);
+ _rl_bind_if_unbound ("\033OF", rl_end_of_line);
- if (count < 0)
- {
- rl_forward_word (-count, key);
- return 0;
- }
-
- while (count)
- {
- if (!rl_point)
- return 0;
-
- /* Like rl_forward_word (), except that we look at the characters
- just before point. */
-
- c = the_line[rl_point - 1];
- if (alphabetic (c) == 0)
- {
- while (--rl_point)
- {
- c = the_line[rl_point - 1];
- if (alphabetic (c))
- break;
- }
- }
-
- while (rl_point)
- {
- c = the_line[rl_point - 1];
- if (alphabetic (c) == 0)
- break;
- else
- --rl_point;
- }
- --count;
- }
- return 0;
-}
-
-/* Clear the current line. Numeric argument to C-l does this. */
-int
-rl_refresh_line (ignore1, ignore2)
- int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
-{
- int curr_line, nleft;
-
- /* Find out whether or not there might be invisible characters in the
- editing buffer. */
- if (rl_display_prompt == rl_prompt)
- nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
- else
- nleft = _rl_last_c_pos - screenwidth;
-
- if (nleft > 0)
- curr_line = 1 + nleft / screenwidth;
- else
- curr_line = 0;
-
- _rl_move_vert (curr_line);
- _rl_move_cursor_relative (0, the_line); /* XXX is this right */
-
-#if defined (__GO32__)
- {
- int row, col, width, row_start;
-
- ScreenGetCursor (&row, &col);
- width = ScreenCols ();
- row_start = ScreenPrimary + (row * width);
- memset (row_start + col, 0, (width - col) * 2);
- }
-#else /* !__GO32__ */
- _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
-#endif /* !__GO32__ */
-
- rl_forced_update_display ();
- rl_display_fixed = 1;
-
- return 0;
-}
-
-/* C-l typed to a line without quoting clears the screen, and then reprints
- the prompt and the current input line. Given a numeric arg, redraw only
- the current line. */
-int
-rl_clear_screen (count, key)
- int count, key;
-{
- if (rl_explicit_arg)
- {
- rl_refresh_line (count, key);
- return 0;
- }
-
- _rl_clear_screen (); /* calls termcap function to clear screen */
- rl_forced_update_display ();
- rl_display_fixed = 1;
-
- return 0;
-}
-
-int
-rl_arrow_keys (count, c)
- int count, c __attribute__((unused));
-{
- int ch;
-
- ch = rl_read_key ();
-
- switch (_rl_to_upper (ch))
- {
- case 'A':
- rl_get_previous_history (count, ch);
- break;
-
- case 'B':
- rl_get_next_history (count, ch);
- break;
-
- case 'C':
- rl_forward (count, ch);
- break;
-
- case 'D':
- rl_backward (count, ch);
- break;
-
- default:
- ding ();
- }
- return 0;
-}
-
-
-/* **************************************************************** */
-/* */
-/* Text commands */
-/* */
-/* **************************************************************** */
-
-/* Insert the character C at the current location, moving point forward. */
-int
-rl_insert (count, c)
- int count, c;
-{
- register int i;
- char *string;
-
- if (count <= 0)
- return 0;
-
- /* If we can optimize, then do it. But don't let people crash
- readline because of extra large arguments. */
- if (count > 1 && count <= 1024)
- {
- string = xmalloc (1 + count);
-
- for (i = 0; i < count; i++)
- string[i] = c;
-
- string[i] = '\0';
- rl_insert_text (string);
- free (string);
-
- return 0;
- }
-
- if (count > 1024)
- {
- int decreaser;
- char str[1024+1];
-
- for (i = 0; i < 1024; i++)
- str[i] = c;
-
- while (count)
- {
- decreaser = (count > 1024 ? 1024 : count);
- str[decreaser] = '\0';
- rl_insert_text (str);
- count -= decreaser;
- }
-
- return 0;
- }
-
- /* We are inserting a single character.
- If there is pending input, then make a string of all of the
- pending characters that are bound to rl_insert, and insert
- them all. */
- if (_rl_any_typein ())
- _rl_insert_typein (c);
- else
- {
- /* Inserting a single character. */
- char str[2];
-
- str[1] = '\0';
- str[0] = c;
- rl_insert_text (str);
- }
- return 0;
-}
-
-/* Insert the next typed character verbatim. */
-int
-rl_quoted_insert (count, key)
- int count, key __attribute__((unused));
-{
- int c;
-
- c = rl_read_key ();
- return (rl_insert (count, c));
-}
-
-/* Insert a tab character. */
-int
-rl_tab_insert (count, key)
- int count, key __attribute__((unused));
-{
- return (rl_insert (count, '\t'));
+ _rl_keymap = xkeymap;
}
-/* What to do when a NEWLINE is pressed. We accept the whole line.
- KEY is the key that invoked this command. I guess it could have
- meaning in the future. */
-int
-rl_newline (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
+/* Try and bind the common arrow key prefixes after giving termcap and
+ the inputrc file a chance to bind them and create `real' keymaps
+ for the arrow key prefix. */
+static void
+bind_arrow_keys ()
{
- rl_done = 1;
+ bind_arrow_keys_internal (emacs_standard_keymap);
#if defined (VI_MODE)
- if (rl_editing_mode == vi_mode)
- {
- _rl_vi_done_inserting ();
- _rl_vi_reset_last ();
- }
-#endif /* VI_MODE */
-
- /* If we've been asked to erase empty lines, suppress the final update,
- since _rl_update_final calls crlf(). */
- if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
- return 0;
-
- if (readline_echoing_p)
- _rl_update_final ();
- return 0;
-}
-
-/* What to do for some uppercase characters, like meta characters,
- and some characters appearing in emacs_ctlx_keymap. This function
- is just a stub, you bind keys to it and the code in _rl_dispatch ()
- is special cased. */
-int
-rl_do_lowercase_version (ignore1, ignore2)
- int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
-{
- return 0;
-}
-
-/* Rubout the character behind point. */
-int
-rl_rubout (count, key)
- int count, key;
-{
- if (count < 0)
- {
- rl_delete (-count, key);
- return 0;
- }
-
- if (!rl_point)
- {
- ding ();
- return -1;
- }
-
- if (count > 1 || rl_explicit_arg)
- {
- int orig_point = rl_point;
- rl_backward (count, key);
- rl_kill_text (orig_point, rl_point);
- }
- else
- {
- int c = the_line[--rl_point];
- rl_delete_text (rl_point, rl_point + 1);
-
- if (rl_point == rl_end && isprint (c) && _rl_last_c_pos)
- {
- int l;
- l = rl_character_len (c, rl_point);
- _rl_erase_at_end_of_line (l);
- }
- }
- return 0;
-}
-
-/* Delete the character under the cursor. Given a numeric argument,
- kill that many characters instead. */
-int
-rl_delete (count, key)
- int count, key;
-{
- if (count < 0)
- return (rl_rubout (-count, key));
-
- if (rl_point == rl_end)
- {
- ding ();
- return -1;
- }
-
- if (count > 1 || rl_explicit_arg)
- {
- int orig_point = rl_point;
- rl_forward (count, key);
- rl_kill_text (orig_point, rl_point);
- rl_point = orig_point;
- return 0;
- }
- else
- return (rl_delete_text (rl_point, rl_point + 1));
-}
-
-/* Delete the character under the cursor, unless the insertion
- point is at the end of the line, in which case the character
- behind the cursor is deleted. COUNT is obeyed and may be used
- to delete forward or backward that many characters. */
-int
-rl_rubout_or_delete (count, key)
- int count, key;
-{
- if (rl_end != 0 && rl_point == rl_end)
- return (rl_rubout (count, key));
- else
- return (rl_delete (count, key));
-}
-
-/* Delete all spaces and tabs around point. */
-int
-rl_delete_horizontal_space (count, ignore)
- int count __attribute__((unused)), ignore __attribute__((unused));
-{
- int start = rl_point;
-
- while (rl_point && whitespace (the_line[rl_point - 1]))
- rl_point--;
-
- start = rl_point;
-
- while (rl_point < rl_end && whitespace (the_line[rl_point]))
- rl_point++;
-
- if (start != rl_point)
- {
- rl_delete_text (start, rl_point);
- rl_point = start;
- }
- return 0;
-}
-
-/* Like the tcsh editing function delete-char-or-list. The eof character
- is caught before this is invoked, so this really does the same thing as
- delete-char-or-list-or-eof, as long as it's bound to the eof character. */
-int
-rl_delete_or_show_completions (count, key)
- int count, key;
-{
- if (rl_end != 0 && rl_point == rl_end)
- return (rl_possible_completions (count, key));
- else
- return (rl_delete (count, key));
-}
-
-#ifndef RL_COMMENT_BEGIN_DEFAULT
-#define RL_COMMENT_BEGIN_DEFAULT "#"
+ bind_arrow_keys_internal (vi_movement_keymap);
+ bind_arrow_keys_internal (vi_insertion_keymap);
#endif
-
-/* Turn the current line into a comment in shell history.
- A K*rn shell style function. */
-int
-rl_insert_comment (count, key)
- int count __attribute__((unused)), key;
-{
- rl_beg_of_line (1, key);
- rl_insert_text (_rl_comment_begin ? _rl_comment_begin
- : RL_COMMENT_BEGIN_DEFAULT);
- (*rl_redisplay_function) ();
- rl_newline (1, '\n');
- return (0);
-}
-
-/* **************************************************************** */
-/* */
-/* Changing Case */
-/* */
-/* **************************************************************** */
-
-/* The three kinds of things that we know how to do. */
-#define UpCase 1
-#define DownCase 2
-#define CapCase 3
-
-static int rl_change_case ();
-
-/* Uppercase the word at point. */
-int
-rl_upcase_word (count, key)
- int count, key __attribute__((unused));
-{
- return (rl_change_case (count, UpCase));
-}
-
-/* Lowercase the word at point. */
-int
-rl_downcase_word (count, key)
- int count, key __attribute__((unused));
-{
- return (rl_change_case (count, DownCase));
-}
-
-/* Upcase the first letter, downcase the rest. */
-int
-rl_capitalize_word (count, key)
- int count, key __attribute__((unused));
-{
- return (rl_change_case (count, CapCase));
-}
-
-/* The meaty function.
- Change the case of COUNT words, performing OP on them.
- OP is one of UpCase, DownCase, or CapCase.
- If a negative argument is given, leave point where it started,
- otherwise, leave it where it moves to. */
-static int
-rl_change_case (count, op)
- int count, op;
-{
- register int start, end;
- int inword, c;
-
- start = rl_point;
- rl_forward_word (count, 0);
- end = rl_point;
-
- if (count < 0)
- SWAP (start, end);
-
- /* We are going to modify some text, so let's prepare to undo it. */
- rl_modifying (start, end);
-
- for (inword = 0; start < end; start++)
- {
- c = the_line[start];
- switch (op)
- {
- case UpCase:
- the_line[start] = _rl_to_upper (c);
- break;
-
- case DownCase:
- the_line[start] = _rl_to_lower (c);
- break;
-
- case CapCase:
- the_line[start] = (inword == 0) ? _rl_to_upper (c) : _rl_to_lower (c);
- inword = alphabetic (the_line[start]);
- break;
-
- default:
- ding ();
- return -1;
- }
- }
- rl_point = end;
- return 0;
}
/* **************************************************************** */
/* */
-/* Transposition */
+/* Saving and Restoring Readline's state */
/* */
/* **************************************************************** */
-/* Transpose the words at point. */
int
-rl_transpose_words (count, key)
- int count, key;
+rl_save_state (sp)
+ struct readline_state *sp;
{
- char *word1, *word2;
- int w1_beg, w1_end, w2_beg, w2_end;
- int orig_point = rl_point;
-
- if (!count)
- return 0;
-
- /* Find the two words. */
- rl_forward_word (count, key);
- w2_end = rl_point;
- rl_backward_word (1, key);
- w2_beg = rl_point;
- rl_backward_word (count, key);
- w1_beg = rl_point;
- rl_forward_word (1, key);
- w1_end = rl_point;
-
- /* Do some check to make sure that there really are two words. */
- if ((w1_beg == w2_beg) || (w2_beg < w1_end))
- {
- ding ();
- rl_point = orig_point;
- return -1;
- }
-
- /* Get the text of the words. */
- word1 = rl_copy_text (w1_beg, w1_end);
- word2 = rl_copy_text (w2_beg, w2_end);
-
- /* We are about to do many insertions and deletions. Remember them
- as one operation. */
- rl_begin_undo_group ();
-
- /* Do the stuff at word2 first, so that we don't have to worry
- about word1 moving. */
- rl_point = w2_beg;
- rl_delete_text (w2_beg, w2_end);
- rl_insert_text (word1);
-
- rl_point = w1_beg;
- rl_delete_text (w1_beg, w1_end);
- rl_insert_text (word2);
-
- /* This is exactly correct since the text before this point has not
- changed in length. */
- rl_point = w2_end;
-
- /* I think that does it. */
- rl_end_undo_group ();
- free (word1);
- free (word2);
-
- return 0;
-}
-
-/* Transpose the characters at point. If point is at the end of the line,
- then transpose the characters before point. */
-int
-rl_transpose_chars (count, key)
- int count, key __attribute__((unused));
-{
- char dummy[2];
-
- if (!count)
- return 0;
-
- if (!rl_point || rl_end < 2)
- {
- ding ();
- return -1;
- }
-
- rl_begin_undo_group ();
-
- if (rl_point == rl_end)
- {
- --rl_point;
- count = 1;
- }
- rl_point--;
-
- dummy[0] = the_line[rl_point];
- dummy[1] = '\0';
-
- rl_delete_text (rl_point, rl_point + 1);
-
- rl_point += count;
- _rl_fix_point (0);
- rl_insert_text (dummy);
-
- rl_end_undo_group ();
- return 0;
-}
-
-/* **************************************************************** */
-/* */
-/* Character Searching */
-/* */
-/* **************************************************************** */
+ if (sp == 0)
+ return -1;
-int
-_rl_char_search_internal (count, dir, schar)
- int count, dir, schar;
-{
- int pos, inc;
+ sp->point = rl_point;
+ sp->end = rl_end;
+ sp->mark = rl_mark;
+ sp->buffer = rl_line_buffer;
+ sp->buflen = rl_line_buffer_len;
+ sp->ul = rl_undo_list;
+ sp->prompt = rl_prompt;
+
+ sp->rlstate = rl_readline_state;
+ sp->done = rl_done;
+ sp->kmap = _rl_keymap;
+
+ sp->lastfunc = rl_last_func;
+ sp->insmode = rl_insert_mode;
+ sp->edmode = rl_editing_mode;
+ sp->kseqlen = rl_key_sequence_length;
+ sp->inf = rl_instream;
+ sp->outf = rl_outstream;
+ sp->pendingin = rl_pending_input;
+ sp->macro = rl_executing_macro;
+
+ sp->catchsigs = rl_catch_signals;
+ sp->catchsigwinch = rl_catch_sigwinch;
- pos = rl_point;
- inc = (dir < 0) ? -1 : 1;
- while (count)
- {
- if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end))
- {
- ding ();
- return -1;
- }
-
- pos += inc;
- do
- {
- if (rl_line_buffer[pos] == schar)
- {
- count--;
- if (dir < 0)
- rl_point = (dir == BTO) ? pos + 1 : pos;
- else
- rl_point = (dir == FTO) ? pos - 1 : pos;
- break;
- }
- }
- while ((dir < 0) ? pos-- : ++pos < rl_end);
- }
return (0);
}
-/* Search COUNT times for a character read from the current input stream.
- FDIR is the direction to search if COUNT is non-negative; otherwise
- the search goes in BDIR. */
-static int
-_rl_char_search (count, fdir, bdir)
- int count, fdir, bdir;
-{
- int c;
-
- c = rl_read_key ();
- if (count < 0)
- return (_rl_char_search_internal (-count, bdir, c));
- else
- return (_rl_char_search_internal (count, fdir, c));
-}
-
-int
-rl_char_search (count, key)
- int count, key __attribute__((unused));
-{
- return (_rl_char_search (count, FFIND, BFIND));
-}
-
-int
-rl_backward_char_search (count, key)
- int count, key __attribute__((unused));
-{
- return (_rl_char_search (count, BFIND, FFIND));
-}
-
-/* **************************************************************** */
-/* */
-/* History Utilities */
-/* */
-/* **************************************************************** */
-
-/* We already have a history library, and that is what we use to control
- the history features of readline. This is our local interface to
- the history mechanism. */
-
-/* While we are editing the history, this is the saved
- version of the original line. */
-HIST_ENTRY *saved_line_for_history = (HIST_ENTRY *)NULL;
-
-/* Set the history pointer back to the last entry in the history. */
-static void
-start_using_history ()
-{
- using_history ();
- if (saved_line_for_history)
- _rl_free_history_entry (saved_line_for_history);
-
- saved_line_for_history = (HIST_ENTRY *)NULL;
-}
-
-/* Free the contents (and containing structure) of a HIST_ENTRY. */
-void
-_rl_free_history_entry (entry)
- HIST_ENTRY *entry;
-{
- if (entry == 0)
- return;
- if (entry->line)
- free (entry->line);
- free (entry);
-}
-
-/* Perhaps put back the current line if it has changed. */
-int
-maybe_replace_line ()
-{
- HIST_ENTRY *temp;
-
- temp = current_history ();
- /* If the current line has changed, save the changes. */
- if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list))
- {
- temp = replace_history_entry (where_history (), the_line, (histdata_t)rl_undo_list);
- free (temp->line);
- free (temp);
- }
- return 0;
-}
-
-/* Put back the saved_line_for_history if there is one. */
-int
-maybe_unsave_line ()
-{
- int line_len;
-
- if (saved_line_for_history)
- {
- line_len = strlen (saved_line_for_history->line);
-
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
-
- strcpy (the_line, saved_line_for_history->line);
- rl_undo_list = (UNDO_LIST *)saved_line_for_history->data;
- _rl_free_history_entry (saved_line_for_history);
- saved_line_for_history = (HIST_ENTRY *)NULL;
- rl_end = rl_point = strlen (the_line);
- }
- else
- ding ();
- return 0;
-}
-
-/* Save the current line in saved_line_for_history. */
-int
-maybe_save_line ()
-{
- if (saved_line_for_history == 0)
- {
- saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
- saved_line_for_history->line = savestring (the_line);
- saved_line_for_history->data = (char *)rl_undo_list;
- }
- return 0;
-}
-
-/* **************************************************************** */
-/* */
-/* History Commands */
-/* */
-/* **************************************************************** */
-
-/* Meta-< goes to the start of the history. */
-int
-rl_beginning_of_history (count, key)
- int count __attribute__((unused)), key;
-{
- return (rl_get_previous_history (1 + where_history (), key));
-}
-
-/* Meta-> goes to the end of the history. (The current line). */
-int
-rl_end_of_history (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- maybe_replace_line ();
- using_history ();
- maybe_unsave_line ();
- return 0;
-}
-
-/* Move down to the next history line. */
-int
-rl_get_next_history (count, key)
- int count, key;
-{
- HIST_ENTRY *temp;
- int line_len;
-
- if (count < 0)
- return (rl_get_previous_history (-count, key));
-
- if (count == 0)
- return 0;
-
- maybe_replace_line ();
-
- temp = (HIST_ENTRY *)NULL;
- while (count)
- {
- temp = next_history ();
- if (!temp)
- break;
- --count;
- }
-
- if (temp == 0)
- maybe_unsave_line ();
- else
- {
- line_len = strlen (temp->line);
-
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
-
- strcpy (the_line, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = rl_point = strlen (the_line);
-#if defined (VI_MODE)
- if (rl_editing_mode == vi_mode)
- rl_point = 0;
-#endif /* VI_MODE */
- }
- return 0;
-}
-
-/* Get the previous item out of our interactive history, making it the current
- line. If there is no previous history, just ding. */
-int
-rl_get_previous_history (count, key)
- int count, key;
-{
- HIST_ENTRY *old_temp, *temp;
- int line_len;
-
- if (count < 0)
- return (rl_get_next_history (-count, key));
-
- if (count == 0)
- return 0;
-
- /* If we don't have a line saved, then save this one. */
- maybe_save_line ();
-
- /* If the current line has changed, save the changes. */
- maybe_replace_line ();
-
- temp = old_temp = (HIST_ENTRY *)NULL;
- while (count)
- {
- temp = previous_history ();
- if (temp == 0)
- break;
-
- old_temp = temp;
- --count;
- }
-
- /* If there was a large argument, and we moved back to the start of the
- history, that is not an error. So use the last value found. */
- if (!temp && old_temp)
- temp = old_temp;
-
- if (temp == 0)
- ding ();
- else
- {
- line_len = strlen (temp->line);
-
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
-
- strcpy (the_line, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = rl_point = line_len;
-
-#if defined (VI_MODE)
- if (rl_editing_mode == vi_mode)
- rl_point = 0;
-#endif /* VI_MODE */
- }
- return 0;
-}
-
-/* **************************************************************** */
-/* */
-/* The Mark and the Region. */
-/* */
-/* **************************************************************** */
-
-/* Set the mark at POSITION. */
int
-_rl_set_mark_at_pos (position)
- int position;
+rl_restore_state (sp)
+ struct readline_state *sp;
{
- if (position > rl_end)
+ if (sp == 0)
return -1;
- rl_mark = position;
- return 0;
-}
-
-/* A bindable command to set the mark. */
-int
-rl_set_mark (count, key)
- int count, key __attribute__((unused));
-{
- return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point));
-}
+ rl_point = sp->point;
+ rl_end = sp->end;
+ rl_mark = sp->mark;
+ the_line = rl_line_buffer = sp->buffer;
+ rl_line_buffer_len = sp->buflen;
+ rl_undo_list = sp->ul;
+ rl_prompt = sp->prompt;
+
+ rl_readline_state = sp->rlstate;
+ rl_done = sp->done;
+ _rl_keymap = sp->kmap;
+
+ rl_last_func = sp->lastfunc;
+ rl_insert_mode = sp->insmode;
+ rl_editing_mode = sp->edmode;
+ rl_key_sequence_length = sp->kseqlen;
+ rl_instream = sp->inf;
+ rl_outstream = sp->outf;
+ rl_pending_input = sp->pendingin;
+ rl_executing_macro = sp->macro;
+
+ rl_catch_signals = sp->catchsigs;
+ rl_catch_sigwinch = sp->catchsigwinch;
-/* Exchange the position of mark and point. */
-int
-rl_exchange_point_and_mark (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- if (rl_mark > rl_end)
- rl_mark = -1;
-
- if (rl_mark == -1)
- {
- ding ();
- return -1;
- }
- else
- SWAP (rl_point, rl_mark);
-
- return 0;
-}
-
-/* **************************************************************** */
-/* */
-/* Editing Modes */
-/* */
-/* **************************************************************** */
-/* How to toggle back and forth between editing modes. */
-int
-rl_vi_editing_mode (count, key)
- int count __attribute__((unused)), key;
-{
-#if defined (VI_MODE)
- rl_editing_mode = vi_mode;
- rl_vi_insertion_mode (1, key);
-#endif /* VI_MODE */
- return 0;
-}
-
-int
-rl_emacs_editing_mode (count, key)
- int count __attribute__((unused)), key __attribute__((unused));
-{
- rl_editing_mode = emacs_mode;
- _rl_keymap = emacs_standard_keymap;
- return 0;
+ return (0);
}
diff --git a/readline/readline.h b/readline/readline.h
index 7804d31efb1..f11b3d0357c 100644
--- a/readline/readline.h
+++ b/readline/readline.h
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_READLINE_H_)
#define _READLINE_H_
@@ -29,14 +29,21 @@ extern "C" {
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
+# include "rltypedefs.h"
# include "keymaps.h"
# include "tilde.h"
#else
# include <readline/rlstdc.h>
+# include <readline/rltypedefs.h>
# include <readline/keymaps.h>
# include <readline/tilde.h>
#endif
+/* Hex-encoded Readline version number. */
+#define RL_READLINE_VERSION 0x0403 /* Readline 4.3 */
+#define RL_VERSION_MAJOR 4
+#define RL_VERSION_MINOR 3
+
/* Readline data structures. */
/* Maintaining the state of undo. We remember individual deletes and inserts
@@ -61,7 +68,7 @@ extern UNDO_LIST *rl_undo_list;
/* The data structure for mapping textual names to code addresses. */
typedef struct _funmap {
const char *name;
- Function *function;
+ rl_command_func_t *function;
} FUNMAP;
extern FUNMAP **funmap;
@@ -73,184 +80,191 @@ extern FUNMAP **funmap;
/* **************************************************************** */
/* Bindable commands for numeric arguments. */
-extern int rl_digit_argument __P((int, int));
-extern int rl_universal_argument __P((int, int));
+extern int rl_digit_argument PARAMS((int, int));
+extern int rl_universal_argument PARAMS((int, int));
/* Bindable commands for moving the cursor. */
-extern int rl_forward __P((int, int));
-extern int rl_backward __P((int, int));
-extern int rl_beg_of_line __P((int, int));
-extern int rl_end_of_line __P((int, int));
-extern int rl_forward_word __P((int, int));
-extern int rl_backward_word __P((int, int));
-extern int rl_refresh_line __P((int, int));
-extern int rl_clear_screen __P((int, int));
-extern int rl_arrow_keys __P((int, int));
+extern int rl_forward_byte PARAMS((int, int));
+extern int rl_forward_char PARAMS((int, int));
+extern int rl_forward PARAMS((int, int));
+extern int rl_backward_byte PARAMS((int, int));
+extern int rl_backward_char PARAMS((int, int));
+extern int rl_backward PARAMS((int, int));
+extern int rl_beg_of_line PARAMS((int, int));
+extern int rl_end_of_line PARAMS((int, int));
+extern int rl_forward_word PARAMS((int, int));
+extern int rl_backward_word PARAMS((int, int));
+extern int rl_refresh_line PARAMS((int, int));
+extern int rl_clear_screen PARAMS((int, int));
+extern int rl_arrow_keys PARAMS((int, int));
/* Bindable commands for inserting and deleting text. */
-extern int rl_insert __P((int, int));
-extern int rl_quoted_insert __P((int, int));
-extern int rl_tab_insert __P((int, int));
-extern int rl_newline __P((int, int));
-extern int rl_do_lowercase_version __P((int, int));
-extern int rl_rubout __P((int, int));
-extern int rl_delete __P((int, int));
-extern int rl_rubout_or_delete __P((int, int));
-extern int rl_delete_horizontal_space __P((int, int));
-extern int rl_delete_or_show_completions __P((int, int));
-extern int rl_insert_comment __P((int, int));
+extern int rl_insert PARAMS((int, int));
+extern int rl_quoted_insert PARAMS((int, int));
+extern int rl_tab_insert PARAMS((int, int));
+extern int rl_newline PARAMS((int, int));
+extern int rl_do_lowercase_version PARAMS((int, int));
+extern int rl_rubout PARAMS((int, int));
+extern int rl_delete PARAMS((int, int));
+extern int rl_rubout_or_delete PARAMS((int, int));
+extern int rl_delete_horizontal_space PARAMS((int, int));
+extern int rl_delete_or_show_completions PARAMS((int, int));
+extern int rl_insert_comment PARAMS((int, int));
/* Bindable commands for changing case. */
-extern int rl_upcase_word __P((int, int));
-extern int rl_downcase_word __P((int, int));
-extern int rl_capitalize_word __P((int, int));
+extern int rl_upcase_word PARAMS((int, int));
+extern int rl_downcase_word PARAMS((int, int));
+extern int rl_capitalize_word PARAMS((int, int));
/* Bindable commands for transposing characters and words. */
-extern int rl_transpose_words __P((int, int));
-extern int rl_transpose_chars __P((int, int));
+extern int rl_transpose_words PARAMS((int, int));
+extern int rl_transpose_chars PARAMS((int, int));
/* Bindable commands for searching within a line. */
-extern int rl_char_search __P((int, int));
-extern int rl_backward_char_search __P((int, int));
+extern int rl_char_search PARAMS((int, int));
+extern int rl_backward_char_search PARAMS((int, int));
/* Bindable commands for readline's interface to the command history. */
-extern int rl_beginning_of_history __P((int, int));
-extern int rl_end_of_history __P((int, int));
-extern int rl_get_next_history __P((int, int));
-extern int rl_get_previous_history __P((int, int));
+extern int rl_beginning_of_history PARAMS((int, int));
+extern int rl_end_of_history PARAMS((int, int));
+extern int rl_get_next_history PARAMS((int, int));
+extern int rl_get_previous_history PARAMS((int, int));
/* Bindable commands for managing the mark and region. */
-extern int rl_set_mark __P((int, int));
-extern int rl_exchange_point_and_mark __P((int, int));
+extern int rl_set_mark PARAMS((int, int));
+extern int rl_exchange_point_and_mark PARAMS((int, int));
/* Bindable commands to set the editing mode (emacs or vi). */
-extern int rl_vi_editing_mode __P((int, int));
-extern int rl_emacs_editing_mode __P((int, int));
+extern int rl_vi_editing_mode PARAMS((int, int));
+extern int rl_emacs_editing_mode PARAMS((int, int));
+
+/* Bindable commands to change the insert mode (insert or overwrite) */
+extern int rl_overwrite_mode PARAMS((int, int));
/* Bindable commands for managing key bindings. */
-extern int rl_re_read_init_file __P((int, int));
-extern int rl_dump_functions __P((int, int));
-extern int rl_dump_macros __P((int, int));
-extern int rl_dump_variables __P((int, int));
+extern int rl_re_read_init_file PARAMS((int, int));
+extern int rl_dump_functions PARAMS((int, int));
+extern int rl_dump_macros PARAMS((int, int));
+extern int rl_dump_variables PARAMS((int, int));
/* Bindable commands for word completion. */
-extern int rl_complete __P((int, int));
-extern int rl_possible_completions __P((int, int));
-extern int rl_insert_completions __P((int, int));
-extern int rl_menu_complete __P((int, int));
+extern int rl_complete PARAMS((int, int));
+extern int rl_possible_completions PARAMS((int, int));
+extern int rl_insert_completions PARAMS((int, int));
+extern int rl_menu_complete PARAMS((int, int));
/* Bindable commands for killing and yanking text, and managing the kill ring. */
-extern int rl_kill_word __P((int, int));
-extern int rl_backward_kill_word __P((int, int));
-extern int rl_kill_line __P((int, int));
-extern int rl_backward_kill_line __P((int, int));
-extern int rl_kill_full_line __P((int, int));
-extern int rl_unix_word_rubout __P((int, int));
-extern int rl_unix_line_discard __P((int, int));
-extern int rl_copy_region_to_kill __P((int, int));
-extern int rl_kill_region __P((int, int));
-extern int rl_copy_forward_word __P((int, int));
-extern int rl_copy_backward_word __P((int, int));
-extern int rl_yank __P((int, int));
-extern int rl_yank_pop __P((int, int));
-extern int rl_yank_nth_arg __P((int, int));
-extern int rl_yank_last_arg __P((int, int));
-/* Not available unless __CYGWIN32__ is defined. */
-#ifdef __CYGWIN32__
-extern int rl_paste_from_clipboard __P((int, int));
+extern int rl_kill_word PARAMS((int, int));
+extern int rl_backward_kill_word PARAMS((int, int));
+extern int rl_kill_line PARAMS((int, int));
+extern int rl_backward_kill_line PARAMS((int, int));
+extern int rl_kill_full_line PARAMS((int, int));
+extern int rl_unix_word_rubout PARAMS((int, int));
+extern int rl_unix_line_discard PARAMS((int, int));
+extern int rl_copy_region_to_kill PARAMS((int, int));
+extern int rl_kill_region PARAMS((int, int));
+extern int rl_copy_forward_word PARAMS((int, int));
+extern int rl_copy_backward_word PARAMS((int, int));
+extern int rl_yank PARAMS((int, int));
+extern int rl_yank_pop PARAMS((int, int));
+extern int rl_yank_nth_arg PARAMS((int, int));
+extern int rl_yank_last_arg PARAMS((int, int));
+/* Not available unless __CYGWIN__ is defined. */
+#ifdef __CYGWIN__
+extern int rl_paste_from_clipboard PARAMS((int, int));
#endif
/* Bindable commands for incremental searching. */
-extern int rl_reverse_search_history __P((int, int));
-extern int rl_forward_search_history __P((int, int));
+extern int rl_reverse_search_history PARAMS((int, int));
+extern int rl_forward_search_history PARAMS((int, int));
/* Bindable keyboard macro commands. */
-extern int rl_start_kbd_macro __P((int, int));
-extern int rl_end_kbd_macro __P((int, int));
-extern int rl_call_last_kbd_macro __P((int, int));
+extern int rl_start_kbd_macro PARAMS((int, int));
+extern int rl_end_kbd_macro PARAMS((int, int));
+extern int rl_call_last_kbd_macro PARAMS((int, int));
/* Bindable undo commands. */
-extern int rl_revert_line __P((int, int));
-extern int rl_undo_command __P((int, int));
+extern int rl_revert_line PARAMS((int, int));
+extern int rl_undo_command PARAMS((int, int));
/* Bindable tilde expansion commands. */
-extern int rl_tilde_expand __P((int, int));
+extern int rl_tilde_expand PARAMS((int, int));
/* Bindable terminal control commands. */
-extern int rl_restart_output __P((int, int));
-extern int rl_stop_output __P((int, int));
+extern int rl_restart_output PARAMS((int, int));
+extern int rl_stop_output PARAMS((int, int));
/* Miscellaneous bindable commands. */
-extern int rl_abort __P((int, int));
-extern int rl_tty_status __P((int, int));
+extern int rl_abort PARAMS((int, int));
+extern int rl_tty_status PARAMS((int, int));
/* Bindable commands for incremental and non-incremental history searching. */
-extern int rl_history_search_forward __P((int, int));
-extern int rl_history_search_backward __P((int, int));
-extern int rl_noninc_forward_search __P((int, int));
-extern int rl_noninc_reverse_search __P((int, int));
-extern int rl_noninc_forward_search_again __P((int, int));
-extern int rl_noninc_reverse_search_again __P((int, int));
+extern int rl_history_search_forward PARAMS((int, int));
+extern int rl_history_search_backward PARAMS((int, int));
+extern int rl_noninc_forward_search PARAMS((int, int));
+extern int rl_noninc_reverse_search PARAMS((int, int));
+extern int rl_noninc_forward_search_again PARAMS((int, int));
+extern int rl_noninc_reverse_search_again PARAMS((int, int));
-/* Not available unless readline is compiled -DPAREN_MATCHING. */
-extern int rl_insert_close __P((int, int));
+/* Bindable command used when inserting a matching close character. */
+extern int rl_insert_close PARAMS((int, int));
/* Not available unless READLINE_CALLBACKS is defined. */
-extern void rl_callback_handler_install __P((char *, VFunction *));
-extern void rl_callback_read_char __P((void));
-extern void rl_callback_handler_remove __P((void));
+extern void rl_callback_handler_install PARAMS((const char *, rl_vcpfunc_t *));
+extern void rl_callback_read_char PARAMS((void));
+extern void rl_callback_handler_remove PARAMS((void));
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
/* VI-mode bindable commands. */
-extern int rl_vi_redo __P((int, int));
-extern int rl_vi_undo __P((int, int));
-extern int rl_vi_yank_arg __P((int, int));
-extern int rl_vi_fetch_history __P((int, int));
-extern int rl_vi_search_again __P((int, int));
-extern int rl_vi_search __P((int, int));
-extern int rl_vi_complete __P((int, int));
-extern int rl_vi_tilde_expand __P((int, int));
-extern int rl_vi_prev_word __P((int, int));
-extern int rl_vi_next_word __P((int, int));
-extern int rl_vi_end_word __P((int, int));
-extern int rl_vi_insert_beg __P((int, int));
-extern int rl_vi_append_mode __P((int, int));
-extern int rl_vi_append_eol __P((int, int));
-extern int rl_vi_eof_maybe __P((int, int));
-extern int rl_vi_insertion_mode __P((int, int));
-extern int rl_vi_movement_mode __P((int, int));
-extern int rl_vi_arg_digit __P((int, int));
-extern int rl_vi_change_case __P((int, int));
-extern int rl_vi_put __P((int, int));
-extern int rl_vi_column __P((int, int));
-extern int rl_vi_delete_to __P((int, int));
-extern int rl_vi_change_to __P((int, int));
-extern int rl_vi_yank_to __P((int, int));
-extern int rl_vi_delete __P((int, int));
-extern int rl_vi_back_to_indent __P((int, int));
-extern int rl_vi_first_print __P((int, int));
-extern int rl_vi_char_search __P((int, int));
-extern int rl_vi_match __P((int, int));
-extern int rl_vi_change_char __P((int, int));
-extern int rl_vi_subst __P((int, int));
-extern int rl_vi_overstrike __P((int, int));
-extern int rl_vi_overstrike_delete __P((int, int));
-extern int rl_vi_replace __P((int, int));
-extern int rl_vi_set_mark __P((int, int));
-extern int rl_vi_goto_mark __P((int, int));
+extern int rl_vi_redo PARAMS((int, int));
+extern int rl_vi_undo PARAMS((int, int));
+extern int rl_vi_yank_arg PARAMS((int, int));
+extern int rl_vi_fetch_history PARAMS((int, int));
+extern int rl_vi_search_again PARAMS((int, int));
+extern int rl_vi_search PARAMS((int, int));
+extern int rl_vi_complete PARAMS((int, int));
+extern int rl_vi_tilde_expand PARAMS((int, int));
+extern int rl_vi_prev_word PARAMS((int, int));
+extern int rl_vi_next_word PARAMS((int, int));
+extern int rl_vi_end_word PARAMS((int, int));
+extern int rl_vi_insert_beg PARAMS((int, int));
+extern int rl_vi_append_mode PARAMS((int, int));
+extern int rl_vi_append_eol PARAMS((int, int));
+extern int rl_vi_eof_maybe PARAMS((int, int));
+extern int rl_vi_insertion_mode PARAMS((int, int));
+extern int rl_vi_movement_mode PARAMS((int, int));
+extern int rl_vi_arg_digit PARAMS((int, int));
+extern int rl_vi_change_case PARAMS((int, int));
+extern int rl_vi_put PARAMS((int, int));
+extern int rl_vi_column PARAMS((int, int));
+extern int rl_vi_delete_to PARAMS((int, int));
+extern int rl_vi_change_to PARAMS((int, int));
+extern int rl_vi_yank_to PARAMS((int, int));
+extern int rl_vi_delete PARAMS((int, int));
+extern int rl_vi_back_to_indent PARAMS((int, int));
+extern int rl_vi_first_print PARAMS((int, int));
+extern int rl_vi_char_search PARAMS((int, int));
+extern int rl_vi_match PARAMS((int, int));
+extern int rl_vi_change_char PARAMS((int, int));
+extern int rl_vi_subst PARAMS((int, int));
+extern int rl_vi_overstrike PARAMS((int, int));
+extern int rl_vi_overstrike_delete PARAMS((int, int));
+extern int rl_vi_replace PARAMS((int, int));
+extern int rl_vi_set_mark PARAMS((int, int));
+extern int rl_vi_goto_mark PARAMS((int, int));
/* VI-mode utility functions. */
-extern int rl_vi_check __P((void));
-extern int rl_vi_domove __P((int, int *));
-extern int rl_vi_bracktype __P((int));
+extern int rl_vi_check PARAMS((void));
+extern int rl_vi_domove PARAMS((int, int *));
+extern int rl_vi_bracktype PARAMS((int));
/* VI-mode pseudo-bindable commands, used as utility functions. */
-extern int rl_vi_fWord __P((int, int));
-extern int rl_vi_bWord __P((int, int));
-extern int rl_vi_eWord __P((int, int));
-extern int rl_vi_fword __P((int, int));
-extern int rl_vi_bword __P((int, int));
-extern int rl_vi_eword __P((int, int));
+extern int rl_vi_fWord PARAMS((int, int));
+extern int rl_vi_bWord PARAMS((int, int));
+extern int rl_vi_eWord PARAMS((int, int));
+extern int rl_vi_fword PARAMS((int, int));
+extern int rl_vi_bword PARAMS((int, int));
+extern int rl_vi_eword PARAMS((int, int));
/* **************************************************************** */
/* */
@@ -260,141 +274,176 @@ extern int rl_vi_eword __P((int, int));
/* Readline functions. */
/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
-extern char *readline __P((char *));
+extern char *readline PARAMS((const char *));
-extern int rl_initialize __P((void));
+extern int rl_set_prompt PARAMS((const char *));
+extern int rl_expand_prompt PARAMS((char *));
-extern int rl_discard_argument __P((void));
+extern int rl_initialize PARAMS((void));
+
+/* Undocumented; unused by readline */
+extern int rl_discard_argument PARAMS((void));
/* Utility functions to bind keys to readline commands. */
-extern int rl_add_defun __P((char *, Function *, int));
-extern int rl_bind_key __P((int, Function *));
-extern int rl_bind_key_in_map __P((int, Function *, Keymap));
-extern int rl_unbind_key __P((int));
-extern int rl_unbind_key_in_map __P((int, Keymap));
-extern int rl_unbind_function_in_map __P((Function *, Keymap));
-extern int rl_unbind_command_in_map __P((char *, Keymap));
-extern int rl_set_key __P((char *, Function *, Keymap));
-extern int rl_generic_bind __P((int, char *, char *, Keymap));
-extern int rl_variable_bind __P((char *, char *));
+extern int rl_add_defun PARAMS((const char *, rl_command_func_t *, int));
+extern int rl_bind_key PARAMS((int, rl_command_func_t *));
+extern int rl_bind_key_in_map PARAMS((int, rl_command_func_t *, Keymap));
+extern int rl_unbind_key PARAMS((int));
+extern int rl_unbind_key_in_map PARAMS((int, Keymap));
+extern int rl_unbind_function_in_map PARAMS((rl_command_func_t *, Keymap));
+extern int rl_unbind_command_in_map PARAMS((const char *, Keymap));
+extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap));
+extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap));
+extern int rl_variable_bind PARAMS((const char *, const char *));
/* Backwards compatibility, use rl_generic_bind instead. */
-extern int rl_macro_bind __P((char *, char *, Keymap));
+extern int rl_macro_bind PARAMS((const char *, const char *, Keymap));
/* Undocumented in the texinfo manual; not really useful to programs. */
-extern int rl_translate_keyseq __P((char *, char *, int *));
-extern char *rl_untranslate_keyseq __P((int));
-
-extern Function *rl_named_function __P((char *));
-extern Function *rl_function_of_keyseq __P((const char *, Keymap, int *));
+extern int rl_translate_keyseq PARAMS((const char *, char *, int *));
+extern char *rl_untranslate_keyseq PARAMS((int));
-extern void rl_list_funmap_names __P((void));
-extern char **rl_invoking_keyseqs_in_map __P((Function *, Keymap));
-extern char **rl_invoking_keyseqs __P((Function *));
+extern rl_command_func_t *rl_named_function PARAMS((const char *));
+extern rl_command_func_t *rl_function_of_keyseq PARAMS((const char *, Keymap, int *));
-extern void rl_function_dumper __P((int));
-extern void rl_macro_dumper __P((int));
-extern void rl_variable_dumper __P((int));
+extern void rl_list_funmap_names PARAMS((void));
+extern char **rl_invoking_keyseqs_in_map PARAMS((rl_command_func_t *, Keymap));
+extern char **rl_invoking_keyseqs PARAMS((rl_command_func_t *));
+
+extern void rl_function_dumper PARAMS((int));
+extern void rl_macro_dumper PARAMS((int));
+extern void rl_variable_dumper PARAMS((int));
-extern int rl_read_init_file __P((const char *));
-extern int rl_parse_and_bind __P((char *));
+extern int rl_read_init_file PARAMS((const char *));
+extern int rl_parse_and_bind PARAMS((char *));
/* Functions for manipulating keymaps. */
-extern Keymap rl_make_bare_keymap __P((void));
-extern Keymap rl_copy_keymap __P((Keymap));
-extern Keymap rl_make_keymap __P((void));
-extern void rl_discard_keymap __P((Keymap));
-
-extern Keymap rl_get_keymap_by_name __P((char *));
-extern const char *rl_get_keymap_name __P((Keymap));
-extern void rl_set_keymap __P((Keymap));
-extern Keymap rl_get_keymap __P((void));
-extern void rl_set_keymap_from_edit_mode __P((void));
-extern const char *rl_get_keymap_name_from_edit_mode __P((void));
+extern Keymap rl_make_bare_keymap PARAMS((void));
+extern Keymap rl_copy_keymap PARAMS((Keymap));
+extern Keymap rl_make_keymap PARAMS((void));
+extern void rl_discard_keymap PARAMS((Keymap));
+
+extern Keymap rl_get_keymap_by_name PARAMS((const char *));
+extern char *rl_get_keymap_name PARAMS((Keymap));
+extern void rl_set_keymap PARAMS((Keymap));
+extern Keymap rl_get_keymap PARAMS((void));
+/* Undocumented; used internally only. */
+extern void rl_set_keymap_from_edit_mode PARAMS((void));
+extern char *rl_get_keymap_name_from_edit_mode PARAMS((void));
/* Functions for manipulating the funmap, which maps command names to functions. */
-extern int rl_add_funmap_entry __P((const char *, Function *));
-extern void rl_initialize_funmap __P((void));
-extern char **rl_funmap_names __P((void));
+extern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));
+extern const char **rl_funmap_names PARAMS((void));
+/* Undocumented, only used internally -- there is only one funmap, and this
+ function may be called only once. */
+extern void rl_initialize_funmap PARAMS((void));
/* Utility functions for managing keyboard macros. */
-extern void rl_push_macro_input __P((char *));
+extern void rl_push_macro_input PARAMS((char *));
/* Functions for undoing, from undo.c */
-extern void rl_add_undo __P((enum undo_code, int, int, char *));
-extern void free_undo_list __P((void));
-extern int rl_do_undo __P((void));
-extern int rl_begin_undo_group __P((void));
-extern int rl_end_undo_group __P((void));
-extern int rl_modifying __P((int, int));
+extern void rl_add_undo PARAMS((enum undo_code, int, int, char *));
+extern void rl_free_undo_list PARAMS((void));
+extern int rl_do_undo PARAMS((void));
+extern int rl_begin_undo_group PARAMS((void));
+extern int rl_end_undo_group PARAMS((void));
+extern int rl_modifying PARAMS((int, int));
/* Functions for redisplay. */
-extern void rl_redisplay __P((void));
-extern int rl_on_new_line __P((void));
-extern int rl_forced_update_display __P((void));
-extern int rl_clear_message __P((void));
-extern int rl_reset_line_state __P((void));
-
-#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
-extern int rl_message (const char *, ...);
+extern void rl_redisplay PARAMS((void));
+extern int rl_on_new_line PARAMS((void));
+extern int rl_on_new_line_with_prompt PARAMS((void));
+extern int rl_forced_update_display PARAMS((void));
+extern int rl_clear_message PARAMS((void));
+extern int rl_reset_line_state PARAMS((void));
+extern int rl_crlf PARAMS((void));
+
+#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG)
+extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
+extern int rl_show_char PARAMS((int));
+
/* Undocumented in texinfo manual. */
-extern int rl_show_char __P((int));
-extern int rl_character_len __P((int, int));
-extern int crlf __P((void));
+extern int rl_character_len PARAMS((int, int));
/* Save and restore internal prompt redisplay information. */
-extern void rl_save_prompt __P((void));
-extern void rl_restore_prompt __P((void));
+extern void rl_save_prompt PARAMS((void));
+extern void rl_restore_prompt PARAMS((void));
/* Modifying text. */
-extern int rl_insert_text __P((const char *));
-extern int rl_delete_text __P((int, int));
-extern int rl_kill_text __P((int, int));
-extern char *rl_copy_text __P((int, int));
+extern void rl_replace_line PARAMS((const char *, int));
+extern int rl_insert_text PARAMS((const char *));
+extern int rl_delete_text PARAMS((int, int));
+extern int rl_kill_text PARAMS((int, int));
+extern char *rl_copy_text PARAMS((int, int));
/* Terminal and tty mode management. */
-extern void rl_prep_terminal __P((int));
-extern void rl_deprep_terminal __P((void));
-extern void rltty_set_default_bindings __P((Keymap));
+extern void rl_prep_terminal PARAMS((int));
+extern void rl_deprep_terminal PARAMS((void));
+extern void rl_tty_set_default_bindings PARAMS((Keymap));
-extern int rl_reset_terminal __P((char *));
-extern void rl_resize_terminal __P((void));
+extern int rl_reset_terminal PARAMS((const char *));
+extern void rl_resize_terminal PARAMS((void));
+extern void rl_set_screen_size PARAMS((int, int));
+extern void rl_get_screen_size PARAMS((int *, int *));
-/* `Public' utility functions . */
-extern void rl_extend_line_buffer __P((int));
-extern int ding __P((void));
+extern char *rl_get_termcap PARAMS((const char *));
/* Functions for character input. */
-extern int rl_stuff_char __P((int));
-extern int rl_execute_next __P((int));
-extern int rl_read_key __P((void));
-extern int rl_getc __P((FILE *));
+extern int rl_stuff_char PARAMS((int));
+extern int rl_execute_next PARAMS((int));
+extern int rl_clear_pending_input PARAMS((void));
+extern int rl_read_key PARAMS((void));
+extern int rl_getc PARAMS((FILE *));
+extern int rl_set_keyboard_input_timeout PARAMS((int));
+
+/* `Public' utility functions . */
+extern void rl_extend_line_buffer PARAMS((int));
+extern int rl_ding PARAMS((void));
+extern int rl_alphabetic PARAMS((int));
/* Readline signal handling, from signals.c */
-extern int rl_set_signals __P((void));
-extern int rl_clear_signals __P((void));
-extern void rl_cleanup_after_signal __P((void));
-extern void rl_reset_after_signal __P((void));
-extern void rl_free_line_state __P((void));
+extern int rl_set_signals PARAMS((void));
+extern int rl_clear_signals PARAMS((void));
+extern void rl_cleanup_after_signal PARAMS((void));
+extern void rl_reset_after_signal PARAMS((void));
+extern void rl_free_line_state PARAMS((void));
+
+extern int rl_set_paren_blink_timeout PARAMS((int));
/* Undocumented. */
-extern int rl_expand_prompt __P((char *));
-
-extern int maybe_save_line __P((void));
-extern int maybe_unsave_line __P((void));
-extern int maybe_replace_line __P((void));
+extern int rl_maybe_save_line PARAMS((void));
+extern int rl_maybe_unsave_line PARAMS((void));
+extern int rl_maybe_replace_line PARAMS((void));
/* Completion functions. */
-extern int rl_complete_internal __P((int));
-extern void rl_display_match_list __P((char **, int, int));
+extern int rl_complete_internal PARAMS((int));
+extern void rl_display_match_list PARAMS((char **, int, int));
+
+extern char **rl_completion_matches PARAMS((const char *, rl_compentry_func_t *));
+extern char *rl_username_completion_function PARAMS((const char *, int));
+extern char *rl_filename_completion_function PARAMS((const char *, int));
+
+extern int rl_completion_mode PARAMS((rl_command_func_t *));
+
+#if 0
+/* Backwards compatibility (compat.c). These will go away sometime. */
+extern void free_undo_list PARAMS((void));
+extern int maybe_save_line PARAMS((void));
+extern int maybe_unsave_line PARAMS((void));
+extern int maybe_replace_line PARAMS((void));
-extern char **completion_matches __P((const char *, CPFunction *));
-extern char *username_completion_function __P((const char *, int));
-extern char *filename_completion_function __P((const char *, int));
+extern int ding PARAMS((void));
+extern int alphabetic PARAMS((int));
+extern int crlf PARAMS((void));
+
+extern char **completion_matches PARAMS((char *, rl_compentry_func_t *));
+extern char *username_completion_function PARAMS((const char *, int));
+extern char *filename_completion_function PARAMS((const char *, int));
+#endif
/* **************************************************************** */
/* */
@@ -403,7 +452,22 @@ extern char *filename_completion_function __P((const char *, int));
/* **************************************************************** */
/* The version of this incarnation of the readline library. */
-extern const char *rl_library_version;
+extern const char *rl_library_version; /* e.g., "4.2" */
+extern int rl_readline_version; /* e.g., 0x0402 */
+
+/* True if this is real GNU readline. */
+extern int rl_gnu_readline_p;
+
+/* Flags word encapsulating the current readline state. */
+extern int rl_readline_state;
+
+/* Says which editing mode readline is currently using. 1 means emacs mode;
+ 0 means vi mode. */
+extern int rl_editing_mode;
+
+/* Insert or overwrite mode for emacs mode. 1 means insert mode; 0 means
+ overwrite mode. Reset to insert mode on each input line. */
+extern int rl_insert_mode;
/* The name of the calling program. You should initialize this to
whatever was in argv[0]. It is used when parsing conditionals. */
@@ -417,7 +481,8 @@ extern char *rl_prompt;
extern char *rl_line_buffer;
/* The location of point, and end. */
-extern int rl_point, rl_end;
+extern int rl_point;
+extern int rl_end;
/* The mark, or saved cursor position. */
extern int rl_mark;
@@ -434,29 +499,44 @@ extern int rl_pending_input;
or directly from an application. */
extern int rl_dispatching;
+/* Non-zero if the user typed a numeric argument before executing the
+ current function. */
+extern int rl_explicit_arg;
+
+/* The current value of the numeric argument specified by the user. */
+extern int rl_numeric_arg;
+
+/* The address of the last command function Readline executed. */
+extern rl_command_func_t *rl_last_func;
+
/* The name of the terminal to use. */
-extern char *rl_terminal_name;
+extern const char *rl_terminal_name;
/* The input and output streams. */
-extern FILE *rl_instream, *rl_outstream;
+extern FILE *rl_instream;
+extern FILE *rl_outstream;
/* If non-zero, then this is the address of a function to call just
before readline_internal () prints the first prompt. */
-extern Function *rl_startup_hook;
+extern rl_hook_func_t *rl_startup_hook;
/* If non-zero, this is the address of a function to call just before
readline_internal_setup () returns and readline_internal starts
reading input characters. */
-extern Function *rl_pre_input_hook;
-
+extern rl_hook_func_t *rl_pre_input_hook;
+
/* The address of a function to call periodically while Readline is
awaiting character input, or NULL, for no event handling. */
-extern Function *rl_event_hook;
+extern rl_hook_func_t *rl_event_hook;
+
+/* The address of the function to call to fetch a character from the current
+ Readline input stream */
+extern rl_getc_func_t *rl_getc_function;
+
+extern rl_voidfunc_t *rl_redisplay_function;
-extern Function *rl_getc_function;
-extern VFunction *rl_redisplay_function;
-extern VFunction *rl_prep_term_function;
-extern VFunction *rl_deprep_term_function;
+extern rl_vintfunc_t *rl_prep_term_function;
+extern rl_voidfunc_t *rl_deprep_term_function;
/* Dispatch variables. */
extern Keymap rl_executing_keymap;
@@ -468,6 +548,18 @@ extern Keymap rl_binding_keymap;
rl_newline. */
extern int rl_erase_empty_line;
+/* If non-zero, the application has already printed the prompt (rl_prompt)
+ before calling readline, so readline should not output it the first time
+ redisplay is done. */
+extern int rl_already_prompted;
+
+/* A non-zero value means to read only this many characters rather than
+ up to a character bound to accept-line. */
+extern int rl_num_chars_to_read;
+
+/* The text of a currently-executing keyboard macro. */
+extern char *rl_executing_macro;
+
/* Variables to control readline signal handling. */
/* If non-zero, readline will install its own signal handlers for
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
@@ -482,9 +574,9 @@ extern int rl_catch_sigwinch;
/* Completion variables. */
/* Pointer to the generator function for completion_matches ().
- NULL means to use filename_entry_function (), the default filename
- completer. */
-extern Function *rl_completion_entry_function;
+ NULL means to use rl_filename_completion_function (), the default
+ filename completer. */
+extern rl_compentry_func_t *rl_completion_entry_function;
/* If rl_ignore_some_completions_function is non-NULL it is the address
of a function to call after all of the possible matches have been
@@ -492,7 +584,7 @@ extern Function *rl_completion_entry_function;
The function is called with one argument; a NULL terminated array
of (char *). If your function removes any of the elements, they
must be free()'ed. */
-extern Function *rl_ignore_some_completions_function;
+extern rl_compignore_func_t *rl_ignore_some_completions_function;
/* Pointer to alternative function to create matches.
Function is called with TEXT, START, and END.
@@ -501,7 +593,7 @@ extern Function *rl_ignore_some_completions_function;
If this function exists and returns NULL then call the value of
rl_completion_entry_function to try to match, otherwise use the
array of strings returned. */
-extern CPPFunction *rl_attempted_completion_function;
+extern rl_completion_func_t *rl_attempted_completion_function;
/* The basic list of characters that signal a break between words for the
completer routine. The initial contents of this variable is what
@@ -517,23 +609,34 @@ extern const char *rl_completer_word_break_characters;
Completion occurs on the entire substring, and within the substring
rl_completer_word_break_characters are treated as any other character,
unless they also appear within this list. */
-extern char *rl_completer_quote_characters;
+extern const char *rl_completer_quote_characters;
/* List of quote characters which cause a word break. */
extern const char *rl_basic_quote_characters;
/* List of characters that need to be quoted in filenames by the completer. */
-extern char *rl_filename_quote_characters;
+extern const char *rl_filename_quote_characters;
/* List of characters that are word break characters, but should be left
in TEXT when it is passed to the completion function. The shell uses
this to help determine what kind of completing to do. */
-extern char *rl_special_prefixes;
+extern const char *rl_special_prefixes;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
- the address of a string (the current directory name) as an arg. */
-extern Function *rl_directory_completion_hook;
+ the address of a string (the current directory name) as an arg. It
+ changes what is displayed when the possible completions are printed
+ or inserted. */
+extern rl_icppfunc_t *rl_directory_completion_hook;
+
+/* If non-zero, this is the address of a function to call when completing
+ a directory name. This function takes the address of the directory name
+ to be modified as an argument. Unlike rl_directory_completion_hook, it
+ only modifies the directory name used in opendir(2), not what is displayed
+ when the possible completions are printed or inserted. It is called
+ before rl_directory_completion_hook. I'm not happy with how this works
+ yet, so it's undocumented. */
+extern rl_icppfunc_t *rl_directory_rewrite_hook;
/* Backwards compatibility with previous versions of readline. */
#define rl_symbolic_link_hook rl_directory_completion_hook
@@ -545,7 +648,7 @@ extern Function *rl_directory_completion_hook;
where MATCHES is the array of strings that matched, NUM_MATCHES is the
number of strings in that array, and MAX_LENGTH is the length of the
longest string in that array. */
-extern VFunction *rl_completion_display_matches_hook;
+extern rl_compdisp_func_t *rl_completion_display_matches_hook;
/* Non-zero means that the results of the matches are to be treated
as filenames. This is ALWAYS zero on entry, and can only be changed
@@ -563,17 +666,17 @@ extern int rl_filename_quoting_desired;
Called with the text to quote, the type of match found (single or multiple)
and a pointer to the quoting character to be used, which the function can
reset if desired. */
-extern CPFunction *rl_filename_quoting_function;
+extern rl_quote_func_t *rl_filename_quoting_function;
/* Function to call to remove quoting characters from a filename. Called
before completion is attempted, so the embedded quotes do not interfere
with matching names in the file system. */
-extern CPFunction *rl_filename_dequoting_function;
+extern rl_dequote_func_t *rl_filename_dequoting_function;
/* Function to call to decide whether or not a word break character is
quoted. If a character is quoted, it does not break words for the
completer. */
-extern Function *rl_char_is_quoted_p;
+extern rl_linebuf_func_t *rl_char_is_quoted_p;
/* Non-zero means to suppress normal filename completion after the
user-specified completion function has been called. */
@@ -588,11 +691,26 @@ extern int rl_completion_type;
default is a space. Nothing is added if this is '\0'. */
extern int rl_completion_append_character;
+/* If set to non-zero by an application completion function,
+ rl_completion_append_character will not be appended. */
+extern int rl_completion_suppress_append;
+
/* 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, a slash will be appended to completed filenames that are
+ symbolic links to directory names, subject to the value of the
+ mark-directories variable (which is user-settable). This exists so
+ that application completion functions can override the user's preference
+ (set via the mark-symlinked-directories variable) if appropriate.
+ It's set to the value of _rl_complete_mark_symlink_dirs in
+ rl_complete_internal before any application-specific completion
+ function is called, so without that function doing anything, the user's
+ preferences are honored. */
+extern int rl_completion_mark_symlink_dirs;
+
/* If non-zero, then disallow duplicates in the matches. */
extern int rl_ignore_completion_duplicates;
@@ -610,9 +728,69 @@ extern int rl_inhibit_completion;
#define SINGLE_MATCH 1
#define MULT_MATCH 2
-#if !defined (savestring)
-extern char *savestring (); /* XXX backwards compatibility */
-#endif
+/* Possible state values for rl_readline_state */
+#define RL_STATE_NONE 0x00000 /* no state; before first call */
+
+#define RL_STATE_INITIALIZING 0x00001 /* initializing */
+#define RL_STATE_INITIALIZED 0x00002 /* initialization done */
+#define RL_STATE_TERMPREPPED 0x00004 /* terminal is prepped */
+#define RL_STATE_READCMD 0x00008 /* reading a command key */
+#define RL_STATE_METANEXT 0x00010 /* reading input after ESC */
+#define RL_STATE_DISPATCHING 0x00020 /* dispatching to a command */
+#define RL_STATE_MOREINPUT 0x00040 /* reading more input in a command function */
+#define RL_STATE_ISEARCH 0x00080 /* doing incremental search */
+#define RL_STATE_NSEARCH 0x00100 /* doing non-inc search */
+#define RL_STATE_SEARCH 0x00200 /* doing a history search */
+#define RL_STATE_NUMERICARG 0x00400 /* reading numeric argument */
+#define RL_STATE_MACROINPUT 0x00800 /* getting input from a macro */
+#define RL_STATE_MACRODEF 0x01000 /* defining keyboard macro */
+#define RL_STATE_OVERWRITE 0x02000 /* overwrite mode */
+#define RL_STATE_COMPLETING 0x04000 /* doing completion */
+#define RL_STATE_SIGHANDLER 0x08000 /* in readline sighandler */
+#define RL_STATE_UNDOING 0x10000 /* doing an undo */
+#define RL_STATE_INPUTPENDING 0x20000 /* rl_execute_next called */
+
+#define RL_STATE_DONE 0x80000 /* done; accepted line */
+
+#define RL_SETSTATE(x) (rl_readline_state |= (x))
+#define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
+#define RL_ISSTATE(x) (rl_readline_state & (x))
+
+struct readline_state {
+ /* line state */
+ int point;
+ int end;
+ int mark;
+ char *buffer;
+ int buflen;
+ UNDO_LIST *ul;
+ char *prompt;
+
+ /* global state */
+ int rlstate;
+ int done;
+ Keymap kmap;
+
+ /* input state */
+ rl_command_func_t *lastfunc;
+ int insmode;
+ int edmode;
+ int kseqlen;
+ FILE *inf;
+ FILE *outf;
+ int pendingin;
+ char *macro;
+
+ /* signal state */
+ int catchsigs;
+ int catchsigwinch;
+
+ /* reserved for future expansion, so the struct size doesn't change */
+ char reserved[64];
+};
+
+extern int rl_save_state PARAMS((struct readline_state *));
+extern int rl_restore_state PARAMS((struct readline_state *));
#ifdef __cplusplus
}
diff --git a/readline/rlconf.h b/readline/rlconf.h
index 1356fd87924..c651fd8b41f 100644
--- a/readline/rlconf.h
+++ b/readline/rlconf.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLCONF_H_)
#define _RLCONF_H_
@@ -30,10 +30,6 @@
/* Define this to get an indication of file type when listing completions. */
#define VISIBLE_STATS
-/* If defined, readline shows opening parens and braces when closing
- paren or brace entered. */
-/* #define PAREN_MATCHING */
-
/* This definition is needed by readline.c, rltty.c, and signals.c. */
/* If on, then readline handles signals in a way that doesn't screw. */
#define HANDLE_SIGNALS
@@ -58,4 +54,7 @@
X `callback' style. */
#define READLINE_CALLBACKS
+/* Define this if you want the cursor to indicate insert or overwrite mode. */
+/* #define CURSOR_MODE */
+
#endif /* _RLCONF_H_ */
diff --git a/readline/rldefs.h b/readline/rldefs.h
index d4aced43e2a..4a28bd1e49c 100644
--- a/readline/rldefs.h
+++ b/readline/rldefs.h
@@ -10,7 +10,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -21,7 +21,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLDEFS_H_)
#define _RLDEFS_H_
@@ -30,6 +30,8 @@
# include "config.h"
#endif
+#include "rlstdc.h"
+
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
# define TERMIOS_TTY_DRIVER
#else
@@ -71,7 +73,14 @@ extern char *strchr (), *strrchr ();
#define _rl_stricmp strcasecmp
#define _rl_strnicmp strncasecmp
#else
-extern int _rl_stricmp (), _rl_strnicmp ();
+extern int _rl_stricmp PARAMS((char *, char *));
+extern int _rl_strnicmp PARAMS((char *, char *, int));
+#endif
+
+#if defined (HAVE_STRPBRK)
+# define _rl_strpbrk(a,b) strpbrk((a),(b))
+#else
+extern char *_rl_strpbrk PARAMS((const char *, const char *));
#endif
#if !defined (emacs_mode)
@@ -80,6 +89,13 @@ extern int _rl_stricmp (), _rl_strnicmp ();
# define emacs_mode 1
#endif
+#if !defined (RL_IM_INSERT)
+# define RL_IM_INSERT 1
+# define RL_IM_OVERWRITE 0
+#
+# define RL_IM_DEFAULT RL_IM_INSERT
+#endif
+
/* If you cast map[key].function to type (Keymap) on a Cray,
the compiler takes the value of map[key].function and
divides it by 4 to convert between pointer types (pointers
@@ -87,15 +103,14 @@ extern int _rl_stricmp (), _rl_strnicmp ();
This is not what is wanted. */
#if defined (CRAY)
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
-# define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data))
+# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)((int)(data))
#else
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
-# define KEYMAP_TO_FUNCTION(data) (Function *)(data)
+# define KEYMAP_TO_FUNCTION(data) (rl_command_func_t *)(data)
#endif
#ifndef savestring
-extern char *xmalloc ();
-#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
#endif
/* Possible values for _rl_bell_preference. */
@@ -113,22 +128,28 @@ extern char *xmalloc ();
/* Possible values for the found_quote flags word used by the completion
functions. It says what kind of (shell-like) quoting we found anywhere
in the line. */
-#define RL_QF_SINGLE_QUOTE 0x1
-#define RL_QF_DOUBLE_QUOTE 0x2
-#define RL_QF_BACKSLASH 0x4
+#define RL_QF_SINGLE_QUOTE 0x01
+#define RL_QF_DOUBLE_QUOTE 0x02
+#define RL_QF_BACKSLASH 0x04
+#define RL_QF_OTHER_QUOTE 0x08
/* Default readline line buffer length. */
#define DEFAULT_BUFFER_SIZE 256
#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
-#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
+#define STREQN(a, b, n) (((n) == 0) ? (1) \
+ : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
#if !defined (FREE)
# define FREE(x) if (x) free (x)
#endif
+#if !defined (SWAP)
+# define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
+#endif
+
/* CONFIGURATION SECTION */
#include "rlconf.h"
diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h
new file mode 100644
index 00000000000..27ca32bfc7d
--- /dev/null
+++ b/readline/rlmbutil.h
@@ -0,0 +1,108 @@
+/* rlmbutil.h -- utility functions for multibyte characters. */
+
+/* Copyright (C) 2001 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_RL_MBUTIL_H_)
+#define _RL_MBUTIL_H_
+
+#include "rlstdc.h"
+
+/************************************************/
+/* check multibyte capability for I18N code */
+/************************************************/
+
+/* For platforms which support the ISO C amendement 1 functionality we
+ support user defined character classes. */
+ /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
+#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H)
+# include <wchar.h>
+# include <wctype.h>
+# if defined (HAVE_MBSRTOWCS) /* system is supposed to support XPG5 */
+# define HANDLE_MULTIBYTE 1
+# endif
+#endif
+
+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
+#if HANDLE_MULTIBYTE && !defined (HAVE_MBSTATE_T)
+# define wcsrtombs(dest, src, len, ps) (wcsrtombs) (dest, src, len, 0)
+# define mbsrtowcs(dest, src, len, ps) (mbsrtowcs) (dest, src, len, 0)
+# define wcrtomb(s, wc, ps) (wcrtomb) (s, wc, 0)
+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
+# define mbrlen(s, n, ps) (mbrlen) (s, n, 0)
+# define mbstate_t int
+#endif
+
+/* Make sure MB_LEN_MAX is at least 16 on systems that claim to be able to
+ handle multibyte chars (some systems define MB_LEN_MAX as 1) */
+#ifdef HANDLE_MULTIBYTE
+# include <limits.h>
+# if defined(MB_LEN_MAX) && (MB_LEN_MAX < 16)
+# undef MB_LEN_MAX
+# endif
+# if !defined (MB_LEN_MAX)
+# define MB_LEN_MAX 16
+# endif
+#endif
+
+/************************************************/
+/* end of multibyte capability checks for I18N */
+/************************************************/
+
+/*
+ * Flags for _rl_find_prev_mbchar and _rl_find_next_mbchar:
+ *
+ * MB_FIND_ANY find any multibyte character
+ * MB_FIND_NONZERO find a non-zero-width multibyte character
+ */
+
+#define MB_FIND_ANY 0x00
+#define MB_FIND_NONZERO 0x01
+
+extern int _rl_find_prev_mbchar PARAMS((char *, int, int));
+extern int _rl_find_next_mbchar PARAMS((char *, int, int, int));
+
+#ifdef HANDLE_MULTIBYTE
+
+extern int _rl_compare_chars PARAMS((char *, int, mbstate_t *, char *, int, mbstate_t *));
+extern int _rl_get_char_len PARAMS((char *, mbstate_t *));
+extern int _rl_adjust_point PARAMS((char *, int, mbstate_t *));
+
+extern int _rl_read_mbchar PARAMS((char *, int));
+extern int _rl_read_mbstring PARAMS((int, char *, int));
+
+extern int _rl_is_mbchar_matched PARAMS((char *, int, int, char *, int));
+
+#else /* !HANDLE_MULTIBYTE */
+
+#undef MB_LEN_MAX
+#undef MB_CUR_MAX
+
+#define MB_LEN_MAX 1
+#define MB_CUR_MAX 1
+
+#define _rl_find_prev_mbchar(b, i, f) (((i) == 0) ? (i) : ((i) - 1))
+#define _rl_find_next_mbchar(b, i1, i2, f) ((i1) + (i2))
+
+#endif /* !HANDLE_MULTIBYTE */
+
+extern int rl_byte_oriented;
+
+#endif /* _RL_MBUTIL_H_ */
diff --git a/readline/rlprivate.h b/readline/rlprivate.h
new file mode 100644
index 00000000000..78bee107dcd
--- /dev/null
+++ b/readline/rlprivate.h
@@ -0,0 +1,284 @@
+/* rlprivate.h -- functions and variables global to the readline library,
+ but not intended for use by applications. */
+
+/* Copyright (C) 1999 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_RL_PRIVATE_H_)
+#define _RL_PRIVATE_H_
+
+#include "rlconf.h" /* for VISIBLE_STATS */
+#include "rlstdc.h"
+#include "posixjmp.h" /* defines procenv_t */
+
+/*************************************************************************
+ * *
+ * Global functions undocumented in texinfo manual and not in readline.h *
+ * *
+ *************************************************************************/
+
+/*************************************************************************
+ * *
+ * Global variables undocumented in texinfo manual and not in readline.h *
+ * *
+ *************************************************************************/
+
+/* complete.c */
+extern int rl_complete_with_tilde_expansion;
+#if defined (VISIBLE_STATS)
+extern int rl_visible_stats;
+#endif /* VISIBLE_STATS */
+
+/* readline.c */
+extern int rl_line_buffer_len;
+extern int rl_arg_sign;
+extern int rl_visible_prompt_length;
+extern int readline_echoing_p;
+extern int rl_key_sequence_length;
+extern int rl_byte_oriented;
+
+/* display.c */
+extern int rl_display_fixed;
+
+/* parens.c */
+extern int rl_blink_matching_paren;
+
+/*************************************************************************
+ * *
+ * Global functions and variables unsed and undocumented *
+ * *
+ *************************************************************************/
+
+/* kill.c */
+extern int rl_set_retained_kills PARAMS((int));
+
+/* terminal.c */
+extern void _rl_set_screen_size PARAMS((int, int));
+
+/* undo.c */
+extern int _rl_fix_last_undo_of_type PARAMS((unsigned int, int, int));
+
+/* util.c */
+extern char *_rl_savestring PARAMS((const char *));
+
+/*************************************************************************
+ * *
+ * Functions and variables private to the readline library *
+ * *
+ *************************************************************************/
+
+/* NOTE: Functions and variables prefixed with `_rl_' are
+ pseudo-global: they are global so they can be shared
+ between files in the readline library, but are not intended
+ to be visible to readline callers. */
+
+/*************************************************************************
+ * Undocumented private functions *
+ *************************************************************************/
+
+#if defined(READLINE_CALLBACKS)
+
+/* readline.c */
+extern void readline_internal_setup PARAMS((void));
+extern char *readline_internal_teardown PARAMS((int));
+extern int readline_internal_char PARAMS((void));
+
+#endif /* READLINE_CALLBACKS */
+
+/* bind.c */
+extern void _rl_bind_if_unbound PARAMS((const char *, rl_command_func_t *));
+
+/* complete.c */
+extern char _rl_find_completion_word PARAMS((int *, int *));
+extern void _rl_free_match_list PARAMS((char **));
+
+/* display.c */
+extern char *_rl_strip_prompt PARAMS((char *));
+extern void _rl_move_cursor_relative PARAMS((int, const char *));
+extern void _rl_move_vert PARAMS((int));
+extern void _rl_save_prompt PARAMS((void));
+extern void _rl_restore_prompt PARAMS((void));
+extern char *_rl_make_prompt_for_search PARAMS((int));
+extern void _rl_erase_at_end_of_line PARAMS((int));
+extern void _rl_clear_to_eol PARAMS((int));
+extern void _rl_clear_screen PARAMS((void));
+extern void _rl_update_final PARAMS((void));
+extern void _rl_redisplay_after_sigwinch PARAMS((void));
+extern void _rl_clean_up_for_exit PARAMS((void));
+extern void _rl_erase_entire_line PARAMS((void));
+extern int _rl_current_display_line PARAMS((void));
+
+/* input.c */
+extern int _rl_any_typein PARAMS((void));
+extern int _rl_input_available PARAMS((void));
+extern int _rl_input_queued PARAMS((int));
+extern void _rl_insert_typein PARAMS((int));
+extern int _rl_unget_char PARAMS((int));
+
+/* macro.c */
+extern void _rl_with_macro_input PARAMS((char *));
+extern int _rl_next_macro_key PARAMS((void));
+extern void _rl_push_executing_macro PARAMS((void));
+extern void _rl_pop_executing_macro PARAMS((void));
+extern void _rl_add_macro_char PARAMS((int));
+extern void _rl_kill_kbd_macro PARAMS((void));
+
+/* misc.c */
+extern int _rl_init_argument PARAMS((void));
+extern void _rl_start_using_history PARAMS((void));
+extern int _rl_free_saved_history_line PARAMS((void));
+extern void _rl_set_insert_mode PARAMS((int, int));
+
+/* nls.c */
+extern int _rl_init_eightbit PARAMS((void));
+
+/* parens.c */
+extern void _rl_enable_paren_matching PARAMS((int));
+
+/* readline.c */
+extern void _rl_init_line_state PARAMS((void));
+extern void _rl_set_the_line PARAMS((void));
+extern int _rl_dispatch PARAMS((int, Keymap));
+extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
+
+/* rltty.c */
+extern int _rl_disable_tty_signals PARAMS((void));
+extern int _rl_restore_tty_signals PARAMS((void));
+
+/* terminal.c */
+extern void _rl_get_screen_size PARAMS((int, int));
+extern int _rl_init_terminal_io PARAMS((const char *));
+#ifdef _MINIX
+extern void _rl_output_character_function PARAMS((int));
+#else
+extern int _rl_output_character_function PARAMS((int));
+#endif
+extern void _rl_output_some_chars PARAMS((const char *, int));
+extern int _rl_backspace PARAMS((int));
+extern void _rl_enable_meta_key PARAMS((void));
+extern void _rl_control_keypad PARAMS((int));
+extern void _rl_set_cursor PARAMS((int, int));
+
+/* text.c */
+extern void _rl_fix_point PARAMS((int));
+extern int _rl_replace_text PARAMS((const char *, int, int));
+extern int _rl_insert_char PARAMS((int, int));
+extern int _rl_overwrite_char PARAMS((int, int));
+extern int _rl_overwrite_rubout PARAMS((int, int));
+extern int _rl_rubout_char PARAMS((int, int));
+#if defined (HANDLE_MULTIBYTE)
+extern int _rl_char_search_internal PARAMS((int, int, char *, int));
+#else
+extern int _rl_char_search_internal PARAMS((int, int, int));
+#endif
+extern int _rl_set_mark_at_pos PARAMS((int));
+
+/* util.c */
+extern int _rl_abort_internal PARAMS((void));
+extern char *_rl_strindex PARAMS((const char *, const char *));
+extern int _rl_qsort_string_compare PARAMS((char **, char **));
+extern int (_rl_uppercase_p) PARAMS((int));
+extern int (_rl_lowercase_p) PARAMS((int));
+extern int (_rl_pure_alphabetic) PARAMS((int));
+extern int (_rl_digit_p) PARAMS((int));
+extern int (_rl_to_lower) PARAMS((int));
+extern int (_rl_to_upper) PARAMS((int));
+extern int (_rl_digit_value) PARAMS((int));
+
+/* vi_mode.c */
+extern void _rl_vi_initialize_line PARAMS((void));
+extern void _rl_vi_reset_last PARAMS((void));
+extern void _rl_vi_set_last PARAMS((int, int, int));
+extern int _rl_vi_textmod_command PARAMS((int));
+extern void _rl_vi_done_inserting PARAMS((void));
+
+/*************************************************************************
+ * Undocumented private variables *
+ *************************************************************************/
+
+/* bind.c */
+extern const char *_rl_possible_control_prefixes[];
+extern const char *_rl_possible_meta_prefixes[];
+
+/* complete.c */
+extern int _rl_complete_show_all;
+extern int _rl_complete_mark_directories;
+extern int _rl_complete_mark_symlink_dirs;
+extern int _rl_print_completions_horizontally;
+extern int _rl_completion_case_fold;
+extern int _rl_match_hidden_files;
+extern int _rl_page_completions;
+
+/* display.c */
+extern int _rl_vis_botlin;
+extern int _rl_last_c_pos;
+extern int _rl_suppress_redisplay;
+extern char *rl_display_prompt;
+
+/* isearch.c */
+extern char *_rl_isearch_terminators;
+
+/* macro.c */
+extern char *_rl_executing_macro;
+
+/* misc.c */
+extern int _rl_history_preserve_point;
+extern int _rl_history_saved_point;
+
+/* readline.c */
+extern int _rl_horizontal_scroll_mode;
+extern int _rl_mark_modified_lines;
+extern int _rl_bell_preference;
+extern int _rl_meta_flag;
+extern int _rl_convert_meta_chars_to_ascii;
+extern int _rl_output_meta_chars;
+extern char *_rl_comment_begin;
+extern unsigned char _rl_parsing_conditionalized_out;
+extern Keymap _rl_keymap;
+extern FILE *_rl_in_stream;
+extern FILE *_rl_out_stream;
+extern int _rl_last_command_was_kill;
+extern int _rl_eof_char;
+extern procenv_t readline_top_level;
+
+/* terminal.c */
+extern int _rl_enable_keypad;
+extern int _rl_enable_meta;
+extern char *_rl_term_clreol;
+extern char *_rl_term_clrpag;
+extern char *_rl_term_im;
+extern char *_rl_term_ic;
+extern char *_rl_term_ei;
+extern char *_rl_term_DC;
+extern char *_rl_term_up;
+extern char *_rl_term_dc;
+extern char *_rl_term_cr;
+extern char *_rl_term_IC;
+extern int _rl_screenheight;
+extern int _rl_screenwidth;
+extern int _rl_screenchars;
+extern int _rl_terminal_can_insert;
+extern int _rl_term_autowrap;
+
+/* undo.c */
+extern int _rl_doing_an_undo;
+extern int _rl_undo_group_level;
+
+#endif /* _RL_PRIVATE_H_ */
diff --git a/readline/rlshell.h b/readline/rlshell.h
new file mode 100644
index 00000000000..3c03fbad576
--- /dev/null
+++ b/readline/rlshell.h
@@ -0,0 +1,34 @@
+/* rlshell.h -- utility functions normally provided by bash. */
+
+/* Copyright (C) 1999 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_RL_SHELL_H_)
+#define _RL_SHELL_H_
+
+#include "rlstdc.h"
+
+extern char *sh_single_quote PARAMS((char *));
+extern void sh_set_lines_and_columns PARAMS((int, int));
+extern char *sh_get_env_value PARAMS((const char *));
+extern char *sh_get_home_dir PARAMS((void));
+extern int sh_unset_nodelay_mode PARAMS((int));
+
+#endif /* _RL_SHELL_H_ */
diff --git a/readline/rlstdc.h b/readline/rlstdc.h
index f79cf89fe76..d6a22b3742c 100644
--- a/readline/rlstdc.h
+++ b/readline/rlstdc.h
@@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RL_STDC_H_)
#define _RL_STDC_H_
@@ -26,58 +26,20 @@
/* A function can be defined using prototypes and compile on both ANSI C
and traditional C compilers with something like this:
- extern char *func __P((char *, char *, int)); */
+ extern char *func PARAMS((char *, char *, int)); */
-#if defined (__STDC__) || defined(__cplusplus)
-
-# if !defined (__P)
-# define __P(protos) protos
-# endif
-# define __STRING(x) #x
-
-# if !defined (__GNUC__) && !defined(__cplusplus) && !defined(inline)
-# define inline
-# endif
-
-#else /* !__STDC__ */
-
-# if !defined (__P)
-# define __P(protos) ()
+#if !defined (PARAMS)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
+# define PARAMS(protos) protos
+# else
+# define PARAMS(protos) ()
# endif
-# define __STRING(x) "x"
+#endif
-#if defined (__GNUC__) /* gcc with -traditional */
-# if !defined (const)
-# define const __const
-# endif
-# if !defined (inline)
-# define inline __inline
+#ifndef __attribute__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
+# define __attribute__(x)
# endif
-# if !defined (signed)
-# define signed __signed
-# endif
-# if !defined (volatile)
-# define volatile __volatile
-# endif
-#else /* !__GNUC__ */
-# if !defined (const)
-# define const
-# endif
-# if !defined (inline)
-# define inline
-# endif
-# if !defined (signed)
-# define signed
-# endif
-# if !defined (volatile)
-# define volatile
-# endif
-#endif /* !__GNUC__ */
-
-#endif /* !__STDC__ */
-
-#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
-#define __attribute__(A)
#endif
#endif /* !_RL_STDC_H_ */
diff --git a/readline/rltty.c b/readline/rltty.c
index f87c1c9747f..09702e9e755 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -43,28 +43,19 @@
#include "rltty.h"
#include "readline.h"
+#include "rlprivate.h"
#if !defined (errno)
extern int errno;
#endif /* !errno */
-extern int readline_echoing_p;
-extern int _rl_eof_char;
+rl_vintfunc_t *rl_prep_term_function = rl_prep_terminal;
+rl_voidfunc_t *rl_deprep_term_function = rl_deprep_terminal;
-extern int _rl_enable_keypad, _rl_enable_meta;
+static void block_sigint PARAMS((void));
+static void release_sigint PARAMS((void));
-extern void _rl_control_keypad ();
-
-#if defined (__GO32__)
-# include <pc.h>
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
-
-/* Indirect functions to allow apps control over terminal management. */
-extern void rl_prep_terminal (), rl_deprep_terminal ();
-
-VFunction *rl_prep_term_function = rl_prep_terminal;
-VFunction *rl_deprep_term_function = rl_deprep_terminal;
+static void set_winsize PARAMS((int));
/* **************************************************************** */
/* */
@@ -104,6 +95,7 @@ block_sigint ()
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+
sigint_blocked = 1;
}
@@ -111,7 +103,7 @@ block_sigint ()
static void
release_sigint ()
{
- if (!sigint_blocked)
+ if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
@@ -138,32 +130,27 @@ release_sigint ()
/* Non-zero means that the terminal is in a prepped state. */
static int terminal_prepped;
+static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
+
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
and output is suspended. */
#if defined (__ksr1__)
static int ksrflow;
#endif
-#if defined (TIOCGWINSZ)
/* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. */
static void
set_winsize (tty)
int tty;
{
+#if defined (TIOCGWINSZ)
struct winsize w;
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
-}
-#else
-static void
-set_winsize (tty)
- int tty;
-{
-// dummy function, required by other code. What should be doing?
-}
#endif /* TIOCGWINSZ */
+}
#if defined (NEW_TTY_DRIVER)
@@ -191,6 +178,50 @@ struct bsdtty {
static TIOTYPE otio;
+static void save_tty_chars PARAMS((TIOTYPE *));
+static int _get_tty_settings PARAMS((int, TIOTYPE *));
+static int get_tty_settings PARAMS((int, TIOTYPE *));
+static int _set_tty_settings PARAMS((int, TIOTYPE *));
+static int set_tty_settings PARAMS((int, TIOTYPE *));
+
+static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
+
+static void
+save_tty_chars (tiop)
+ TIOTYPE *tiop;
+{
+ _rl_last_tty_chars = _rl_tty_chars;
+
+ if (tiop->flags & SGTTY_SET)
+ {
+ _rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
+ _rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
+ }
+
+ if (tiop->flags & TCHARS_SET)
+ {
+ _rl_tty_chars.t_intr = tiop->tchars.t_intrc;
+ _rl_tty_chars.t_quit = tiop->tchars.t_quitc;
+ _rl_tty_chars.t_start = tiop->tchars.t_startc;
+ _rl_tty_chars.t_stop = tiop->tchars.t_stopc;
+ _rl_tty_chars.t_eof = tiop->tchars.t_eofc;
+ _rl_tty_chars.t_eol = '\n';
+ _rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
+ }
+
+ if (tiop->flags & LTCHARS_SET)
+ {
+ _rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
+ _rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
+ _rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
+ _rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
+ _rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
+ _rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
+ }
+
+ _rl_tty_chars.t_status = -1;
+}
+
static int
get_tty_settings (tty, tiop)
int tty;
@@ -200,22 +231,23 @@ get_tty_settings (tty, tiop)
tiop->flags = tiop->lflag = 0;
- ioctl (tty, TIOCGETP, &(tiop->sgttyb));
+ if (ioctl (tty, TIOCGETP, &(tiop->sgttyb)) < 0)
+ return -1;
tiop->flags |= SGTTY_SET;
#if defined (TIOCLGET)
- ioctl (tty, TIOCLGET, &(tiop->lflag));
- tiop->flags |= LFLAG_SET;
+ if (ioctl (tty, TIOCLGET, &(tiop->lflag)) == 0)
+ tiop->flags |= LFLAG_SET;
#endif
#if defined (TIOCGETC)
- ioctl (tty, TIOCGETC, &(tiop->tchars));
- tiop->flags |= TCHARS_SET;
+ if (ioctl (tty, TIOCGETC, &(tiop->tchars)) == 0)
+ tiop->flags |= TCHARS_SET;
#endif
#if defined (TIOCGLTC)
- ioctl (tty, TIOCGLTC, &(tiop->ltchars));
- tiop->flags |= LTCHARS_SET;
+ if (ioctl (tty, TIOCGLTC, &(tiop->ltchars)) == 0)
+ tiop->flags |= LTCHARS_SET;
#endif
return 0;
@@ -261,24 +293,23 @@ set_tty_settings (tty, tiop)
}
static void
-prepare_terminal_settings (meta_flag, otio, tiop)
+prepare_terminal_settings (meta_flag, oldtio, tiop)
int meta_flag;
- TIOTYPE otio, *tiop;
+ TIOTYPE oldtio, *tiop;
{
-#if !defined (__GO32__)
- readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
+ readline_echoing_p = (oldtio.sgttyb.sg_flags & ECHO);
/* Copy the original settings to the structure we're going to use for
our settings. */
- tiop->sgttyb = otio.sgttyb;
- tiop->lflag = otio.lflag;
+ tiop->sgttyb = oldtio.sgttyb;
+ tiop->lflag = oldtio.lflag;
#if defined (TIOCGETC)
- tiop->tchars = otio.tchars;
+ tiop->tchars = oldtio.tchars;
#endif
#if defined (TIOCGLTC)
- tiop->ltchars = otio.ltchars;
+ tiop->ltchars = oldtio.ltchars;
#endif
- tiop->flags = otio.flags;
+ tiop->flags = oldtio.flags;
/* First, the basic settings to put us into character-at-a-time, no-echo
input mode. */
@@ -291,8 +322,8 @@ prepare_terminal_settings (meta_flag, otio, tiop)
#if !defined (ANYP)
# define ANYP (EVENP | ODDP)
#endif
- if (((otio.sgttyb.sg_flags & ANYP) == ANYP) ||
- ((otio.sgttyb.sg_flags & ANYP) == 0))
+ if (((oldtio.sgttyb.sg_flags & ANYP) == ANYP) ||
+ ((oldtio.sgttyb.sg_flags & ANYP) == 0))
{
tiop->sgttyb.sg_flags |= ANYP;
@@ -311,13 +342,13 @@ prepare_terminal_settings (meta_flag, otio, tiop)
tiop->tchars.t_startc = -1; /* C-q */
/* If there is an XON character, bind it to restart the output. */
- if (otio.tchars.t_startc != -1)
- rl_bind_key (otio.tchars.t_startc, rl_restart_output);
+ if (oldtio.tchars.t_startc != -1)
+ rl_bind_key (oldtio.tchars.t_startc, rl_restart_output);
# endif /* USE_XON_XOFF */
/* If there is an EOF char, bind _rl_eof_char to it. */
- if (otio.tchars.t_eofc != -1)
- _rl_eof_char = otio.tchars.t_eofc;
+ if (oldtio.tchars.t_eofc != -1)
+ _rl_eof_char = oldtio.tchars.t_eofc;
# if defined (NO_KILL_INTR)
/* Get rid of terminal-generated SIGQUIT and SIGINT. */
@@ -331,7 +362,6 @@ prepare_terminal_settings (meta_flag, otio, tiop)
tiop->ltchars.t_dsuspc = -1; /* C-y */
tiop->ltchars.t_lnextc = -1; /* C-v */
#endif /* TIOCGLTC */
-#endif /* !__GO32__ */
}
#else /* !defined (NEW_TTY_DRIVER) */
@@ -357,18 +387,71 @@ prepare_terminal_settings (meta_flag, otio, tiop)
# define TIOTYPE struct termio
# define DRAIN_OUTPUT(fd)
# define GETATTR(tty, tiop) (ioctl (tty, TCGETA, tiop))
-# define SETATTR(tty, tiop) (ioctl (tty, TCSETA, tiop))
+# define SETATTR(tty, tiop) (ioctl (tty, TCSETAW, tiop))
#endif /* !TERMIOS_TTY_DRIVER */
static TIOTYPE otio;
+static void save_tty_chars PARAMS((TIOTYPE *));
+static int _get_tty_settings PARAMS((int, TIOTYPE *));
+static int get_tty_settings PARAMS((int, TIOTYPE *));
+static int _set_tty_settings PARAMS((int, TIOTYPE *));
+static int set_tty_settings PARAMS((int, TIOTYPE *));
+
+static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *));
+
#if defined (FLUSHO)
# define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO)
#else
# define OUTPUT_BEING_FLUSHED(tp) 0
#endif
-#if defined (_AIX) || (defined (FLUSHO) && defined (_AIX41))
+static void
+save_tty_chars (tiop)
+ TIOTYPE *tiop;
+{
+ _rl_last_tty_chars = _rl_tty_chars;
+
+ _rl_tty_chars.t_eof = tiop->c_cc[VEOF];
+ _rl_tty_chars.t_eol = tiop->c_cc[VEOL];
+#ifdef VEOL2
+ _rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
+#endif
+ _rl_tty_chars.t_erase = tiop->c_cc[VERASE];
+#ifdef VWERASE
+ _rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
+#endif
+ _rl_tty_chars.t_kill = tiop->c_cc[VKILL];
+#ifdef VREPRINT
+ _rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
+#endif
+ _rl_tty_chars.t_intr = tiop->c_cc[VINTR];
+ _rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
+#ifdef VSUSP
+ _rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
+#endif
+#ifdef VDSUSP
+ _rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
+#endif
+#ifdef VSTART
+ _rl_tty_chars.t_start = tiop->c_cc[VSTART];
+#endif
+#ifdef VSTOP
+ _rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
+#endif
+#ifdef VLNEXT
+ _rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
+#endif
+#ifdef VDISCARD
+ _rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
+#endif
+#ifdef VSTATUS
+ _rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
+#endif
+}
+
+#if defined (_AIX) || defined (_AIX41)
+/* Currently this is only used on AIX */
static void
rltty_warning (msg)
char *msg;
@@ -377,7 +460,6 @@ rltty_warning (msg)
}
#endif
-
#if defined (_AIX)
void
setopost(tp)
@@ -392,14 +474,12 @@ TIOTYPE *tp;
#endif
static int
-get_tty_settings (tty, tiop)
+_get_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
int ioctl_ret;
- set_winsize (tty);
-
while (1)
{
ioctl_ret = GETATTR (tty, tiop);
@@ -423,6 +503,19 @@ get_tty_settings (tty, tiop)
break;
}
+ return 0;
+}
+
+static int
+get_tty_settings (tty, tiop)
+ int tty;
+ TIOTYPE *tiop;
+{
+ set_winsize (tty);
+
+ if (_get_tty_settings (tty, tiop) < 0)
+ return -1;
+
#if defined (_AIX)
setopost(tiop);
#endif
@@ -431,7 +524,7 @@ get_tty_settings (tty, tiop)
}
static int
-set_tty_settings (tty, tiop)
+_set_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
@@ -441,7 +534,17 @@ set_tty_settings (tty, tiop)
return -1;
errno = 0;
}
+ return 0;
+}
+static int
+set_tty_settings (tty, tiop)
+ int tty;
+ TIOTYPE *tiop;
+{
+ if (_set_tty_settings (tty, tiop) < 0)
+ return -1;
+
#if 0
#if defined (TERMIOS_TTY_DRIVER)
@@ -458,22 +561,22 @@ set_tty_settings (tty, tiop)
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
#endif /* !TERMIOS_TTY_DRIVER */
-#endif
+#endif /* 0 */
return 0;
}
static void
-prepare_terminal_settings (meta_flag, otio, tiop)
+prepare_terminal_settings (meta_flag, oldtio, tiop)
int meta_flag;
- TIOTYPE otio, *tiop;
+ TIOTYPE oldtio, *tiop;
{
- readline_echoing_p = (otio.c_lflag & ECHO);
+ readline_echoing_p = (oldtio.c_lflag & ECHO);
tiop->c_lflag &= ~(ICANON | ECHO);
- if ((unsigned char) otio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
- _rl_eof_char = otio.c_cc[VEOF];
+ if ((unsigned char) oldtio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
+ _rl_eof_char = oldtio.c_cc[VEOF];
#if defined (USE_XON_XOFF)
#if defined (IXANY)
@@ -504,7 +607,7 @@ prepare_terminal_settings (meta_flag, otio, tiop)
if (OUTPUT_BEING_FLUSHED (tiop))
{
tiop->c_lflag &= ~FLUSHO;
- otio.c_lflag &= ~FLUSHO;
+ oldtio.c_lflag &= ~FLUSHO;
}
#endif
@@ -530,7 +633,6 @@ void
rl_prep_terminal (meta_flag)
int meta_flag;
{
-#if !defined (__GO32__)
int tty;
TIOTYPE tio;
@@ -550,6 +652,8 @@ rl_prep_terminal (meta_flag)
otio = tio;
+ save_tty_chars (&otio);
+
prepare_terminal_settings (meta_flag, otio, &tio);
if (set_tty_settings (tty, &tio) < 0)
@@ -563,16 +667,15 @@ rl_prep_terminal (meta_flag)
fflush (rl_outstream);
terminal_prepped = 1;
+ RL_SETSTATE(RL_STATE_TERMPREPPED);
release_sigint ();
-#endif /* !__GO32__ */
}
/* Restore the terminal's normal settings and modes. */
void
rl_deprep_terminal ()
{
-#if !defined (__GO32__)
int tty;
if (!terminal_prepped)
@@ -595,9 +698,9 @@ rl_deprep_terminal ()
}
terminal_prepped = 0;
+ RL_UNSETSTATE(RL_STATE_TERMPREPPED);
release_sigint ();
-#endif /* !__GO32__ */
}
/* **************************************************************** */
@@ -607,8 +710,8 @@ rl_deprep_terminal ()
/* **************************************************************** */
int
-rl_restart_output (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_restart_output (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
int fildes = fileno (rl_outstream);
#if defined (TIOCSTART)
@@ -640,8 +743,8 @@ rl_restart_output (int count __attribute__((unused)),
}
int
-rl_stop_output (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_stop_output (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
int fildes = fileno (rl_instream);
@@ -672,6 +775,9 @@ rl_stop_output (int count __attribute__((unused)),
/* Default Key Bindings */
/* */
/* **************************************************************** */
+
+/* Set the system's default editing characters to their readline equivalents
+ in KMAP. Should be static, now that we have rl_tty_set_default_bindings. */
void
rltty_set_default_bindings (kmap)
Keymap kmap;
@@ -686,8 +792,8 @@ rltty_set_default_bindings (kmap)
{ \
int ic; \
ic = sc; \
- if (ic != -1 && kmap[ic].type == ISFUNC) \
- kmap[ic].function = func; \
+ if (ic != -1 && kmap[(unsigned char)ic].type == ISFUNC) \
+ kmap[(unsigned char)ic].function = func; \
} \
while (0)
@@ -735,3 +841,71 @@ rltty_set_default_bindings (kmap)
}
#endif /* !NEW_TTY_DRIVER */
}
+
+/* New public way to set the system default editing chars to their readline
+ equivalents. */
+void
+rl_tty_set_default_bindings (kmap)
+ Keymap kmap;
+{
+ rltty_set_default_bindings (kmap);
+}
+
+#if defined (HANDLE_SIGNALS)
+
+#if defined (NEW_TTY_DRIVER)
+int
+_rl_disable_tty_signals ()
+{
+ return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+ return 0;
+}
+#else
+
+static TIOTYPE sigstty, nosigstty;
+static int tty_sigs_disabled = 0;
+
+int
+_rl_disable_tty_signals ()
+{
+ if (tty_sigs_disabled)
+ return 0;
+
+ if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
+ return -1;
+
+ nosigstty = sigstty;
+
+ nosigstty.c_lflag &= ~ISIG;
+ nosigstty.c_iflag &= ~IXON;
+
+ if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
+ return (_set_tty_settings (fileno (rl_instream), &sigstty));
+
+ tty_sigs_disabled = 1;
+ return 0;
+}
+
+int
+_rl_restore_tty_signals ()
+{
+ int r;
+
+ if (tty_sigs_disabled == 0)
+ return 0;
+
+ r = _set_tty_settings (fileno (rl_instream), &sigstty);
+
+ if (r == 0)
+ tty_sigs_disabled = 0;
+
+ return r;
+}
+#endif /* !NEW_TTY_DRIVER */
+
+#endif /* HANDLE_SIGNALS */
diff --git a/readline/rltty.h b/readline/rltty.h
index fe783463f6a..029a3fbc0e1 100644
--- a/readline/rltty.h
+++ b/readline/rltty.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,10 +19,10 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLTTY_H_)
-#define _RLTTY_H
+#define _RLTTY_H_
/* Posix systems use termios and the Posix signal functions. */
#if defined (TERMIOS_TTY_DRIVER)
@@ -60,4 +60,23 @@
# endif /* !_SVR4_DISABLE */
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
+typedef struct _rl_tty_chars {
+ char t_eof;
+ char t_eol;
+ char t_eol2;
+ char t_erase;
+ char t_werase;
+ char t_kill;
+ char t_reprint;
+ char t_intr;
+ char t_quit;
+ char t_susp;
+ char t_dsusp;
+ char t_start;
+ char t_stop;
+ char t_lnext;
+ char t_flush;
+ char t_status;
+} _RL_TTY_CHARS;
+
#endif /* _RLTTY_H_ */
diff --git a/readline/rltypedefs.h b/readline/rltypedefs.h
new file mode 100644
index 00000000000..f3280e9fce0
--- /dev/null
+++ b/readline/rltypedefs.h
@@ -0,0 +1,88 @@
+/* rltypedefs.h -- Type declarations for readline functions. */
+
+/* Copyright (C) 2000 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#ifndef _RL_TYPEDEFS_H_
+#define _RL_TYPEDEFS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Old-style */
+
+#if !defined (_FUNCTION_DEF)
+# define _FUNCTION_DEF
+
+typedef int Function ();
+typedef void VFunction ();
+typedef char *CPFunction ();
+typedef char **CPPFunction ();
+
+#endif /* _FUNCTION_DEF */
+
+/* New style. */
+
+#if !defined (_RL_FUNCTION_TYPEDEF)
+# define _RL_FUNCTION_TYPEDEF
+
+/* Bindable functions */
+typedef int rl_command_func_t PARAMS((int, int));
+
+/* Typedefs for the completion system */
+typedef char *rl_compentry_func_t PARAMS((const char *, int));
+typedef char **rl_completion_func_t PARAMS((const char *, int, int));
+
+typedef char *rl_quote_func_t PARAMS((char *, int, char *));
+typedef char *rl_dequote_func_t PARAMS((char *, int));
+
+typedef int rl_compignore_func_t PARAMS((char **));
+
+typedef void rl_compdisp_func_t PARAMS((char **, int, int));
+
+/* Type for input and pre-read hook functions like rl_event_hook */
+typedef int rl_hook_func_t PARAMS((void));
+
+/* Input function type */
+typedef int rl_getc_func_t PARAMS((FILE *));
+
+/* Generic function that takes a character buffer (which could be the readline
+ line buffer) and an index into it (which could be rl_point) and returns
+ an int. */
+typedef int rl_linebuf_func_t PARAMS((char *, int));
+
+/* `Generic' function pointer typedefs */
+typedef int rl_intfunc_t PARAMS((int));
+#define rl_ivoidfunc_t rl_hook_func_t
+typedef int rl_icpfunc_t PARAMS((char *));
+typedef int rl_icppfunc_t PARAMS((char **));
+
+typedef void rl_voidfunc_t PARAMS((void));
+typedef void rl_vintfunc_t PARAMS((int));
+typedef void rl_vcpfunc_t PARAMS((char *));
+typedef void rl_vcppfunc_t PARAMS((char **));
+#endif /* _RL_FUNCTION_TYPEDEF */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RL_TYPEDEFS_H_ */
diff --git a/readline/rlwinsize.h b/readline/rlwinsize.h
index 92b3de174bf..7838154d023 100644
--- a/readline/rlwinsize.h
+++ b/readline/rlwinsize.h
@@ -9,7 +9,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -20,7 +20,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLWINSIZE_H_)
#define _RLWINSIZE_H_
@@ -55,4 +55,3 @@
#endif /* _RL_WINSIZE_H */
-
diff --git a/readline/search.c b/readline/search.c
index 0179d8da2f1..ac47596a3f8 100644
--- a/readline/search.c
+++ b/readline/search.c
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -40,33 +40,56 @@
#endif
#include "rldefs.h"
+#include "rlmbutil.h"
+
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+#include "xmalloc.h"
+
#ifdef abs
# undef abs
#endif
#define abs(x) (((x) >= 0) ? (x) : -(x))
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_line_buffer_len;
-extern int rl_editing_mode;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
-extern HIST_ENTRY *saved_line_for_history;
-extern Function *rl_last_func;
+extern HIST_ENTRY *_rl_saved_line_for_history;
/* Functions imported from the rest of the library. */
-extern int _rl_free_history_entry ();
-extern char *_rl_make_prompt_for_search ();
-extern void rl_extend_line_buffer ();
+extern int _rl_free_history_entry PARAMS((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
+
static char *prev_line_found = (char *) NULL;
+static int rl_history_search_len;
+static int rl_history_search_pos;
+static char *history_search_string;
+static int history_string_size;
+
+static void make_history_line_current PARAMS((HIST_ENTRY *));
+static int noninc_search_from_pos PARAMS((char *, int, int));
+static void noninc_dosearch PARAMS((char *, int));
+static void noninc_search PARAMS((int, int));
+static int rl_history_search_internal PARAMS((int, int));
+static void rl_history_search_reinit PARAMS((void));
+
+/* Make the data from the history entry ENTRY be the contents of the
+ current line. This doesn't do anything with rl_point; the caller
+ must set it. */
+static void
+make_history_line_current (entry)
+ HIST_ENTRY *entry;
+{
+ rl_replace_line (entry->line, 0);
+ rl_undo_list = (UNDO_LIST *)entry->data;
+
+ if (_rl_saved_line_for_history)
+ _rl_free_history_entry (_rl_saved_line_for_history);
+ _rl_saved_line_for_history = (HIST_ENTRY *)NULL;
+}
+
/* Search the history list for STRING starting at absolute history position
POS. If STRING begins with `^', the search must match STRING at the
beginning of a history line, otherwise a full substring match is performed
@@ -79,13 +102,19 @@ noninc_search_from_pos (string, pos, dir)
{
int ret, old;
+ if (pos < 0)
+ return -1;
+
old = where_history ();
- history_set_pos (pos);
+ if (history_set_pos (pos) == 0)
+ return -1;
+ RL_SETSTATE(RL_STATE_SEARCH);
if (*string == '^')
ret = history_search_prefix (string + 1, dir);
else
ret = history_search (string, dir);
+ RL_UNSETSTATE(RL_STATE_SEARCH);
if (ret != -1)
ret = where_history ();
@@ -102,12 +131,12 @@ noninc_dosearch (string, dir)
char *string;
int dir;
{
- int oldpos, pos, line_len;
+ int oldpos, pos;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
{
- ding ();
+ rl_ding ();
return;
}
@@ -115,10 +144,10 @@ noninc_dosearch (string, dir)
if (pos == -1)
{
/* Search failed, current history position unchanged. */
- maybe_unsave_line ();
+ rl_maybe_unsave_line ();
rl_clear_message ();
rl_point = 0;
- ding ();
+ rl_ding ();
return;
}
@@ -132,19 +161,12 @@ noninc_dosearch (string, dir)
#endif
history_set_pos (oldpos);
- line_len = strlen (entry->line);
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
- strcpy (rl_line_buffer, entry->line);
+ make_history_line_current (entry);
- rl_undo_list = (UNDO_LIST *)entry->data;
- rl_end = strlen (rl_line_buffer);
rl_point = 0;
- rl_clear_message ();
+ rl_mark = rl_end;
- if (saved_line_for_history)
- _rl_free_history_entry (saved_line_for_history);
- saved_line_for_history = (HIST_ENTRY *)NULL;
+ rl_clear_message ();
}
/* Search non-interactively through the history list. DIR < 0 means to
@@ -157,11 +179,15 @@ noninc_search (dir, pchar)
int dir;
int pchar;
{
- int saved_point, c;
+ int saved_point, saved_mark, c;
char *p;
+#if defined (HANDLE_MULTIBYTE)
+ char mb[MB_LEN_MAX];
+#endif
- maybe_save_line ();
+ rl_maybe_save_line ();
saved_point = rl_point;
+ saved_mark = rl_mark;
/* Use the line buffer to read the search string. */
rl_line_buffer[0] = 0;
@@ -171,23 +197,37 @@ noninc_search (dir, pchar)
rl_message (p, 0, 0);
free (p);
-#define SEARCH_RETURN rl_restore_prompt (); return
+#define SEARCH_RETURN rl_restore_prompt (); RL_UNSETSTATE(RL_STATE_NSEARCH); return
+ RL_SETSTATE(RL_STATE_NSEARCH);
/* Read the search string. */
- while ((c = rl_read_key ()))
+ while (1)
{
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ c = _rl_read_mbstring (c, mb, MB_LEN_MAX);
+#endif
+
+ if (c == 0)
+ break;
+
switch (c)
{
case CTRL('H'):
case RUBOUT:
if (rl_point == 0)
{
- maybe_unsave_line ();
+ rl_maybe_unsave_line ();
rl_clear_message ();
rl_point = saved_point;
+ rl_mark = saved_mark;
SEARCH_RETURN;
}
- rl_rubout (1, c);
+ _rl_rubout_char (1, c);
break;
case CTRL('W'):
@@ -206,20 +246,28 @@ noninc_search (dir, pchar)
case CTRL('C'):
case CTRL('G'):
- maybe_unsave_line ();
+ rl_maybe_unsave_line ();
rl_clear_message ();
rl_point = saved_point;
- ding ();
+ rl_mark = saved_mark;
+ rl_ding ();
SEARCH_RETURN;
default:
- rl_insert (1, c);
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_insert_text (mb);
+ else
+#endif
+ _rl_insert_char (1, c);
break;
}
(*rl_redisplay_function) ();
}
dosearch:
+ rl_mark = saved_mark;
+
/* If rl_point == 0, we want to re-use the previous search string and
start from the saved history position. If there's no previous search
string, punt. */
@@ -227,7 +275,7 @@ noninc_search (dir, pchar)
{
if (!noninc_search_string)
{
- ding ();
+ rl_ding ();
SEARCH_RETURN;
}
}
@@ -235,19 +283,20 @@ noninc_search (dir, pchar)
{
/* We want to start the search from the current history position. */
noninc_history_pos = where_history ();
- if (noninc_search_string)
- free (noninc_search_string);
+ FREE (noninc_search_string);
noninc_search_string = savestring (rl_line_buffer);
}
rl_restore_prompt ();
noninc_dosearch (noninc_search_string, dir);
+ RL_UNSETSTATE(RL_STATE_NSEARCH);
}
/* Search forward through the history list for a string. If the vi-mode
code calls this, KEY will be `?'. */
int
-rl_noninc_forward_search (int count __attribute__((unused)), int key)
+rl_noninc_forward_search (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
noninc_search (1, (key == '?') ? '?' : 0);
return 0;
@@ -256,7 +305,8 @@ rl_noninc_forward_search (int count __attribute__((unused)), int key)
/* Reverse search the history list for a string. If the vi-mode code
calls this, KEY will be `/'. */
int
-rl_noninc_reverse_search (int count __attribute__((unused)), int key)
+rl_noninc_reverse_search (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
noninc_search (-1, (key == '/') ? '/' : 0);
return 0;
@@ -265,12 +315,12 @@ rl_noninc_reverse_search (int count __attribute__((unused)), int key)
/* Search forward through the history list for the last string searched
for. If there is no saved search string, abort. */
int
-rl_noninc_forward_search_again (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_noninc_forward_search_again (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (!noninc_search_string)
{
- ding ();
+ rl_ding ();
return (-1);
}
noninc_dosearch (noninc_search_string, 1);
@@ -280,12 +330,12 @@ rl_noninc_forward_search_again (int count __attribute__((unused)),
/* Reverse search in the history list for the last string searched
for. If there is no saved search string, abort. */
int
-rl_noninc_reverse_search_again (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_noninc_reverse_search_again (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (!noninc_search_string)
{
- ding ();
+ rl_ding ();
return (-1);
}
noninc_dosearch (noninc_search_string, -1);
@@ -293,69 +343,105 @@ rl_noninc_reverse_search_again (int count __attribute__((unused)),
}
static int
-rl_history_search_internal (count, direction)
- int count, direction;
+rl_history_search_internal (count, dir)
+ int count, dir;
{
- HIST_ENTRY *temp, *old_temp;
- int line_len;
+ HIST_ENTRY *temp;
+ int ret, oldpos;
- maybe_save_line ();
+ rl_maybe_save_line ();
+ temp = (HIST_ENTRY *)NULL;
- temp = old_temp = (HIST_ENTRY *)NULL;
+ /* Search COUNT times through the history for a line whose prefix
+ matches history_search_string. When this loop finishes, TEMP,
+ if non-null, is the history line to copy into the line buffer. */
while (count)
{
- temp = (direction < 0) ? previous_history () : next_history ();
- if (temp == 0)
- break;
- /* On an empty prefix, make this the same as previous-history. */
- if (rl_point == 0)
- {
- count--;
- continue;
- }
- if (STREQN (rl_line_buffer, temp->line, rl_point))
- {
- /* Don't find multiple instances of the same line. */
- if (prev_line_found && STREQ (prev_line_found, temp->line))
- continue;
- if (direction < 0)
- old_temp = temp;
- prev_line_found = temp->line;
- count--;
- }
+ ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
+ if (ret == -1)
+ break;
+
+ /* Get the history entry we found. */
+ rl_history_search_pos = ret;
+ oldpos = where_history ();
+ history_set_pos (rl_history_search_pos);
+ temp = current_history ();
+ history_set_pos (oldpos);
+
+ /* Don't find multiple instances of the same line. */
+ if (prev_line_found && STREQ (prev_line_found, temp->line))
+ continue;
+ prev_line_found = temp->line;
+ count--;
}
+ /* If we didn't find anything at all, return. */
if (temp == 0)
{
- if (direction < 0 && old_temp)
- temp = old_temp;
- else
- {
- maybe_unsave_line ();
- ding ();
- return 1;
- }
+ rl_maybe_unsave_line ();
+ rl_ding ();
+ /* If you don't want the saved history line (last match) to show up
+ in the line buffer after the search fails, change the #if 0 to
+ #if 1 */
+#if 0
+ if (rl_point > rl_history_search_len)
+ {
+ rl_point = rl_end = rl_history_search_len;
+ rl_line_buffer[rl_end] = '\0';
+ rl_mark = 0;
+ }
+#else
+ rl_point = rl_history_search_len; /* rl_maybe_unsave_line changes it */
+ rl_mark = rl_end;
+#endif
+ return 1;
}
- line_len = strlen (temp->line);
- if (line_len >= rl_line_buffer_len)
- rl_extend_line_buffer (line_len);
- strcpy (rl_line_buffer, temp->line);
- rl_undo_list = (UNDO_LIST *)temp->data;
- rl_end = line_len;
+ /* Copy the line we found into the current line buffer. */
+ make_history_line_current (temp);
+
+ rl_point = rl_history_search_len;
+ rl_mark = rl_end;
+
return 0;
}
+static void
+rl_history_search_reinit ()
+{
+ rl_history_search_pos = where_history ();
+ rl_history_search_len = rl_point;
+ prev_line_found = (char *)NULL;
+ if (rl_point)
+ {
+ if (rl_history_search_len >= history_string_size - 2)
+ {
+ history_string_size = rl_history_search_len + 2;
+ history_search_string = (char *)xrealloc (history_search_string, history_string_size);
+ }
+ history_search_string[0] = '^';
+ strncpy (history_search_string + 1, rl_line_buffer, rl_point);
+ history_search_string[rl_point + 1] = '\0';
+ }
+ _rl_free_saved_history_line ();
+}
+
/* Search forward in the history for the string of characters
from the start of the line to rl_point. This is a non-incremental
search. */
int
-rl_history_search_forward (int count, int ignore __attribute__((unused)))
+rl_history_search_forward (count, ignore)
+ int count, ignore;
{
if (count == 0)
return (0);
- if (rl_last_func != rl_history_search_forward)
- prev_line_found = (char *)NULL;
+
+ if (rl_last_func != rl_history_search_forward &&
+ rl_last_func != rl_history_search_backward)
+ rl_history_search_reinit ();
+
+ if (rl_history_search_len == 0)
+ return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
@@ -363,11 +449,17 @@ rl_history_search_forward (int count, int ignore __attribute__((unused)))
from the start of the line to rl_point. This is a non-incremental
search. */
int
-rl_history_search_backward (int count, int ignore __attribute__((unused)))
+rl_history_search_backward (count, ignore)
+ int count, ignore;
{
if (count == 0)
return (0);
- if (rl_last_func != rl_history_search_backward)
- prev_line_found = (char *)NULL;
+
+ if (rl_last_func != rl_history_search_forward &&
+ rl_last_func != rl_history_search_backward)
+ rl_history_search_reinit ();
+
+ if (rl_history_search_len == 0)
+ return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}
diff --git a/readline/shell.c b/readline/shell.c
index becd66e0f9a..ad27cc14884 100644
--- a/readline/shell.c
+++ b/readline/shell.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,14 +19,13 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
-#include <stdio.h>
#include <sys/types.h>
#if defined (HAVE_UNISTD_H)
@@ -39,36 +38,61 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-#if defined (HAVE_STDIO_H)
-# include <stdio.h>
-#endif /* HAVE_STDIO_H */
-
#if defined (HAVE_STRING_H)
# include <string.h>
#else
# include <strings.h>
#endif /* !HAVE_STRING_H */
+#if defined (HAVE_LIMITS_H)
+# include <limits.h>
+#endif
+
+#include <fcntl.h>
#include <pwd.h>
+#include <stdio.h>
+
+#include "rlstdc.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
#if !defined (HAVE_GETPW_DECLS)
-extern struct passwd *getpwuid ();
+extern struct passwd *getpwuid PARAMS((uid_t));
#endif /* !HAVE_GETPW_DECLS */
-extern char *xmalloc ();
+#ifndef NULL
+# define NULL 0
+#endif
+
+#ifndef CHAR_BIT
+# define CHAR_BIT 8
+#endif
+
+/* Nonzero if the integer type T is signed. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+/* Bound on length of the string representing an integer value of type T.
+ Subtract one for the sign bit if T is signed;
+ 302 / 1000 is log10 (2) rounded up;
+ add one for integer division truncation;
+ add one more for a minus sign if t is signed. */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
+ + 1 + TYPE_SIGNED (t))
/* All of these functions are resolved from bash if we are linking readline
as part of bash. */
/* Does shell-like quoting using single quotes. */
char *
-single_quote (string)
+sh_single_quote (string)
char *string;
{
register int c;
char *result, *r, *s;
- result = (char *)xmalloc (3 + (3 * strlen (string)));
+ result = (char *)xmalloc (3 + (4 * strlen (string)));
r = result;
*r++ = '\'';
@@ -93,24 +117,24 @@ single_quote (string)
/* Set the environment variables LINES and COLUMNS to lines and cols,
respectively. */
void
-set_lines_and_columns (lines, cols)
+sh_set_lines_and_columns (lines, cols)
int lines, cols;
{
char *b;
#if defined (HAVE_PUTENV)
- b = xmalloc (24);
+ b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1);
sprintf (b, "LINES=%d", lines);
putenv (b);
- b = xmalloc (24);
+ b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1);
sprintf (b, "COLUMNS=%d", cols);
putenv (b);
#else /* !HAVE_PUTENV */
# if defined (HAVE_SETENV)
- b = xmalloc (8);
+ b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
- b = xmalloc (8);
+ b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1);
sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
# endif /* HAVE_SETENV */
@@ -118,14 +142,14 @@ set_lines_and_columns (lines, cols)
}
char *
-get_env_value (varname)
- char *varname;
+sh_get_env_value (varname)
+ const char *varname;
{
return ((char *)getenv (varname));
}
char *
-get_home_dir ()
+sh_get_home_dir ()
{
char *home_dir;
struct passwd *entry;
@@ -136,3 +160,37 @@ get_home_dir ()
home_dir = entry->pw_dir;
return (home_dir);
}
+
+#if !defined (O_NDELAY)
+# if defined (FNDELAY)
+# define O_NDELAY FNDELAY
+# endif
+#endif
+
+int
+sh_unset_nodelay_mode (fd)
+ int fd;
+{
+ int flags, bflags;
+
+ if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
+ return -1;
+
+ bflags = 0;
+
+#ifdef O_NONBLOCK
+ bflags |= O_NONBLOCK;
+#endif
+
+#ifdef O_NDELAY
+ bflags |= O_NDELAY;
+#endif
+
+ if (flags & bflags)
+ {
+ flags &= ~bflags;
+ return (fcntl (fd, F_SETFL, flags));
+ }
+
+ return 0;
+}
diff --git a/readline/signals.c b/readline/signals.c
index 3a34432f143..0a1468b6b2a 100644
--- a/readline/signals.c
+++ b/readline/signals.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -40,15 +40,13 @@
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL */
-#if defined (__GO32__)
-# undef HANDLE_SIGNALS
-#endif /* __GO32__ */
-
#if defined (HANDLE_SIGNALS)
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
+#include "rlprivate.h"
+
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
@@ -63,23 +61,20 @@
# define SIGHANDLER_RETURN return (0)
#endif
-/* This typedef is equivalant to the one for Function; it allows us
+/* This typedef is equivalent to the one for Function; it allows us
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef RETSIGTYPE SigHandler ();
-extern int readline_echoing_p;
-extern int rl_pending_input;
-extern int _rl_meta_flag;
-
-extern void free_undo_list ();
-extern void _rl_get_screen_size ();
-extern void _rl_redisplay_after_sigwinch ();
-extern void _rl_clean_up_for_exit ();
-extern void _rl_kill_kbd_macro ();
-extern void _rl_init_argument ();
-extern void rl_deprep_terminal (), rl_prep_terminal ();
+#if defined (HAVE_POSIX_SIGNALS)
+typedef struct sigaction sighandler_cxt;
+# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
+#else
+typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
+# define sigemptyset(m)
+#endif /* !HAVE_POSIX_SIGNALS */
-static SigHandler *rl_set_sighandler ();
+static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
+static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
/* Exported variables for use by applications. */
@@ -101,14 +96,6 @@ static int sigwinch_set_flag;
/* */
/* **************************************************************** */
-#if defined (HAVE_POSIX_SIGNALS)
-typedef struct sigaction sighandler_cxt;
-# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
-#else
-typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
-# define sigemptyset(m)
-#endif /* !HAVE_POSIX_SIGNALS */
-
static sighandler_cxt old_int, old_term, old_alrm, old_quit;
#if defined (SIGTSTP)
static sighandler_cxt old_tstp, old_ttou, old_ttin;
@@ -133,6 +120,8 @@ rl_signal_handler (sig)
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+ RL_SETSTATE(RL_STATE_SIGHANDLER);
+
#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. */
@@ -165,6 +154,10 @@ rl_signal_handler (sig)
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#if defined (__EMX__)
+ signal (sig, SIG_ACK);
+#endif
+
kill (getpid (), sig);
/* Let the signal that we just sent through. */
@@ -179,6 +172,7 @@ rl_signal_handler (sig)
rl_reset_after_signal ();
}
+ RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
@@ -199,6 +193,7 @@ rl_sigwinch_handler (sig)
rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
#endif
+ RL_SETSTATE(RL_STATE_SIGHANDLER);
rl_resize_terminal ();
/* If another sigwinch handler has been installed, call it. */
@@ -206,6 +201,7 @@ rl_sigwinch_handler (sig)
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
(*oh) (sig);
+ RL_UNSETSTATE(RL_STATE_SIGHANDLER);
SIGHANDLER_RETURN;
}
#endif /* SIGWINCH */
@@ -232,17 +228,25 @@ rl_set_sighandler (sig, handler, ohandler)
SigHandler *handler;
sighandler_cxt *ohandler;
{
+ sighandler_cxt old_handler;
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
act.sa_handler = handler;
- act.sa_flags = 0;
+ act.sa_flags = 0; /* XXX - should we set SA_RESTART for SIGWINCH? */
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
- sigaction (sig, &act, ohandler);
+ sigaction (sig, &act, &old_handler);
#else
- ohandler->sa_handler = (SigHandler *)signal (sig, handler);
+ old_handler.sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
+
+ /* XXX -- assume we have memcpy */
+ /* If rl_set_signals is called twice in a row, don't set the old handler to
+ rl_signal_handler, because that would cause infinite recursion. */
+ if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
+ memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
+
return (ohandler->sa_handler);
}
@@ -360,7 +364,7 @@ rl_cleanup_after_signal ()
_rl_clean_up_for_exit ();
(*rl_deprep_term_function) ();
rl_clear_signals ();
- rl_pending_input = 0;
+ rl_clear_pending_input ();
}
/* Reset the terminal and readline state after a signal handler returns. */
@@ -380,7 +384,7 @@ rl_free_line_state ()
{
register HIST_ENTRY *entry;
- free_undo_list ();
+ rl_free_undo_list ();
entry = current_history ();
if (entry)
diff --git a/readline/tcap.h b/readline/tcap.h
index acb2d76ab48..58ab894d93e 100644
--- a/readline/tcap.h
+++ b/readline/tcap.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLTCAP_H_)
#define _RLTCAP_H_
diff --git a/readline/terminal.c b/readline/terminal.c
index 1d2fead7768..c6f53e3a500 100644
--- a/readline/terminal.c
+++ b/readline/terminal.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -46,9 +46,7 @@
# include <locale.h>
#endif
-#include <signal.h>
#include <stdio.h>
-#include <setjmp.h>
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@@ -64,18 +62,12 @@
#include "readline.h"
#include "history.h"
-/* Variables and functions imported from readline.c */
-extern FILE *_rl_in_stream, *_rl_out_stream;
-extern int readline_echoing_p;
-extern int _rl_bell_preference;
-extern Keymap _rl_keymap;
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
-/* 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 ();
+#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
+#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
/* **************************************************************** */
/* */
@@ -88,9 +80,6 @@ static char *term_string_buffer = (char *)NULL;
static int tcap_initialized;
-/* Non-zero means this terminal can't really do anything. */
-static int dumb_term;
-
#if !defined (__linux__)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
extern
@@ -99,27 +88,36 @@ char PC, *BC, *UP;
#endif /* __linux__ */
/* Some strings to control terminal actions. These are output by tputs (). */
-char *term_goto, *term_clreol, *term_clrpag, *term_backspace;
-char *term_cr, *term_pc;
+char *_rl_term_clreol;
+char *_rl_term_clrpag;
+char *_rl_term_cr;
+char *_rl_term_backspace;
+char *_rl_term_goto;
+char *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */
-int terminal_can_insert = 0;
+int _rl_terminal_can_insert = 0;
/* How to insert characters. */
-char *term_im, *term_ei, *term_ic, *term_ip, *term_IC;
+char *_rl_term_im;
+char *_rl_term_ei;
+char *_rl_term_ic;
+char *_rl_term_ip;
+char *_rl_term_IC;
/* How to delete characters. */
-char *term_dc, *term_DC;
+char *_rl_term_dc;
+char *_rl_term_DC;
#if defined (HACK_TERMCAP_MOTION)
-char *term_forward_char;
+char *_rl_term_forward_char;
#endif /* HACK_TERMCAP_MOTION */
/* How to go up a line. */
-char *term_up;
+char *_rl_term_up;
-/* A visible bell, if the terminal can be made to flash the screen. */
-static char *visible_bell;
+/* A visible bell; char if the terminal can be made to flash the screen. */
+static char *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */
int _rl_term_autowrap;
@@ -128,20 +126,36 @@ int _rl_term_autowrap;
static int term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
- terminal has one. */
-static char *term_mm, *term_mo;
+ terminal has one. */
+static char *_rl_term_mm;
+static char *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */
-static char *term_ku, *term_kd, *term_kr, *term_kl;
+static char *_rl_term_ku;
+static char *_rl_term_kd;
+static char *_rl_term_kr;
+static char *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */
-static char *term_ks, *term_ke;
+static char *_rl_term_ks;
+static char *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */
-static char *term_kh, *term_kH;
+static char *_rl_term_kh;
+static char *_rl_term_kH;
+static char *_rl_term_at7; /* @7 */
+
+/* Insert key */
+static char *_rl_term_kI;
+
+/* Cursor control */
+static char *_rl_term_vs; /* very visible */
+static char *_rl_term_ve; /* normal */
+
+static void bind_termcap_arrow_keys PARAMS((Keymap));
/* Variables that hold the screen dimensions, used by the display code. */
-int screenwidth, screenheight, screenchars;
+int _rl_screenwidth, _rl_screenheight, _rl_screenchars;
/* Non-zero means the user wants to enable the keypad. */
int _rl_enable_keypad;
@@ -149,6 +163,22 @@ int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
+#if defined (__EMX__)
+static void
+_emx_get_screensize (swp, shp)
+ int *swp, *shp;
+{
+ int sz[2];
+
+ _scrsize (sz);
+
+ if (swp)
+ *swp = sz[0];
+ if (shp)
+ *shp = sz[1];
+}
+#endif
+
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
@@ -161,124 +191,148 @@ _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)
{
- screenwidth = (int) window_size.ws_col;
- screenheight = (int) window_size.ws_row;
+ _rl_screenwidth = (int) window_size.ws_col;
+ _rl_screenheight = (int) window_size.ws_row;
}
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
- _scrsize (sz);
- screenwidth = sz[0];
- screenheight = sz[1];
+ _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
#endif
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
is unset. */
- if (screenwidth <= 0)
+ if (_rl_screenwidth <= 0)
{
- if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
- screenwidth = atoi (ss);
+ if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
+ _rl_screenwidth = atoi (ss);
- if (screenwidth <= 0 && term_string_buffer)
- screenwidth = tgetnum ("co");
+#if !defined (__DJGPP__)
+ if (_rl_screenwidth <= 0 && term_string_buffer)
+ _rl_screenwidth = tgetnum ("co");
+#endif
}
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
is unset. */
- if (screenheight <= 0)
+ if (_rl_screenheight <= 0)
{
- if (ignore_env == 0 && (ss = get_env_value ("LINES")))
- screenheight = atoi (ss);
+ if (ignore_env == 0 && (ss = sh_get_env_value ("LINES")))
+ _rl_screenheight = atoi (ss);
- if (screenheight <= 0 && term_string_buffer)
- screenheight = tgetnum ("li");
+#if !defined (__DJGPP__)
+ if (_rl_screenheight <= 0 && term_string_buffer)
+ _rl_screenheight = tgetnum ("li");
+#endif
}
/* If all else fails, default to 80x24 terminal. */
- if (screenwidth <= 1)
- screenwidth = 80;
+ if (_rl_screenwidth <= 1)
+ _rl_screenwidth = 80;
- if (screenheight <= 0)
- screenheight = 24;
+ if (_rl_screenheight <= 0)
+ _rl_screenheight = 24;
/* If we're being compiled as part of bash, set the environment
variables $LINES and $COLUMNS to new values. Otherwise, just
do a pair of putenv () or setenv () calls. */
- set_lines_and_columns (screenheight, screenwidth);
+ sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
- if (!_rl_term_autowrap)
- screenwidth--;
+ if (_rl_term_autowrap == 0)
+ _rl_screenwidth--;
- screenchars = screenwidth * screenheight;
+ _rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
void
_rl_set_screen_size (rows, cols)
int rows, cols;
{
- screenheight = rows;
- screenwidth = cols;
+ if (rows == 0 || cols == 0)
+ return;
+
+ _rl_screenheight = rows;
+ _rl_screenwidth = cols;
if (_rl_term_autowrap == 0)
- screenwidth--;
+ _rl_screenwidth--;
- screenchars = screenwidth * screenheight;
+ _rl_screenchars = _rl_screenwidth * _rl_screenheight;
}
-extern void _rl_redisplay_after_sigwinch();
+void
+rl_set_screen_size (rows, cols)
+ int rows, cols;
+{
+ _rl_set_screen_size (rows, cols);
+}
void
+rl_get_screen_size (rows, cols)
+ int *rows, *cols;
+{
+ if (rows)
+ *rows = _rl_screenheight;
+ if (cols)
+ *cols = _rl_screenwidth;
+}
+
+void
rl_resize_terminal ()
{
if (readline_echoing_p)
{
_rl_get_screen_size (fileno (rl_instream), 1);
- _rl_redisplay_after_sigwinch ();
+ if (CUSTOM_REDISPLAY_FUNC ())
+ rl_forced_update_display ();
+ else
+ _rl_redisplay_after_sigwinch ();
}
}
struct _tc_string {
- const char *tc_var;
- char **tc_value;
+ const char *tc_var;
+ char **tc_value;
};
/* This should be kept sorted, just in case we decide to change the
search algorithm to something smarter. */
static struct _tc_string tc_strings[] =
{
- {"DC", &term_DC},
- {"IC", &term_IC},
- {"ce", &term_clreol},
- {"cl", &term_clrpag},
- {"cr", &term_cr},
- {"dc", &term_dc},
- {"ei", &term_ei},
- {"ic", &term_ic},
- {"im", &term_im},
- {"kd", &term_kd},
- {"kh", &term_kh}, /* home */
- {"kH", &term_kH}, /* end */
- {"kl", &term_kl},
- {"kr", &term_kr},
- {"ku", &term_ku},
- {"ks", &term_ks},
- {"ke", &term_ke},
- {"le", &term_backspace},
- {"mm", &term_mm},
- {"mo", &term_mo},
+ { "@7", &_rl_term_at7 },
+ { "DC", &_rl_term_DC },
+ { "IC", &_rl_term_IC },
+ { "ce", &_rl_term_clreol },
+ { "cl", &_rl_term_clrpag },
+ { "cr", &_rl_term_cr },
+ { "dc", &_rl_term_dc },
+ { "ei", &_rl_term_ei },
+ { "ic", &_rl_term_ic },
+ { "im", &_rl_term_im },
+ { "kH", &_rl_term_kH }, /* home down ?? */
+ { "kI", &_rl_term_kI }, /* insert */
+ { "kd", &_rl_term_kd },
+ { "ke", &_rl_term_ke }, /* end keypad mode */
+ { "kh", &_rl_term_kh }, /* home */
+ { "kl", &_rl_term_kl },
+ { "kr", &_rl_term_kr },
+ { "ks", &_rl_term_ks }, /* start keypad mode */
+ { "ku", &_rl_term_ku },
+ { "le", &_rl_term_backspace },
+ { "mm", &_rl_term_mm },
+ { "mo", &_rl_term_mo },
#if defined (HACK_TERMCAP_MOTION)
- {"nd", &term_forward_char},
+ { "nd", &_rl_term_forward_char },
#endif
- {"pc", &term_pc},
- {"up", &term_up},
- {"vb", &visible_bell},
+ { "pc", &_rl_term_pc },
+ { "up", &_rl_term_up },
+ { "vb", &_rl_visible_bell },
+ { "vs", &_rl_term_vs },
+ { "ve", &_rl_term_ve },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
@@ -289,73 +343,99 @@ static void
get_term_capabilities (bp)
char **bp;
{
- register int i;
+#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
+ register unsigned int i;
- for (i = 0; i < (int) NUM_TC_STRINGS; i++)
+ for (i = 0; i < NUM_TC_STRINGS; i++)
+# ifdef __LCC__
+ *(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp);
+# else
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
+# endif
+#endif
tcap_initialized = 1;
}
int
_rl_init_terminal_io (terminal_name)
- char *terminal_name;
+ const char *terminal_name;
{
-#if defined (__GO32__)
- screenwidth = ScreenCols ();
- screenheight = ScreenRows ();
- screenchars = screenwidth * screenheight;
- term_cr = (char*) "\r";
- term_im = term_ei = term_ic = term_IC = (char *)NULL;
- term_up = term_dc = term_DC = visible_bell = (char *)NULL;
-
- /* Does the __GO32__ have a meta key? I don't know. */
- term_has_meta = 0;
- term_mm = term_mo = (char *)NULL;
-
- /* It probably has arrow keys, but I don't know what they are. */
- term_ku = term_kd = term_kr = term_kl = (char *)NULL;
-
-#if defined (HACK_TERMCAP_MOTION)
- term_forward_char = (char *)NULL;
-#endif /* HACK_TERMCAP_MOTION */
- terminal_can_insert = _rl_term_autowrap = 0;
- return;
-#else /* !__GO32__ */
-
const char *term;
char *buffer;
- int tty;
- Keymap xkeymap;
+ int tty, tgetent_ret;
- term = terminal_name ? terminal_name : get_env_value ("TERM");
+ term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
+ _rl_term_clrpag = _rl_term_cr = _rl_term_clreol = (char *)NULL;
+ tty = rl_instream ? fileno (rl_instream) : 0;
+ _rl_screenwidth = _rl_screenheight = 0;
- if (term_string_buffer == 0)
- term_string_buffer = xmalloc (2032);
+ if (term == 0)
+ term = "dumb";
- if (term_buffer == 0)
- term_buffer = xmalloc (4080);
+ /* I've separated this out for later work on not calling tgetent at all
+ if the calling application has supplied a custom redisplay function,
+ (and possibly if the application has supplied a custom input function). */
+ if (CUSTOM_REDISPLAY_FUNC())
+ {
+ tgetent_ret = -1;
+ }
+ else
+ {
+ if (term_string_buffer == 0)
+ term_string_buffer = (char *)xmalloc(2032);
- buffer = term_string_buffer;
+ if (term_buffer == 0)
+ term_buffer = (char *)xmalloc(4080);
- term_clrpag = term_cr = term_clreol = (char *)NULL;
+ buffer = term_string_buffer;
- if (term == 0)
- term = "dumb";
+ tgetent_ret = tgetent (term_buffer, term);
+ }
- if (tgetent (term_buffer, term) <= 0)
+ if (tgetent_ret <= 0)
{
- dumb_term = 1;
- screenwidth = 79;
- screenheight = 24;
- screenchars = 79 * 24;
- term_cr = (char*) "\r";
- term_im = term_ei = term_ic = term_IC = (char *)NULL;
- term_up = term_dc = term_DC = visible_bell = (char *)NULL;
- term_ku = term_kd = term_kl = term_kr = (char *)NULL;
+ FREE (term_string_buffer);
+ FREE (term_buffer);
+ buffer = term_buffer = term_string_buffer = (char *)NULL;
+
+ _rl_term_autowrap = 0; /* used by _rl_get_screen_size */
+
+#if defined (__EMX__)
+ _emx_get_screensize (&_rl_screenwidth, &_rl_screenheight);
+ _rl_screenwidth--;
+#else /* !__EMX__ */
+ _rl_get_screen_size (tty, 0);
+#endif /* !__EMX__ */
+
+ /* Defaults. */
+ if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
+ {
+ _rl_screenwidth = 79;
+ _rl_screenheight = 24;
+ }
+
+ /* Everything below here is used by the redisplay code (tputs). */
+ _rl_screenchars = _rl_screenwidth * _rl_screenheight;
+ _rl_term_cr = (char*)"\r";
+ _rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
+ _rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
+ _rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
+ _rl_term_kh = _rl_term_kH = _rl_term_kI = (char *)NULL;
+ _rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
+ _rl_term_mm = _rl_term_mo = (char *)NULL;
+ _rl_term_ve = _rl_term_vs = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif
- terminal_can_insert = 0;
+ _rl_terminal_can_insert = term_has_meta = 0;
+
+ /* Reasonable defaults for tgoto(). Readline currently only uses
+ tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
+ change that later... */
+ PC = '\0';
+ BC = _rl_term_backspace = (char*)"\b";
+ UP = _rl_term_up;
+
return 0;
}
@@ -363,16 +443,12 @@ _rl_init_terminal_io (terminal_name)
/* Set up the variables that the termcap library expects the application
to provide. */
- PC = term_pc ? *term_pc : 0;
- BC = term_backspace;
- UP = term_up;
+ PC = _rl_term_pc ? *_rl_term_pc : 0;
+ BC = _rl_term_backspace;
+ UP = _rl_term_up;
- if (!term_cr)
- term_cr = (char*) "\r";
-
- tty = rl_instream ? fileno (rl_instream) : 0;
-
- screenwidth = screenheight = 0;
+ if (!_rl_term_cr)
+ _rl_term_cr = (char*)"\r";
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
@@ -382,53 +458,57 @@ _rl_init_terminal_io (terminal_name)
character insertion if *any one of* the capabilities `IC',
`im', `ic' or `ip' is provided." But we can't do anything if
only `ip' is provided, so... */
- terminal_can_insert = (term_IC || term_im || term_ic);
+ _rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
if (!term_has_meta)
- term_mm = term_mo = (char *)NULL;
+ _rl_term_mm = _rl_term_mo = (char *)NULL;
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
- xkeymap = _rl_keymap;
-
- _rl_keymap = emacs_standard_keymap;
- _rl_bind_if_unbound (term_ku, rl_get_previous_history);
- _rl_bind_if_unbound (term_kd, rl_get_next_history);
- _rl_bind_if_unbound (term_kr, rl_forward);
- _rl_bind_if_unbound (term_kl, rl_backward);
- _rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
- _rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
+ bind_termcap_arrow_keys (emacs_standard_keymap);
#if defined (VI_MODE)
- _rl_keymap = vi_movement_keymap;
- _rl_bind_if_unbound (term_ku, rl_get_previous_history);
- _rl_bind_if_unbound (term_kd, rl_get_next_history);
- _rl_bind_if_unbound (term_kr, rl_forward);
- _rl_bind_if_unbound (term_kl, rl_backward);
-
- _rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
- _rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
+ bind_termcap_arrow_keys (vi_movement_keymap);
+ bind_termcap_arrow_keys (vi_insertion_keymap);
#endif /* VI_MODE */
- _rl_keymap = xkeymap;
-
-#endif /* !__GO32__ */
return 0;
}
+/* Bind the arrow key sequences from the termcap description in MAP. */
+static void
+bind_termcap_arrow_keys (map)
+ Keymap map;
+{
+ Keymap xkeymap;
+
+ xkeymap = _rl_keymap;
+ _rl_keymap = map;
+
+ _rl_bind_if_unbound (_rl_term_ku, rl_get_previous_history);
+ _rl_bind_if_unbound (_rl_term_kd, rl_get_next_history);
+ _rl_bind_if_unbound (_rl_term_kr, rl_forward);
+ _rl_bind_if_unbound (_rl_term_kl, rl_backward);
+
+ _rl_bind_if_unbound (_rl_term_kh, rl_beg_of_line); /* Home */
+ _rl_bind_if_unbound (_rl_term_at7, rl_end_of_line); /* End */
+
+ _rl_keymap = xkeymap;
+}
+
char *
rl_get_termcap (cap)
- char *cap;
+ const char *cap;
{
- register int i;
+ register unsigned int i;
if (tcap_initialized == 0)
return ((char *)NULL);
- for (i = 0; i < (int) NUM_TC_STRINGS; i++)
+ for (i = 0; i < NUM_TC_STRINGS; i++)
{
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
return *(tc_strings[i].tc_value);
@@ -440,7 +520,7 @@ rl_get_termcap (cap)
has changed. */
int
rl_reset_terminal (terminal_name)
- char *terminal_name;
+ const char *terminal_name;
{
_rl_init_terminal_io (terminal_name);
return 0;
@@ -462,10 +542,11 @@ _rl_output_character_function (c)
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
+
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
- char *string;
+ const char *string;
int count;
{
fwrite (string, 1, count, _rl_out_stream);
@@ -478,12 +559,10 @@ _rl_backspace (count)
{
register int i;
-#if !defined (__GO32__)
- if (term_backspace)
+ if (_rl_term_backspace)
for (i = 0; i < count; i++)
- tputs (term_backspace, 1, _rl_output_character_function);
+ tputs (_rl_term_backspace, 1, _rl_output_character_function);
else
-#endif /* !__GO32__ */
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
@@ -491,11 +570,11 @@ _rl_backspace (count)
/* Move to the start of the next line. */
int
-crlf ()
+rl_crlf ()
{
#if defined (NEW_TTY_DRIVER)
- if (term_cr)
- tputs (term_cr, 1, _rl_output_character_function);
+ if (_rl_term_cr)
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
#endif /* NEW_TTY_DRIVER */
putc ('\n', _rl_out_stream);
return 0;
@@ -503,20 +582,19 @@ crlf ()
/* Ring the terminal bell. */
int
-ding ()
+rl_ding ()
{
if (readline_echoing_p)
{
-#if !defined (__GO32__)
switch (_rl_bell_preference)
{
case NO_BELL:
default:
break;
case VISIBLE_BELL:
- if (visible_bell)
+ if (_rl_visible_bell)
{
- tputs (visible_bell, 1, _rl_output_character_function);
+ tputs (_rl_visible_bell, 1, _rl_output_character_function);
break;
}
/* FALLTHROUGH */
@@ -525,10 +603,6 @@ ding ()
fflush (stderr);
break;
}
-#else /* __GO32__ */
- fprintf (stderr, "\007");
- fflush (stderr);
-#endif /* __GO32__ */
return (0);
}
return (-1);
@@ -543,16 +617,46 @@ ding ()
void
_rl_enable_meta_key ()
{
- if (term_has_meta && term_mm)
- tputs (term_mm, 1, _rl_output_character_function);
+#if !defined (__DJGPP__)
+ if (term_has_meta && _rl_term_mm)
+ tputs (_rl_term_mm, 1, _rl_output_character_function);
+#endif
}
void
_rl_control_keypad (on)
int on;
{
- if (on && term_ks)
- tputs (term_ks, 1, _rl_output_character_function);
- else if (!on && term_ke)
- tputs (term_ke, 1, _rl_output_character_function);
+#if !defined (__DJGPP__)
+ if (on && _rl_term_ks)
+ tputs (_rl_term_ks, 1, _rl_output_character_function);
+ else if (!on && _rl_term_ke)
+ tputs (_rl_term_ke, 1, _rl_output_character_function);
+#endif
+}
+
+/* **************************************************************** */
+/* */
+/* Controlling the Cursor */
+/* */
+/* **************************************************************** */
+
+/* Set the cursor appropriately depending on IM, which is one of the
+ insert modes (insert or overwrite). Insert mode gets the normal
+ cursor. Overwrite mode gets a very visible cursor. Only does
+ anything if we have both capabilities. */
+void
+_rl_set_cursor (im, force)
+ int im, force;
+{
+ if (_rl_term_ve && _rl_term_vs)
+ {
+ if (force || im != rl_insert_mode)
+ {
+ if (im == RL_IM_OVERWRITE)
+ tputs (_rl_term_vs, 1, _rl_output_character_function);
+ else
+ tputs (_rl_term_ve, 1, _rl_output_character_function);
+ }
+ }
}
diff --git a/readline/text.c b/readline/text.c
new file mode 100644
index 00000000000..f84fd91344f
--- /dev/null
+++ b/readline/text.c
@@ -0,0 +1,1540 @@
+/* text.c -- text handling commands for readline. */
+
+/* Copyright (C) 1987-2002 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 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 */
+
+#if defined (HAVE_LOCALE_H)
+# include <locale.h>
+#endif
+
+#include <stdio.h>
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+#include "rlmbutil.h"
+
+#if defined (__EMX__)
+# define INCL_DOSPROCESS
+# include <os2.h>
+#endif /* __EMX__ */
+
+/* Some standard library routines. */
+#include "readline.h"
+#include "history.h"
+
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
+/* Forward declarations. */
+static int rl_change_case PARAMS((int, int));
+static int _rl_char_search PARAMS((int, int, int));
+
+/* **************************************************************** */
+/* */
+/* Insert and Delete */
+/* */
+/* **************************************************************** */
+
+/* Insert a string of text into the line at point. This is the only
+ way that you should do insertion. _rl_insert_char () calls this
+ function. Returns the number of characters inserted. */
+int
+rl_insert_text (string)
+ const char *string;
+{
+ register int i, l;
+
+ l = (string && *string) ? strlen (string) : 0;
+ if (l == 0)
+ return 0;
+
+ if (rl_end + l >= rl_line_buffer_len)
+ rl_extend_line_buffer (rl_end + l);
+
+ for (i = rl_end; i >= rl_point; i--)
+ rl_line_buffer[i + l] = rl_line_buffer[i];
+ strncpy (rl_line_buffer + rl_point, string, l);
+
+ /* Remember how to undo this if we aren't undoing something. */
+ if (_rl_doing_an_undo == 0)
+ {
+ /* If possible and desirable, concatenate the undos. */
+ if ((l == 1) &&
+ rl_undo_list &&
+ (rl_undo_list->what == UNDO_INSERT) &&
+ (rl_undo_list->end == rl_point) &&
+ (rl_undo_list->end - rl_undo_list->start < 20))
+ rl_undo_list->end++;
+ else
+ rl_add_undo (UNDO_INSERT, rl_point, rl_point + l, (char *)NULL);
+ }
+ rl_point += l;
+ rl_end += l;
+ rl_line_buffer[rl_end] = '\0';
+ return l;
+}
+
+/* Delete the string between FROM and TO. FROM is inclusive, TO is not.
+ Returns the number of characters deleted. */
+int
+rl_delete_text (from, to)
+ int from, to;
+{
+ register char *text;
+ register int diff, i;
+
+ /* Fix it if the caller is confused. */
+ if (from > to)
+ SWAP (from, to);
+
+ /* fix boundaries */
+ if (to > rl_end)
+ {
+ to = rl_end;
+ if (from > to)
+ from = to;
+ }
+ if (from < 0)
+ from = 0;
+
+ text = rl_copy_text (from, to);
+
+ /* Some versions of strncpy() can't handle overlapping arguments. */
+ diff = to - from;
+ for (i = from; i < rl_end - diff; i++)
+ rl_line_buffer[i] = rl_line_buffer[i + diff];
+
+ /* Remember how to undo this delete. */
+ if (_rl_doing_an_undo == 0)
+ rl_add_undo (UNDO_DELETE, from, to, text);
+ else
+ free (text);
+
+ rl_end -= diff;
+ rl_line_buffer[rl_end] = '\0';
+ 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
+
+int
+_rl_replace_text (text, start, end)
+ const char *text;
+ int start, end;
+{
+ int n;
+
+ rl_begin_undo_group ();
+ rl_delete_text (start, end + 1);
+ rl_point = start;
+ n = rl_insert_text (text);
+ rl_end_undo_group ();
+
+ return n;
+}
+
+/* Replace the current line buffer contents with TEXT. If CLEAR_UNDO is
+ non-zero, we free the current undo list. */
+void
+rl_replace_line (text, clear_undo)
+ const char *text;
+ int clear_undo;
+{
+ int len;
+
+ len = strlen (text);
+ if (len >= rl_line_buffer_len)
+ rl_extend_line_buffer (len);
+ strcpy (rl_line_buffer, text);
+ rl_end = len;
+
+ if (clear_undo)
+ rl_free_undo_list ();
+
+ _rl_fix_point (1);
+}
+
+/* **************************************************************** */
+/* */
+/* Readline character functions */
+/* */
+/* **************************************************************** */
+
+/* This is not a gap editor, just a stupid line input routine. No hair
+ is involved in writing any of the functions, and none should be. */
+
+/* Note that:
+
+ rl_end is the place in the string that we would place '\0';
+ i.e., it is always safe to place '\0' there.
+
+ rl_point is the place in the string where the cursor is. Sometimes
+ this is the same as rl_end.
+
+ Any command that is called interactively receives two arguments.
+ The first is a count: the numeric arg pased to this command.
+ The second is the key which invoked this command.
+*/
+
+/* **************************************************************** */
+/* */
+/* Movement Commands */
+/* */
+/* **************************************************************** */
+
+/* Note that if you `optimize' the display for these functions, you cannot
+ use said functions in other functions which do not do optimizing display.
+ I.e., you will have to update the data base for rl_redisplay, and you
+ might as well let rl_redisplay do that job. */
+
+/* Move forward COUNT bytes. */
+int
+rl_forward_byte (count, key)
+ int count, key;
+{
+ if (count < 0)
+ return (rl_backward_byte (-count, key));
+
+ if (count > 0)
+ {
+ int end = rl_point + count;
+#if defined (VI_MODE)
+ int lend = rl_end > 0 ? rl_end - (rl_editing_mode == vi_mode) : rl_end;
+#else
+ int lend = rl_end;
+#endif
+
+ if (end > lend)
+ {
+ rl_point = lend;
+ rl_ding ();
+ }
+ else
+ rl_point = end;
+ }
+
+ if (rl_end < 0)
+ rl_end = 0;
+
+ return 0;
+}
+
+#if defined (HANDLE_MULTIBYTE)
+/* Move forward COUNT characters. */
+int
+rl_forward_char (count, key)
+ int count, key;
+{
+ int point;
+
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ return (rl_forward_byte (count, key));
+
+ if (count < 0)
+ return (rl_backward_char (-count, key));
+
+ if (count > 0)
+ {
+ point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
+
+#if defined (VI_MODE)
+ if (rl_end <= point && rl_editing_mode == vi_mode)
+ point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
+#endif
+
+ if (rl_point == point)
+ rl_ding ();
+
+ rl_point = point;
+
+ if (rl_end < 0)
+ rl_end = 0;
+ }
+
+ return 0;
+}
+#else /* !HANDLE_MULTIBYTE */
+int
+rl_forward_char (count, key)
+ int count, key;
+{
+ return (rl_forward_byte (count, key));
+}
+#endif /* !HANDLE_MULTIBYTE */
+
+/* Backwards compatibility. */
+int
+rl_forward (count, key)
+ int count, key;
+{
+ return (rl_forward_char (count, key));
+}
+
+/* Move backward COUNT bytes. */
+int
+rl_backward_byte (count, key)
+ int count, key;
+{
+ if (count < 0)
+ return (rl_forward_byte (-count, key));
+
+ if (count > 0)
+ {
+ if (rl_point < count)
+ {
+ rl_point = 0;
+ rl_ding ();
+ }
+ else
+ rl_point -= count;
+ }
+
+ if (rl_point < 0)
+ rl_point = 0;
+
+ return 0;
+}
+
+#if defined (HANDLE_MULTIBYTE)
+/* Move backward COUNT characters. */
+int
+rl_backward_char (count, key)
+ int count, key;
+{
+ int point;
+
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ return (rl_backward_byte (count, key));
+
+ if (count < 0)
+ return (rl_forward_char (-count, key));
+
+ if (count > 0)
+ {
+ point = rl_point;
+
+ while (count > 0 && point > 0)
+ {
+ point = _rl_find_prev_mbchar (rl_line_buffer, point, MB_FIND_NONZERO);
+ count--;
+ }
+ if (count > 0)
+ {
+ rl_point = 0;
+ rl_ding ();
+ }
+ else
+ rl_point = point;
+ }
+
+ return 0;
+}
+#else
+int
+rl_backward_char (count, key)
+ int count, key;
+{
+ return (rl_backward_byte (count, key));
+}
+#endif
+
+/* Backwards compatibility. */
+int
+rl_backward (count, key)
+ int count, key;
+{
+ return (rl_backward_char (count, key));
+}
+
+/* Move to the beginning of the line. */
+int
+rl_beg_of_line (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_point = 0;
+ return 0;
+}
+
+/* Move to the end of the line. */
+int
+rl_end_of_line (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_point = rl_end;
+ return 0;
+}
+
+/* XXX - these might need changes for multibyte characters */
+/* Move forward a word. We do what Emacs does. */
+int
+rl_forward_word (count, key)
+ int count, key;
+{
+ int c;
+
+ if (count < 0)
+ return (rl_backward_word (-count, key));
+
+ while (count)
+ {
+ if (rl_point == rl_end)
+ return 0;
+
+ /* If we are not in a word, move forward until we are in one.
+ Then, move forward until we hit a non-alphabetic character. */
+ c = rl_line_buffer[rl_point];
+ if (rl_alphabetic (c) == 0)
+ {
+ while (++rl_point < rl_end)
+ {
+ c = rl_line_buffer[rl_point];
+ if (rl_alphabetic (c))
+ break;
+ }
+ }
+
+ if (rl_point == rl_end)
+ return 0;
+
+ while (++rl_point < rl_end)
+ {
+ c = rl_line_buffer[rl_point];
+ if (rl_alphabetic (c) == 0)
+ break;
+ }
+ --count;
+ }
+
+ return 0;
+}
+
+/* Move backward a word. We do what Emacs does. */
+int
+rl_backward_word (count, key)
+ int count, key;
+{
+ int c;
+
+ if (count < 0)
+ return (rl_forward_word (-count, key));
+
+ while (count)
+ {
+ if (!rl_point)
+ return 0;
+
+ /* Like rl_forward_word (), except that we look at the characters
+ just before point. */
+
+ c = rl_line_buffer[rl_point - 1];
+ if (rl_alphabetic (c) == 0)
+ {
+ while (--rl_point)
+ {
+ c = rl_line_buffer[rl_point - 1];
+ if (rl_alphabetic (c))
+ break;
+ }
+ }
+
+ while (rl_point)
+ {
+ c = rl_line_buffer[rl_point - 1];
+ if (rl_alphabetic (c) == 0)
+ break;
+ else
+ --rl_point;
+ }
+
+ --count;
+ }
+
+ return 0;
+}
+
+/* Clear the current line. Numeric argument to C-l does this. */
+int
+rl_refresh_line (ignore1, ignore2)
+ int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
+{
+ int curr_line;
+
+ curr_line = _rl_current_display_line ();
+
+ _rl_move_vert (curr_line);
+ _rl_move_cursor_relative (0, rl_line_buffer); /* XXX is this right */
+
+ _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
+
+ rl_forced_update_display ();
+ rl_display_fixed = 1;
+
+ return 0;
+}
+
+/* C-l typed to a line without quoting clears the screen, and then reprints
+ the prompt and the current input line. Given a numeric arg, redraw only
+ the current line. */
+int
+rl_clear_screen (count, key)
+ int count, key;
+{
+ if (rl_explicit_arg)
+ {
+ rl_refresh_line (count, key);
+ return 0;
+ }
+
+ _rl_clear_screen (); /* calls termcap function to clear screen */
+ rl_forced_update_display ();
+ rl_display_fixed = 1;
+
+ return 0;
+}
+
+int
+rl_arrow_keys (count, c)
+ int count, c __attribute__((unused));
+{
+ int ch;
+
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ ch = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ switch (_rl_to_upper (ch))
+ {
+ case 'A':
+ rl_get_previous_history (count, ch);
+ break;
+
+ case 'B':
+ rl_get_next_history (count, ch);
+ break;
+
+ case 'C':
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_forward_char (count, ch);
+ else
+ rl_forward_byte (count, ch);
+ break;
+
+ case 'D':
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_backward_char (count, ch);
+ else
+ rl_backward_byte (count, ch);
+ break;
+
+ default:
+ rl_ding ();
+ }
+
+ return 0;
+}
+
+/* **************************************************************** */
+/* */
+/* Text commands */
+/* */
+/* **************************************************************** */
+
+#ifdef HANDLE_MULTIBYTE
+static char pending_bytes[MB_LEN_MAX];
+static int pending_bytes_length = 0;
+static mbstate_t ps = {0};
+#endif
+
+/* Insert the character C at the current location, moving point forward.
+ If C introduces a multibyte sequence, we read the whole sequence and
+ then insert the multibyte char into the line buffer. */
+int
+_rl_insert_char (count, c)
+ int count, c;
+{
+ register int i;
+ char *string;
+#ifdef HANDLE_MULTIBYTE
+ int string_size;
+ char incoming[MB_LEN_MAX + 1];
+ int incoming_length = 0;
+ mbstate_t ps_back;
+ static int stored_count = 0;
+#endif
+
+ if (count <= 0)
+ return 0;
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ {
+ incoming[0] = c;
+ incoming[1] = '\0';
+ incoming_length = 1;
+ }
+ else
+ {
+ wchar_t wc;
+ size_t ret;
+
+ if (stored_count <= 0)
+ stored_count = count;
+ else
+ count = stored_count;
+
+ ps_back = ps;
+ pending_bytes[pending_bytes_length++] = c;
+ ret = mbrtowc (&wc, pending_bytes, pending_bytes_length, &ps);
+
+ if (ret == (size_t)-2)
+ {
+ /* Bytes too short to compose character, try to wait for next byte.
+ Restore the state of the byte sequence, because in this case the
+ effect of mbstate is undefined. */
+ ps = ps_back;
+ return 1;
+ }
+ else if (ret == (size_t)-1)
+ {
+ /* Invalid byte sequence for the current locale. Treat first byte
+ as a single character. */
+ incoming[0] = pending_bytes[0];
+ incoming[1] = '\0';
+ incoming_length = 1;
+ pending_bytes_length--;
+ memmove (pending_bytes, pending_bytes + 1, pending_bytes_length);
+ /* Clear the state of the byte sequence, because in this case the
+ effect of mbstate is undefined. */
+ memset (&ps, 0, sizeof (mbstate_t));
+ }
+ else if (ret == (size_t)0)
+ {
+ incoming[0] = '\0';
+ incoming_length = 0;
+ pending_bytes_length--;
+ /* Clear the state of the byte sequence, because in this case the
+ effect of mbstate is undefined. */
+ memset (&ps, 0, sizeof (mbstate_t));
+ }
+ else
+ {
+ /* We successfully read a single multibyte character. */
+ memcpy (incoming, pending_bytes, pending_bytes_length);
+ incoming[pending_bytes_length] = '\0';
+ incoming_length = pending_bytes_length;
+ pending_bytes_length = 0;
+ }
+ }
+#endif /* HANDLE_MULTIBYTE */
+
+ /* If we can optimize, then do it. But don't let people crash
+ readline because of extra large arguments. */
+ if (count > 1 && count <= 1024)
+ {
+#if defined (HANDLE_MULTIBYTE)
+ string_size = count * incoming_length;
+ string = (char *)xmalloc (1 + string_size);
+
+ i = 0;
+ while (i < string_size)
+ {
+ strncpy (string + i, incoming, incoming_length);
+ i += incoming_length;
+ }
+ incoming_length = 0;
+ stored_count = 0;
+#else /* !HANDLE_MULTIBYTE */
+ string = (char *)xmalloc (1 + count);
+
+ for (i = 0; i < count; i++)
+ string[i] = c;
+#endif /* !HANDLE_MULTIBYTE */
+
+ string[i] = '\0';
+ rl_insert_text (string);
+ free (string);
+
+ return 0;
+ }
+
+ if (count > 1024)
+ {
+ int decreaser;
+#if defined (HANDLE_MULTIBYTE)
+ string_size = incoming_length * 1024;
+ string = (char *)xmalloc (1 + string_size);
+
+ i = 0;
+ while (i < string_size)
+ {
+ strncpy (string + i, incoming, incoming_length);
+ i += incoming_length;
+ }
+
+ while (count)
+ {
+ decreaser = (count > 1024) ? 1024 : count;
+ string[decreaser*incoming_length] = '\0';
+ rl_insert_text (string);
+ count -= decreaser;
+ }
+
+ free (string);
+ incoming_length = 0;
+ stored_count = 0;
+#else /* !HANDLE_MULTIBYTE */
+ char str[1024+1];
+
+ for (i = 0; i < 1024; i++)
+ str[i] = c;
+
+ while (count)
+ {
+ decreaser = (count > 1024 ? 1024 : count);
+ str[decreaser] = '\0';
+ rl_insert_text (str);
+ count -= decreaser;
+ }
+#endif /* !HANDLE_MULTIBYTE */
+
+ return 0;
+ }
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ {
+#endif
+ /* We are inserting a single character.
+ If there is pending input, then make a string of all of the
+ pending characters that are bound to rl_insert, and insert
+ them all. */
+ if (_rl_any_typein ())
+ _rl_insert_typein (c);
+ else
+ {
+ /* Inserting a single character. */
+ char str[2];
+
+ str[1] = '\0';
+ str[0] = c;
+ rl_insert_text (str);
+ }
+#if defined (HANDLE_MULTIBYTE)
+ }
+ else
+ {
+ rl_insert_text (incoming);
+ stored_count = 0;
+ }
+#endif
+
+ return 0;
+}
+
+/* Overwrite the character at point (or next COUNT characters) with C.
+ If C introduces a multibyte character sequence, read the entire sequence
+ before starting the overwrite loop. */
+int
+_rl_overwrite_char (count, c)
+ int count, c;
+{
+ int i;
+#if defined (HANDLE_MULTIBYTE)
+ char mbkey[MB_LEN_MAX];
+ int k;
+
+ /* Read an entire multibyte character sequence to insert COUNT times. */
+ if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
+#endif
+
+ for (i = 0; i < count; i++)
+ {
+ rl_begin_undo_group ();
+
+ if (rl_point < rl_end)
+ rl_delete (1, c);
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_insert_text (mbkey);
+ else
+#endif
+ _rl_insert_char (1, c);
+
+ rl_end_undo_group ();
+ }
+
+ return 0;
+}
+
+int
+rl_insert (count, c)
+ int count, c;
+{
+ return (rl_insert_mode == RL_IM_INSERT ? _rl_insert_char (count, c)
+ : _rl_overwrite_char (count, c));
+}
+
+/* Insert the next typed character verbatim. */
+int
+rl_quoted_insert (count, key)
+ int count, key __attribute__((unused));
+{
+ int c;
+
+#if defined (HANDLE_SIGNALS)
+ _rl_disable_tty_signals ();
+#endif
+
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+#if defined (HANDLE_SIGNALS)
+ _rl_restore_tty_signals ();
+#endif
+
+ return (_rl_insert_char (count, c));
+}
+
+/* Insert a tab character. */
+int
+rl_tab_insert (count, key)
+ int count, key __attribute__((unused));
+{
+ return (_rl_insert_char (count, '\t'));
+}
+
+/* What to do when a NEWLINE is pressed. We accept the whole line.
+ KEY is the key that invoked this command. I guess it could have
+ meaning in the future. */
+int
+rl_newline (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ rl_done = 1;
+
+ if (_rl_history_preserve_point)
+ _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point;
+
+ RL_SETSTATE(RL_STATE_DONE);
+
+#if defined (VI_MODE)
+ if (rl_editing_mode == vi_mode)
+ {
+ _rl_vi_done_inserting ();
+ _rl_vi_reset_last ();
+ }
+#endif /* VI_MODE */
+
+ /* If we've been asked to erase empty lines, suppress the final update,
+ since _rl_update_final calls rl_crlf(). */
+ if (rl_erase_empty_line && rl_point == 0 && rl_end == 0)
+ return 0;
+
+ if (readline_echoing_p)
+ _rl_update_final ();
+ return 0;
+}
+
+/* What to do for some uppercase characters, like meta characters,
+ and some characters appearing in emacs_ctlx_keymap. This function
+ is just a stub, you bind keys to it and the code in _rl_dispatch ()
+ is special cased. */
+int
+rl_do_lowercase_version (ignore1, ignore2)
+ int ignore1 __attribute__((unused)), ignore2 __attribute__((unused));
+{
+ return 0;
+}
+
+/* This is different from what vi does, so the code's not shared. Emacs
+ rubout in overwrite mode has one oddity: it replaces a control
+ character that's displayed as two characters (^X) with two spaces. */
+int
+_rl_overwrite_rubout (count, key)
+ int count, key;
+{
+ int opoint;
+ int i, l;
+
+ if (rl_point == 0)
+ {
+ rl_ding ();
+ return 1;
+ }
+
+ opoint = rl_point;
+
+ /* L == number of spaces to insert */
+ for (i = l = 0; i < count; i++)
+ {
+ rl_backward_char (1, key);
+ l += rl_character_len (rl_line_buffer[rl_point], rl_point); /* not exactly right */
+ }
+
+ rl_begin_undo_group ();
+
+ if (count > 1 || rl_explicit_arg)
+ rl_kill_text (opoint, rl_point);
+ else
+ rl_delete_text (opoint, rl_point);
+
+ /* Emacs puts point at the beginning of the sequence of spaces. */
+ opoint = rl_point;
+ _rl_insert_char (l, ' ');
+ rl_point = opoint;
+
+ rl_end_undo_group ();
+
+ return 0;
+}
+
+/* Rubout the character behind point. */
+int
+rl_rubout (count, key)
+ int count, key;
+{
+ if (count < 0)
+ return (rl_delete (-count, key));
+
+ if (!rl_point)
+ {
+ rl_ding ();
+ return -1;
+ }
+
+ if (rl_insert_mode == RL_IM_OVERWRITE)
+ return (_rl_overwrite_rubout (count, key));
+
+ return (_rl_rubout_char (count, key));
+}
+
+int
+_rl_rubout_char (count, key)
+ int count, key;
+{
+ int orig_point;
+ unsigned char c;
+
+ /* Duplicated code because this is called from other parts of the library. */
+ if (count < 0)
+ return (rl_delete (-count, key));
+
+ if (rl_point == 0)
+ {
+ rl_ding ();
+ return -1;
+ }
+
+ if (count > 1 || rl_explicit_arg)
+ {
+ orig_point = rl_point;
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_backward_char (count, key);
+ else
+#endif
+ rl_backward_byte (count, key);
+ rl_kill_text (orig_point, rl_point);
+ }
+ else
+ {
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ {
+#endif
+ c = rl_line_buffer[--rl_point];
+ rl_delete_text (rl_point, rl_point + 1);
+#if defined (HANDLE_MULTIBYTE)
+ }
+ else
+ {
+ int orig_point;
+
+ orig_point = rl_point;
+ rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
+ c = rl_line_buffer[rl_point];
+ rl_delete_text (rl_point, orig_point);
+ }
+#endif /* HANDLE_MULTIBYTE */
+
+ /* I don't think that the hack for end of line is needed for
+ multibyte chars. */
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+#endif
+ if (rl_point == rl_end && ISPRINT (c) && _rl_last_c_pos)
+ {
+ int l;
+ l = rl_character_len (c, rl_point);
+ _rl_erase_at_end_of_line (l);
+ }
+ }
+
+ return 0;
+}
+
+/* Delete the character under the cursor. Given a numeric argument,
+ kill that many characters instead. */
+int
+rl_delete (count, key)
+ int count, key;
+{
+ int r;
+
+ if (count < 0)
+ return (_rl_rubout_char (-count, key));
+
+ if (rl_point == rl_end)
+ {
+ rl_ding ();
+ return -1;
+ }
+
+ if (count > 1 || rl_explicit_arg)
+ {
+ int orig_point = rl_point;
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_forward_char (count, key);
+ else
+#endif
+ rl_forward_byte (count, key);
+
+ r = rl_kill_text (orig_point, rl_point);
+ rl_point = orig_point;
+ return r;
+ }
+ else
+ {
+ int new_point;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ new_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
+ else
+ new_point = rl_point + 1;
+
+ return (rl_delete_text (rl_point, new_point));
+ }
+}
+
+/* Delete the character under the cursor, unless the insertion
+ point is at the end of the line, in which case the character
+ behind the cursor is deleted. COUNT is obeyed and may be used
+ to delete forward or backward that many characters. */
+int
+rl_rubout_or_delete (count, key)
+ int count, key;
+{
+ if (rl_end != 0 && rl_point == rl_end)
+ return (_rl_rubout_char (count, key));
+ else
+ return (rl_delete (count, key));
+}
+
+/* Delete all spaces and tabs around point. */
+int
+rl_delete_horizontal_space (count, ignore)
+ int count __attribute__((unused)), ignore __attribute__((unused));
+{
+ int start = rl_point;
+
+ while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
+ rl_point--;
+
+ start = rl_point;
+
+ while (rl_point < rl_end && whitespace (rl_line_buffer[rl_point]))
+ rl_point++;
+
+ if (start != rl_point)
+ {
+ rl_delete_text (start, rl_point);
+ rl_point = start;
+ }
+ return 0;
+}
+
+/* Like the tcsh editing function delete-char-or-list. The eof character
+ is caught before this is invoked, so this really does the same thing as
+ delete-char-or-list-or-eof, as long as it's bound to the eof character. */
+int
+rl_delete_or_show_completions (count, key)
+ int count, key;
+{
+ if (rl_end != 0 && rl_point == rl_end)
+ return (rl_possible_completions (count, key));
+ else
+ return (rl_delete (count, key));
+}
+
+#ifndef RL_COMMENT_BEGIN_DEFAULT
+#define RL_COMMENT_BEGIN_DEFAULT "#"
+#endif
+
+/* Turn the current line into a comment in shell history.
+ A K*rn shell style function. */
+int
+rl_insert_comment (count, key)
+ int count __attribute__((unused)), key;
+{
+ char *rl_comment_text;
+ int rl_comment_len;
+
+ rl_beg_of_line (1, key);
+ rl_comment_text = (char*)(_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT);
+
+ if (rl_explicit_arg == 0)
+ rl_insert_text (rl_comment_text);
+ else
+ {
+ rl_comment_len = strlen (rl_comment_text);
+ if (STREQN (rl_comment_text, rl_line_buffer, rl_comment_len))
+ rl_delete_text (rl_point, rl_point + rl_comment_len);
+ else
+ rl_insert_text (rl_comment_text);
+ }
+
+ (*rl_redisplay_function) ();
+ rl_newline (1, '\n');
+
+ return (0);
+}
+
+/* **************************************************************** */
+/* */
+/* Changing Case */
+/* */
+/* **************************************************************** */
+
+/* The three kinds of things that we know how to do. */
+#define UpCase 1
+#define DownCase 2
+#define CapCase 3
+
+/* Uppercase the word at point. */
+int
+rl_upcase_word (count, key)
+ int count, key __attribute__((unused));
+{
+ return (rl_change_case (count, UpCase));
+}
+
+/* Lowercase the word at point. */
+int
+rl_downcase_word (count, key)
+ int count, key __attribute__((unused));
+{
+ return (rl_change_case (count, DownCase));
+}
+
+/* Upcase the first letter, downcase the rest. */
+int
+rl_capitalize_word (count, key)
+ int count, key __attribute__((unused));
+{
+ return (rl_change_case (count, CapCase));
+}
+
+/* The meaty function.
+ Change the case of COUNT words, performing OP on them.
+ OP is one of UpCase, DownCase, or CapCase.
+ If a negative argument is given, leave point where it started,
+ otherwise, leave it where it moves to. */
+static int
+rl_change_case (count, op)
+ int count, op;
+{
+ register int start, end;
+ int inword, c;
+
+ start = rl_point;
+ rl_forward_word (count, 0);
+ end = rl_point;
+
+ if (count < 0)
+ SWAP (start, end);
+
+ /* We are going to modify some text, so let's prepare to undo it. */
+ rl_modifying (start, end);
+
+ for (inword = 0; start < end; start++)
+ {
+ c = rl_line_buffer[start];
+ switch (op)
+ {
+ case UpCase:
+ rl_line_buffer[start] = _rl_to_upper (c);
+ break;
+
+ case DownCase:
+ rl_line_buffer[start] = _rl_to_lower (c);
+ break;
+
+ case CapCase:
+ rl_line_buffer[start] = (inword == 0) ? _rl_to_upper (c) : _rl_to_lower (c);
+ inword = rl_alphabetic (rl_line_buffer[start]);
+ break;
+
+ default:
+ rl_ding ();
+ return -1;
+ }
+ }
+ rl_point = end;
+ return 0;
+}
+
+/* **************************************************************** */
+/* */
+/* Transposition */
+/* */
+/* **************************************************************** */
+
+/* Transpose the words at point. If point is at the end of the line,
+ transpose the two words before point. */
+int
+rl_transpose_words (count, key)
+ int count, key;
+{
+ char *word1, *word2;
+ int w1_beg, w1_end, w2_beg, w2_end;
+ int orig_point = rl_point;
+
+ if (!count)
+ return 0;
+
+ /* Find the two words. */
+ rl_forward_word (count, key);
+ w2_end = rl_point;
+ rl_backward_word (1, key);
+ w2_beg = rl_point;
+ rl_backward_word (count, key);
+ w1_beg = rl_point;
+ rl_forward_word (1, key);
+ w1_end = rl_point;
+
+ /* Do some check to make sure that there really are two words. */
+ if ((w1_beg == w2_beg) || (w2_beg < w1_end))
+ {
+ rl_ding ();
+ rl_point = orig_point;
+ return -1;
+ }
+
+ /* Get the text of the words. */
+ word1 = rl_copy_text (w1_beg, w1_end);
+ word2 = rl_copy_text (w2_beg, w2_end);
+
+ /* We are about to do many insertions and deletions. Remember them
+ as one operation. */
+ rl_begin_undo_group ();
+
+ /* Do the stuff at word2 first, so that we don't have to worry
+ about word1 moving. */
+ rl_point = w2_beg;
+ rl_delete_text (w2_beg, w2_end);
+ rl_insert_text (word1);
+
+ rl_point = w1_beg;
+ rl_delete_text (w1_beg, w1_end);
+ rl_insert_text (word2);
+
+ /* This is exactly correct since the text before this point has not
+ changed in length. */
+ rl_point = w2_end;
+
+ /* I think that does it. */
+ rl_end_undo_group ();
+ free (word1);
+ free (word2);
+
+ return 0;
+}
+
+/* Transpose the characters at point. If point is at the end of the line,
+ then transpose the characters before point. */
+int
+rl_transpose_chars (count, key)
+ int count, key __attribute__((unused));
+{
+#if defined (HANDLE_MULTIBYTE)
+ char *dummy;
+ int i, prev_point;
+#else
+ char dummy[2];
+#endif
+ int char_length;
+
+ if (count == 0)
+ return 0;
+
+ if (!rl_point || rl_end < 2)
+ {
+ rl_ding ();
+ return -1;
+ }
+
+ rl_begin_undo_group ();
+
+ if (rl_point == rl_end)
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
+ else
+ --rl_point;
+ count = 1;
+ }
+
+#if defined (HANDLE_MULTIBYTE)
+ prev_point = rl_point;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
+ else
+#endif
+ rl_point--;
+
+#if defined (HANDLE_MULTIBYTE)
+ char_length = prev_point - rl_point;
+ dummy = (char *)xmalloc (char_length + 1);
+ for (i = 0; i < char_length; i++)
+ dummy[i] = rl_line_buffer[rl_point + i];
+ dummy[i] = '\0';
+#else
+ dummy[0] = rl_line_buffer[rl_point];
+ dummy[char_length = 1] = '\0';
+#endif
+
+ rl_delete_text (rl_point, rl_point + char_length);
+
+ rl_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
+
+ _rl_fix_point (0);
+ rl_insert_text (dummy);
+ rl_end_undo_group ();
+
+#if defined (HANDLE_MULTIBYTE)
+ free (dummy);
+#endif
+
+ return 0;
+}
+
+/* **************************************************************** */
+/* */
+/* Character Searching */
+/* */
+/* **************************************************************** */
+
+int
+#if defined (HANDLE_MULTIBYTE)
+_rl_char_search_internal (count, dir, smbchar, len)
+ int count, dir;
+ char *smbchar;
+ int len;
+#else
+_rl_char_search_internal (count, dir, schar)
+ int count, dir, schar;
+#endif
+{
+ int pos, inc;
+#if defined (HANDLE_MULTIBYTE)
+ int prepos;
+#endif
+
+ pos = rl_point;
+ inc = (dir < 0) ? -1 : 1;
+ while (count)
+ {
+ if ((dir < 0 && pos <= 0) || (dir > 0 && pos >= rl_end))
+ {
+ rl_ding ();
+ return -1;
+ }
+
+#if defined (HANDLE_MULTIBYTE)
+ pos = (inc > 0) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)
+ : _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
+#else
+ pos += inc;
+#endif
+ do
+ {
+#if defined (HANDLE_MULTIBYTE)
+ if (_rl_is_mbchar_matched (rl_line_buffer, pos, rl_end, smbchar, len))
+#else
+ if (rl_line_buffer[pos] == schar)
+#endif
+ {
+ count--;
+ if (dir < 0)
+ rl_point = (dir == BTO) ? _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)
+ : pos;
+ else
+ rl_point = (dir == FTO) ? _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY)
+ : pos;
+ break;
+ }
+#if defined (HANDLE_MULTIBYTE)
+ prepos = pos;
+#endif
+ }
+#if defined (HANDLE_MULTIBYTE)
+ while ((dir < 0) ? (pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY)) != prepos
+ : (pos = _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY)) != prepos);
+#else
+ while ((dir < 0) ? pos-- : ++pos < rl_end);
+#endif
+ }
+ return (0);
+}
+
+/* Search COUNT times for a character read from the current input stream.
+ FDIR is the direction to search if COUNT is non-negative; otherwise
+ the search goes in BDIR. So much is dependent on HANDLE_MULTIBYTE
+ that there are two separate versions of this function. */
+#if defined (HANDLE_MULTIBYTE)
+static int
+_rl_char_search (count, fdir, bdir)
+ int count, fdir, bdir;
+{
+ char mbchar[MB_LEN_MAX];
+ int mb_len;
+
+ mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
+
+ if (count < 0)
+ return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
+ else
+ return (_rl_char_search_internal (count, fdir, mbchar, mb_len));
+}
+#else /* !HANDLE_MULTIBYTE */
+static int
+_rl_char_search (count, fdir, bdir)
+ int count, fdir, bdir;
+{
+ int c;
+
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (count < 0)
+ return (_rl_char_search_internal (-count, bdir, c));
+ else
+ return (_rl_char_search_internal (count, fdir, c));
+}
+#endif /* !HANDLE_MULTIBYTE */
+
+int
+rl_char_search (count, key)
+ int count, key __attribute__((unused));
+{
+ return (_rl_char_search (count, FFIND, BFIND));
+}
+
+int
+rl_backward_char_search (count, key)
+ int count, key __attribute__((unused));
+{
+ return (_rl_char_search (count, BFIND, FFIND));
+}
+
+/* **************************************************************** */
+/* */
+/* The Mark and the Region. */
+/* */
+/* **************************************************************** */
+
+/* Set the mark at POSITION. */
+int
+_rl_set_mark_at_pos (position)
+ int position;
+{
+ if (position > rl_end)
+ return -1;
+
+ rl_mark = position;
+ return 0;
+}
+
+/* A bindable command to set the mark. */
+int
+rl_set_mark (count, key)
+ int count, key __attribute__((unused));
+{
+ return (_rl_set_mark_at_pos (rl_explicit_arg ? count : rl_point));
+}
+
+/* Exchange the position of mark and point. */
+int
+rl_exchange_point_and_mark (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
+{
+ if (rl_mark > rl_end)
+ rl_mark = -1;
+
+ if (rl_mark == -1)
+ {
+ rl_ding ();
+ return -1;
+ }
+ else
+ SWAP (rl_point, rl_mark);
+
+ return 0;
+}
diff --git a/readline/tilde.c b/readline/tilde.c
index 05c9ed741ed..11209903cf8 100644
--- a/readline/tilde.c
+++ b/readline/tilde.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if defined (HAVE_CONFIG_H)
# include <config.h>
@@ -47,16 +47,19 @@
#include "tilde.h"
+#if defined (TEST) || defined (STATIC_MALLOC)
+static void *xmalloc (), *xrealloc ();
+#else
+# include "xmalloc.h"
+#endif /* TEST || STATIC_MALLOC */
+
#if !defined (HAVE_GETPW_DECLS)
-extern struct passwd *getpwuid (), *getpwnam ();
+extern struct passwd *getpwuid PARAMS((uid_t));
+extern struct passwd *getpwnam PARAMS((const char *));
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
-extern char *xmalloc ();
-# ifndef strcpy
-extern char *strcpy ();
-# endif
-#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
#endif /* !savestring */
#if !defined (NULL)
@@ -67,62 +70,63 @@ extern char *strcpy ();
# endif /* !__STDC__ */
#endif /* !NULL */
-#if defined (TEST) || defined (STATIC_MALLOC)
-static char *xmalloc (), *xrealloc ();
-#else
-extern char *xmalloc (), *xrealloc ();
-#endif /* TEST || STATIC_MALLOC */
-
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
-extern char *get_home_dir ();
-extern char *get_env_value ();
+extern char *sh_get_home_dir PARAMS((void));
+extern char *sh_get_env_value PARAMS((const char *));
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_prefixes[] =
- { " ~", "\t~", (char *)NULL };
+ { " ~", "\t~", (const char *)NULL };
/* The default value of tilde_additional_suffixes. This is set to
whitespace or newline so that simple programs which do not
perform any word separation get desired behaviour. */
static const char *default_suffixes[] =
- { " ", "\n", (char *)NULL };
+ { " ", "\n", (const 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;
+tilde_hook_func_t *tilde_expansion_preexpansion_hook = (tilde_hook_func_t *)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
which is the expansion, or a NULL pointer if there is no expansion. */
-CPFunction *tilde_expansion_failure_hook = (CPFunction *)NULL;
+tilde_hook_func_t *tilde_expansion_failure_hook = (tilde_hook_func_t *)NULL;
/* When non-null, this is a NULL terminated array of strings which
are duplicates for a tilde prefix. Bash uses this to expand
`=~' and `:~'. */
-const char ** tilde_additional_prefixes = default_prefixes;
+char **tilde_additional_prefixes = (char **)default_prefixes;
/* When non-null, this is a NULL terminated array of strings which match
the end of a username, instead of just "/". Bash sets this to
`:' and `=~'. */
-const char **tilde_additional_suffixes = default_suffixes;
+char **tilde_additional_suffixes = (char **)default_suffixes;
+
+static int tilde_find_prefix PARAMS((const char *, int *));
+static int tilde_find_suffix PARAMS((const char *));
+static char *isolate_tilde_prefix PARAMS((const char *, int *));
+static char *glue_prefix_and_suffix PARAMS((char *, const char *, int));
/* Find the start of a tilde expansion in STRING, and return the index of
the tilde which starts the expansion. Place the length of the text
which identified this tilde starter in LEN, excluding the tilde itself. */
static int
tilde_find_prefix (string, len)
- char *string;
+ const char *string;
int *len;
{
register int i, j, string_len;
- register const char **prefixes = tilde_additional_prefixes;
+ register char **prefixes;
+
+ prefixes = tilde_additional_prefixes;
string_len = strlen (string);
*len = 0;
@@ -151,17 +155,21 @@ tilde_find_prefix (string, len)
the character which ends the tilde definition. */
static int
tilde_find_suffix (string)
- char *string;
+ const char *string;
{
register int i, j, string_len;
- register const char **suffixes;
+ register char **suffixes;
suffixes = tilde_additional_suffixes;
string_len = strlen (string);
for (i = 0; i < string_len; i++)
{
+#if defined (__MSDOS__)
+ if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
+#else
if (string[i] == '/' /* || !string[i] */)
+#endif
break;
for (j = 0; suffixes && suffixes[j]; j++)
@@ -176,16 +184,16 @@ tilde_find_suffix (string)
/* Return a new string which is the result of tilde expanding STRING. */
char *
tilde_expand (string)
- char *string;
+ const char *string;
{
char *result;
int result_size, result_index;
result_index = result_size = 0;
- if ((result = strchr (string, '~')))
- result = xmalloc (result_size = (strlen (string) + 16));
+ if ((result = (char*)strchr(string, '~')))
+ result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
- result = xmalloc (result_size = (strlen (string) + 1));
+ result = (char *)xmalloc (result_size = (strlen (string) + 1));
/* Scan through STRING expanding tildes as we come to them. */
while (1)
@@ -199,7 +207,7 @@ tilde_expand (string)
/* Copy the skipped text into the result. */
if ((result_index + start + 1) > result_size)
- result = xrealloc (result, 1 + (result_size += (start + 20)));
+ result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
strncpy (result + result_index, string, start);
result_index += start;
@@ -216,7 +224,7 @@ tilde_expand (string)
break;
/* Expand the entire tilde word, and copy it into RESULT. */
- tilde_word = xmalloc (1 + end);
+ tilde_word = (char *)xmalloc (1 + end);
strncpy (tilde_word, string, end);
tilde_word[end] = '\0';
string += end;
@@ -225,11 +233,18 @@ tilde_expand (string)
free (tilde_word);
len = strlen (expansion);
- if ((result_index + len + 1) > result_size)
- result = xrealloc (result, 1 + (result_size += (len + 20)));
+#ifdef __CYGWIN__
+ /* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
+ $HOME for `user' is /. On cygwin, // denotes a network drive. */
+ if (len > 1 || *expansion != '/' || *string != '/')
+#endif
+ {
+ if ((result_index + len + 1) > result_size)
+ result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
- strcpy (result + result_index, expansion);
- result_index += len;
+ strcpy (result + result_index, expansion);
+ result_index += len;
+ }
free (expansion);
}
@@ -243,14 +258,18 @@ tilde_expand (string)
the location it points to. */
static char *
isolate_tilde_prefix (fname, lenp)
- char *fname;
+ const char *fname;
int *lenp;
{
char *ret;
int i;
- ret = xmalloc (strlen (fname));
+ ret = (char *)xmalloc (strlen (fname));
+#if defined (__MSDOS__)
+ for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
+#else
for (i = 1; fname[i] && fname[i] != '/'; i++)
+#endif
ret[i - 1] = fname[i];
ret[i - 1] = '\0';
if (lenp)
@@ -262,7 +281,8 @@ isolate_tilde_prefix (fname, lenp)
SUFFIND. */
static char *
glue_prefix_and_suffix (prefix, suffix, suffind)
- char *prefix, *suffix;
+ char *prefix;
+ const char *suffix;
int suffind;
{
char *ret;
@@ -270,8 +290,8 @@ glue_prefix_and_suffix (prefix, suffix, suffind)
plen = (prefix && *prefix) ? strlen (prefix) : 0;
slen = strlen (suffix + suffind);
- ret = xmalloc (plen + slen + 1);
- if (prefix && *prefix)
+ ret = (char *)xmalloc (plen + slen + 1);
+ if (plen)
strcpy (ret, prefix);
strcpy (ret + plen, suffix + suffind);
return ret;
@@ -282,7 +302,7 @@ glue_prefix_and_suffix (prefix, suffix, suffind)
This always returns a newly-allocated string, never static storage. */
char *
tilde_expand_word (filename)
- char *filename;
+ const char *filename;
{
char *dirname, *expansion, *username;
int user_len;
@@ -300,12 +320,12 @@ tilde_expand_word (filename)
if (filename[1] == '\0' || filename[1] == '/')
{
/* Prefix $HOME to the rest of the string. */
- expansion = get_env_value ("HOME");
+ expansion = sh_get_env_value ("HOME");
/* If there is no HOME variable, look up the directory in
the password database. */
if (expansion == 0)
- expansion = get_home_dir ();
+ expansion = sh_get_home_dir ();
return (glue_prefix_and_suffix (expansion, filename, 1));
}
@@ -394,28 +414,28 @@ main (argc, argv)
static void memory_error_and_abort ();
-static char *
+static void *
xmalloc (bytes)
- int bytes;
+ size_t bytes;
{
- char *temp = (char *)malloc (bytes);
+ void *temp = (char *)malloc (bytes);
if (!temp)
memory_error_and_abort ();
return (temp);
}
-static char *
+static void *
xrealloc (pointer, bytes)
- char *pointer;
+ void *pointer;
int bytes;
{
- char *temp;
+ void *temp;
if (!pointer)
- temp = (char *)malloc (bytes);
+ temp = malloc (bytes);
else
- temp = (char *)realloc (pointer, bytes);
+ temp = realloc (pointer, bytes);
if (!temp)
memory_error_and_abort ();
diff --git a/readline/tilde.h b/readline/tilde.h
index 45eea1b66e5..f8182c999d9 100644
--- a/readline/tilde.h
+++ b/readline/tilde.h
@@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@@ -19,47 +19,60 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_TILDE_H_)
# define _TILDE_H_
-/* Function pointers can be declared as (Function *)foo. */
-#if !defined (_FUNCTION_DEF)
-# define _FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CPFunction ();
-typedef char **CPPFunction ();
-#endif /* _FUNCTION_DEF */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A function can be defined using prototypes and compile on both ANSI C
+ and traditional C compilers with something like this:
+ extern char *func PARAMS((char *, char *, int)); */
+
+#if !defined (PARAMS)
+# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
+# define PARAMS(protos) protos
+# else
+# define PARAMS(protos) ()
+# endif
+#endif
+
+typedef char *tilde_hook_func_t PARAMS((char *));
/* 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;
+extern tilde_hook_func_t *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
which is the expansion, or a NULL pointer if there is no expansion. */
-extern CPFunction *tilde_expansion_failure_hook;
+extern tilde_hook_func_t *tilde_expansion_failure_hook;
/* When non-null, this is a NULL terminated array of strings which
are duplicates for a tilde prefix. Bash uses this to expand
`=~' and `:~'. */
-extern const char **tilde_additional_prefixes;
+extern char **tilde_additional_prefixes;
/* When non-null, this is a NULL terminated array of strings which match
the end of a username, instead of just "/". Bash sets this to
`:' and `=~'. */
-extern const char **tilde_additional_suffixes;
+extern char **tilde_additional_suffixes;
/* Return a new string which is the result of tilde expanding STRING. */
-extern char *tilde_expand ();
+extern char *tilde_expand PARAMS((const char *));
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
-extern char *tilde_expand_word ();
+extern char *tilde_expand_word PARAMS((const char *));
+
+#ifdef __cplusplus
+}
+#endif
#endif /* _TILDE_H_ */
diff --git a/readline/undo.c b/readline/undo.c
index c8f4892b774..df913195fad 100644
--- a/readline/undo.c
+++ b/readline/undo.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -47,7 +47,8 @@
#include "readline.h"
#include "history.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
+#include "rlprivate.h"
+#include "xmalloc.h"
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
the undo list. */
@@ -84,7 +85,7 @@ rl_add_undo (what, start, end, text)
/* Free the existing undo list. */
void
-free_undo_list ()
+rl_free_undo_list ()
{
while (rl_undo_list)
{
@@ -105,17 +106,18 @@ int
rl_do_undo ()
{
UNDO_LIST *release;
- int waiting_for_begin = 0;
- int start = 0, end = 0;
+ int waiting_for_begin, start, end;
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
+ start = end = waiting_for_begin = 0;
do
{
if (!rl_undo_list)
return (0);
_rl_doing_an_undo = 1;
+ RL_SETSTATE(RL_STATE_UNDOING);
/* To better support vi-mode, a start or end value of -1 means
rl_point, and a value of -2 means rl_end. */
@@ -150,11 +152,12 @@ rl_do_undo ()
if (waiting_for_begin)
waiting_for_begin--;
else
- ding ();
+ rl_ding ();
break;
}
_rl_doing_an_undo = 0;
+ RL_UNSETSTATE(RL_STATE_UNDOING);
release = rl_undo_list;
rl_undo_list = rl_undo_list->next;
@@ -168,13 +171,14 @@ rl_do_undo ()
int
_rl_fix_last_undo_of_type (type, start, end)
- int type, start, end;
+ unsigned int type;
+ int start, end;
{
UNDO_LIST *rl;
for (rl = rl_undo_list; rl; rl = rl->next)
{
- if ((int) rl->what == type)
+ if (rl->what == type)
{
rl->start = start;
rl->end = end;
@@ -225,11 +229,11 @@ rl_modifying (start, end)
/* Revert the current line to its previous state. */
int
-rl_revert_line (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_revert_line (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
if (!rl_undo_list)
- ding ();
+ rl_ding ();
else
{
while (rl_undo_list)
@@ -240,7 +244,8 @@ rl_revert_line (int count __attribute__((unused)),
/* Do some undoing of things that were done. */
int
-rl_undo_command (int count, int key __attribute__((unused)))
+rl_undo_command (count, key)
+ int count, key __attribute__((unused));
{
if (count < 0)
return 0; /* Nothing to do. */
@@ -251,7 +256,7 @@ rl_undo_command (int count, int key __attribute__((unused)))
count--;
else
{
- ding ();
+ rl_ding ();
break;
}
}
diff --git a/readline/util.c b/readline/util.c
index bcd8f3bc5b2..2a6e4e3398a 100644
--- a/readline/util.c
+++ b/readline/util.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@@ -52,24 +52,8 @@
/* Some standard library routines. */
#include "readline.h"
-#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
-
-/* Pseudo-globals imported from readline.c */
-extern int readline_echoing_p;
-extern procenv_t readline_top_level;
-extern int rl_line_buffer_len;
-extern Function *rl_last_func;
-
-extern int _rl_defining_kbd_macro;
-extern char *_rl_executing_macro;
-
-/* Pseudo-global functions imported from other library files. */
-extern void _rl_replace_text ();
-extern void _rl_pop_executing_macro ();
-extern void _rl_set_the_line ();
-extern void _rl_init_argument ();
-
-extern char *xmalloc (), *xrealloc ();
+#include "rlprivate.h"
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -84,7 +68,7 @@ int _rl_allow_pathname_alphabetic_chars = 0;
static const char *pathname_alphabetic_chars = "/-_=~.#$";
int
-alphabetic (c)
+rl_alphabetic (c)
int c;
{
if (ALPHABETIC (c))
@@ -98,36 +82,36 @@ alphabetic (c)
int
_rl_abort_internal ()
{
- ding ();
+ rl_ding ();
rl_clear_message ();
_rl_init_argument ();
- rl_pending_input = 0;
+ rl_clear_pending_input ();
- _rl_defining_kbd_macro = 0;
- while (_rl_executing_macro)
+ RL_UNSETSTATE (RL_STATE_MACRODEF);
+ while (rl_executing_macro)
_rl_pop_executing_macro ();
- rl_last_func = (Function *)NULL;
+ rl_last_func = (rl_command_func_t *)NULL;
longjmp (readline_top_level, 1);
return (0);
}
int
-rl_abort (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_abort (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
return (_rl_abort_internal ());
}
int
-rl_tty_status (int count __attribute__((unused)),
- int key __attribute__((unused)))
+rl_tty_status (count, key)
+ int count __attribute__((unused)), key __attribute__((unused));
{
#if defined (TIOCSTAT)
ioctl (1, TIOCSTAT, (char *)0);
rl_refresh_line (count, key);
#else
- ding ();
+ rl_ding ();
#endif
return 0;
}
@@ -146,7 +130,7 @@ rl_copy_text (from, to)
SWAP (from, to);
length = to - from;
- copy = xmalloc (1 + length);
+ copy = (char *)xmalloc (1 + length);
strncpy (copy, rl_line_buffer + from, length);
copy[length] = '\0';
return (copy);
@@ -161,7 +145,7 @@ rl_extend_line_buffer (len)
while (len >= rl_line_buffer_len)
{
rl_line_buffer_len += DEFAULT_BUFFER_SIZE;
- rl_line_buffer = xrealloc (rl_line_buffer, rl_line_buffer_len);
+ rl_line_buffer = (char *)xrealloc (rl_line_buffer, rl_line_buffer_len);
}
_rl_set_the_line ();
@@ -170,8 +154,8 @@ rl_extend_line_buffer (len)
/* A function for simple tilde expansion. */
int
-rl_tilde_expand (int ignore __attribute__((unused)),
- int key __attribute__((unused)))
+rl_tilde_expand (ignore, key)
+ int ignore __attribute__((unused)), key __attribute__((unused));
{
register int start, end;
char *homedir, *temp;
@@ -207,7 +191,7 @@ rl_tilde_expand (int ignore __attribute__((unused)),
if (rl_line_buffer[start] == '~')
{
len = end - start + 1;
- temp = xmalloc (len + 1);
+ temp = (char *)xmalloc (len + 1);
strncpy (temp, rl_line_buffer + start, len);
temp[len] = '\0';
homedir = tilde_expand (temp);
@@ -229,16 +213,51 @@ rl_tilde_expand (int ignore __attribute__((unused)),
match in s1. The compare is case insensitive. */
char *
_rl_strindex (s1, s2)
- register char *s1, *s2;
+ register const char *s1, *s2;
{
register int i, l, len;
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
if (_rl_strnicmp (s1 + i, s2, l) == 0)
- return (s1 + i);
+ return ((char *) (s1 + i));
return ((char *)NULL);
}
+#ifndef HAVE_STRPBRK
+/* Find the first occurrence in STRING1 of any character from STRING2.
+ Return a pointer to the character in STRING1. */
+char *
+_rl_strpbrk (string1, string2)
+ const char *string1, *string2;
+{
+ register const char *scan;
+#if defined (HANDLE_MULTIBYTE)
+ mbstate_t ps;
+ register int i, v;
+
+ memset (&ps, 0, sizeof (mbstate_t));
+#endif
+
+ for (; *string1; string1++)
+ {
+ for (scan = string2; *scan; scan++)
+ {
+ if (*string1 == *scan)
+ return ((char *)string1);
+ }
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ v = _rl_get_char_len (string1, &ps);
+ if (v > 1)
+ string += v - 1; /* -1 to account for auto-increment in loop */
+ }
+#endif
+ }
+ return ((char *)NULL);
+}
+#endif
+
#if !defined (HAVE_STRCASECMP)
/* Compare at most COUNT characters from string1 to string2. Case
doesn't matter. */
@@ -297,69 +316,23 @@ _rl_qsort_string_compare (s1, s2)
#endif
}
-/* Function equivalents for the macros defined in chartypes.h. */
-#undef _rl_uppercase_p
-int
-_rl_uppercase_p (c)
- int c;
-{
- return (isupper (c));
-}
-
-#undef _rl_lowercase_p
-int
-_rl_lowercase_p (c)
- int c;
-{
- return (islower (c));
-}
+/* Function equivalents for the macros defined in chardefs.h. */
+#define FUNCTION_FOR_MACRO(f) int (f) (c) int c; { return f (c); }
-#undef _rl_pure_alphabetic
-int
-_rl_pure_alphabetic (c)
- int c;
-{
- return (isupper (c) || islower (c));
-}
-
-#undef _rl_digit_p
-int
-_rl_digit_p (c)
- int c;
-{
- return (isdigit (c));
-}
-
-#undef _rl_to_lower
-int
-_rl_to_lower (c)
- int c;
-{
- return (isupper (c) ? tolower (c) : c);
-}
-
-#undef _rl_to_upper
-int
-_rl_to_upper (c)
- int c;
-{
- return (islower (c) ? toupper (c) : c);
-}
-
-#undef _rl_digit_value
-int
-_rl_digit_value (c)
- int c;
-{
- return (isdigit (c) ? c - '0' : c);
-}
+FUNCTION_FOR_MACRO (_rl_digit_p)
+FUNCTION_FOR_MACRO (_rl_digit_value)
+FUNCTION_FOR_MACRO (_rl_lowercase_p)
+FUNCTION_FOR_MACRO (_rl_pure_alphabetic)
+FUNCTION_FOR_MACRO (_rl_to_lower)
+FUNCTION_FOR_MACRO (_rl_to_upper)
+FUNCTION_FOR_MACRO (_rl_uppercase_p)
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
#undef _rl_savestring
char *
_rl_savestring (s)
- char *s;
+ const char *s;
{
- return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
+ return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s)));
}
diff --git a/readline/vi_keymap.c b/readline/vi_keymap.c
index 14929a31930..53a67c674ce 100644
--- a/readline/vi_keymap.c
+++ b/readline/vi_keymap.c
@@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (BUFSIZ)
#include <stdio.h>
@@ -33,429 +33,429 @@ extern KEYMAP_ENTRY_ARRAY vi_escape_keymap;
/* The keymap arrays for handling vi mode. */
KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
/* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
- { ISFUNC, rl_emacs_editing_mode }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, rl_abort }, /* Control-g */
- { ISFUNC, rl_backward }, /* Control-h */
- { ISFUNC, (Function *)0x0 }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, rl_clear_screen }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_get_next_history }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, rl_get_previous_history }, /* Control-p */
- { ISFUNC, rl_quoted_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISFUNC, (Function *)0x0 }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
-
- { ISFUNC, (Function *)0x0 }, /* Control-[ */ /* vi_escape_keymap */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_vi_undo }, /* Control-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
+ { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
+ { ISFUNC, rl_emacs_editing_mode }, /* Control-e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */
+ { ISFUNC, rl_abort }, /* Control-g */
+ { ISFUNC, rl_backward_char }, /* Control-h */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-i */
+ { ISFUNC, rl_newline }, /* Control-j */
+ { ISFUNC, rl_kill_line }, /* Control-k */
+ { ISFUNC, rl_clear_screen }, /* Control-l */
+ { ISFUNC, rl_newline }, /* Control-m */
+ { ISFUNC, rl_get_next_history }, /* Control-n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
+ { ISFUNC, rl_get_previous_history }, /* Control-p */
+ { ISFUNC, rl_quoted_insert }, /* Control-q */
+ { ISFUNC, rl_reverse_search_history }, /* Control-r */
+ { ISFUNC, rl_forward_search_history }, /* Control-s */
+ { ISFUNC, rl_transpose_chars }, /* Control-t */
+ { ISFUNC, rl_unix_line_discard }, /* Control-u */
+ { ISFUNC, rl_quoted_insert }, /* Control-v */
+ { ISFUNC, rl_unix_word_rubout }, /* Control-w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
+ { ISFUNC, rl_yank }, /* Control-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
+
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-[ */ /* vi_escape_keymap */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
+ { ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
- { ISFUNC, rl_forward }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, rl_insert_comment }, /* # */
- { ISFUNC, rl_end_of_line }, /* $ */
- { ISFUNC, rl_vi_match }, /* % */
- { ISFUNC, rl_vi_tilde_expand }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, (Function *)0x0 }, /* ( */
- { ISFUNC, (Function *)0x0 }, /* ) */
- { ISFUNC, rl_vi_complete }, /* * */
- { ISFUNC, rl_get_next_history}, /* + */
- { ISFUNC, rl_vi_char_search }, /* , */
- { ISFUNC, rl_get_previous_history }, /* - */
- { ISFUNC, rl_vi_redo }, /* . */
- { ISFUNC, rl_vi_search }, /* / */
+ { ISFUNC, rl_forward_char }, /* SPACE */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* " */
+ { ISFUNC, rl_insert_comment }, /* # */
+ { ISFUNC, rl_end_of_line }, /* $ */
+ { ISFUNC, rl_vi_match }, /* % */
+ { ISFUNC, rl_vi_tilde_expand }, /* & */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ( */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ) */
+ { ISFUNC, rl_vi_complete }, /* * */
+ { ISFUNC, rl_get_next_history}, /* + */
+ { ISFUNC, rl_vi_char_search }, /* , */
+ { ISFUNC, rl_get_previous_history }, /* - */
+ { ISFUNC, rl_vi_redo }, /* . */
+ { ISFUNC, rl_vi_search }, /* / */
/* Regular digits. */
- { ISFUNC, rl_beg_of_line }, /* 0 */
- { ISFUNC, rl_vi_arg_digit }, /* 1 */
- { ISFUNC, rl_vi_arg_digit }, /* 2 */
- { ISFUNC, rl_vi_arg_digit }, /* 3 */
- { ISFUNC, rl_vi_arg_digit }, /* 4 */
- { ISFUNC, rl_vi_arg_digit }, /* 5 */
- { ISFUNC, rl_vi_arg_digit }, /* 6 */
- { ISFUNC, rl_vi_arg_digit }, /* 7 */
- { ISFUNC, rl_vi_arg_digit }, /* 8 */
- { ISFUNC, rl_vi_arg_digit }, /* 9 */
+ { ISFUNC, rl_beg_of_line }, /* 0 */
+ { ISFUNC, rl_vi_arg_digit }, /* 1 */
+ { ISFUNC, rl_vi_arg_digit }, /* 2 */
+ { ISFUNC, rl_vi_arg_digit }, /* 3 */
+ { ISFUNC, rl_vi_arg_digit }, /* 4 */
+ { ISFUNC, rl_vi_arg_digit }, /* 5 */
+ { ISFUNC, rl_vi_arg_digit }, /* 6 */
+ { ISFUNC, rl_vi_arg_digit }, /* 7 */
+ { ISFUNC, rl_vi_arg_digit }, /* 8 */
+ { ISFUNC, rl_vi_arg_digit }, /* 9 */
/* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, rl_vi_char_search }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, rl_vi_complete }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, rl_vi_search }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* : */
+ { ISFUNC, rl_vi_char_search }, /* ; */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* < */
+ { ISFUNC, rl_vi_complete }, /* = */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* > */
+ { ISFUNC, rl_vi_search }, /* ? */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */
/* Uppercase alphabet. */
- { ISFUNC, rl_vi_append_eol }, /* A */
- { ISFUNC, rl_vi_prev_word}, /* B */
- { ISFUNC, rl_vi_change_to }, /* C */
- { ISFUNC, rl_vi_delete_to }, /* D */
- { ISFUNC, rl_vi_end_word }, /* E */
- { ISFUNC, rl_vi_char_search }, /* F */
- { ISFUNC, rl_vi_fetch_history }, /* G */
- { ISFUNC, (Function *)0x0 }, /* H */
- { ISFUNC, rl_vi_insert_beg }, /* I */
- { ISFUNC, (Function *)0x0 }, /* J */
- { ISFUNC, (Function *)0x0 }, /* K */
- { ISFUNC, (Function *)0x0 }, /* L */
- { ISFUNC, (Function *)0x0 }, /* M */
- { ISFUNC, rl_vi_search_again }, /* N */
- { ISFUNC, (Function *)0x0 }, /* O */
- { ISFUNC, rl_vi_put }, /* P */
- { ISFUNC, (Function *)0x0 }, /* Q */
- { ISFUNC, rl_vi_replace }, /* R */
- { ISFUNC, rl_vi_subst }, /* S */
- { ISFUNC, rl_vi_char_search }, /* T */
- { ISFUNC, rl_revert_line }, /* U */
- { ISFUNC, (Function *)0x0 }, /* V */
- { ISFUNC, rl_vi_next_word }, /* W */
- { ISFUNC, rl_rubout }, /* X */
- { ISFUNC, rl_vi_yank_to }, /* Y */
- { ISFUNC, (Function *)0x0 }, /* Z */
+ { ISFUNC, rl_vi_append_eol }, /* A */
+ { ISFUNC, rl_vi_prev_word}, /* B */
+ { ISFUNC, rl_vi_change_to }, /* C */
+ { ISFUNC, rl_vi_delete_to }, /* D */
+ { ISFUNC, rl_vi_end_word }, /* E */
+ { ISFUNC, rl_vi_char_search }, /* F */
+ { ISFUNC, rl_vi_fetch_history }, /* G */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* H */
+ { ISFUNC, rl_vi_insert_beg }, /* I */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* J */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* K */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* L */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* M */
+ { ISFUNC, rl_vi_search_again }, /* N */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* O */
+ { ISFUNC, rl_vi_put }, /* P */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Q */
+ { ISFUNC, rl_vi_replace }, /* R */
+ { ISFUNC, rl_vi_subst }, /* S */
+ { ISFUNC, rl_vi_char_search }, /* T */
+ { ISFUNC, rl_revert_line }, /* U */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* V */
+ { ISFUNC, rl_vi_next_word }, /* W */
+ { ISFUNC, rl_rubout }, /* X */
+ { ISFUNC, rl_vi_yank_to }, /* Y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Z */
/* Some more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* [ */
- { ISFUNC, rl_vi_complete }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, rl_vi_first_print }, /* ^ */
- { ISFUNC, rl_vi_yank_arg }, /* _ */
- { ISFUNC, rl_vi_goto_mark }, /* ` */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* [ */
+ { ISFUNC, rl_vi_complete }, /* \ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */
+ { ISFUNC, rl_vi_first_print }, /* ^ */
+ { ISFUNC, rl_vi_yank_arg }, /* _ */
+ { ISFUNC, rl_vi_goto_mark }, /* ` */
/* Lowercase alphabet. */
- { ISFUNC, rl_vi_append_mode }, /* a */
- { ISFUNC, rl_vi_prev_word }, /* b */
- { ISFUNC, rl_vi_change_to }, /* c */
- { ISFUNC, rl_vi_delete_to }, /* d */
- { ISFUNC, rl_vi_end_word }, /* e */
- { ISFUNC, rl_vi_char_search }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, rl_backward }, /* h */
- { ISFUNC, rl_vi_insertion_mode }, /* i */
- { ISFUNC, rl_get_next_history }, /* j */
- { ISFUNC, rl_get_previous_history }, /* k */
- { ISFUNC, rl_forward }, /* l */
- { ISFUNC, rl_vi_set_mark }, /* m */
- { ISFUNC, rl_vi_search_again }, /* n */
- { ISFUNC, (Function *)0x0 }, /* o */
- { ISFUNC, rl_vi_put }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, rl_vi_change_char }, /* r */
- { ISFUNC, rl_vi_subst }, /* s */
- { ISFUNC, rl_vi_char_search }, /* t */
- { ISFUNC, rl_vi_undo }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, rl_vi_next_word }, /* w */
- { ISFUNC, rl_vi_delete }, /* x */
- { ISFUNC, rl_vi_yank_to }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
+ { ISFUNC, rl_vi_append_mode }, /* a */
+ { ISFUNC, rl_vi_prev_word }, /* b */
+ { ISFUNC, rl_vi_change_to }, /* c */
+ { ISFUNC, rl_vi_delete_to }, /* d */
+ { ISFUNC, rl_vi_end_word }, /* e */
+ { ISFUNC, rl_vi_char_search }, /* f */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* g */
+ { ISFUNC, rl_backward_char }, /* h */
+ { ISFUNC, rl_vi_insertion_mode }, /* i */
+ { ISFUNC, rl_get_next_history }, /* j */
+ { ISFUNC, rl_get_previous_history }, /* k */
+ { ISFUNC, rl_forward_char }, /* l */
+ { ISFUNC, rl_vi_set_mark }, /* m */
+ { ISFUNC, rl_vi_search_again }, /* n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* o */
+ { ISFUNC, rl_vi_put }, /* p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* q */
+ { ISFUNC, rl_vi_change_char }, /* r */
+ { ISFUNC, rl_vi_subst }, /* s */
+ { ISFUNC, rl_vi_char_search }, /* t */
+ { ISFUNC, rl_vi_undo }, /* u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* v */
+ { ISFUNC, rl_vi_next_word }, /* w */
+ { ISFUNC, rl_vi_delete }, /* x */
+ { ISFUNC, rl_vi_yank_to }, /* y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* z */
/* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, rl_vi_column }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, rl_vi_change_case }, /* ~ */
- { ISFUNC, (Function *)0x0 }, /* RUBOUT */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* { */
+ { ISFUNC, rl_vi_column }, /* | */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* } */
+ { ISFUNC, rl_vi_change_case }, /* ~ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 }
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
/* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, rl_insert }, /* Control-a */
- { ISFUNC, rl_insert }, /* Control-b */
- { ISFUNC, rl_insert }, /* Control-c */
- { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
- { ISFUNC, rl_insert }, /* Control-e */
- { ISFUNC, rl_insert }, /* Control-f */
- { ISFUNC, rl_insert }, /* Control-g */
- { ISFUNC, rl_rubout }, /* Control-h */
- { ISFUNC, rl_complete }, /* Control-i */
- { ISFUNC, rl_newline }, /* Control-j */
- { ISFUNC, rl_insert }, /* Control-k */
- { ISFUNC, rl_insert }, /* Control-l */
- { ISFUNC, rl_newline }, /* Control-m */
- { ISFUNC, rl_insert }, /* Control-n */
- { ISFUNC, rl_insert }, /* Control-o */
- { ISFUNC, rl_insert }, /* Control-p */
- { ISFUNC, rl_insert }, /* Control-q */
- { ISFUNC, rl_reverse_search_history }, /* Control-r */
- { ISFUNC, rl_forward_search_history }, /* Control-s */
- { ISFUNC, rl_transpose_chars }, /* Control-t */
- { ISFUNC, rl_unix_line_discard }, /* Control-u */
- { ISFUNC, rl_quoted_insert }, /* Control-v */
- { ISFUNC, rl_unix_word_rubout }, /* Control-w */
- { ISFUNC, rl_insert }, /* Control-x */
- { ISFUNC, rl_yank }, /* Control-y */
- { ISFUNC, rl_insert }, /* Control-z */
-
- { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
- { ISFUNC, rl_insert }, /* Control-\ */
- { ISFUNC, rl_insert }, /* Control-] */
- { ISFUNC, rl_insert }, /* Control-^ */
- { ISFUNC, rl_vi_undo }, /* Control-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
+ { ISFUNC, rl_insert }, /* Control-a */
+ { ISFUNC, rl_insert }, /* Control-b */
+ { ISFUNC, rl_insert }, /* Control-c */
+ { ISFUNC, rl_vi_eof_maybe }, /* Control-d */
+ { ISFUNC, rl_insert }, /* Control-e */
+ { ISFUNC, rl_insert }, /* Control-f */
+ { ISFUNC, rl_insert }, /* Control-g */
+ { ISFUNC, rl_rubout }, /* Control-h */
+ { ISFUNC, rl_complete }, /* Control-i */
+ { ISFUNC, rl_newline }, /* Control-j */
+ { ISFUNC, rl_insert }, /* Control-k */
+ { ISFUNC, rl_insert }, /* Control-l */
+ { ISFUNC, rl_newline }, /* Control-m */
+ { ISFUNC, rl_insert }, /* Control-n */
+ { ISFUNC, rl_insert }, /* Control-o */
+ { ISFUNC, rl_insert }, /* Control-p */
+ { ISFUNC, rl_insert }, /* Control-q */
+ { ISFUNC, rl_reverse_search_history }, /* Control-r */
+ { ISFUNC, rl_forward_search_history }, /* Control-s */
+ { ISFUNC, rl_transpose_chars }, /* Control-t */
+ { ISFUNC, rl_unix_line_discard }, /* Control-u */
+ { ISFUNC, rl_quoted_insert }, /* Control-v */
+ { ISFUNC, rl_unix_word_rubout }, /* Control-w */
+ { ISFUNC, rl_insert }, /* Control-x */
+ { ISFUNC, rl_yank }, /* Control-y */
+ { ISFUNC, rl_insert }, /* Control-z */
+
+ { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
+ { ISFUNC, rl_insert }, /* Control-\ */
+ { ISFUNC, rl_insert }, /* Control-] */
+ { ISFUNC, rl_insert }, /* Control-^ */
+ { ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
- { ISFUNC, rl_insert }, /* SPACE */
- { ISFUNC, rl_insert }, /* ! */
- { ISFUNC, rl_insert }, /* " */
- { ISFUNC, rl_insert }, /* # */
- { ISFUNC, rl_insert }, /* $ */
- { ISFUNC, rl_insert }, /* % */
- { ISFUNC, rl_insert }, /* & */
- { ISFUNC, rl_insert }, /* ' */
- { ISFUNC, rl_insert }, /* ( */
- { ISFUNC, rl_insert }, /* ) */
- { ISFUNC, rl_insert }, /* * */
- { ISFUNC, rl_insert }, /* + */
- { ISFUNC, rl_insert }, /* , */
- { ISFUNC, rl_insert }, /* - */
- { ISFUNC, rl_insert }, /* . */
- { ISFUNC, rl_insert }, /* / */
+ { ISFUNC, rl_insert }, /* SPACE */
+ { ISFUNC, rl_insert }, /* ! */
+ { ISFUNC, rl_insert }, /* " */
+ { ISFUNC, rl_insert }, /* # */
+ { ISFUNC, rl_insert }, /* $ */
+ { ISFUNC, rl_insert }, /* % */
+ { ISFUNC, rl_insert }, /* & */
+ { ISFUNC, rl_insert }, /* ' */
+ { ISFUNC, rl_insert }, /* ( */
+ { ISFUNC, rl_insert }, /* ) */
+ { ISFUNC, rl_insert }, /* * */
+ { ISFUNC, rl_insert }, /* + */
+ { ISFUNC, rl_insert }, /* , */
+ { ISFUNC, rl_insert }, /* - */
+ { ISFUNC, rl_insert }, /* . */
+ { ISFUNC, rl_insert }, /* / */
/* Regular digits. */
- { ISFUNC, rl_insert }, /* 0 */
- { ISFUNC, rl_insert }, /* 1 */
- { ISFUNC, rl_insert }, /* 2 */
- { ISFUNC, rl_insert }, /* 3 */
- { ISFUNC, rl_insert }, /* 4 */
- { ISFUNC, rl_insert }, /* 5 */
- { ISFUNC, rl_insert }, /* 6 */
- { ISFUNC, rl_insert }, /* 7 */
- { ISFUNC, rl_insert }, /* 8 */
- { ISFUNC, rl_insert }, /* 9 */
+ { ISFUNC, rl_insert }, /* 0 */
+ { ISFUNC, rl_insert }, /* 1 */
+ { ISFUNC, rl_insert }, /* 2 */
+ { ISFUNC, rl_insert }, /* 3 */
+ { ISFUNC, rl_insert }, /* 4 */
+ { ISFUNC, rl_insert }, /* 5 */
+ { ISFUNC, rl_insert }, /* 6 */
+ { ISFUNC, rl_insert }, /* 7 */
+ { ISFUNC, rl_insert }, /* 8 */
+ { ISFUNC, rl_insert }, /* 9 */
/* A little more punctuation. */
- { ISFUNC, rl_insert }, /* : */
- { ISFUNC, rl_insert }, /* ; */
- { ISFUNC, rl_insert }, /* < */
- { ISFUNC, rl_insert }, /* = */
- { ISFUNC, rl_insert }, /* > */
- { ISFUNC, rl_insert }, /* ? */
- { ISFUNC, rl_insert }, /* @ */
+ { ISFUNC, rl_insert }, /* : */
+ { ISFUNC, rl_insert }, /* ; */
+ { ISFUNC, rl_insert }, /* < */
+ { ISFUNC, rl_insert }, /* = */
+ { ISFUNC, rl_insert }, /* > */
+ { ISFUNC, rl_insert }, /* ? */
+ { ISFUNC, rl_insert }, /* @ */
/* Uppercase alphabet. */
- { ISFUNC, rl_insert }, /* A */
- { ISFUNC, rl_insert }, /* B */
- { ISFUNC, rl_insert }, /* C */
- { ISFUNC, rl_insert }, /* D */
- { ISFUNC, rl_insert }, /* E */
- { ISFUNC, rl_insert }, /* F */
- { ISFUNC, rl_insert }, /* G */
- { ISFUNC, rl_insert }, /* H */
- { ISFUNC, rl_insert }, /* I */
- { ISFUNC, rl_insert }, /* J */
- { ISFUNC, rl_insert }, /* K */
- { ISFUNC, rl_insert }, /* L */
- { ISFUNC, rl_insert }, /* M */
- { ISFUNC, rl_insert }, /* N */
- { ISFUNC, rl_insert }, /* O */
- { ISFUNC, rl_insert }, /* P */
- { ISFUNC, rl_insert }, /* Q */
- { ISFUNC, rl_insert }, /* R */
- { ISFUNC, rl_insert }, /* S */
- { ISFUNC, rl_insert }, /* T */
- { ISFUNC, rl_insert }, /* U */
- { ISFUNC, rl_insert }, /* V */
- { ISFUNC, rl_insert }, /* W */
- { ISFUNC, rl_insert }, /* X */
- { ISFUNC, rl_insert }, /* Y */
- { ISFUNC, rl_insert }, /* Z */
+ { ISFUNC, rl_insert }, /* A */
+ { ISFUNC, rl_insert }, /* B */
+ { ISFUNC, rl_insert }, /* C */
+ { ISFUNC, rl_insert }, /* D */
+ { ISFUNC, rl_insert }, /* E */
+ { ISFUNC, rl_insert }, /* F */
+ { ISFUNC, rl_insert }, /* G */
+ { ISFUNC, rl_insert }, /* H */
+ { ISFUNC, rl_insert }, /* I */
+ { ISFUNC, rl_insert }, /* J */
+ { ISFUNC, rl_insert }, /* K */
+ { ISFUNC, rl_insert }, /* L */
+ { ISFUNC, rl_insert }, /* M */
+ { ISFUNC, rl_insert }, /* N */
+ { ISFUNC, rl_insert }, /* O */
+ { ISFUNC, rl_insert }, /* P */
+ { ISFUNC, rl_insert }, /* Q */
+ { ISFUNC, rl_insert }, /* R */
+ { ISFUNC, rl_insert }, /* S */
+ { ISFUNC, rl_insert }, /* T */
+ { ISFUNC, rl_insert }, /* U */
+ { ISFUNC, rl_insert }, /* V */
+ { ISFUNC, rl_insert }, /* W */
+ { ISFUNC, rl_insert }, /* X */
+ { ISFUNC, rl_insert }, /* Y */
+ { ISFUNC, rl_insert }, /* Z */
/* Some more punctuation. */
- { ISFUNC, rl_insert }, /* [ */
- { ISFUNC, rl_insert }, /* \ */
- { ISFUNC, rl_insert }, /* ] */
- { ISFUNC, rl_insert }, /* ^ */
- { ISFUNC, rl_insert }, /* _ */
- { ISFUNC, rl_insert }, /* ` */
+ { ISFUNC, rl_insert }, /* [ */
+ { ISFUNC, rl_insert }, /* \ */
+ { ISFUNC, rl_insert }, /* ] */
+ { ISFUNC, rl_insert }, /* ^ */
+ { ISFUNC, rl_insert }, /* _ */
+ { ISFUNC, rl_insert }, /* ` */
/* Lowercase alphabet. */
- { ISFUNC, rl_insert }, /* a */
- { ISFUNC, rl_insert }, /* b */
- { ISFUNC, rl_insert }, /* c */
- { ISFUNC, rl_insert }, /* d */
- { ISFUNC, rl_insert }, /* e */
- { ISFUNC, rl_insert }, /* f */
- { ISFUNC, rl_insert }, /* g */
- { ISFUNC, rl_insert }, /* h */
- { ISFUNC, rl_insert }, /* i */
- { ISFUNC, rl_insert }, /* j */
- { ISFUNC, rl_insert }, /* k */
- { ISFUNC, rl_insert }, /* l */
- { ISFUNC, rl_insert }, /* m */
- { ISFUNC, rl_insert }, /* n */
- { ISFUNC, rl_insert }, /* o */
- { ISFUNC, rl_insert }, /* p */
- { ISFUNC, rl_insert }, /* q */
- { ISFUNC, rl_insert }, /* r */
- { ISFUNC, rl_insert }, /* s */
- { ISFUNC, rl_insert }, /* t */
- { ISFUNC, rl_insert }, /* u */
- { ISFUNC, rl_insert }, /* v */
- { ISFUNC, rl_insert }, /* w */
- { ISFUNC, rl_insert }, /* x */
- { ISFUNC, rl_insert }, /* y */
- { ISFUNC, rl_insert }, /* z */
+ { ISFUNC, rl_insert }, /* a */
+ { ISFUNC, rl_insert }, /* b */
+ { ISFUNC, rl_insert }, /* c */
+ { ISFUNC, rl_insert }, /* d */
+ { ISFUNC, rl_insert }, /* e */
+ { ISFUNC, rl_insert }, /* f */
+ { ISFUNC, rl_insert }, /* g */
+ { ISFUNC, rl_insert }, /* h */
+ { ISFUNC, rl_insert }, /* i */
+ { ISFUNC, rl_insert }, /* j */
+ { ISFUNC, rl_insert }, /* k */
+ { ISFUNC, rl_insert }, /* l */
+ { ISFUNC, rl_insert }, /* m */
+ { ISFUNC, rl_insert }, /* n */
+ { ISFUNC, rl_insert }, /* o */
+ { ISFUNC, rl_insert }, /* p */
+ { ISFUNC, rl_insert }, /* q */
+ { ISFUNC, rl_insert }, /* r */
+ { ISFUNC, rl_insert }, /* s */
+ { ISFUNC, rl_insert }, /* t */
+ { ISFUNC, rl_insert }, /* u */
+ { ISFUNC, rl_insert }, /* v */
+ { ISFUNC, rl_insert }, /* w */
+ { ISFUNC, rl_insert }, /* x */
+ { ISFUNC, rl_insert }, /* y */
+ { ISFUNC, rl_insert }, /* z */
/* Final punctuation. */
- { ISFUNC, rl_insert }, /* { */
- { ISFUNC, rl_insert }, /* | */
- { ISFUNC, rl_insert }, /* } */
- { ISFUNC, rl_insert }, /* ~ */
- { ISFUNC, rl_rubout }, /* RUBOUT */
+ { ISFUNC, rl_insert }, /* { */
+ { ISFUNC, rl_insert }, /* | */
+ { ISFUNC, rl_insert }, /* } */
+ { ISFUNC, rl_insert }, /* ~ */
+ { ISFUNC, rl_rubout }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Pure 8-bit characters (128 - 159).
@@ -598,280 +598,280 @@ KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
#if 0
KEYMAP_ENTRY_ARRAY vi_escape_keymap = {
/* The regular control keys come first. */
- { ISFUNC, (Function *)0x0 }, /* Control-@ */
- { ISFUNC, (Function *)0x0 }, /* Control-a */
- { ISFUNC, (Function *)0x0 }, /* Control-b */
- { ISFUNC, (Function *)0x0 }, /* Control-c */
- { ISFUNC, (Function *)0x0 }, /* Control-d */
- { ISFUNC, (Function *)0x0 }, /* Control-e */
- { ISFUNC, (Function *)0x0 }, /* Control-f */
- { ISFUNC, (Function *)0x0 }, /* Control-g */
- { ISFUNC, (Function *)0x0 }, /* Control-h */
- { ISFUNC, rl_tab_insert}, /* Control-i */
- { ISFUNC, rl_emacs_editing_mode}, /* Control-j */
- { ISFUNC, rl_kill_line }, /* Control-k */
- { ISFUNC, (Function *)0x0 }, /* Control-l */
- { ISFUNC, rl_emacs_editing_mode}, /* Control-m */
- { ISFUNC, (Function *)0x0 }, /* Control-n */
- { ISFUNC, (Function *)0x0 }, /* Control-o */
- { ISFUNC, (Function *)0x0 }, /* Control-p */
- { ISFUNC, (Function *)0x0 }, /* Control-q */
- { ISFUNC, (Function *)0x0 }, /* Control-r */
- { ISFUNC, (Function *)0x0 }, /* Control-s */
- { ISFUNC, (Function *)0x0 }, /* Control-t */
- { ISFUNC, (Function *)0x0 }, /* Control-u */
- { ISFUNC, (Function *)0x0 }, /* Control-v */
- { ISFUNC, (Function *)0x0 }, /* Control-w */
- { ISFUNC, (Function *)0x0 }, /* Control-x */
- { ISFUNC, (Function *)0x0 }, /* Control-y */
- { ISFUNC, (Function *)0x0 }, /* Control-z */
-
- { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
- { ISFUNC, (Function *)0x0 }, /* Control-\ */
- { ISFUNC, (Function *)0x0 }, /* Control-] */
- { ISFUNC, (Function *)0x0 }, /* Control-^ */
- { ISFUNC, rl_vi_undo }, /* Control-_ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-c */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-d */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-f */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-h */
+ { ISFUNC, rl_tab_insert}, /* Control-i */
+ { ISFUNC, rl_emacs_editing_mode}, /* Control-j */
+ { ISFUNC, rl_kill_line }, /* Control-k */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-l */
+ { ISFUNC, rl_emacs_editing_mode}, /* Control-m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-n */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-q */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-s */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-t */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
+
+ { ISFUNC, rl_vi_movement_mode }, /* Control-[ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-\ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-^ */
+ { ISFUNC, rl_vi_undo }, /* Control-_ */
/* The start of printing characters. */
- { ISFUNC, (Function *)0x0 }, /* SPACE */
- { ISFUNC, (Function *)0x0 }, /* ! */
- { ISFUNC, (Function *)0x0 }, /* " */
- { ISFUNC, (Function *)0x0 }, /* # */
- { ISFUNC, (Function *)0x0 }, /* $ */
- { ISFUNC, (Function *)0x0 }, /* % */
- { ISFUNC, (Function *)0x0 }, /* & */
- { ISFUNC, (Function *)0x0 }, /* ' */
- { ISFUNC, (Function *)0x0 }, /* ( */
- { ISFUNC, (Function *)0x0 }, /* ) */
- { ISFUNC, (Function *)0x0 }, /* * */
- { ISFUNC, (Function *)0x0 }, /* + */
- { ISFUNC, (Function *)0x0 }, /* , */
- { ISFUNC, (Function *)0x0 }, /* - */
- { ISFUNC, (Function *)0x0 }, /* . */
- { ISFUNC, (Function *)0x0 }, /* / */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* SPACE */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ! */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* " */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* # */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* $ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* % */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* & */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ' */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ( */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ) */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* * */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* + */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* , */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* - */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* . */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* / */
/* Regular digits. */
- { ISFUNC, rl_vi_arg_digit }, /* 0 */
- { ISFUNC, rl_vi_arg_digit }, /* 1 */
- { ISFUNC, rl_vi_arg_digit }, /* 2 */
- { ISFUNC, rl_vi_arg_digit }, /* 3 */
- { ISFUNC, rl_vi_arg_digit }, /* 4 */
- { ISFUNC, rl_vi_arg_digit }, /* 5 */
- { ISFUNC, rl_vi_arg_digit }, /* 6 */
- { ISFUNC, rl_vi_arg_digit }, /* 7 */
- { ISFUNC, rl_vi_arg_digit }, /* 8 */
- { ISFUNC, rl_vi_arg_digit }, /* 9 */
+ { ISFUNC, rl_vi_arg_digit }, /* 0 */
+ { ISFUNC, rl_vi_arg_digit }, /* 1 */
+ { ISFUNC, rl_vi_arg_digit }, /* 2 */
+ { ISFUNC, rl_vi_arg_digit }, /* 3 */
+ { ISFUNC, rl_vi_arg_digit }, /* 4 */
+ { ISFUNC, rl_vi_arg_digit }, /* 5 */
+ { ISFUNC, rl_vi_arg_digit }, /* 6 */
+ { ISFUNC, rl_vi_arg_digit }, /* 7 */
+ { ISFUNC, rl_vi_arg_digit }, /* 8 */
+ { ISFUNC, rl_vi_arg_digit }, /* 9 */
/* A little more punctuation. */
- { ISFUNC, (Function *)0x0 }, /* : */
- { ISFUNC, (Function *)0x0 }, /* ; */
- { ISFUNC, (Function *)0x0 }, /* < */
- { ISFUNC, (Function *)0x0 }, /* = */
- { ISFUNC, (Function *)0x0 }, /* > */
- { ISFUNC, (Function *)0x0 }, /* ? */
- { ISFUNC, (Function *)0x0 }, /* @ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* : */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ; */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* < */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* = */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* > */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ? */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* @ */
/* Uppercase alphabet. */
- { ISFUNC, rl_do_lowercase_version }, /* A */
- { ISFUNC, rl_do_lowercase_version }, /* B */
- { ISFUNC, rl_do_lowercase_version }, /* C */
- { ISFUNC, rl_do_lowercase_version }, /* D */
- { ISFUNC, rl_do_lowercase_version }, /* E */
- { ISFUNC, rl_do_lowercase_version }, /* F */
- { ISFUNC, rl_do_lowercase_version }, /* G */
- { ISFUNC, rl_do_lowercase_version }, /* H */
- { ISFUNC, rl_do_lowercase_version }, /* I */
- { ISFUNC, rl_do_lowercase_version }, /* J */
- { ISFUNC, rl_do_lowercase_version }, /* K */
- { ISFUNC, rl_do_lowercase_version }, /* L */
- { ISFUNC, rl_do_lowercase_version }, /* M */
- { ISFUNC, rl_do_lowercase_version }, /* N */
- { ISFUNC, rl_do_lowercase_version }, /* O */
- { ISFUNC, rl_do_lowercase_version }, /* P */
- { ISFUNC, rl_do_lowercase_version }, /* Q */
- { ISFUNC, rl_do_lowercase_version }, /* R */
- { ISFUNC, rl_do_lowercase_version }, /* S */
- { ISFUNC, rl_do_lowercase_version }, /* T */
- { ISFUNC, rl_do_lowercase_version }, /* U */
- { ISFUNC, rl_do_lowercase_version }, /* V */
- { ISFUNC, rl_do_lowercase_version }, /* W */
- { ISFUNC, rl_do_lowercase_version }, /* X */
- { ISFUNC, rl_do_lowercase_version }, /* Y */
- { ISFUNC, rl_do_lowercase_version }, /* Z */
+ { ISFUNC, rl_do_lowercase_version }, /* A */
+ { ISFUNC, rl_do_lowercase_version }, /* B */
+ { ISFUNC, rl_do_lowercase_version }, /* C */
+ { ISFUNC, rl_do_lowercase_version }, /* D */
+ { ISFUNC, rl_do_lowercase_version }, /* E */
+ { ISFUNC, rl_do_lowercase_version }, /* F */
+ { ISFUNC, rl_do_lowercase_version }, /* G */
+ { ISFUNC, rl_do_lowercase_version }, /* H */
+ { ISFUNC, rl_do_lowercase_version }, /* I */
+ { ISFUNC, rl_do_lowercase_version }, /* J */
+ { ISFUNC, rl_do_lowercase_version }, /* K */
+ { ISFUNC, rl_do_lowercase_version }, /* L */
+ { ISFUNC, rl_do_lowercase_version }, /* M */
+ { ISFUNC, rl_do_lowercase_version }, /* N */
+ { ISFUNC, rl_do_lowercase_version }, /* O */
+ { ISFUNC, rl_do_lowercase_version }, /* P */
+ { ISFUNC, rl_do_lowercase_version }, /* Q */
+ { ISFUNC, rl_do_lowercase_version }, /* R */
+ { ISFUNC, rl_do_lowercase_version }, /* S */
+ { ISFUNC, rl_do_lowercase_version }, /* T */
+ { ISFUNC, rl_do_lowercase_version }, /* U */
+ { ISFUNC, rl_do_lowercase_version }, /* V */
+ { ISFUNC, rl_do_lowercase_version }, /* W */
+ { ISFUNC, rl_do_lowercase_version }, /* X */
+ { ISFUNC, rl_do_lowercase_version }, /* Y */
+ { ISFUNC, rl_do_lowercase_version }, /* Z */
/* Some more punctuation. */
- { ISFUNC, rl_arrow_keys }, /* [ */
- { ISFUNC, (Function *)0x0 }, /* \ */
- { ISFUNC, (Function *)0x0 }, /* ] */
- { ISFUNC, (Function *)0x0 }, /* ^ */
- { ISFUNC, (Function *)0x0 }, /* _ */
- { ISFUNC, (Function *)0x0 }, /* ` */
+ { ISFUNC, rl_arrow_keys }, /* [ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* \ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ] */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ^ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* _ */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ` */
/* Lowercase alphabet. */
- { ISFUNC, (Function *)0x0 }, /* a */
- { ISFUNC, (Function *)0x0 }, /* b */
- { ISFUNC, (Function *)0x0 }, /* c */
- { ISFUNC, (Function *)0x0 }, /* d */
- { ISFUNC, (Function *)0x0 }, /* e */
- { ISFUNC, (Function *)0x0 }, /* f */
- { ISFUNC, (Function *)0x0 }, /* g */
- { ISFUNC, (Function *)0x0 }, /* h */
- { ISFUNC, (Function *)0x0 }, /* i */
- { ISFUNC, (Function *)0x0 }, /* j */
- { ISFUNC, (Function *)0x0 }, /* k */
- { ISFUNC, (Function *)0x0 }, /* l */
- { ISFUNC, (Function *)0x0 }, /* m */
- { ISFUNC, (Function *)0x0 }, /* n */
- { ISFUNC, rl_arrow_keys }, /* o */
- { ISFUNC, (Function *)0x0 }, /* p */
- { ISFUNC, (Function *)0x0 }, /* q */
- { ISFUNC, (Function *)0x0 }, /* r */
- { ISFUNC, (Function *)0x0 }, /* s */
- { ISFUNC, (Function *)0x0 }, /* t */
- { ISFUNC, (Function *)0x0 }, /* u */
- { ISFUNC, (Function *)0x0 }, /* v */
- { ISFUNC, (Function *)0x0 }, /* w */
- { ISFUNC, (Function *)0x0 }, /* x */
- { ISFUNC, (Function *)0x0 }, /* y */
- { ISFUNC, (Function *)0x0 }, /* z */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* a */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* b */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* c */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* d */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* e */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* f */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* g */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* h */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* i */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* j */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* k */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* l */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* m */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* n */
+ { ISFUNC, rl_arrow_keys }, /* o */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* p */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* q */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* r */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* s */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* t */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* u */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* v */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* w */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* x */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* y */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* z */
/* Final punctuation. */
- { ISFUNC, (Function *)0x0 }, /* { */
- { ISFUNC, (Function *)0x0 }, /* | */
- { ISFUNC, (Function *)0x0 }, /* } */
- { ISFUNC, (Function *)0x0 }, /* ~ */
- { ISFUNC, rl_backward_kill_word }, /* RUBOUT */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* { */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* | */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* } */
+ { ISFUNC, (rl_command_func_t *)0x0 }, /* ~ */
+ { ISFUNC, rl_backward_kill_word }, /* RUBOUT */
#if KEYMAP_SIZE > 128
/* Undefined keys. */
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 },
- { ISFUNC, (Function *)0x0 }
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 },
+ { ISFUNC, (rl_command_func_t *)0x0 }
#endif /* KEYMAP_SIZE > 128 */
};
#endif
diff --git a/readline/vi_mode.c b/readline/vi_mode.c
index eb392b643ba..01df589f625 100644
--- a/readline/vi_mode.c
+++ b/readline/vi_mode.c
@@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 1, or
+ as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA. */
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
/* **************************************************************** */
@@ -51,54 +51,23 @@
/* Some standard library routines. */
#include "rldefs.h"
+#include "rlmbutil.h"
+
#include "readline.h"
#include "history.h"
-#ifndef _rl_digit_p
-#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
-#endif
-
-#ifndef _rl_digit_value
-#define _rl_digit_value(c) ((c) - '0')
-#endif
+#include "rlprivate.h"
+#include "xmalloc.h"
#ifndef member
#define member(c, s) ((c) ? (char *)strchr ((s), (c)) != (char *)NULL : 0)
#endif
-#ifndef isident
-#define isident(c) ((_rl_pure_alphabetic (c) || _rl_digit_p (c) || c == '_'))
-#endif
-
-#ifndef exchange
-#define exchange(x, y) do {int temp = x; x = y; y = temp;} while (0)
-#endif
-
-extern char *xmalloc (), *xrealloc ();
-
-/* Variables imported from readline.c */
-extern int rl_point, rl_end, rl_mark;
-extern FILE *rl_instream;
-extern int rl_line_buffer_len, rl_explicit_arg, rl_numeric_arg;
-extern Keymap _rl_keymap;
-extern char *rl_prompt;
-extern char *rl_line_buffer;
-extern int rl_arg_sign;
-
-extern int _rl_doing_an_undo;
-extern int _rl_undo_group_level;
-
-extern void _rl_dispatch ();
-extern int _rl_char_search_internal ();
-
-extern void rl_extend_line_buffer ();
-extern int rl_vi_check ();
-
/* Non-zero means enter insertion mode. */
static int _rl_vi_doing_insert;
/* Command keys which do movement for xxx_to commands. */
-static const char *vi_motion = " hl^$0ftFt;,%wbeWBE|";
+static const char *vi_motion = " hl^$0ftFT;,%wbeWBE|";
/* Keymap used for vi replace characters. Created dynamically since
rarely used. */
@@ -118,7 +87,11 @@ static int _rl_vi_last_command = 'i'; /* default `.' puts you in insert mode */
static int _rl_vi_last_repeat = 1;
static int _rl_vi_last_arg_sign = 1;
static int _rl_vi_last_motion;
+#if defined (HANDLE_MULTIBYTE)
+static char _rl_vi_last_search_mbchar[MB_LEN_MAX];
+#else
static int _rl_vi_last_search_char;
+#endif
static int _rl_vi_last_replacement;
static int _rl_vi_last_key_before_insert;
@@ -129,20 +102,18 @@ static int vi_redoing;
static const char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
/* Arrays for the saved marks. */
-static int vi_mark_chars[27];
+static int vi_mark_chars['z' - 'a' + 1];
-static int rl_digit_loop1 ();
+static void _rl_vi_stuff_insert PARAMS((int));
+static void _rl_vi_save_insert PARAMS((UNDO_LIST *));
+static int rl_digit_loop1 PARAMS((void));
void
_rl_vi_initialize_line ()
{
-#ifndef __QNXNTO__
- register uint i;
-#else
register unsigned int i;
-#endif
- for (i = 0; i < (int) sizeof (vi_mark_chars) / sizeof (int); i++)
+ for (i = 0; i < sizeof (vi_mark_chars) / sizeof (int); i++)
vi_mark_chars[i] = -1;
}
@@ -189,12 +160,15 @@ int
rl_vi_redo (count, c)
int count, c __attribute__((unused));
{
+ int r;
+
if (!rl_explicit_arg)
{
rl_numeric_arg = _rl_vi_last_repeat;
rl_arg_sign = _rl_vi_last_arg_sign;
}
+ r = 0;
vi_redoing = 1;
/* If we're redoing an insert with `i', stuff in the inserted text
and do not go into insertion mode. */
@@ -206,10 +180,10 @@ rl_vi_redo (count, c)
rl_point--;
}
else
- _rl_dispatch (_rl_vi_last_command, _rl_keymap);
+ r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
vi_redoing = 0;
- return (0);
+ return (r);
}
/* A placeholder for further expansion. */
@@ -219,10 +193,10 @@ rl_vi_undo (count, key)
{
return (rl_undo_command (count, key));
}
-
+
/* Yank the nth arg from the previous line into this line at point. */
int
-rl_vi_yank_arg (count, key)
+rl_vi_yank_arg (count, key)
int count, key __attribute__((unused));
{
/* Readline thinks that the first word on a line is the 0th, while vi
@@ -295,7 +269,7 @@ rl_vi_search (count, key)
break;
default:
- ding ();
+ rl_ding ();
break;
}
return (0);
@@ -351,7 +325,7 @@ rl_vi_prev_word (count, key)
if (rl_point == 0)
{
- ding ();
+ rl_ding ();
return (0);
}
@@ -373,7 +347,7 @@ rl_vi_next_word (count, key)
if (rl_point >= (rl_end - 1))
{
- ding ();
+ rl_ding ();
return (0);
}
@@ -391,7 +365,7 @@ rl_vi_end_word (count, key)
{
if (count < 0)
{
- ding ();
+ rl_ding ();
return -1;
}
@@ -481,14 +455,14 @@ rl_vi_fword (count, ignore)
while (count-- && rl_point < (rl_end - 1))
{
/* Move to white space (really non-identifer). */
- if (isident (rl_line_buffer[rl_point]))
+ if (_rl_isident (rl_line_buffer[rl_point]))
{
- while (isident (rl_line_buffer[rl_point]) && rl_point < rl_end)
+ while (_rl_isident (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
}
else /* if (!whitespace (rl_line_buffer[rl_point])) */
{
- while (!isident (rl_line_buffer[rl_point]) &&
+ while (!_rl_isident (rl_line_buffer[rl_point]) &&
!whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
rl_point++;
}
@@ -518,9 +492,9 @@ rl_vi_bword (count, ignore)
back so we don't get messed up by the rl_point++ down there in
the while loop. Without this code, words like `l;' screw up the
function. */
- last_is_ident = isident (rl_line_buffer[rl_point - 1]);
- if ((isident (rl_line_buffer[rl_point]) && !last_is_ident) ||
- (!isident (rl_line_buffer[rl_point]) && last_is_ident))
+ last_is_ident = _rl_isident (rl_line_buffer[rl_point - 1]);
+ if ((_rl_isident (rl_line_buffer[rl_point]) && !last_is_ident) ||
+ (!_rl_isident (rl_line_buffer[rl_point]) && last_is_ident))
rl_point--;
while (rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
@@ -528,10 +502,10 @@ rl_vi_bword (count, ignore)
if (rl_point > 0)
{
- if (isident (rl_line_buffer[rl_point]))
- while (--rl_point >= 0 && isident (rl_line_buffer[rl_point]));
+ if (_rl_isident (rl_line_buffer[rl_point]))
+ while (--rl_point >= 0 && _rl_isident (rl_line_buffer[rl_point]));
else
- while (--rl_point >= 0 && !isident (rl_line_buffer[rl_point]) &&
+ while (--rl_point >= 0 && !_rl_isident (rl_line_buffer[rl_point]) &&
!whitespace (rl_line_buffer[rl_point]));
rl_point++;
}
@@ -553,10 +527,10 @@ rl_vi_eword (count, ignore)
if (rl_point < rl_end)
{
- if (isident (rl_line_buffer[rl_point]))
- while (++rl_point < rl_end && isident (rl_line_buffer[rl_point]));
+ if (_rl_isident (rl_line_buffer[rl_point]))
+ while (++rl_point < rl_end && _rl_isident (rl_line_buffer[rl_point]));
else
- while (++rl_point < rl_end && !isident (rl_line_buffer[rl_point])
+ while (++rl_point < rl_end && !_rl_isident (rl_line_buffer[rl_point])
&& !whitespace (rl_line_buffer[rl_point]));
}
rl_point--;
@@ -578,7 +552,17 @@ rl_vi_append_mode (count, key)
int count __attribute__((unused)), key;
{
if (rl_point < rl_end)
- rl_point++;
+ {
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ rl_point++;
+ else
+ {
+ int point = rl_point;
+ rl_forward_char (1, key);
+ if (point == rl_point)
+ rl_point = rl_end;
+ }
+ }
rl_vi_insertion_mode (1, key);
return (0);
}
@@ -632,17 +616,18 @@ _rl_vi_save_insert (up)
if (len >= vi_insert_buffer_size)
{
vi_insert_buffer_size += (len + 32) - (len % 32);
- vi_insert_buffer = xrealloc (vi_insert_buffer, vi_insert_buffer_size);
+ vi_insert_buffer = (char *)xrealloc (vi_insert_buffer, vi_insert_buffer_size);
}
strncpy (vi_insert_buffer, rl_line_buffer + start, len - 1);
vi_insert_buffer[len-1] = '\0';
}
-
+
void
_rl_vi_done_inserting ()
{
if (_rl_vi_doing_insert)
{
+ /* The `C', `s', and `S' commands set this. */
rl_end_undo_group ();
/* Now, the text between rl_undo_list->next->start and
rl_undo_list->next->end is what was inserted while in insert
@@ -671,7 +656,7 @@ rl_vi_movement_mode (count, key)
int count __attribute__((unused)), key;
{
if (rl_point > 0)
- rl_backward (1, key);
+ rl_backward_char (1, key);
_rl_keymap = vi_movement_keymap;
_rl_vi_done_inserting ();
@@ -688,6 +673,51 @@ rl_vi_arg_digit (count, c)
return (rl_digit_argument (count, c));
}
+/* Change the case of the next COUNT characters. */
+#if defined (HANDLE_MULTIBYTE)
+static int
+_rl_vi_change_mbchar_case (count)
+ int count;
+{
+ wchar_t wc;
+ char mb[MB_LEN_MAX];
+ mbstate_t ps;
+
+ memset (&ps, 0, sizeof (mbstate_t));
+ if (_rl_adjust_point (rl_line_buffer, rl_point, &ps) > 0)
+ count--;
+ while (count-- && rl_point < rl_end)
+ {
+ mbrtowc (&wc, rl_line_buffer + rl_point, rl_end - rl_point, &ps);
+ if (iswupper (wc))
+ wc = towlower (wc);
+ else if (iswlower (wc))
+ wc = towupper (wc);
+ else
+ {
+ /* Just skip over chars neither upper nor lower case */
+ rl_forward_char (1, 0);
+ continue;
+ }
+
+ /* Vi is kind of strange here. */
+ if (wc)
+ {
+ wctomb (mb, wc);
+ rl_begin_undo_group ();
+ rl_delete (1, 0);
+ rl_insert_text (mb);
+ rl_end_undo_group ();
+ rl_vi_check ();
+ }
+ else
+ rl_forward_char (1, 0);
+ }
+
+ return 0;
+}
+#endif
+
int
rl_vi_change_case (count, ignore)
int count, ignore __attribute__((unused));
@@ -698,6 +728,11 @@ rl_vi_change_case (count, ignore)
if (rl_point >= rl_end)
return (0);
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ return (_rl_vi_change_mbchar_case (count));
+#endif
+
while (count-- && rl_point < rl_end)
{
if (_rl_uppercase_p (rl_line_buffer[rl_point]))
@@ -707,7 +742,7 @@ rl_vi_change_case (count, ignore)
else
{
/* Just skip over characters neither upper nor lower case. */
- rl_forward (1, c);
+ rl_forward_char (1, c);
continue;
}
@@ -716,12 +751,12 @@ rl_vi_change_case (count, ignore)
{
rl_begin_undo_group ();
rl_delete (1, c);
- rl_insert (1, c);
+ _rl_insert_char (1, c);
rl_end_undo_group ();
rl_vi_check ();
}
else
- rl_forward (1, c);
+ rl_forward_char (1, c);
}
return (0);
}
@@ -731,10 +766,10 @@ rl_vi_put (count, key)
int count __attribute__((unused)), key;
{
if (!_rl_uppercase_p (key) && (rl_point + 1 <= rl_end))
- rl_point++;
+ rl_point = _rl_find_next_mbchar (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
rl_yank (1, key);
- rl_backward (1, key);
+ rl_backward_char (1, key);
return (0);
}
@@ -742,7 +777,12 @@ int
rl_vi_check ()
{
if (rl_point && rl_point == rl_end)
- rl_point--;
+ {
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
+ else
+ rl_point--;
+ }
return (0);
}
@@ -765,7 +805,9 @@ rl_vi_domove (key, nextkey)
int old_end;
rl_mark = rl_point;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
*nextkey = c;
if (!member (c, vi_motion))
@@ -776,7 +818,9 @@ rl_vi_domove (key, nextkey)
rl_numeric_arg = _rl_digit_value (c);
rl_digit_loop1 ();
rl_numeric_arg *= save;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key (); /* real command */
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
*nextkey = c;
}
else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
@@ -840,24 +884,36 @@ rl_vi_domove (key, nextkey)
}
if (rl_mark < rl_point)
- exchange (rl_point, rl_mark);
+ SWAP (rl_point, rl_mark);
return (0);
}
/* A simplified loop for vi. Don't dispatch key at end.
- Don't recognize minus sign? */
+ Don't recognize minus sign?
+ Should this do rl_save_prompt/rl_restore_prompt? */
static int
rl_digit_loop1 ()
{
int key, c;
+ RL_SETSTATE(RL_STATE_NUMERICARG);
while (1)
{
- rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg, 0);
+ if (rl_numeric_arg > 1000000)
+ {
+ rl_explicit_arg = rl_numeric_arg = 0;
+ rl_ding ();
+ rl_clear_message ();
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ return 1;
+ }
+ rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg);
+ RL_SETSTATE(RL_STATE_MOREINPUT);
key = c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
- if (_rl_keymap[c].type == ISFUNC &&
+ if (c >= 0 && _rl_keymap[c].type == ISFUNC &&
_rl_keymap[c].function == rl_universal_argument)
{
rl_numeric_arg *= 4;
@@ -880,6 +936,8 @@ rl_digit_loop1 ()
break;
}
}
+
+ RL_UNSETSTATE(RL_STATE_NUMERICARG);
return (0);
}
@@ -896,7 +954,7 @@ rl_vi_delete_to (count, key)
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
@@ -924,7 +982,7 @@ rl_vi_change_to (count, key)
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
@@ -974,7 +1032,7 @@ rl_vi_yank_to (count, key)
if (rl_vi_domove (key, &c))
{
- ding ();
+ rl_ding ();
return -1;
}
@@ -1000,19 +1058,22 @@ rl_vi_delete (count, key)
if (rl_end == 0)
{
- ding ();
+ rl_ding ();
return -1;
}
- end = rl_point + count;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ end = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
+ else
+ end = rl_point + count;
if (end >= rl_end)
end = rl_end;
rl_kill_text (rl_point, end);
-
+
if (rl_point > 0 && rl_point == rl_end)
- rl_backward (1, key);
+ rl_backward_char (1, key);
return (0);
}
@@ -1037,7 +1098,12 @@ int
rl_vi_char_search (count, key)
int count, key;
{
+#if defined (HANDLE_MULTIBYTE)
+ static char *target;
+ static int mb_len;
+#else
static char target;
+#endif
static int orig_dir, dir;
if (key == ';' || key == ',')
@@ -1045,9 +1111,22 @@ rl_vi_char_search (count, key)
else
{
if (vi_redoing)
+#if defined (HANDLE_MULTIBYTE)
+ target = _rl_vi_last_search_mbchar;
+#else
target = _rl_vi_last_search_char;
+#endif
else
- _rl_vi_last_search_char = target = rl_getc (rl_instream);
+ {
+#if defined (HANDLE_MULTIBYTE)
+ mb_len = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
+ target = _rl_vi_last_search_mbchar;
+#else
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ _rl_vi_last_search_char = target = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+#endif
+ }
switch (key)
{
@@ -1069,7 +1148,11 @@ rl_vi_char_search (count, key)
}
}
+#if defined (HANDLE_MULTIBYTE)
+ return (_rl_char_search_internal (count, dir, target, mb_len));
+#else
return (_rl_char_search_internal (count, dir, target));
+#endif
}
/* Match brackets */
@@ -1077,19 +1160,30 @@ int
rl_vi_match (ignore, key)
int ignore __attribute__((unused)), key;
{
- int count = 1, brack, pos;
+ int count = 1, brack, pos, tmp, pre;
pos = rl_point;
if ((brack = rl_vi_bracktype (rl_line_buffer[rl_point])) == 0)
{
- while ((brack = rl_vi_bracktype (rl_line_buffer[rl_point])) == 0 &&
- rl_point < rl_end - 1)
- rl_forward (1, key);
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ while ((brack = rl_vi_bracktype (rl_line_buffer[rl_point])) == 0)
+ {
+ pre = rl_point;
+ rl_forward_char (1, key);
+ if (pre == rl_point)
+ break;
+ }
+ }
+ else
+ while ((brack = rl_vi_bracktype (rl_line_buffer[rl_point])) == 0 &&
+ rl_point < rl_end - 1)
+ rl_forward_char (1, key);
if (brack <= 0)
{
rl_point = pos;
- ding ();
+ rl_ding ();
return -1;
}
}
@@ -1100,7 +1194,16 @@ rl_vi_match (ignore, key)
{
while (count)
{
- if (--pos >= 0)
+ tmp = pos;
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ pos--;
+ else
+ {
+ pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
+ if (tmp == pos)
+ pos--;
+ }
+ if (pos >= 0)
{
int b = rl_vi_bracktype (rl_line_buffer[pos]);
if (b == -brack)
@@ -1110,7 +1213,7 @@ rl_vi_match (ignore, key)
}
else
{
- ding ();
+ rl_ding ();
return -1;
}
}
@@ -1119,7 +1222,12 @@ rl_vi_match (ignore, key)
{ /* brack > 0 */
while (count)
{
- if (++pos < rl_end)
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ pos++;
+ else
+ pos = _rl_find_next_mbchar (rl_line_buffer, pos, 1, MB_FIND_ANY);
+
+ if (pos < rl_end)
{
int b = rl_vi_bracktype (rl_line_buffer[pos]);
if (b == -brack)
@@ -1129,7 +1237,7 @@ rl_vi_match (ignore, key)
}
else
{
- ding ();
+ rl_ding ();
return -1;
}
}
@@ -1154,6 +1262,11 @@ rl_vi_bracktype (c)
}
}
+/* XXX - think about reading an entire mbchar with _rl_read_mbchar and
+ inserting it in one bunch instead of the loop below (like in
+ rl_vi_char_search or _rl_vi_change_mbchar_case. Set c to mbchar[0]
+ for test against 033 or ^C. Make sure that _rl_read_mbchar does
+ this right. */
int
rl_vi_change_char (count, key)
int count, key __attribute__((unused));
@@ -1163,7 +1276,11 @@ rl_vi_change_char (count, key)
if (vi_redoing)
c = _rl_vi_last_replacement;
else
- _rl_vi_last_replacement = c = rl_getc (rl_instream);
+ {
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ _rl_vi_last_replacement = c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ }
if (c == '\033' || c == CTRL ('C'))
return -1;
@@ -1173,9 +1290,19 @@ rl_vi_change_char (count, key)
rl_begin_undo_group ();
rl_delete (1, c);
- rl_insert (1, c);
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ while (_rl_insert_char (1, c))
+ {
+ RL_SETSTATE (RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE (RL_STATE_MOREINPUT);
+ }
+ else
+#endif
+ _rl_insert_char (1, c);
if (count == 0)
- rl_backward (1, c);
+ rl_backward_char (1, c);
rl_end_undo_group ();
}
@@ -1186,66 +1313,29 @@ int
rl_vi_subst (count, key)
int count, key;
{
- rl_begin_undo_group ();
-
- if (_rl_uppercase_p (key))
- {
- rl_beg_of_line (1, key);
- rl_kill_line (1, key);
- }
- else
- rl_delete_text (rl_point, rl_point+count);
-
- rl_end_undo_group ();
-
- _rl_vi_set_last (key, count, rl_arg_sign);
-
- if (vi_redoing)
- {
- int o = _rl_doing_an_undo;
-
- _rl_doing_an_undo = 1;
- if (vi_insert_buffer && *vi_insert_buffer)
- rl_insert_text (vi_insert_buffer);
- _rl_doing_an_undo = o;
- }
- else
- {
- rl_begin_undo_group ();
- _rl_vi_doing_insert = 1;
- rl_vi_insertion_mode (1, key);
- }
+ /* If we are redoing, rl_vi_change_to will stuff the last motion char */
+ if (vi_redoing == 0)
+ rl_stuff_char ((key == 'S') ? 'c' : ' '); /* `S' == `cc', `s' == `c ' */
- return (0);
+ return (rl_vi_change_to (count, 'c'));
}
int
rl_vi_overstrike (count, key)
int count, key;
{
- int i;
-
if (_rl_vi_doing_insert == 0)
{
_rl_vi_doing_insert = 1;
rl_begin_undo_group ();
}
- for (i = 0; i < count; i++)
+ if (count > 0)
{
- vi_replace_count++;
- rl_begin_undo_group ();
-
- if (rl_point < rl_end)
- {
- rl_delete (1, key);
- rl_insert (1, key);
- }
- else
- rl_insert (1, key);
-
- rl_end_undo_group ();
+ _rl_overwrite_char (count, key);
+ vi_replace_count += count;
}
+
return (0);
}
@@ -1259,7 +1349,7 @@ rl_vi_overstrike_delete (count, key)
{
if (vi_replace_count == 0)
{
- ding ();
+ rl_ding ();
break;
}
s = rl_point;
@@ -1268,7 +1358,7 @@ rl_vi_overstrike_delete (count, key)
vi_replace_count--;
if (rl_point == s)
- rl_backward (1, key);
+ rl_backward_char (1, key);
}
if (vi_replace_count == 0 && _rl_vi_doing_insert)
@@ -1329,7 +1419,7 @@ rl_vi_possible_completions()
}
else if (rl_line_buffer[rl_point - 1] == ';')
{
- ding ();
+ rl_ding ();
return (0);
}
@@ -1347,10 +1437,13 @@ rl_vi_set_mark (count, key)
{
int ch;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
- if (_rl_lowercase_p (ch) == 0)
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (ch < 'a' || ch > 'z')
{
- ding ();
+ rl_ding ();
return -1;
}
ch -= 'a';
@@ -1364,22 +1457,25 @@ rl_vi_goto_mark (count, key)
{
int ch;
+ RL_SETSTATE(RL_STATE_MOREINPUT);
ch = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
if (ch == '`')
{
rl_point = rl_mark;
return 0;
}
- else if (_rl_lowercase_p (ch) == 0)
+ else if (ch < 'a' || ch > 'z')
{
- ding ();
+ rl_ding ();
return -1;
}
ch -= 'a';
if (vi_mark_chars[ch] == -1)
{
- ding ();
+ rl_ding ();
return -1;
}
rl_point = vi_mark_chars[ch];
diff --git a/readline/xmalloc.c b/readline/xmalloc.c
index 4160651191b..8985d340d39 100644
--- a/readline/xmalloc.c
+++ b/readline/xmalloc.c
@@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 1, or (at your option) any
+ Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@@ -17,7 +17,8 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
- Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
@@ -31,7 +32,7 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
-static void memory_error_and_abort ();
+#include "xmalloc.h"
/* **************************************************************** */
/* */
@@ -39,48 +40,48 @@ static void memory_error_and_abort ();
/* */
/* **************************************************************** */
+static void
+memory_error_and_abort (fname)
+ char *fname;
+{
+ fprintf (stderr, "%s: out of virtual memory\n", fname);
+ exit (2);
+}
+
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
-char *
+PTR_T
xmalloc (bytes)
- int bytes;
+ size_t bytes;
{
- char *temp;
+ PTR_T temp;
- temp = (char *)malloc (bytes);
+ temp = malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xmalloc");
return (temp);
}
-char *
+PTR_T
xrealloc (pointer, bytes)
- char *pointer;
- int bytes;
+ PTR_T pointer;
+ size_t bytes;
{
- char *temp;
+ PTR_T temp;
- temp = pointer ? (char *)realloc (pointer, bytes) : (char *)malloc (bytes);
+ temp = pointer ? realloc (pointer, bytes) : malloc (bytes);
if (temp == 0)
memory_error_and_abort ("xrealloc");
return (temp);
}
-static void
-memory_error_and_abort (fname)
- char *fname;
-{
- fprintf (stderr, "%s: out of virtual memory\n", fname);
- exit (2);
-}
-
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
- char *string;
+ PTR_T string;
{
if (string)
free (string);
diff --git a/readline/xmalloc.h b/readline/xmalloc.h
new file mode 100644
index 00000000000..9cb08ba21f1
--- /dev/null
+++ b/readline/xmalloc.h
@@ -0,0 +1,46 @@
+/* xmalloc.h -- memory allocation that aborts on errors. */
+
+/* Copyright (C) 1999 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 2, 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,
+ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+
+#if !defined (_XMALLOC_H_)
+#define _XMALLOC_H_
+
+#if defined (READLINE_LIBRARY)
+# include "rlstdc.h"
+#else
+# include <readline/rlstdc.h>
+#endif
+
+#ifndef PTR_T
+
+#ifdef __STDC__
+# define PTR_T void *
+#else
+# define PTR_T char *
+#endif
+
+#endif /* !PTR_T */
+
+extern PTR_T xmalloc PARAMS((size_t));
+extern PTR_T xrealloc PARAMS((void *, size_t));
+extern void xfree PARAMS((void *));
+
+#endif /* _XMALLOC_H_ */