readline:

2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>

        * Import of readline 4.1.

        Locally modified files: Makefile.in, configure.in, configure
        (regenerated), config.h.in (regenerated), readline.h, rltty.c,
 	shell.c signals.c.

        Locally added files: acconfig.h, config/*, config.h.bot,
        cross-build/*, doc/inc-hit.texinfo.

        New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
examples:
2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>

        * Import of readline 4.1.

        New files: excallback.c, rlfe.c.
doc:
2000-07-09  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>

        * Import of readline 4.1.

        Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
        inclusion in the gdb manual.

        New file: rluserman.texinfo
This commit is contained in:
Elena Zannoni 2000-07-09 17:20:00 +00:00
parent d0352a18a5
commit 1b17e76665
92 changed files with 3656 additions and 26798 deletions

View File

@ -214,3 +214,126 @@ Makefile.in,{doc,examples,shlib}/Makefile.in
- set SHELL from @MAKE_SHELL@
[readline-4.0 released]
3/11
----
doc/Makefile.in
- removed references to HTMLTOC, since separate HTML table-of-contents
files are no longer created
examples/Makefile.in
- remove `*.exe' in clean target for MS-DOS
Makefile.in
- make `readline' target depend on ./libreadline.a
- configure now substitutes TERMCAP_LIB into Makefile.in
- use ${TERMCAP_LIB} instead of -ltermcap in recipe for `readline'
- clean target now removes readline and readline.exe in case they
get built
configure.in
- use `pwd.exe' to set BUILD_DIR on MS-DOS DJGPP
3/15
----
support/shlib-install
- Irix 5.x and Irix 6.x should install shared libraries like Solaris 2
- changes for installing on hp-ux 1[01].x
3/23
----
configure.in
- make sure that the $CC argument to shobj-conf is quoted
4/8
---
xmalloc.h, rlprivate.h, rlshell.h
- new files
Makefile.in,shlib/Makefile.in
- add dependencies on xmalloc.h, rlshell.h
- add xmalloc.h, rlprivate.h, rlshell.h to list of header files
MANIFEST
- add xmalloc.h, rlprivate.h, rlshell.h
4/9
---
Makefile.in,shlib/Makefile.in
- add dependencies on rlprivate.h
4/13
----
doc/Makefile.in
- add variable, PSDVI, which is the desired resolution of the
generated postscript files. Set to 300 because I don't have
any 600-dpi printers
- set LANGUAGE= before calling makeinfo, so messages are in English
- add rluserman.{info,dvi,ps,html} to appropriate variables
- add rules to create rluserman.{info,dvi,ps,html}
- install and uninstall rluserman.info, but don't update the directory
file in $(infodir) yet
MANIFEST
- add doc/rluserman.{texinfo,info,dvi,ps,html}
4/30
----
configure.in
- updated library version to 4.1
5/3
---
configure.in
- SHLIB_MAJOR and SHLIB_MINOR shared library version numbers are
constructed from $LIBRARY_VERSION and substituted into Makefiles
5/5
---
support/shlib-install
- OSF/1 installs shared libraries like Solaris
Makefile.in
- broke the header file install and uninstall into two new targets:
install-headers and uninstall-headers
- install and uninstall depend on install-headers and uninstall-headers
respectively
- changed install-shared and uninstall-shared targets to depend on
install-headers and uninstall-headers, respectively, so users may
choose to install only the shared libraries. I'm not sure about
the uninstall one yet -- maybe it should check whether or not
the static libraries are installed and not remove the header files
if they are
9/3
---
configure.in, config.h.in
- added test for memmove (for later use)
- changed version to 4.1-beta1
9/13
----
examples/rlfe.c
- Per Bothner's `rlfe' readline front-end program
examples/Makefile.in
- added rules to build rlfe
9/21
----
support/shlib-install
- changes to handle FreeBSD-3.x elf or a.out shared libraries, which
have different semantics and need different naming conventions
1/24/2000
---------
doc/Makefile.in
- remove *.bt and *.bts on `make clean'
2/4
---
configure.in
- changed LIBVERSION to 4.1-beta5

View File

@ -1,3 +1,111 @@
This document details the changes between this version, readline-4.1,
and the previous version, readline-4.0.
1. Changes to Readline
a. Changed the HTML documents so that the table-of-contents is no longer
a separate file.
b. Changes to the shared object configuration for: Irix 5.x, Irix 6.x,
OSF/1.
c. The shared library major and minor versions are now constructed
automatically by configure and substituted into the makefiles.
d. It's now possible to install the shared libraries separately from the
static libraries.
e. The history library tries to truncate the history file only if it is a
regular file.
f. A bug that caused _rl_dispatch to address negative array indices on
systems with signed chars was fixed.
g. rl-yank-nth-arg now leaves the history position the same as when it was
called.
h. Changes to the completion code to handle MS-DOS drive-letter:pathname
filenames.
i. Completion is now case-insensitive by default on MS-DOS.
j. Fixes to the history file manipulation code for MS-DOS.
k. Readline attempts to bind the arrow keys to appropriate defaults on MS-DOS.
l. Some fixes were made to the redisplay code for better operation on MS-DOS.
m. The quoted-insert code will now insert tty special chars like ^C.
n. A bug was fixed that caused the display code to reference memory before
the start of the prompt string.
o. More support for __EMX__ (OS/2).
p. A bug was fixed in readline's signal handling that could cause infinite
recursion in signal handlers.
q. A bug was fixed that caused the point to be less than zero when rl_forward
was given a very large numeric argument.
r. The vi-mode code now gets characters via the application-settable value
of rl_getc_function rather than calling rl_getc directly.
s. The history file code now uses O_BINARY mode when reading and writing
the history file on cygwin32.
t. Fixed a bug in the redisplay code for lines with more than 256 line
breaks.
u. A bug was fixed which caused invisible character markers to not be
stripped from the prompt string if the terminal was in no-echo mode.
v. Readline no longer tries to get the variables it needs for redisplay
from the termcap entry if the calling application has specified its
own redisplay function. Readline treats the terminal as `dumb' in
this case.
w. Fixes to the SIGWINCH code so that a multiple-line prompt with escape
sequences is redrawn correctly.
x. Changes to the install and install-shared targets so that the libraries
and header files are installed separately.
2. New Features in Readline
a. A new Readline `user manual' is in doc/rluserman.texinfo.
b. Parentheses matching is now always compiled into readline, and enabled
or disabled when the value of the `blink-matching-paren' variable is
changed.
c. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
d. MS-DOS systems now use ~/_history as the default history file.
e. history-search-{forward,backward} now leave the point at the end of the
line when the string to search for is empty, like
{reverse,forward}-search-history.
f. history-search-{forward,backward} now leave the last history line found
in the readline buffer if the second or subsequent search fails.
g. New function for use by applications: rl_on_new_line_with_prompt, used
when an application displays the prompt itself before calling readline().
h. New variable for use by applications: rl_already_prompted. An application
that displays the prompt itself before calling readline() must set this to
a non-zero value.
i. A new variable, rl_gnu_readline_p, always 1. The intent is that an
application can verify whether or not it is linked with the `real'
readline library or some substitute.
j. Per Bothner's `rlfe' (pronounced `Ralphie') readline front-end program
is included in the examples subdirectory, though it is not built
by default.
-------------------------------------------------------------------------------
This document details the changes between this version, readline-4.0,
and the previous version, readline-2.2.

View File

@ -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.

View File

@ -1,3 +1,16 @@
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Locally modified files: Makefile.in, configure.in, configure
(regenerated), config.h.in (regenerated), readline.h, rltty.c,
shell.c signals.c.
Locally added files: acconfig.h, config/*, config.h.bot,
cross-build/*, doc/inc-hit.texinfo.
New files: USAGE, rlprivate.h, rlshell.h, xmalloc.h.
2000-03-16 Eli Zaretskii <eliz@is.elta.co.il>
* support/shobj-conf: Shared libs are unsupported on MSDOS.

View File

@ -11,8 +11,8 @@ MANIFEST f
INSTALL f
CHANGELOG f
CHANGES f
USAGE f
aclocal.m4 f
acconfig.h f
config.h.in f
configure f
configure.in f
@ -28,11 +28,14 @@ posixstat.h f
readline.h f
rlconf.h f
rldefs.h f
rlprivate.h f
rlshell.h f
rlstdc.h f
rltty.h f
rlwinsize.h f
tcap.h f
tilde.h f
xmalloc.h f
bind.c f
complete.c f
display.c f
@ -77,6 +80,7 @@ doc/manvers.texinfo f
doc/rlman.texinfo f
doc/rltech.texinfo f
doc/rluser.texinfo f
doc/rluserman.texinfo f
doc/hist.texinfo f
doc/hstech.texinfo f
doc/hsuser.texinfo f
@ -84,8 +88,10 @@ doc/readline.3 f
doc/texi2dvi f
doc/texi2html f
examples/Makefile.in f
examples/excallback.c f
examples/fileman.c f
examples/manexamp.c f
examples/rlfe.c f
examples/rltest.c f
examples/rl.c f
examples/rlversion.c f
@ -94,10 +100,14 @@ examples/Inputrc f
# formatted documentation, from MANIFEST.doc
doc/readline.ps f
doc/history.ps f
doc/rluserman.ps f
doc/readline.dvi f
doc/history.dvi f
doc/rluserman.dvi f
doc/readline.info f
doc/history.info f
doc/rluserman.info f
doc/readline.html f
doc/history.html f
doc/rluserman.html f
doc/readline.0 f

View File

@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
RL_LIBRARY_VERSION = @LIBVERSION@
RL_LIBRARY_NAME = readline
@ -60,6 +60,8 @@ CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
TERMCAP_LIB = @TERMCAP_LIB@
# For libraries which include headers from other libraries.
INCLUDES = -I. -I$(srcdir) -I$(includedir)
@ -88,7 +90,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
ansi_stdlib.h tcap.h rlstdc.h
ansi_stdlib.h tcap.h rlstdc.h xmalloc.h rlprivate.h rlshell.h
HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o
TILDEOBJ = tilde.o
@ -115,6 +117,8 @@ INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \
all: static
everything: static shared examples
static: $(STATIC_LIBS)
libreadline.a: $(OBJECTS)
@ -127,8 +131,8 @@ libhistory.a: $(HISTOBJ) xmalloc.o
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
readline: $(OBJECTS) readline.h rldefs.h chardefs.h
$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap
readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
$(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
Makefile makefile: config.status $(srcdir)/Makefile.in
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
@ -147,9 +151,8 @@ stamp-h: config.status $(srcdir)/config.h.in
CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
echo > $@
# CYGNUS LOCAL: Never run autoconf.
#$(srcdir)/configure: $(srcdir)/configure.in Comment-me-out in distribution
# cd $(srcdir) && autoconf Comment-me-out in distribution
#$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution
# cd $(srcdir) && autoconf ## Comment-me-out in distribution
shared: force
-test -d shlib || mkdir shlib
@ -165,6 +168,17 @@ examples: force
force:
install-headers: installdirs ${INSTALLED_HEADERS}
for f in ${INSTALLED_HEADERS}; do \
$(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
done
uninstall-headers:
-test -n "$(includedir)" && cd $(includedir)/readline && \
${RM} ${INSTALLED_HEADERS}
maybe-uninstall-headers: uninstall-headers
## CYGNUS LOCAL
## Don't mess with people's installed readline's.
## This tries to install this version of readline over whatever
@ -175,14 +189,11 @@ force:
install:
#install: installdirs $(STATIC_LIBS)
# for f in ${INSTALLED_HEADERS}; do \
# $(INSTALL_DATA) $(srcdir)/$$f $(includedir)/readline ; \
# done
# -( if test -f $(libdir)/libreadline.a ; then $(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old; fi )
#install: installdirs $(STATIC_LIBS) install-headers
# -$(MV) $(libdir)/libreadline.a $(libdir)/libreadline.old
# $(INSTALL_DATA) libreadline.a $(libdir)/libreadline.a
# -test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libreadline.a
# -( if test -f $(libdir)/libhistory.a; then $(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old; fi )
# -$(MV) $(libdir)/libhistory.a $(libdir)/libhistory.old
# $(INSTALL_DATA) libhistory.a $(libdir)/libhistory.a
# -test -n "$(RANLIB)" && $(RANLIB) -t $(libdir)/libhistory.a
# -( if test -d doc ; then \
@ -194,16 +205,14 @@ installdirs: $(srcdir)/support/mkdirs
-$(SHELL) $(srcdir)/support/mkdirs $(includedir) \
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
uninstall:
-test -n "$(includedir)" && cd $(includedir)/readline && \
${RM} ${INSTALLED_HEADERS}
uninstall: uninstall-headers
-test -n "$(libdir)" && cd $(libdir) && \
${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS)
install-shared: installdirs shared
install-shared: installdirs install-headers shared
-( cd shlib ; ${MAKE} ${MFLAGS} install )
uninstall-shared:
uninstall-shared: maybe-uninstall-headers
-( cd shlib; ${MAKE} ${MFLAGS} uninstall )
TAGS: force
@ -214,6 +223,7 @@ tags: force
clean: force
$(RM) $(OBJECTS) $(STATIC_LIBS)
$(RM) readline readline.exe
-( cd shlib && $(MAKE) $(MFLAGS) $@ )
-( cd doc && $(MAKE) $(MFLAGS) $@ )
-( cd examples && $(MAKE) $(MFLAGS) $@ )
@ -241,7 +251,7 @@ installcheck:
dist: force
@echo Readline distributions are created using $(srcdir)/support/mkdist.
@echo Here is a sample of the necessary commands:
@echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION)
@echo bash $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r $(RL_LIBRARY_NAME) $(RL_LIBRARY_VERSION)
@echo tar cf $(RL_LIBRARY_NAME)-${RL_LIBRARY_VERSION}.tar ${RL_LIBRARY_NAME}-$(RL_LIBRARY_VERSION)
@echo gzip $(RL_LIBRARY_NAME)-$(RL_LIBRARY_VERSION).tar
@ -300,6 +310,8 @@ macro.o: readline.h keymaps.h chardefs.h tilde.h
macro.o: history.h rlstdc.h
nls.o: ansi_stdlib.h
nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
nls.o: readline.h keymaps.h chardefs.h tilde.h
nls.o: history.h rlstdc.h
parens.o: rlconf.h
parens.o: ${BUILD_DIR}/config.h
parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h
@ -338,6 +350,54 @@ vi_mode.o: history.h ansi_stdlib.h rlstdc.h
xmalloc.o: ${BUILD_DIR}/config.h
xmalloc.o: ansi_stdlib.h
bind.o: rlshell.h
histfile.o: rlshell.h
nls.o: rlshell.h
readline.o: rlshell.h
shell.o: rlshell.h
terminal.o: rlshell.h
histexpand.o: rlshell.h
bind.o: rlprivate.h
callback.o: rlprivate.h
complete.o: rlprivate.h
display.o: rlprivate.h
input.o: rlprivate.h
isearch.o: rlprivate.h
kill.o: rlprivate.h
macro.o: rlprivate.h
nls.o: rlprivate.h
parens.o: rlprivate.h
readline.o: rlprivate.h
rltty.o: rlprivate.h
search.o: rlprivate.h
signals.o: rlprivate.h
terminal.o: rlprivate.h
undo.o: rlprivate.h
util.o: rlprivate.h
vi_mode.o: rlprivate.h
bind.o: xmalloc.h
complete.o: xmalloc.h
display.o: xmalloc.h
funmap.o: xmalloc.h
histexpand.o: xmalloc.h
histfile.o: xmalloc.h
history.o: xmalloc.h
input.o: xmalloc.h
isearch.o: xmalloc.h
keymaps.o: xmalloc.h
kill.o: xmalloc.h
macro.o: xmalloc.h
readline.o: xmalloc.h
savestring.o: xmalloc.h
search.o: xmalloc.h
shell.o: xmalloc.h
tilde.o: xmalloc.h
tilde.o: xmalloc.h
util.o: xmalloc.h
vi_mode.o: xmalloc.h
readline.o: $(srcdir)/readline.c
vi_mode.o: $(srcdir)/vi_mode.c
funmap.o: $(srcdir)/funmap.c

View File

@ -1,7 +1,7 @@
Introduction
============
This is the Gnu Readline library, version 4.0.
This is the Gnu Readline library, version 4.1.
The Readline library provides a set of functions for use by applications
that allow users to edit command lines as they are typed in. Both

176
readline/aclocal.m4 vendored
View File

@ -316,13 +316,19 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
main()
{
DIR *dir;
int fd;
unlink("/tmp/not_a_directory");
fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666);
int fd, err;
err = mkdir("/tmp/bash-aclocal", 0700);
if (err < 0) {
perror("mkdir");
exit(1);
}
unlink("/tmp/bash-aclocal/not_a_directory");
fd = open("/tmp/bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
write(fd, "\n", 1);
close(fd);
dir = opendir("/tmp/not_a_directory");
unlink("/tmp/not_a_directory");
dir = opendir("/tmp/bash-aclocal/not_a_directory");
unlink("/tmp/bash-aclocal/not_a_directory");
rmdir("/tmp/bash-aclocal");
exit (dir == 0);
}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
[AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
@ -354,25 +360,59 @@ AC_DEFINE(VOID_SIGHANDLER)
fi
])
AC_DEFUN(BASH_TYPE_INT32_T,
dnl
dnl A signed 16-bit integer quantity
dnl
AC_DEFUN(BASH_TYPE_BITS16_T,
[
if test "$ac_cv_sizeof_int" = 4; then
AC_CHECK_TYPE(int32_t, int)
elif test "$ac_cv_sizeof_long" = 4; then
AC_CHECK_TYPE(int32_t, long)
if test "$ac_cv_sizeof_short" = 2; then
AC_CHECK_TYPE(bits16_t, short)
elif test "$ac_cv_sizeof_char" = 2; then
AC_CHECK_TYPE(bits16_t, char)
else
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(bits16_t, short)
fi
])
AC_DEFUN(BASH_TYPE_U_INT32_T,
dnl
dnl An unsigned 16-bit integer quantity
dnl
AC_DEFUN(BASH_TYPE_U_BITS16_T,
[
if test "$ac_cv_sizeof_short" = 2; then
AC_CHECK_TYPE(u_bits16_t, unsigned short)
elif test "$ac_cv_sizeof_char" = 2; then
AC_CHECK_TYPE(u_bits16_t, unsigned char)
else
AC_CHECK_TYPE(u_bits16_t, unsigned short)
fi
])
dnl
dnl A signed 32-bit integer quantity
dnl
AC_DEFUN(BASH_TYPE_BITS32_T,
[
if test "$ac_cv_sizeof_int" = 4; then
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(bits32_t, int)
elif test "$ac_cv_sizeof_long" = 4; then
AC_CHECK_TYPE(u_int32_t, unsigned long)
AC_CHECK_TYPE(bits32_t, long)
else
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_CHECK_TYPE(bits32_t, int)
fi
])
dnl
dnl An unsigned 32-bit integer quantity
dnl
AC_DEFUN(BASH_TYPE_U_BITS32_T,
[
if test "$ac_cv_sizeof_int" = 4; then
AC_CHECK_TYPE(u_bits32_t, unsigned int)
elif test "$ac_cv_sizeof_long" = 4; then
AC_CHECK_TYPE(u_bits32_t, unsigned long)
else
AC_CHECK_TYPE(u_bits32_t, unsigned int)
fi
])
@ -387,6 +427,9 @@ else
fi
])
dnl
dnl A signed 64-bit quantity
dnl
AC_DEFUN(BASH_TYPE_BITS64_T,
[
if test "$ac_sv_sizeof_char_p" = 8; then
@ -427,6 +470,20 @@ if test $bash_cv_func_lstat = yes; then
fi
])
AC_DEFUN(BASH_FUNC_INET_ATON,
[
AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
[AC_TRY_LINK([
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
if test $bash_cv_func_inet_aton = yes; then
AC_DEFINE(HAVE_INET_ATON)
fi
])
AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
[AC_MSG_CHECKING([for a c_line member of struct termios])
AC_CACHE_VAL(bash_cv_termios_ldisc,
@ -845,7 +902,7 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
/* Add more tests in here as appropriate. */
main()
{
int fd;
int fd, err;
#if defined (HAVE_MKFIFO)
exit (0);
@ -858,12 +915,19 @@ exit (1);
#if defined (NeXT)
exit (1);
#endif
fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0);
if (fd == -1)
err = mkdir("/tmp/bash-aclocal", 0700);
if (err < 0) {
perror ("mkdir");
exit(1);
}
fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
if (fd == -1) {
rmdir ("/tmp/bash-aclocal");
exit (1);
}
close(fd);
unlink ("/tmp/sh-np-autoconf");
unlink ("/tmp/bash-aclocal/sh-np-autoconf");
rmdir ("/tmp/bash-aclocal");
exit(0);
}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
[AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
@ -1037,12 +1101,32 @@ elif test $bash_cv_dev_fd = "whacky"; then
fi
])
AC_DEFUN(BASH_CHECK_DEV_STDIN,
[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
AC_CACHE_VAL(bash_cv_dev_stdin,
[if test -d /dev/fd && test -r /dev/stdin; then
bash_cv_dev_stdin=present
elif test -d /proc/self/fd && test -r /dev/stdin; then
bash_cv_dev_stdin=present
else
bash_cv_dev_stdin=absent
fi
])
AC_MSG_RESULT($bash_cv_dev_stdin)
if test $bash_cv_dev_stdin = "present"; then
AC_DEFINE(HAVE_DEV_STDIN)
fi
])
dnl
dnl Check for the presence of getpeername (the only networking function
dnl bash currently requires) in libsocket. If libsocket is present,
dnl check for libnsl and add it to LIBS if it's there, since most
dnl systems with libsocket require linking with libnsl as well.
dnl This should only be called if getpeername was not found in libc.
dnl Check for the presence of getpeername in libsocket.
dnl If libsocket is present, check for libnsl and add it to LIBS if
dnl it's there, since most systems with libsocket require linking
dnl with libnsl as well. This should only be called if getpeername
dnl was not found in libc.
dnl
dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
dnl AS WELL
dnl
AC_DEFUN(BASH_CHECK_SOCKLIB,
[
@ -1084,6 +1168,32 @@ if test $bash_cv_have_socklib = yes; then
fi
])
dnl
dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
dnl system, we can't use AC_PREREQ
dnl
AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
[if test "X$bash_cv_have_gethostbyname" = "X"; then
_bash_needmsg=yes
else
AC_MSG_CHECKING(for gethostbyname in socket library)
_bash_needmsg=
fi
AC_CACHE_VAL(bash_cv_have_gethostbyname,
[AC_TRY_LINK([#include <netdb.h>],
[ struct hostent *hp;
hp = gethostbyname("localhost");
], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
)
if test "X$_bash_needmsg" = Xyes; then
AC_MSG_CHECKING(for gethostbyname in socket library)
fi
AC_MSG_RESULT($bash_cv_have_gethostbyname)
if test "$bash_cv_have_gethostbyname" = yes; then
AC_DEFINE(HAVE_GETHOSTBYNAME)
fi
])
AC_DEFUN(BASH_DEFAULT_MAIL_DIR,
[AC_MSG_CHECKING(for default mail directory)
AC_CACHE_VAL(bash_cv_mail_dir,
@ -1299,3 +1409,19 @@ switch (0) case 0: case (sizeof (off_t) <= 4):;
if test $bash_cv_off_t_64 = yes; then
AC_DEFINE(HAVE_OFF_T_64)
fi])
AC_DEFUN(BASH_STRUCT_TIMEVAL,
[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
AC_CACHE_VAL(bash_cv_struct_timeval,
[
AC_EGREP_HEADER(struct timeval, sys/time.h,
bash_cv_struct_timeval=yes,
AC_EGREP_HEADER(struct timeval, time.h,
bash_cv_struct_timeval=yes,
bash_cv_struct_timeval=no))
])
AC_MSG_RESULT($bash_cv_struct_timeval)
if test $bash_cv_struct_timeval = yes; then
AC_DEFINE(HAVE_TIMEVAL)
fi
])

View File

@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_STDLIB_H_)
#define _STDLIB_H_ 1

View File

@ -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,65 +57,25 @@ extern int errno;
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#ifndef O_BINARY
# define O_BINARY 0
#endif
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_bell_preference;
extern int _rl_meta_flag;
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_complete_show_all;
extern int _rl_complete_mark_directories;
extern int _rl_print_completions_horizontally;
extern int _rl_completion_case_fold;
extern int _rl_enable_keypad;
#if defined (PAREN_MATCHING)
extern int rl_blink_matching_paren;
#endif /* PAREN_MATCHING */
#if defined (VISIBLE_STATS)
extern int rl_visible_stats;
#endif /* VISIBLE_STATS */
extern int rl_complete_with_tilde_expansion;
extern int rl_completion_query_items;
extern int rl_inhibit_completion;
extern char *_rl_comment_begin;
extern unsigned char *_rl_isearch_terminators;
extern int rl_explicit_arg;
extern int rl_editing_mode;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
extern char *possible_control_prefixes[], *possible_meta_prefixes[];
/* Functions imported from funmap.c */
extern char **rl_funmap_names ();
extern int rl_add_funmap_entry ();
/* Functions imported from util.c */
extern char *_rl_strindex ();
/* Functions imported from shell.c */
extern char *get_env_value ();
/* Variables exported by this file. */
Keymap rl_binding_keymap;
/* Forward declarations */
void rl_set_keymap_from_edit_mode ();
static int _rl_read_init_file __P((char *, int));
static int glean_key_from_name __P((char *));
static int substring_member_of_array __P((char *, char **));
static int _rl_read_init_file ();
static int glean_key_from_name ();
static int substring_member_of_array ();
static int currently_reading_init_file;
extern char *xmalloc (), *xrealloc ();
/* used only in this file */
static int _rl_prefer_visible_bell = 1;
/* **************************************************************** */
/* */
@ -650,7 +609,7 @@ _rl_read_file (filename, sizep)
char *buffer;
int i, file;
if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY | O_BINARY, 0666)) < 0)
if ((stat (filename, &finfo) < 0) || (file = open (filename, O_RDONLY, 0666)) < 0)
return ((char *)NULL);
file_size = (size_t)finfo.st_size;
@ -671,7 +630,7 @@ _rl_read_file (filename, sizep)
i = read (file, buffer, file_size);
close (file);
#if 1
#if 0
if (i < file_size)
#else
if (i < 0)
@ -681,33 +640,16 @@ _rl_read_file (filename, sizep)
return ((char *)NULL);
}
#if 0
buffer[file_size] = '\0';
#if O_BINARY
{
/* Systems which distinguish between text and binary files need
to strip the CR characters before each Newline, otherwise the
parsing functions won't work. */
char *s, *d;
size_t removed = 0;
for (s = buffer, d = buffer; s < buffer + file_size; s++)
{
if (removed)
*d = *s;
if (*s != '\r' || s[1] != '\n')
d++;
else
removed++;
}
file_size -= removed;
buffer[file_size] = '\0';
}
#endif
if (sizep)
*sizep = file_size;
#else
buffer[i] = '\0';
if (sizep)
*sizep = i;
#endif
return (buffer);
}
@ -727,7 +669,6 @@ rl_re_read_init_file (count, ignore)
1. the filename used for the previous call
2. the value of the shell variable `INPUTRC'
3. ~/.inputrc
4. (for __MSDOS__ only) ~/_inputrc
If the file existed and could be opened and read, 0 is returned,
otherwise errno is returned. */
int
@ -747,20 +688,11 @@ rl_read_init_file (filename)
if (*filename == 0)
filename = DEFAULT_INPUTRC;
#ifdef __MSDOS__
{
/* DOS doesn't allow leading dots in file names. If the original
name fails (it could work if we are on Windows), fall back to
~/_inputrc. */
int retval = _rl_read_init_file (filename, 0);
if (retval == 0)
return retval;
else if (strcmp (filename, "~/.inputrc") == 0)
filename = "~/_inputrc";
}
#if defined (__MSDOS__)
if (_rl_read_init_file (filename, 0) == 0)
return 0;
filename = "~/_inputrc";
#endif
return (_rl_read_init_file (filename, 0));
}
@ -789,6 +721,8 @@ _rl_read_init_file (filename, include_level)
last_readline_init_file = savestring (filename);
}
currently_reading_init_file = 1;
/* Loop over the lines in the file. Lines that start with `#' are
comments; all other lines are commands for readline initialization. */
current_readline_init_lineno = 1;
@ -799,6 +733,12 @@ _rl_read_init_file (filename, include_level)
/* Find the end of this line. */
for (i = 0; line + i != end && line[i] != '\n'; i++);
#if defined (__CYGWIN32__)
/* ``Be liberal in what you accept.'' */
if (line[i] == '\n' && line[i-1] == '\r')
line[i - 1] = '\0';
#endif
/* Mark end of line. */
line[i] = '\0';
@ -819,6 +759,7 @@ _rl_read_init_file (filename, include_level)
}
free (buffer);
currently_reading_init_file = 0;
return (0);
}
@ -826,9 +767,11 @@ static void
_rl_init_file_error (msg)
char *msg;
{
fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
current_readline_init_lineno,
msg);
if (currently_reading_init_file)
fprintf (stderr, "readline: %s: line %d: %s\n", current_readline_init_file,
current_readline_init_lineno, msg);
else
fprintf (stderr, "readline: %s\n", msg);
}
/* **************************************************************** */
@ -1275,154 +1218,273 @@ rl_parse_and_bind (string)
have one of two values; either "On" or 1 for truth, or "Off" or 0 for
false. */
#define V_SPECIAL 0x1
static struct {
char *name;
int *value;
int flags;
} boolean_varlist [] = {
#if defined (PAREN_MATCHING)
{ "blink-matching-paren", &rl_blink_matching_paren },
#endif
{ "completion-ignore-case", &_rl_completion_case_fold },
{ "convert-meta", &_rl_convert_meta_chars_to_ascii },
{ "disable-completion", &rl_inhibit_completion },
{ "enable-keypad", &_rl_enable_keypad },
{ "expand-tilde", &rl_complete_with_tilde_expansion },
{ "horizontal-scroll-mode", &_rl_horizontal_scroll_mode },
{ "input-meta", &_rl_meta_flag },
{ "mark-directories", &_rl_complete_mark_directories },
{ "mark-modified-lines", &_rl_mark_modified_lines },
{ "meta-flag", &_rl_meta_flag },
{ "output-meta", &_rl_output_meta_chars },
{ "print-completions-horizontally", &_rl_print_completions_horizontally },
{ "show-all-if-ambiguous", &_rl_complete_show_all },
{ "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
{ "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
{ "disable-completion", &rl_inhibit_completion, 0 },
{ "enable-keypad", &_rl_enable_keypad, 0 },
{ "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
{ "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 },
{ "input-meta", &_rl_meta_flag, 0 },
{ "mark-directories", &_rl_complete_mark_directories, 0 },
{ "mark-modified-lines", &_rl_mark_modified_lines, 0 },
{ "meta-flag", &_rl_meta_flag, 0 },
{ "output-meta", &_rl_output_meta_chars, 0 },
{ "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL },
{ "print-completions-horizontally", &_rl_print_completions_horizontally, 0 },
{ "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
#if defined (VISIBLE_STATS)
{ "visible-stats", &rl_visible_stats },
{ "visible-stats", &rl_visible_stats, 0 },
#endif /* VISIBLE_STATS */
{ (char *)NULL, (int *)NULL }
};
static int
find_boolean_var (name)
char *name;
{
register int i;
for (i = 0; boolean_varlist[i].name; i++)
if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
return i;
return -1;
}
/* Hooks for handling special boolean variables, where a
function needs to be called or another variable needs
to be changed when they're changed. */
static void
hack_special_boolean_var (i)
int i;
{
char *name;
name = boolean_varlist[i].name;
if (_rl_stricmp (name, "blink-matching-paren") == 0)
_rl_enable_paren_matching (rl_blink_matching_paren);
else if (_rl_stricmp (name, "prefer-visible-bell") == 0)
{
if (_rl_prefer_visible_bell)
_rl_bell_preference = VISIBLE_BELL;
else
_rl_bell_preference = AUDIBLE_BELL;
}
}
/* These *must* correspond to the array indices for the appropriate
string variable. (Though they're not used right now.) */
#define V_BELLSTYLE 0
#define V_COMBEGIN 1
#define V_EDITMODE 2
#define V_ISRCHTERM 3
#define V_KEYMAP 4
#define V_STRING 1
#define V_INT 2
/* Forward declarations */
static int sv_bell_style __P((char *));
static int sv_combegin __P((char *));
static int sv_compquery __P((char *));
static int sv_editmode __P((char *));
static int sv_isrchterm __P((char *));
static int sv_keymap __P((char *));
static struct {
char *name;
int flags;
Function *set_func;
} string_varlist[] = {
{ "bell-style", V_STRING, sv_bell_style },
{ "comment-begin", V_STRING, sv_combegin },
{ "completion-query-items", V_INT, sv_compquery },
{ "editing-mode", V_STRING, sv_editmode },
{ "isearch-terminators", V_STRING, sv_isrchterm },
{ "keymap", V_STRING, sv_keymap },
{ (char *)NULL, 0 }
};
static int
find_string_var (name)
char *name;
{
register int i;
for (i = 0; string_varlist[i].name; i++)
if (_rl_stricmp (name, string_varlist[i].name) == 0)
return i;
return -1;
}
/* A boolean value that can appear in a `set variable' command is true if
the value is null or empty, `on' (case-insenstive), or "1". Any other
values result in 0 (false). */
static int
bool_to_int (value)
char *value;
{
return (value == 0 || *value == '\0' ||
(_rl_stricmp (value, "on") == 0) ||
(value[0] == '1' && value[1] == '\0'));
}
int
rl_variable_bind (name, value)
char *name, *value;
{
register int i;
int v;
/* Check for simple variables first. */
for (i = 0; boolean_varlist[i].name; i++)
i = find_boolean_var (name);
if (i >= 0)
{
if (_rl_stricmp (name, boolean_varlist[i].name) == 0)
{
/* A variable is TRUE if the "value" is "on", "1" or "". */
*boolean_varlist[i].value = *value == 0 ||
_rl_stricmp (value, "on") == 0 ||
(value[0] == '1' && value[1] == '\0');
return 0;
}
*boolean_varlist[i].value = bool_to_int (value);
if (boolean_varlist[i].flags & V_SPECIAL)
hack_special_boolean_var (i);
return 0;
}
/* Not a boolean variable, so check for specials. */
i = find_string_var (name);
/* Editing mode change? */
if (_rl_stricmp (name, "editing-mode") == 0)
/* For the time being, unknown variable names or string names without a
handler function are simply ignored. */
if (i < 0 || string_varlist[i].set_func == 0)
return 0;
v = (*string_varlist[i].set_func) (value);
return v;
}
static int
sv_editmode (value)
char *value;
{
if (_rl_strnicmp (value, "vi", 2) == 0)
{
if (_rl_strnicmp (value, "vi", 2) == 0)
{
#if defined (VI_MODE)
_rl_keymap = vi_insertion_keymap;
rl_editing_mode = vi_mode;
_rl_keymap = vi_insertion_keymap;
rl_editing_mode = vi_mode;
#endif /* VI_MODE */
}
else if (_rl_strnicmp (value, "emacs", 5) == 0)
{
_rl_keymap = emacs_standard_keymap;
rl_editing_mode = emacs_mode;
}
return 0;
}
else if (_rl_strnicmp (value, "emacs", 5) == 0)
{
_rl_keymap = emacs_standard_keymap;
rl_editing_mode = emacs_mode;
return 0;
}
return 1;
}
/* Comment string change? */
else if (_rl_stricmp (name, "comment-begin") == 0)
static int
sv_combegin (value)
char *value;
{
if (value && *value)
{
if (*value)
{
if (_rl_comment_begin)
free (_rl_comment_begin);
FREE (_rl_comment_begin);
_rl_comment_begin = savestring (value);
return 0;
}
return 1;
}
_rl_comment_begin = savestring (value);
}
}
else if (_rl_stricmp (name, "completion-query-items") == 0)
{
int nval = 100;
if (*value)
{
nval = atoi (value);
if (nval < 0)
nval = 0;
}
rl_completion_query_items = nval;
}
else if (_rl_stricmp (name, "keymap") == 0)
{
Keymap kmap;
kmap = rl_get_keymap_by_name (value);
if (kmap)
rl_set_keymap (kmap);
}
else if (_rl_stricmp (name, "bell-style") == 0)
{
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;
}
}
else if (_rl_stricmp (name, "prefer-visible-bell") == 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;
}
else if (_rl_stricmp (name, "isearch-terminators") == 0)
{
/* Isolate the value and translate it into a character string. */
int beg, end;
char *v;
static int
sv_compquery (value)
char *value;
{
int nval = 100;
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';
/* The value starts at v + beg. Translate it into a character string. */
_rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
_rl_isearch_terminators[end] = '\0';
free (v);
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
nval = 0;
}
/* For the time being, unknown variable names are simply ignored. */
rl_completion_query_items = nval;
return 0;
}
static int
sv_keymap (value)
char *value;
{
Keymap kmap;
kmap = rl_get_keymap_by_name (value);
if (kmap)
{
rl_set_keymap (kmap);
return 0;
}
return 1;
}
#define _SET_BELL(v) do { _rl_bell_preference = v; return 0; } while (0)
static int
sv_bell_style (value)
char *value;
{
if (value == 0 || *value == '\0')
_SET_BELL (AUDIBLE_BELL);
else if (_rl_stricmp (value, "none") == 0 || _rl_stricmp (value, "off") == 0)
_SET_BELL (NO_BELL);
else if (_rl_stricmp (value, "audible") == 0 || _rl_stricmp (value, "on") == 0)
_SET_BELL (AUDIBLE_BELL);
else if (_rl_stricmp (value, "visible") == 0)
_SET_BELL (VISIBLE_BELL);
else
return 1;
}
#undef _SET_BELL
static int
sv_isrchterm (value)
char *value;
{
int beg, end, delim;
char *v;
if (value == 0)
return 1;
/* Isolate the value and translate it into a character string. */
v = savestring (value);
FREE (_rl_isearch_terminators);
if (v[0] == '"' || v[0] == '\'')
{
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';
/* The value starts at v + beg. Translate it into a character string. */
_rl_isearch_terminators = (unsigned char *)xmalloc (2 * strlen (v) + 1);
rl_translate_keyseq (v + beg, _rl_isearch_terminators, &end);
_rl_isearch_terminators[end] = '\0';
free (v);
return 0;
}
/* Return the character which matches NAME.
For example, `Space' returns ' '. */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -35,15 +35,7 @@
/* System-specific feature definitions and include files. */
#include "rldefs.h"
#include "readline.h"
extern void readline_internal_setup ();
extern char *readline_internal_teardown ();
extern int readline_internal_char ();
extern void _rl_init_line_state ();
extern int _rl_meta_flag;
extern char *rl_prompt;
extern int rl_visible_prompt_length;
#include "rlprivate.h"
/* **************************************************************** */
/* */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _CHARDEFS_H_
#define _CHARDEFS_H_

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -70,20 +70,14 @@ extern struct passwd *getpwent ();
/* Some standard library routines. */
#include "readline.h"
#include "xmalloc.h"
#include "rlprivate.h"
extern char *tilde_expand ();
extern char *rl_copy_text ();
extern void _rl_abort_internal ();
extern int _rl_qsort_string_compare ();
extern void _rl_replace_text ();
extern Function *rl_last_func;
extern int rl_editing_mode;
extern int screenwidth;
extern void _rl_move_vert ();
extern int _rl_vis_botlin;
extern int rl_display_fixed;
#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
#else
typedef int QSFUNC ();
#endif
/* If non-zero, then this is the address of a function to call when
completing a word would normally display the list of possible matches.
@ -95,27 +89,25 @@ extern int rl_display_fixed;
VFunction *rl_completion_display_matches_hook = (VFunction *)NULL;
/* Forward declarations for functions defined and used in this file. */
char *filename_completion_function ();
char **completion_matches ();
char *filename_completion_function __P((char *, int));
char **completion_matches __P((char *, CPFunction *));
#if defined (VISIBLE_STATS)
# if !defined (X_OK)
# define X_OK 1
# endif
static int stat_char ();
static int stat_char __P((char *));
#endif
static char *rl_quote_filename ();
static char *rl_strpbrk ();
static char *rl_quote_filename __P((char *, int, char *));
static char *rl_strpbrk __P((char *, char *));
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 ();
extern char *xmalloc (), *xrealloc ();
static char **remove_duplicate_matches __P((char **));
static void insert_match __P((char *, int, int, char *));
static int append_to_match __P((char *, int, int));
static void insert_all_matches __P((char **, int, char *));
static void display_matches __P((char **));
static int compute_lcd_of_matches __P((char **, int, char *));
/* **************************************************************** */
/* */
@ -136,7 +128,11 @@ int _rl_complete_mark_directories = 1;
int _rl_print_completions_horizontally;
/* Non-zero means that case is not significant in filename completion. */
#if defined (__MSDOS__) && !defined (__DJGPP__)
int _rl_completion_case_fold = 1;
#else
int _rl_completion_case_fold;
#endif
/* Global variables available to applications using readline. */
@ -417,6 +413,10 @@ printable_part (pathname)
char *temp;
temp = rl_filename_completion_desired ? strrchr (pathname, '/') : (char *)NULL;
#if defined (__MSDOS__)
if (rl_filename_completion_desired && temp == 0 && isalpha (pathname[0]) && pathname[1] == ':')
temp = pathname + 1;
#endif
return (temp ? ++temp : pathname);
}
@ -477,7 +477,12 @@ print_filename (to_print, full_pathname)
c = to_print[-1];
to_print[-1] = '\0';
s = tilde_expand (full_pathname);
/* If setting the last slash in full_pathname to a NUL results in
full_pathname being the empty string, we are trying to complete
files in the root directory. If we pass a null string to the
bash directory completion hook, for example, it will expand it
to the current directory. We just want the `/'. */
s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
if (rl_directory_completion_hook)
(*rl_directory_completion_hook) (&s);
@ -627,25 +632,31 @@ find_completion_word (fp, dp)
/* If there is an application-specific function to say whether or not
a character is quoted and we found a quote character, let that
function decide whether or not a character is a word break, even
if it is found in rl_completer_word_break_characters. */
if (rl_char_is_quoted_p)
isbrk = (found_quote == 0 ||
(*rl_char_is_quoted_p) (rl_line_buffer, rl_point) == 0) &&
strchr (rl_completer_word_break_characters, scan) != 0;
else
isbrk = strchr (rl_completer_word_break_characters, scan) != 0;
if (isbrk)
if it is found in rl_completer_word_break_characters. Don't bother
if we're at the end of the line, though. */
if (scan)
{
/* If the character that caused the word break was a quoting
character, then remember it as the delimiter. */
if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, scan) && (end - rl_point) > 1)
delimiter = scan;
if (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 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 (isbrk)
{
/* If the character that caused the word break was a quoting
character, then remember it as the delimiter. */
if (rl_basic_quote_characters &&
strchr (rl_basic_quote_characters, scan) &&
(end - rl_point) > 1)
delimiter = scan;
/* If the character isn't needed to determine something special
about what kind of completion to perform, then advance past it. */
if (rl_special_prefixes == 0 || strchr (rl_special_prefixes, scan) == 0)
rl_point++;
}
}
if (fp)
@ -715,7 +726,7 @@ remove_duplicate_matches (matches)
/* Sort the array without matches[0], since we need it to
stay in place no matter what. */
if (i)
qsort (matches+1, i-1, sizeof (char *), _rl_qsort_string_compare);
qsort (matches+1, i-1, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
/* Remember the lowest common denominator for it may be unique. */
lowest_common = savestring (matches[0]);
@ -908,7 +919,7 @@ rl_display_match_list (matches, len, max)
/* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0)
qsort (matches + 1, len, sizeof (char *), _rl_qsort_string_compare);
qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
crlf ();
@ -1409,7 +1420,7 @@ username_completion_function (text, state)
{
#if defined (__WIN32__) || defined (__OPENNT)
return (char *)NULL;
#else /* !__WIN32__ && !__OPENNT */
#else /* !__WIN32__ && !__OPENNT) */
static char *username = (char *)NULL;
static struct passwd *entry;
static int namelen, first_char, first_char_loc;
@ -1452,7 +1463,7 @@ username_completion_function (text, state)
return (value);
}
#endif /* !__GO32__ */
#endif /* !__WIN32__ && !__OPENNT */
}
/* Okay, now we write the entry_function for filename completion. In the
@ -1494,18 +1505,24 @@ filename_completion_function (text, state)
temp = strrchr (dirname, '/');
#if defined (__MSDOS__)
/* special hack for //X/... */
if (dirname[0] == '/' && dirname[1] == '/' && isalpha (dirname[2]) && dirname[3] == '/')
temp = strrchr (dirname + 3, '/');
#endif
if (temp)
{
strcpy (filename, ++temp);
*temp = '\0';
}
#if defined (__WIN32__) || defined (__OPENNT) || defined (__MSDOS__)
/* Handle the drive-relative names "d:foo/bar". */
else if (dirname[1] == ':')
{
strcpy (filename, dirname + 2);
dirname[2] = '\0';
}
#if defined (__MSDOS__)
/* searches from current directory on the drive */
else if (isalpha (dirname[0]) && dirname[1] == ':')
{
strcpy (filename, dirname + 2);
dirname[2] = '\0';
}
#endif
else
{
@ -1668,11 +1685,7 @@ rl_menu_complete (count, ignore)
/* Clean up from previous call, if any. */
FREE (orig_text);
if (matches)
{
for (match_list_index = 0; matches[match_list_index]; match_list_index++)
free (matches[match_list_index]);
free (matches);
}
free_match_list (matches);
match_list_index = match_list_size = 0;
matches = (char **)NULL;

View File

@ -57,6 +57,9 @@
/* Define if you have the lstat function. */
#undef HAVE_LSTAT
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the putenv function. */
#undef HAVE_PUTENV

277
readline/configure vendored
View File

@ -1,7 +1,19 @@
#! /bin/sh
# From configure.in for Readline 4.0, version 2.14, from autoconf version 2.13
LIBVERSION=4.0
# From configure.in for Readline 4.1, version 2.22, from autoconf version 2.13
LIBVERSION=4.1
@ -121,7 +133,6 @@ program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
sitefile=
srcdir=
target=NONE
verbose=
@ -236,7 +247,6 @@ Configuration:
--help print this message
--no-create do not create output files
--quiet, --silent do not print \`checking...' messages
--site-file=FILE use FILE as the site file
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
@ -407,11 +417,6 @@ EOF
-site=* | --site=* | --sit=*)
site="$ac_optarg" ;;
-site-file | --site-file | --site-fil | --site-fi | --site-f)
ac_prev=sitefile ;;
-site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
sitefile="$ac_optarg" ;;
-srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
ac_prev=srcdir ;;
-srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
@ -577,16 +582,12 @@ fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
# Prefer explicitly selected file to automatically selected ones.
if test -z "$sitefile"; then
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
if test -z "$CONFIG_SITE"; then
if test "x$prefix" != xNONE; then
CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
else
CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
fi
else
CONFIG_SITE="$sitefile"
fi
for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
@ -656,7 +657,7 @@ 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:660: checking host system type" >&5
echo "configure:661: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -697,7 +698,7 @@ test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:701: checking for $ac_word" >&5
echo "configure:702: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -727,7 +728,7 @@ 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:731: checking for $ac_word" >&5
echo "configure:732: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -778,7 +779,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:782: checking for $ac_word" >&5
echo "configure:783: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -810,7 +811,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:814: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:815: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -821,12 +822,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 825 "configure"
#line 826 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -852,12 +853,12 @@ 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:856: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:857: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:861: checking whether we are using GNU C" >&5
echo "configure:862: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -866,7 +867,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -885,7 +886,7 @@ 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:889: checking whether ${CC-cc} accepts -g" >&5
echo "configure:890: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -917,7 +918,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:921: checking how to run the C preprocessor" >&5
echo "configure:922: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -932,13 +933,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 936 "configure"
#line 937 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:942: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:943: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -949,13 +950,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 953 "configure"
#line 954 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -966,13 +967,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 970 "configure"
#line 971 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:976: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:977: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -998,17 +999,17 @@ 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:1002: checking for minix/config.h" >&5
echo "configure:1003: checking for minix/config.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1007 "configure"
#line 1008 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1013: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1085,13 +1086,13 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:1089: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:1090: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 1095 "configure"
#line 1096 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -1109,7 +1110,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 1113 "configure"
#line 1114 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -1142,7 +1143,7 @@ fi
# 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:1146: checking for a BSD compatible install" >&5
echo "configure:1147: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1197,7 +1198,7 @@ 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:1201: checking for $ac_word" >&5
echo "configure:1202: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1227,7 +1228,7 @@ 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:1231: checking for $ac_word" >&5
echo "configure:1232: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1259,12 +1260,12 @@ MAKE_SHELL=/bin/sh
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:1263: checking return type of signal handlers" >&5
echo "configure:1264: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1268 "configure"
#line 1269 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -1281,7 +1282,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -1301,12 +1302,12 @@ EOF
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
echo "configure:1305: checking whether stat file-mode macros are broken" >&5
echo "configure:1306: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1310 "configure"
#line 1311 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -1361,12 +1362,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
echo "configure:1365: checking for $ac_hdr that defines DIR" >&5
echo "configure:1366: 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 1370 "configure"
#line 1371 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@ -1374,7 +1375,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
if { (eval echo configure:1378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@ -1399,7 +1400,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
echo "configure:1403: checking for opendir in -ldir" >&5
echo "configure:1404: 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
@ -1407,7 +1408,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1411 "configure"
#line 1412 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1418,7 +1419,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:1422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1440,7 +1441,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
echo "configure:1444: checking for opendir in -lx" >&5
echo "configure:1445: 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
@ -1448,7 +1449,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1452 "configure"
#line 1453 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1459,7 +1460,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1482,15 +1483,16 @@ fi
fi
for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat
for ac_func in lstat memmove putenv select setenv setlocale \
strcasecmp tcgetattr
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1489: checking for $ac_func" >&5
echo "configure:1491: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1494 "configure"
#line 1496 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1513,7 +1515,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1539,7 +1541,7 @@ done
echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
echo "configure:1543: checking for working strcoll" >&5
echo "configure:1545: checking for working strcoll" >&5
if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1547,7 +1549,7 @@ else
ac_cv_func_strcoll_works=no
else
cat > conftest.$ac_ext <<EOF
#line 1551 "configure"
#line 1553 "configure"
#include "confdefs.h"
#include <string.h>
main ()
@ -1557,7 +1559,7 @@ main ()
strcoll ("123", "456") >= 0);
}
EOF
if { (eval echo configure:1561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_strcoll_works=yes
else
@ -1586,17 +1588,17 @@ for ac_hdr in unistd.h stdlib.h varargs.h stdarg.h string.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1590: checking for $ac_hdr" >&5
echo "configure:1592: 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 1595 "configure"
#line 1597 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1625,13 +1627,13 @@ done
echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6
echo "configure:1629: checking for type of signal functions" >&5
echo "configure:1631: checking for type of signal functions" >&5
if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1635 "configure"
#line 1637 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
@ -1644,7 +1646,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=posix
else
@ -1653,7 +1655,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
#line 1657 "configure"
#line 1659 "configure"
#include "confdefs.h"
#include <signal.h>
int main() {
@ -1663,7 +1665,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=4.2bsd
else
@ -1672,7 +1674,7 @@ else
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
#line 1676 "configure"
#line 1678 "configure"
#include "confdefs.h"
#include <signal.h>
@ -1685,7 +1687,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:1689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_signal_vintage=svr3
else
@ -1726,7 +1728,7 @@ fi
echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6
echo "configure:1730: checking if signal handlers must be reinstalled when invoked" >&5
echo "configure:1732: checking if signal handlers must be reinstalled when invoked" >&5
if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1736,7 +1738,7 @@ else
else
cat > conftest.$ac_ext <<EOF
#line 1740 "configure"
#line 1742 "configure"
#include "confdefs.h"
#include <signal.h>
@ -1783,7 +1785,7 @@ main()
}
EOF
if { (eval echo configure:1787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_must_reinstall_sighandlers=no
else
@ -1808,7 +1810,7 @@ fi
echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6
echo "configure:1812: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
echo "configure:1814: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5
if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1818,7 +1820,7 @@ else
else
cat > conftest.$ac_ext <<EOF
#line 1822 "configure"
#line 1824 "configure"
#include "confdefs.h"
#ifdef HAVE_UNISTD_H
@ -1859,7 +1861,7 @@ exit(1);
#endif
}
EOF
if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_func_sigsetjmp=present
else
@ -1882,12 +1884,12 @@ EOF
fi
echo $ac_n "checking for lstat""... $ac_c" 1>&6
echo "configure:1886: checking for lstat" >&5
echo "configure:1888: checking for lstat" >&5
if eval "test \"`echo '$''{'bash_cv_func_lstat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1891 "configure"
#line 1893 "configure"
#include "confdefs.h"
#include <sys/types.h>
@ -1897,7 +1899,7 @@ int main() {
lstat(".",(struct stat *)0);
; return 0; }
EOF
if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
bash_cv_func_lstat=yes
else
@ -1918,12 +1920,12 @@ EOF
fi
echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6
echo "configure:1922: checking whether programs are able to redeclare getpw functions" >&5
echo "configure:1924: 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 1927 "configure"
#line 1929 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <pwd.h>
@ -1934,7 +1936,7 @@ int main() {
struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");
; return 0; }
EOF
if { (eval echo configure:1938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_can_redecl_getpw=yes
else
@ -1956,7 +1958,7 @@ fi
echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6
echo "configure:1960: checking whether or not strcoll and strcmp differ" >&5
echo "configure:1962: checking whether or not strcoll and strcmp differ" >&5
if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1966,7 +1968,7 @@ else
else
cat > conftest.$ac_ext <<EOF
#line 1970 "configure"
#line 1972 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -2005,7 +2007,7 @@ char *v[];
}
EOF
if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
bash_cv_func_strcoll_broken=yes
else
@ -2029,12 +2031,12 @@ fi
echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6
echo "configure:2033: checking whether signal handlers are of type void" >&5
echo "configure:2035: checking whether signal handlers are of type void" >&5
if eval "test \"`echo '$''{'bash_cv_void_sighandler'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2038 "configure"
#line 2040 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -2049,7 +2051,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_void_sighandler=yes
else
@ -2069,12 +2071,12 @@ EOF
fi
echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6
echo "configure:2073: checking for TIOCGWINSZ in sys/ioctl.h" >&5
echo "configure:2075: checking for TIOCGWINSZ in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_tiocgwinsz_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2078 "configure"
#line 2080 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@ -2082,7 +2084,7 @@ int main() {
int x = TIOCGWINSZ;
; return 0; }
EOF
if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2088: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_tiocgwinsz_in_ioctl=yes
else
@ -2103,12 +2105,12 @@ EOF
fi
echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6
echo "configure:2107: checking for TIOCSTAT in sys/ioctl.h" >&5
echo "configure:2109: checking for TIOCSTAT in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_tiocstat_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2112 "configure"
#line 2114 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@ -2116,7 +2118,7 @@ int main() {
int x = TIOCSTAT;
; return 0; }
EOF
if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_tiocstat_in_ioctl=yes
else
@ -2137,12 +2139,12 @@ EOF
fi
echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6
echo "configure:2141: checking for FIONREAD in sys/ioctl.h" >&5
echo "configure:2143: checking for FIONREAD in sys/ioctl.h" >&5
if eval "test \"`echo '$''{'bash_cv_fionread_in_ioctl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2146 "configure"
#line 2148 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@ -2150,7 +2152,7 @@ int main() {
int x = FIONREAD;
; return 0; }
EOF
if { (eval echo configure:2154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_fionread_in_ioctl=yes
else
@ -2171,19 +2173,19 @@ EOF
fi
echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6
echo "configure:2175: checking for speed_t in sys/types.h" >&5
echo "configure:2177: checking for speed_t in sys/types.h" >&5
if eval "test \"`echo '$''{'bash_cv_speed_t_in_sys_types'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2180 "configure"
#line 2182 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
speed_t x;
; return 0; }
EOF
if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2189: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_speed_t_in_sys_types=yes
else
@ -2204,12 +2206,12 @@ EOF
fi
echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6
echo "configure:2208: checking for struct winsize in sys/ioctl.h and termios.h" >&5
echo "configure:2210: checking for struct winsize in sys/ioctl.h and termios.h" >&5
if eval "test \"`echo '$''{'bash_cv_struct_winsize_header'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2213 "configure"
#line 2215 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@ -2217,7 +2219,7 @@ int main() {
struct winsize x;
; return 0; }
EOF
if { (eval echo configure:2221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_struct_winsize_header=ioctl_h
else
@ -2225,7 +2227,7 @@ else
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
#line 2229 "configure"
#line 2231 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <termios.h>
@ -2233,7 +2235,7 @@ int main() {
struct winsize x;
; return 0; }
EOF
if { (eval echo configure:2237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_struct_winsize_header=termios_h
else
@ -2266,12 +2268,12 @@ fi
echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6
echo "configure:2270: checking if struct dirent has a d_ino member" >&5
echo "configure:2272: checking if struct dirent has a d_ino member" >&5
if eval "test \"`echo '$''{'bash_cv_dirent_has_dino'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2275 "configure"
#line 2277 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -2300,7 +2302,7 @@ struct dirent d; int z; z = d.d_ino;
; return 0; }
EOF
if { (eval echo configure:2304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2306: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_dirent_has_dino=yes
else
@ -2322,12 +2324,12 @@ fi
echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6
echo "configure:2326: checking if struct dirent has a d_fileno member" >&5
echo "configure:2328: checking if struct dirent has a d_fileno member" >&5
if eval "test \"`echo '$''{'bash_cv_dirent_has_d_fileno'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2331 "configure"
#line 2333 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -2356,7 +2358,7 @@ struct dirent d; int z; z = d.d_fileno;
; return 0; }
EOF
if { (eval echo configure:2360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
bash_cv_dirent_has_d_fileno=yes
else
@ -2385,14 +2387,14 @@ if test "X$bash_cv_termcap_lib" = "X"; then
_bash_needmsg=yes
else
echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
echo "configure:2389: checking which library has the termcap functions" >&5
echo "configure:2391: checking which library has the termcap functions" >&5
_bash_needmsg=
fi
if eval "test \"`echo '$''{'bash_cv_termcap_lib'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
echo "configure:2396: checking for tgetent in -ltermcap" >&5
echo "configure:2398: 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
@ -2400,7 +2402,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2404 "configure"
#line 2406 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2411,7 +2413,7 @@ int main() {
tgetent()
; return 0; }
EOF
if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2430,7 +2432,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
echo "configure:2434: checking for tgetent in -lcurses" >&5
echo "configure:2436: 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
@ -2438,7 +2440,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2442 "configure"
#line 2444 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2449,7 +2451,7 @@ int main() {
tgetent()
; return 0; }
EOF
if { (eval echo configure:2453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2468,7 +2470,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
echo "configure:2472: checking for tgetent in -lncurses" >&5
echo "configure:2474: 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
@ -2476,7 +2478,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2480 "configure"
#line 2482 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2487,7 +2489,7 @@ int main() {
tgetent()
; return 0; }
EOF
if { (eval echo configure:2491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2516,7 +2518,7 @@ fi
if test "X$_bash_needmsg" = "Xyes"; then
echo $ac_n "checking which library has the termcap functions""... $ac_c" 1>&6
echo "configure:2520: checking which library has the termcap functions" >&5
echo "configure:2522: checking which library has the termcap functions" >&5
fi
echo "$ac_t""using $bash_cv_termcap_lib" 1>&6
if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
@ -2553,8 +2555,8 @@ esac
#
if test -f ${srcdir}/support/shobj-conf; then
echo $ac_n "checking configuration for building shared libraries""... $ac_c" 1>&6
echo "configure:2557: checking configuration for building shared libraries" >&5
eval `${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C ${CC} -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
echo "configure:2559: 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}`
@ -2568,9 +2570,20 @@ echo "configure:2557: checking configuration for building shared libraries" >&5
echo "$ac_t""$SHLIB_STATUS" 1>&6
# shared library versioning
# quoted for m4 so I can use character classes
SHLIB_MAJOR=`expr "$LIBVERSION" : '\([0-9]\)\..*'`
SHLIB_MINOR=`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`
fi
BUILD_DIR=`pwd`
case "$host_os" in
msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
*) BUILD_DIR=`pwd` ;;
esac
@ -2748,6 +2761,8 @@ s%@SHLIB_XLDFLAGS@%$SHLIB_XLDFLAGS%g
s%@SHLIB_LIBSUFF@%$SHLIB_LIBSUFF%g
s%@SHLIB_LIBVERSION@%$SHLIB_LIBVERSION%g
s%@SHLIB_LIBS@%$SHLIB_LIBS%g
s%@SHLIB_MAJOR@%$SHLIB_MAJOR%g
s%@SHLIB_MINOR@%$SHLIB_MINOR%g
s%@BUILD_DIR@%$BUILD_DIR%g
s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g
s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g

View File

@ -4,8 +4,8 @@ dnl
dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
AC_REVISION([for Readline 4.0, version 2.14, from autoconf version] AC_ACVERSION)
LIBVERSION=4.0
AC_REVISION([for Readline 4.1, version 2.22, from autoconf version] AC_ACVERSION)
LIBVERSION=4.1
AC_INIT(readline.h)
AC_CONFIG_HEADER(config.h)
@ -32,6 +32,7 @@ fi
test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
AC_PROG_CC
dnl AC_AIX
AC_MINIX
dnl BEGIN changes for CYGNUS cross-building for Cygwin
@ -91,7 +92,8 @@ AC_RETSIGTYPE
AC_HEADER_STAT
AC_HEADER_DIRENT
AC_CHECK_FUNCS(strcasecmp select setenv putenv tcgetattr setlocale lstat)
AC_CHECK_FUNCS(lstat memmove putenv select setenv setlocale \
strcasecmp tcgetattr)
AC_FUNC_STRCOLL
@ -140,7 +142,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)
@ -154,9 +156,20 @@ if test -f ${srcdir}/support/shobj-conf; then
AC_SUBST(SHLIB_LIBVERSION)
AC_SUBST(SHLIB_LIBS)
AC_MSG_RESULT($SHLIB_STATUS)
# shared library versioning
# quoted for m4 so I can use character classes
SHLIB_MAJOR=[`expr "$LIBVERSION" : '\([0-9]\)\..*'`]
SHLIB_MINOR=[`expr "$LIBVERSION" : '[0-9]\.\([0-9]\).*'`]
AC_SUBST(SHLIB_MAJOR)
AC_SUBST(SHLIB_MINOR)
fi
BUILD_DIR=`pwd`
case "$host_os" in
msdosdjgpp*) BUILD_DIR=`pwd.exe` ;; # to prevent //d/path/file
*) BUILD_DIR=`pwd` ;;
esac
AC_SUBST(BUILD_DIR)
AC_SUBST(CFLAGS)

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -41,11 +41,6 @@
#include <stdio.h>
#if defined (__GO32__)
# include <go32.h>
# include <pc.h>
#endif /* __GO32__ */
/* System-specific feature definitions and include files. */
#include "rldefs.h"
@ -56,48 +51,25 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
#if !defined (strchr) && !defined (__STDC__)
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
/* Global and pseudo-global variables and functions
imported from readline.c. */
extern char *rl_prompt;
extern int readline_echoing_p;
extern int _rl_output_meta_chars;
extern int _rl_horizontal_scroll_mode;
extern int _rl_mark_modified_lines;
extern int _rl_prefer_visible_bell;
/* Variables and functions imported from terminal.c */
extern void _rl_output_some_chars ();
#ifdef _MINIX
extern void _rl_output_character_function ();
#else
extern int _rl_output_character_function ();
#if defined (HACK_TERMCAP_MOTION)
extern char *term_forward_char;
#endif
extern int _rl_backspace ();
extern char *term_clreol, *term_clrpag;
extern char *term_im, *term_ic, *term_ei, *term_DC;
extern char *term_up, *term_dc, *term_cr, *term_IC;
extern int screenheight, screenwidth, screenchars;
extern int terminal_can_insert, _rl_term_autowrap;
/* Pseudo-global functions (local to the readline library) exported
by this file. */
void _rl_move_cursor_relative (), _rl_output_some_chars ();
void _rl_move_vert ();
void _rl_clear_to_eol (), _rl_clear_screen ();
static void update_line (), space_to_eol ();
static void delete_chars (), insert_some_chars ();
static void cr ();
static void update_line __P((char *, char *, int, int, int, int));
static void space_to_eol __P((int));
static void delete_chars __P((int));
static void insert_some_chars __P((char *, int));
static void cr __P((void));
static int *inv_lbreaks, *vis_lbreaks;
extern char *xmalloc (), *xrealloc ();
static int inv_lbsize, vis_lbsize;
/* Heuristic used to decide whether it is faster to move from CUR to NEW
by backing up or outputting a carriage return and moving forward. */
@ -190,7 +162,7 @@ static int visible_first_line_len;
/* Expand the prompt string S and return the number of visible
characters in *LP, if LP is not null. This is currently more-or-less
a placeholder for expansion. LIP, if non-null is a place to store the
index of the last invisible character in ther eturned string. */
index of the last invisible character in the returned string. */
/* Current implementation:
\001 (^A) start non-visible characters
@ -250,6 +222,18 @@ expand_prompt (pmt, lp, lip)
return ret;
}
/* Just strip out RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE from
PMT and return the rest of PMT. */
char *
_rl_strip_prompt (pmt)
char *pmt;
{
char *ret;
ret = expand_prompt (pmt, (int *)NULL, (int *)NULL);
return ret;
}
/*
* Expand the prompt string into the various display components, if
* necessary.
@ -307,6 +291,49 @@ rl_expand_prompt (prompt)
}
}
/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
increased. If the lines have already been allocated, this ensures that
they can hold at least MINSIZE characters. */
static void
init_line_structures (minsize)
int minsize;
{
register int n;
if (invisible_line == 0) /* initialize it */
{
if (line_size < minsize)
line_size = minsize;
visible_line = xmalloc (line_size);
invisible_line = xmalloc (line_size);
}
else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
{
line_size *= 2;
if (line_size < minsize)
line_size = minsize;
visible_line = xrealloc (visible_line, line_size);
invisible_line = xrealloc (invisible_line, line_size);
}
for (n = minsize; n < line_size; n++)
{
visible_line[n] = 0;
invisible_line[n] = 1;
}
if (vis_lbreaks == 0)
{
/* should be enough. */
inv_lbsize = vis_lbsize = 256;
inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
inv_lbreaks[0] = vis_lbreaks[0] = 0;
}
}
/* Basic redisplay algorithm. */
void
rl_redisplay ()
@ -325,19 +352,7 @@ rl_redisplay ()
if (invisible_line == 0)
{
visible_line = xmalloc (line_size);
invisible_line = xmalloc (line_size);
for (in = 0; in < line_size; in++)
{
visible_line[in] = 0;
invisible_line[in] = 1;
}
/* should be enough, but then again, this is just for testing. */
inv_lbreaks = (int *)malloc (256 * sizeof (int));
vis_lbreaks = (int *)malloc (256 * sizeof (int));
inv_lbreaks[0] = vis_lbreaks[0] = 0;
init_line_structures (0);
rl_on_new_line ();
}
@ -395,12 +410,13 @@ rl_redisplay ()
else
{
prompt_this_line++;
pmtlen = prompt_this_line - rl_display_prompt; /* temp var */
if (forced_display)
{
_rl_output_some_chars (rl_display_prompt, prompt_this_line - rl_display_prompt);
_rl_output_some_chars (rl_display_prompt, pmtlen);
/* Make sure we are at column zero even after a newline,
regardless of the state of terminal output processing. */
if (prompt_this_line[-2] != '\r')
if (pmtlen < 2 || prompt_this_line[-2] != '\r')
cr ();
}
}
@ -419,11 +435,25 @@ rl_redisplay ()
wrap_offset = 0;
}
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
} while (0)
#define CHECK_LPOS() \
do { \
lpos++; \
if (lpos >= screenwidth) \
{ \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \
inv_lbreaks[++newlines] = out; \
lpos = 0; \
} \
@ -437,14 +467,13 @@ rl_redisplay ()
contents of the command line? */
while (lpos >= screenwidth)
{
#if 0
temp = ((newlines + 1) * screenwidth) - ((newlines == 0) ? wrap_offset : 0);
#else
/* XXX - possible fix from Darin Johnson <darin@acuson.com> for prompt
string with invisible characters that is longer than the screen
width. */
width. XXX - this doesn't work right if invisible characters have
to be put on the second screen line -- it adds too much (the number
of invisible chars after the screenwidth). */
temp = ((newlines + 1) * screenwidth) + ((newlines == 0) ? wrap_offset : 0);
#endif
inv_lbreaks[++newlines] = temp;
lpos -= screenwidth;
}
@ -477,6 +506,7 @@ rl_redisplay ()
if (lpos + 4 >= screenwidth)
{
temp = screenwidth - lpos;
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp;
lpos = 4 - temp;
}
@ -506,6 +536,7 @@ rl_redisplay ()
{
register int temp2;
temp2 = screenwidth - lpos;
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out + temp2;
lpos = temp - temp2;
while (out < newout)
@ -522,6 +553,7 @@ rl_redisplay ()
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up)
{
line[out++] = '\0'; /* XXX - sentinel */
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
lpos = 0;
}
@ -546,6 +578,7 @@ rl_redisplay ()
}
inv_botlin = lb_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
cursor_linenum = lb_linenum;
@ -776,11 +809,17 @@ rl_redisplay ()
/* Swap visible and non-visible lines. */
{
char *temp = visible_line;
int *itemp = vis_lbreaks;
int *itemp = vis_lbreaks, ntemp = vis_lbsize;
visible_line = invisible_line;
invisible_line = temp;
vis_lbreaks = inv_lbreaks;
inv_lbreaks = itemp;
vis_lbsize = inv_lbsize;
inv_lbsize = ntemp;
rl_display_fixed = 0;
/* If we are displaying on a single line, and last_lmargin is > 0, we
are not displaying any invisible characters, so set visible_wrap_offset
@ -907,7 +946,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
putc ('\r', rl_outstream);
#else
tputs (term_cr, 1, _rl_output_character_function);
#endif /* !__MSDOS__ */
#endif
_rl_output_some_chars (local_prompt, lendiff);
_rl_last_c_pos = lendiff;
}
@ -1037,6 +1076,58 @@ rl_on_new_line ()
return 0;
}
/* Tell the update routines that we have moved onto a new line with the
prompt already displayed. Code originally from the version of readline
distributed with CLISP. */
int
rl_on_new_line_with_prompt ()
{
int prompt_size, i, l, real_screenwidth, newlines;
char *prompt_last_line;
/* Initialize visible_line and invisible_line to ensure that they can hold
the already-displayed prompt. */
prompt_size = strlen (rl_prompt) + 1;
init_line_structures (prompt_size);
/* Make sure the line structures hold the already-displayed prompt for
redisplay. */
strcpy (visible_line, rl_prompt);
strcpy (invisible_line, rl_prompt);
/* If the prompt contains newlines, take the last tail. */
prompt_last_line = strrchr (rl_prompt, '\n');
if (!prompt_last_line)
prompt_last_line = rl_prompt;
l = strlen (prompt_last_line);
_rl_last_c_pos = l;
/* Dissect prompt_last_line into screen lines. Note that here we have
to use the real screenwidth. Readline's notion of screenwidth might be
one less, see terminal.c. */
real_screenwidth = screenwidth + (_rl_term_autowrap ? 0 : 1);
_rl_last_v_pos = l / real_screenwidth;
/* If the prompt length is a multiple of real_screenwidth, we don't know
whether the cursor is at the end of the last line, or already at the
beginning of the next line. Output a newline just to be safe. */
if (l > 0 && (l % real_screenwidth) == 0)
_rl_output_some_chars ("\n", 1);
last_lmargin = 0;
newlines = 0; i = 0;
while (i <= l)
{
_rl_vis_botlin = newlines;
vis_lbreaks[newlines++] = i;
i += real_screenwidth;
}
vis_lbreaks[newlines] = l;
visible_wrap_offset = 0;
return 0;
}
/* Actually update the display, period. */
int
rl_forced_update_display ()
@ -1094,8 +1185,6 @@ _rl_move_cursor_relative (new, data)
That kind of control is for people who don't know what the
data is underneath the cursor. */
#if defined (HACK_TERMCAP_MOTION)
extern char *term_forward_char;
if (term_forward_char)
for (i = _rl_last_c_pos; i < new; i++)
tputs (term_forward_char, 1, _rl_output_character_function);
@ -1122,22 +1211,15 @@ _rl_move_vert (to)
if (_rl_last_v_pos == to || to > screenheight)
return;
#if defined (__GO32__)
{
int row, col;
i = fflush (rl_outstream); /* make sure the cursor pos is current! */
ScreenGetCursor (&row, &col);
ScreenSetCursor ((row + to - _rl_last_v_pos), col);
delta = i;
}
#else /* !__GO32__ */
if ((delta = to - _rl_last_v_pos) > 0)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
#else
tputs (term_cr, 1, _rl_output_character_function);
#endif
_rl_last_c_pos = 0;
}
else
@ -1146,7 +1228,7 @@ _rl_move_vert (to)
for (i = 0; i < -delta; i++)
tputs (term_up, 1, _rl_output_character_function);
}
#endif /* !__GO32__ */
_rl_last_v_pos = to; /* Now TO is here */
}
@ -1354,11 +1436,9 @@ void
_rl_clear_to_eol (count)
int count;
{
#if !defined (__GO32__)
if (term_clreol)
tputs (term_clreol, 1, _rl_output_character_function);
else if (count)
#endif /* !__GO32__ */
space_to_eol (count);
}
@ -1379,14 +1459,9 @@ space_to_eol (count)
void
_rl_clear_screen ()
{
#if defined (__GO32__)
ScreenClear (); /* FIXME: only works in text modes */
ScreenSetCursor (0, 0); /* term_clrpag is "cl" which homes the cursor */
#else
if (term_clrpag)
tputs (term_clrpag, 1, _rl_output_character_function);
else
#endif /* !__GO32__ */
crlf ();
}
@ -1396,21 +1471,6 @@ insert_some_chars (string, count)
char *string;
int count;
{
#if defined (__GO32__)
#ifndef __DJGPP__
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);
#endif /* !__DJGPP__ */
/* Place the text on the screen. */
_rl_output_some_chars (string, count);
#else /* !_GO32 */
/* If IC is defined, then we do not have to "enter" insert mode. */
if (term_IC)
{
@ -1443,7 +1503,6 @@ insert_some_chars (string, count)
if (term_ei && *term_ei)
tputs (term_ei, 1, _rl_output_character_function);
}
#endif /* !__GO32__ */
}
/* Delete COUNT characters from the display line. */
@ -1451,19 +1510,6 @@ static void
delete_chars (count)
int count;
{
#if !defined (__DJGPP__)
#if defined (__GO32__)
int row, col, width;
char *row_start;
ScreenGetCursor (&row, &col);
width = ScreenCols ();
row_start = ScreenPrimary + (row * width);
memcpy (row_start + col, row_start + col + count, width - col - count);
memset (row_start + width - count, 0, count * 2);
#else /* !_GO32 */
if (count > screenwidth) /* XXX */
return;
@ -1479,8 +1525,6 @@ delete_chars (count)
while (count--)
tputs (term_dc, 1, _rl_output_character_function);
}
#endif /* !__GO32__ */
#endif /* !__DJGPP__ */
}
void
@ -1502,7 +1546,11 @@ _rl_update_final ()
if (full_lines && _rl_term_autowrap && (VIS_LLEN(_rl_vis_botlin) == screenwidth))
{
char *last_line;
#if 0
last_line = &visible_line[inv_lbreaks[_rl_vis_botlin]];
#else
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]];
#endif
_rl_move_cursor_relative (screenwidth - 1, last_line);
_rl_clear_to_eol (0);
putc (last_line[screenwidth - 1], rl_outstream);
@ -1523,16 +1571,47 @@ cr ()
putc ('\r', rl_outstream);
#else
tputs (term_cr, 1, _rl_output_character_function);
#endif /* !__MSDOS__ */
#endif
_rl_last_c_pos = 0;
}
}
/* Redraw the last line of a multi-line prompt that may possibly contain
terminal escape sequences. Called with the cursor at column 0 of the
line to draw the prompt on. */
static void
redraw_prompt (t)
char *t;
{
char *oldp, *oldl, *oldlprefix;
int oldlen, oldlast, oldplen;
/* Geez, I should make this a struct. */
oldp = rl_display_prompt;
oldl = local_prompt;
oldlprefix = local_prompt_prefix;
oldlen = visible_length;
oldplen = prefix_length;
oldlast = last_invisible;
rl_display_prompt = t;
local_prompt = expand_prompt (t, &visible_length, &last_invisible);
local_prompt_prefix = (char *)NULL;
rl_forced_update_display ();
rl_display_prompt = oldp;
local_prompt = oldl;
local_prompt_prefix = oldlprefix;
visible_length = oldlen;
prefix_length = oldplen;
last_invisible = oldlast;
}
/* Redisplay the current line after a SIGWINCH is received. */
void
_rl_redisplay_after_sigwinch ()
{
char *t, *oldp, *oldl, *oldlprefix;
char *t;
/* Clear the current line and put the cursor at column 0. Make sure
the right thing happens if we have wrapped to a new screen line. */
@ -1542,7 +1621,7 @@ _rl_redisplay_after_sigwinch ()
putc ('\r', rl_outstream);
#else
tputs (term_cr, 1, _rl_output_character_function);
#endif /* !__MSDOS__ */
#endif
_rl_last_c_pos = 0;
#if defined (__MSDOS__)
space_to_eol (screenwidth);
@ -1565,17 +1644,7 @@ _rl_redisplay_after_sigwinch ()
/* Redraw only the last line of a multi-line prompt. */
t = strrchr (rl_display_prompt, '\n');
if (t)
{
oldp = rl_display_prompt;
oldl = local_prompt;
oldlprefix = local_prompt_prefix;
rl_display_prompt = ++t;
local_prompt = local_prompt_prefix = (char *)NULL;
rl_forced_update_display ();
rl_display_prompt = oldp;
local_prompt = oldl;
local_prompt_prefix = oldlprefix;
}
redraw_prompt (++t);
else
rl_forced_update_display ();
}
@ -1600,3 +1669,25 @@ _rl_erase_entire_line ()
cr ();
fflush (rl_outstream);
}
/* return the `current display line' of the cursor -- the number of lines to
move up to get to the first screen line of the current readline line. */
int
_rl_current_display_line ()
{
int ret, nleft;
/* Find out whether or not there might be invisible characters in the
editing buffer. */
if (rl_display_prompt == rl_prompt)
nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
else
nleft = _rl_last_c_pos - screenwidth;
if (nleft > 0)
ret = 1 + nleft / screenwidth;
else
ret = 0;
return ret;
}

View File

@ -1,3 +1,12 @@
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
Regenerated inc-hist.texinfo as copy of hsuser.texinfo, for
inclusion in the gdb manual.
New file: rluserman.texinfo
Tue Apr 18 15:43:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
* readline.0: Delete. Generated by Makefile, deleted by distclean

View File

@ -1,6 +1,23 @@
# This makefile for Readline library documentation is in -*- text -*- mode.
# Emacs likes it that way.
top_srcdir = @top_srcdir@
# Copyright (C) 1996 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
topdir = @top_srcdir@
srcdir = @srcdir@
VPATH = .:@srcdir@
@ -8,25 +25,33 @@ prefix = @prefix@
infodir = @infodir@
mandir = @mandir@
man3dir = $(mandir)/man3
manpfx = man
man1ext = 1
man1dir = $(mandir)/$(manpfx)$(man1ext)
man3ext = 3
man3dir = $(mandir)/$(manpfx)$(man3ext)
SHELL = @MAKE_SHELL@
RM = rm -f
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
BUILD_DIR = @BUILD_DIR@
TEXINPUTDIR = $(srcdir)
MAKEINFO = makeinfo
MAKEINFO = LANGUAGE= makeinfo
TEXI2DVI = $(srcdir)/texi2dvi
TEXI2HTML = $(srcdir)/texi2html
QUIETPS = #set this to -q to shut up dvips
DVIPS = dvips -D 300 $(QUIETPS) -o $@ # tricky
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
PAPERSIZE = letter
PSDPI = 300 # I don't have any 600-dpi printers
DVIPS = dvips -D ${PSDPI} $(QUIETPS) -t ${PAPERSIZE} -o $@ # tricky
RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \
$(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo
$(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo \
$(srcdir)/rluserman.texinfo
HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \
$(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo
@ -36,16 +61,15 @@ NROFF = groff -Tascii
# This should be a program that converts troff to postscript
GROFF = groff
DVIOBJ = readline.dvi history.dvi
INFOOBJ = readline.info history.info
PSOBJ = readline.ps history.ps
HTMLOBJ = readline.html history.html
HTMLTOC = readline_toc.html history_toc.html
DVIOBJ = readline.dvi history.dvi rluserman.dvi
INFOOBJ = readline.info history.info rluserman.info
PSOBJ = readline.ps history.ps rluserman.ps
HTMLOBJ = readline.html history.html rluserman.html
TEXTOBJ = readline.0
INTERMEDIATE_OBJ = rlman.dvi hist.dvi
INTERMEDIATE_OBJ = rlman.dvi hist.dvi rluserman.dvi
CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(HTMLTOC) $(TEXTOBJ)
CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(TEXTOBJ)
.SUFFIXES: .0 .3 .ps .txt .dvi
@ -63,6 +87,12 @@ readline.dvi: $(RLSRC)
readline.info: $(RLSRC)
$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texinfo
rluserman.dvi: $(RLSRC)
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texinfo
rluserman.info: $(RLSRC)
$(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texinfo
history.dvi: ${HISTSRC}
TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/hist.texinfo
mv hist.dvi history.dvi
@ -74,18 +104,25 @@ readline.ps: readline.dvi
$(RM) $@
$(DVIPS) readline.dvi
rluserman.ps: rluserman.dvi
$(RM) $@
$(DVIPS) rluserman.dvi
history.ps: history.dvi
$(RM) $@
$(DVIPS) history.dvi
readline.html: ${RLSRC}
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo
sed -e 's:rlman.html:readline.html:' rlman.html > readline.html
sed -e 's:rlman.html:readline.html:g' rlman.html > readline.html
$(RM) rlman.html
rluserman.html: ${RLSRC}
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rluserman.texinfo
history.html: ${HISTSRC}
$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo
sed -e 's:hist.html:history.html:' hist.html > history.html
sed -e 's:hist.html:history.html:g' hist.html > history.html
$(RM) hist.html
info: $(INFOOBJ)
@ -98,7 +135,7 @@ readline.0: readline.3
clean:
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
*.fns *.kys *.tps *.vrs *.o core
*.fns *.kys *.tps *.vrs *.bt *.bts *.o core
distclean: clean
$(RM) $(CREATED_DOCS)
@ -112,8 +149,8 @@ maintainer-clean: clean
$(RM) $(INTERMEDIATE_OBJ)
$(RM) Makefile
installdirs: $(top_srcdir)/support/mkdirs
-$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir)
installdirs: $(topdir)/support/mkdirs
-$(SHELL) $(topdir)/support/mkdirs $(infodir) $(man3dir)
install: installdirs
if test -f readline.info; then \
@ -121,12 +158,17 @@ install: installdirs
else \
${INSTALL_DATA} $(srcdir)/readline.info $(infodir)/readline.info; \
fi
if test -f rluserman.info; then \
${INSTALL_DATA} rluserman.info $(infodir)/rluserman.info; \
else \
${INSTALL_DATA} $(srcdir)/rluserman.info $(infodir)/rluserman.info; \
fi
if test -f history.info; then \
${INSTALL_DATA} history.info $(infodir)/history.info; \
else \
${INSTALL_DATA} $(srcdir)/history.info $(infodir)/history.info; \
fi
if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(infodir)/dir $(infodir)/readline.info ; \
install-info --dir-file=$(infodir)/dir $(infodir)/history.info ; \
else true; fi
@ -134,5 +176,6 @@ install: installdirs
uninstall:
$(RM) $(infodir)/readline.info
$(RM) $(infodir)/rluserman.info
$(RM) $(infodir)/history.info
$(RM) $(man3dir)/readline.3

View File

@ -55,8 +55,8 @@ provides a consistent user interface for recalling lines of previously
typed input.
Published by the Free Software Foundation @*
675 Massachusetts Avenue, @*
Cambridge, MA 02139 USA
59 Temple Place, Suite 330, @*
Boston, MA 02111 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,811 +0,0 @@
This is Info file history.info, produced by Makeinfo version 1.68 from
the input file /usr/homes/chet/src/bash/readline-src/doc/hist.texinfo.
INFO-DIR-SECTION Libraries
START-INFO-DIR-ENTRY
* History: (history). The GNU history library API
END-INFO-DIR-ENTRY
This document describes the GNU History library, a programming tool
that provides a consistent user interface for recalling lines of
previously typed input.
Copyright (C) 1988-1999 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice pare
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Free Software Foundation.

File: history.info, Node: Top, Next: Using History Interactively, Up: (dir)
GNU History Library
*******************
This document describes the GNU History library, a programming tool
that provides a consistent user interface for recalling lines of
previously typed input.
* Menu:
* Using History Interactively:: GNU History User's Manual.
* Programming with GNU History:: GNU History Programmer's Manual.
* Concept Index:: Index of concepts described in this manual.
* Function and Variable Index:: Index of externally visible functions
and variables.

File: history.info, Node: Using History Interactively, Next: Programming with GNU History, Prev: Top, Up: Top
Using History Interactively
***************************
This chapter describes how to use the GNU History Library
interactively, from a user's standpoint. It should be considered a
user's guide. For information on using the GNU History Library in your
own programs, *note Programming with GNU History::..
* Menu:
* History Interaction:: What it feels like using History as a user.

File: history.info, Node: History Interaction, Up: Using History Interactively
History Expansion
=================
The History library provides a history expansion feature that is
similar to the history expansion provided by `csh'. This section
describes the syntax used to manipulate the history information.
History expansions introduce words from the history list into the
input stream, making it easy to repeat commands, insert the arguments
to a previous command into the current input line, or fix errors in
previous commands quickly.
History expansion takes place in two parts. The first is to
determine which line from the history list should be used during
substitution. The second is to select portions of that line for
inclusion into the current one. The line selected from the history is
called the "event", and the portions of that line that are acted upon
are called "words". Various "modifiers" are available to manipulate
the selected words. The line is broken into words in the same fashion
that Bash does, so that several words surrounded by quotes are
considered one word. History expansions are introduced by the
appearance of the history expansion character, which is `!' by default.
* Menu:
* Event Designators:: How to specify which history line to use.
* Word Designators:: Specifying which words are of interest.
* Modifiers:: Modifying the results of substitution.

File: history.info, Node: Event Designators, Next: Word Designators, Up: History Interaction
Event Designators
-----------------
An event designator is a reference to a command line entry in the
history list.
`!'
Start a history substitution, except when followed by a space, tab,
the end of the line, `=' or `('.
`!N'
Refer to command line N.
`!-N'
Refer to the command N lines back.
`!!'
Refer to the previous command. This is a synonym for `!-1'.
`!STRING'
Refer to the most recent command starting with STRING.
`!?STRING[?]'
Refer to the most recent command containing STRING. The trailing
`?' may be omitted if the STRING is followed immediately by a
newline.
`^STRING1^STRING2^'
Quick Substitution. Repeat the last command, replacing STRING1
with STRING2. Equivalent to `!!:s/STRING1/STRING2/'.
`!#'
The entire command line typed so far.

File: history.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction
Word Designators
----------------
Word designators are used to select desired words from the event. A
`:' separates the event specification from the word designator. It may
be omitted if the word designator begins with a `^', `$', `*', `-', or
`%'. Words are numbered from the beginning of the line, with the first
word being denoted by 0 (zero). Words are inserted into the current
line separated by single spaces.
For example,
`!!'
designates the preceding command. When you type this, the
preceding command is repeated in toto.
`!!:$'
designates the last argument of the preceding command. This may be
shortened to `!$'.
`!fi:2'
designates the second argument of the most recent command starting
with the letters `fi'.
Here are the word designators:
`0 (zero)'
The `0'th word. For many applications, this is the command word.
`N'
The Nth word.
`^'
The first argument; that is, word 1.
`$'
The last argument.
`%'
The word matched by the most recent `?STRING?' search.
`X-Y'
A range of words; `-Y' abbreviates `0-Y'.
`*'
All of the words, except the `0'th. This is a synonym for `1-$'.
It is not an error to use `*' if there is just one word in the
event; the empty string is returned in that case.
`X*'
Abbreviates `X-$'
`X-'
Abbreviates `X-$' like `X*', but omits the last word.
If a word designator is supplied without an event specification, the
previous command is used as the event.

File: history.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction
Modifiers
---------
After the optional word designator, you can add a sequence of one or
more of the following modifiers, each preceded by a `:'.
`h'
Remove a trailing pathname component, leaving only the head.
`t'
Remove all leading pathname components, leaving the tail.
`r'
Remove a trailing suffix of the form `.SUFFIX', leaving the
basename.
`e'
Remove all but the trailing suffix.
`p'
Print the new command but do not execute it.
`s/OLD/NEW/'
Substitute NEW for the first occurrence of OLD in the event line.
Any delimiter may be used in place of `/'. The delimiter may be
quoted in OLD and NEW with a single backslash. If `&' appears in
NEW, it is replaced by OLD. A single backslash will quote the
`&'. The final delimiter is optional if it is the last character
on the input line.
`&'
Repeat the previous substitution.
`g'
Cause changes to be applied over the entire event line. Used in
conjunction with `s', as in `gs/OLD/NEW/', or with `&'.

File: history.info, Node: Programming with GNU History, Next: Concept Index, Prev: Using History Interactively, Up: Top
Programming with GNU History
****************************
This chapter describes how to interface programs that you write with
the GNU History Library. It should be considered a technical guide.
For information on the interactive use of GNU History, *note Using
History Interactively::..
* Menu:
* Introduction to History:: What is the GNU History library for?
* History Storage:: How information is stored.
* History Functions:: Functions that you can use.
* History Variables:: Variables that control behaviour.
* History Programming Example:: Example of using the GNU History Library.

File: history.info, Node: Introduction to History, Next: History Storage, Up: Programming with GNU History
Introduction to History
=======================
Many programs read input from the user a line at a time. The GNU
History library is able to keep track of those lines, associate
arbitrary data with each line, and utilize information from previous
lines in composing new ones.
The programmer using the History library has available functions for
remembering lines on a history list, associating arbitrary data with a
line, removing lines from the list, searching through the list for a
line containing an arbitrary text string, and referencing any line in
the list directly. In addition, a history "expansion" function is
available which provides for a consistent user interface across
different programs.
The user using programs written with the History library has the
benefit of a consistent user interface with a set of well-known
commands for manipulating the text of previous lines and using that text
in new commands. The basic history manipulation commands are similar to
the history substitution provided by `csh'.
If the programmer desires, he can use the Readline library, which
includes some history manipulation by default, and has the added
advantage of command line editing.
Before declaring any functions using any functionality the History
library provides in other code, an application writer should include
the file `<readline/history.h>' in any file that uses the History
library's features. It supplies extern declarations for all of the
library's public functions and variables, and declares all of the
public data structures.

File: history.info, Node: History Storage, Next: History Functions, Prev: Introduction to History, Up: Programming with GNU History
History Storage
===============
The history list is an array of history entries. A history entry is
declared as follows:
typedef struct _hist_entry {
char *line;
char *data;
} HIST_ENTRY;
The history list itself might therefore be declared as
HIST_ENTRY **the_history_list;
The state of the History library is encapsulated into a single
structure:
/* A structure used to pass the current state of the history stuff around. */
typedef struct _hist_state {
HIST_ENTRY **entries; /* Pointer to the entries themselves. */
int offset; /* The location pointer within this array. */
int length; /* Number of elements within this array. */
int size; /* Number of slots allocated to this array. */
int flags;
} HISTORY_STATE;
If the flags member includes `HS_STIFLED', the history has been
stifled.

File: history.info, Node: History Functions, Next: History Variables, Prev: History Storage, Up: Programming with GNU History
History Functions
=================
This section describes the calling sequence for the various functions
present in GNU History.
* Menu:
* Initializing History and State Management:: Functions to call when you
want to use history in a
program.
* History List Management:: Functions used to manage the list
of history entries.
* Information About the History List:: Functions returning information about
the history list.
* Moving Around the History List:: Functions used to change the position
in the history list.
* Searching the History List:: Functions to search the history list
for entries containing a string.
* Managing the History File:: Functions that read and write a file
containing the history list.
* History Expansion:: Functions to perform csh-like history
expansion.

File: history.info, Node: Initializing History and State Management, Next: History List Management, Up: History Functions
Initializing History and State Management
-----------------------------------------
This section describes functions used to initialize and manage the
state of the History library when you want to use the history functions
in your program.
- Function: void using_history ()
Begin a session in which the history functions might be used. This
initializes the interactive variables.
- Function: HISTORY_STATE * history_get_history_state ()
Return a structure describing the current state of the input
history.
- Function: void history_set_history_state (HISTORY_STATE *state)
Set the state of the history list according to STATE.

File: history.info, Node: History List Management, Next: Information About the History List, Prev: Initializing History and State Management, Up: History Functions
History List Management
-----------------------
These functions manage individual entries on the history list, or set
parameters managing the list itself.
- Function: void add_history (char *string)
Place STRING at the end of the history list. The associated data
field (if any) is set to `NULL'.
- Function: HIST_ENTRY * remove_history (int which)
Remove history entry at offset WHICH from the history. The
removed element is returned so you can free the line, data, and
containing structure.
- Function: HIST_ENTRY * replace_history_entry (int which, char *line,
char *data)
Make the history entry at offset 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.
- Function: void clear_history ()
Clear the history list by deleting all the entries.
- Function: void stifle_history (int max)
Stifle the history list, remembering only the last MAX entries.
- Function: int unstifle_history ()
Stop stifling the history. This returns the previous amount the
history was stifled. The value is positive if the history was
stifled, negative if it wasn't.
- Function: int history_is_stifled ()
Returns non-zero if the history is stifled, zero if it is not.

File: history.info, Node: Information About the History List, Next: Moving Around the History List, Prev: History List Management, Up: History Functions
Information About the History List
----------------------------------
These functions return information about the entire history list or
individual list entries.
- Function: HIST_ENTRY ** 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'.
- Function: int where_history ()
Returns the offset of the current history element.
- Function: HIST_ENTRY * current_history ()
Return the history entry at the current position, as determined by
`where_history ()'. If there is no entry there, return a `NULL'
pointer.
- Function: HIST_ENTRY * history_get (int offset)
Return the history entry at position OFFSET, starting from
`history_base'. If there is no entry there, or if OFFSET is
greater than the history length, return a `NULL' pointer.
- Function: int history_total_bytes ()
Return the number of bytes that the primary history entries are
using. This function returns the sum of the lengths of all the
lines in the history.

File: history.info, Node: Moving Around the History List, Next: Searching the History List, Prev: Information About the History List, Up: History Functions
Moving Around the History List
------------------------------
These functions allow the current index into the history list to be
set or changed.
- Function: int history_set_pos (int pos)
Set the position in the history list to POS, an absolute index
into the list.
- Function: HIST_ENTRY * previous_history ()
Back up the current history offset to the previous history entry,
and return a pointer to that entry. If there is no previous
entry, return a `NULL' pointer.
- Function: HIST_ENTRY * next_history ()
Move the current history offset forward to the next history entry,
and return the a pointer to that entry. If there is no next
entry, return a `NULL' pointer.

File: history.info, Node: Searching the History List, Next: Managing the History File, Prev: Moving Around the History List, Up: History Functions
Searching the History List
--------------------------
These functions allow searching of the history list for entries
containing a specific string. Searching may be performed both forward
and backward from the current history position. The search may be
"anchored", meaning that the string must match at the beginning of the
history entry.
- Function: int history_search (char *string, int direction)
Search the history for STRING, starting at the current history
offset. If DIRECTION < 0, then the search is through previous
entries, else through subsequent. If STRING is found, then the
current history index is set to that history entry, and the value
returned is the offset in the line of the entry where STRING was
found. Otherwise, nothing is changed, and a -1 is returned.
- Function: int history_search_prefix (char *string, int direction)
Search the history for STRING, starting at the current history
offset. The search is anchored: matching lines must begin with
STRING. If DIRECTION < 0, then the search is through previous
entries, else through subsequent. If STRING is found, then the
current history index is set to that entry, and the return value
is 0. Otherwise, nothing is changed, and a -1 is returned.
- Function: int history_search_pos (char *string, int direction, int
pos)
Search for STRING in the history list, starting at POS, an
absolute index into the list. If DIRECTION is negative, the search
proceeds backward from POS, otherwise forward. Returns the
absolute index of the history element where STRING was found, or
-1 otherwise.

File: history.info, Node: Managing the History File, Next: History Expansion, Prev: Searching the History List, Up: History Functions
Managing the History File
-------------------------
The History library can read the history from and write it to a file.
This section documents the functions for managing a history file.
- Function: int read_history (char *filename)
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.
- Function: int read_history_range (char *filename, int from, int to)
Read a range of lines from FILENAME, adding them to the history
list. Start reading at line FROM and end at TO. If FROM is zero,
start at the beginning. If TO is less than FROM, then read until
the end of the file. If FILENAME is `NULL', then read from
`~/.history'. Returns 0 if successful, or `errno' if not.
- Function: int write_history (char *filename)
Write the current history to FILENAME, overwriting FILENAME if
necessary. If FILENAME is `NULL', then write the history list to
`~/.history'. Values returned are as in `read_history ()'.
- Function: int append_history (int nelements, char *filename)
Append the last NELEMENTS of the history list to FILENAME.
- Function: int history_truncate_file (char *filename, int nlines)
Truncate the history file FILENAME, leaving only the last NLINES
lines.

File: history.info, Node: History Expansion, Prev: Managing the History File, Up: History Functions
History Expansion
-----------------
These functions implement `csh'-like history expansion.
- Function: int history_expand (char *string, char **output)
Expand STRING, placing the result into OUTPUT, a pointer to a
string (*note History Interaction::.). Returns:
`0'
If no expansions took place (or, if the only change in the
text was the de-slashifying of the history expansion
character);
`1'
if expansions did take place;
`-1'
if there was an error in expansion;
`2'
if the returned line should be displayed, but not executed,
as with the `:p' modifier (*note Modifiers::.).
If an error ocurred in expansion, then OUTPUT contains a
descriptive error message.
- Function: char * history_arg_extract (int first, int last, char
*string)
Extract a string segment consisting of the FIRST through LAST
arguments present in STRING. Arguments are broken up as in Bash.
- Function: char * get_history_event (char *string, int *cindex, int
qchar)
Returns the text of the history event beginning at STRING +
*CINDEX. *CINDEX is modified to point to after the event
specifier. At function entry, CINDEX points to the index into
STRING where the history event specification begins. QCHAR is a
character that is allowed to end the event specification in
addition to the "normal" terminating characters.
- Function: char ** history_tokenize (char *string)
Return an array of tokens parsed out of STRING, much as the shell
might. The tokens are split on white space and on the characters
`()<>;&|$', and shell quoting conventions are obeyed.

File: history.info, Node: History Variables, Next: History Programming Example, Prev: History Functions, Up: Programming with GNU History
History Variables
=================
This section describes the externally visible variables exported by
the GNU History Library.
- Variable: int history_base
The logical offset of the first entry in the history list.
- Variable: int history_length
The number of entries currently stored in the history list.
- Variable: int max_input_history
The maximum number of history entries. This must be changed using
`stifle_history ()'.
- Variable: char history_expansion_char
The character that starts a history event. The default is `!'.
- Variable: char history_subst_char
The character that invokes word substitution if found at the start
of a line. The default is `^'.
- Variable: char history_comment_char
During tokenization, if this character is seen as the first
character of a word, then it and all subsequent characters up to a
newline are ignored, suppressing history expansion for the
remainder of the line. This is disabled by default.
- Variable: char * history_no_expand_chars
The list of characters which inhibit history expansion if found
immediately following HISTORY_EXPANSION_CHAR. The default is
whitespace and `='.
- Variable: char * history_search_delimiter_chars
The list of additional characters which can delimit a history
search string, in addition to whitespace, `:' and `?' in the case
of a substring search. The default is empty.
- Variable: int history_quotes_inhibit_expansion
If non-zero, single-quoted words are not scanned for the history
expansion character. The default value is 0.
- Variable: Function * history_inhibit_expansion_function
This should be set to the address of a function that takes two
arguments: a `char *' (STRING) and an integer index into that
string (I). It should return a non-zero value if the history
expansion starting at STRING[I] should not be performed; zero if
the expansion should be done. It is intended for use by
applications like Bash that use the history expansion character
for additional purposes. By default, this variable is set to NULL.

File: history.info, Node: History Programming Example, Prev: History Variables, Up: Programming with GNU History
History Programming Example
===========================
The following program demonstrates simple use of the GNU History
Library.
main ()
{
char line[1024], *t;
int len, done = 0;
line[0] = 0;
using_history ();
while (!done)
{
printf ("history$ ");
fflush (stdout);
t = fgets (line, sizeof (line) - 1, stdin);
if (t && *t)
{
len = strlen (t);
if (t[len - 1] == '\n')
t[len - 1] = '\0';
}
if (!t)
strcpy (line, "quit");
if (line[0])
{
char *expansion;
int result;
result = history_expand (line, &expansion);
if (result)
fprintf (stderr, "%s\n", expansion);
if (result < 0 || result == 2)
{
free (expansion);
continue;
}
add_history (expansion);
strncpy (line, expansion, sizeof (line) - 1);
free (expansion);
}
if (strcmp (line, "quit") == 0)
done = 1;
else if (strcmp (line, "save") == 0)
write_history ("history_file");
else if (strcmp (line, "read") == 0)
read_history ("history_file");
else if (strcmp (line, "list") == 0)
{
register HIST_ENTRY **the_list;
register int i;
the_list = history_list ();
if (the_list)
for (i = 0; the_list[i]; i++)
printf ("%d: %s\n", i + history_base, the_list[i]->line);
}
else if (strncmp (line, "delete", 6) == 0)
{
int which;
if ((sscanf (line + 6, "%d", &which)) == 1)
{
HIST_ENTRY *entry = remove_history (which);
if (!entry)
fprintf (stderr, "No such entry %d\n", which);
else
{
free (entry->line);
free (entry);
}
}
else
{
fprintf (stderr, "non-numeric arg given to `delete'\n");
}
}
}
}

File: history.info, Node: Concept Index, Next: Function and Variable Index, Prev: Programming with GNU History, Up: Top
Concept Index
*************
* Menu:
* anchored search: Searching the History List.
* event designators: Event Designators.
* history events: Event Designators.
* history expansion: History Interaction.
* History Searching: Searching the History List.

File: history.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
Function and Variable Index
***************************
* Menu:
* add_history: History List Management.
* append_history: Managing the History File.
* clear_history: History List Management.
* current_history: Information About the History List.
* get_history_event: History Expansion.
* history_arg_extract: History Expansion.
* history_base: History Variables.
* history_comment_char: History Variables.
* history_expand: History Expansion.
* history_expansion_char: History Variables.
* history_get: Information About the History List.
* history_get_history_state: Initializing History and State Management.
* history_inhibit_expansion_function: History Variables.
* history_is_stifled: History List Management.
* history_length: History Variables.
* history_list: Information About the History List.
* history_no_expand_chars: History Variables.
* history_quotes_inhibit_expansion: History Variables.
* history_search: Searching the History List.
* history_search_delimiter_chars: History Variables.
* history_search_pos: Searching the History List.
* history_search_prefix: Searching the History List.
* history_set_history_state: Initializing History and State Management.
* history_set_pos: Moving Around the History List.
* history_subst_char: History Variables.
* history_tokenize: History Expansion.
* history_total_bytes: Information About the History List.
* history_truncate_file: Managing the History File.
* max_input_history: History Variables.
* next_history: Moving Around the History List.
* previous_history: Moving Around the History List.
* read_history: Managing the History File.
* read_history_range: Managing the History File.
* remove_history: History List Management.
* replace_history_entry: History List Management.
* stifle_history: History List Management.
* unstifle_history: History List Management.
* using_history: Initializing History and State Management.
* where_history: Information About the History List.
* write_history: Managing the History File.

Tag Table:
Node: Top1162
Node: Using History Interactively1742
Node: History Interaction2250
Node: Event Designators3669
Node: Word Designators4596
Node: Modifiers6225
Node: Programming with GNU History7363
Node: Introduction to History8089
Node: History Storage9774
Node: History Functions10867
Node: Initializing History and State Management11838
Node: History List Management12630
Node: Information About the History List14151
Node: Moving Around the History List15457
Node: Searching the History List16342
Node: Managing the History File18174
Node: History Expansion19680
Node: History Variables21519
Node: History Programming Example23837
Node: Concept Index26441
Node: Function and Variable Index26927

End Tag Table

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,13 @@ If the programmer desires, he can use the Readline library, which
includes some history manipulation by default, and has the added
advantage of command line editing.
Before declaring any functions using any functionality the History
library provides in other code, an application writer should include
the file @code{<readline/history.h>} in any file that uses the
History library's features. It supplies extern declarations for all
of the library's public functions and variables, and declares all of
the public data structures.
@node History Storage
@section History Storage
@ -334,7 +341,7 @@ if expansions did take place;
@item -1
if there was an error in expansion;
@item 2
if the returned line should only be displayed, but not executed,
if the returned line should be displayed, but not executed,
as with the @code{:p} modifier (@pxref{Modifiers}).
@end table

View File

@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
Copyright (C) 1988-1999 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@ -26,11 +26,16 @@ into another language, under the above conditions for modified versions.
@node Using History Interactively
@chapter Using History Interactively
@ifclear BashFeatures
@defcodeindex bt
@end ifclear
@ifset BashFeatures
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the GNU History Library in other programs,
see the GNU Readline Library Manual.
This chapter describes how to use the @sc{gnu} History Library
interactively, from a user's standpoint.
It should be considered a user's guide.
For information on using the @sc{gnu} History Library in other programs,
see the @sc{gnu} Readline Library Manual.
@end ifset
@ifclear BashFeatures
This chapter describes how to use the GNU History Library interactively,
@ -63,20 +68,25 @@ information on using the GNU History Library in your own programs,
When the @samp{-o history} option to the @code{set} builtin
is enabled (@pxref{The Set Builtin}),
the shell provides access to the @var{command history},
the list of commands previously typed. The text of the last
@code{HISTSIZE}
commands (default 500) is saved in a history list. The shell
stores each command in the history list prior to parameter and
variable expansion
the list of commands previously typed.
The value of the @code{HISTSIZE} shell variable is used as the
number of commands to save in a history list.
The text of the last @code{$HISTSIZE}
commands (default 500) is saved.
The shell stores each command in the history list prior to
parameter and variable expansion
but after history expansion is performed, subject to the
values of the shell variables
@code{HISTIGNORE} and @code{HISTCONTROL}.
When the shell starts up, the history is initialized from the
file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
@code{HISTFILE} is truncated, if necessary, to contain no more than
the number of lines specified by the value of the @code{HISTFILESIZE}
variable. When an interactive shell exits, the last
@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
The file named by the value of @code{HISTFILE} is truncated, if
necessary, to contain no more than the number of lines specified by
the value of the @code{HISTFILESIZE} variable.
When an interactive shell exits, the last
@code{$HISTSIZE} lines are copied from the history list to the file
named by @code{$HISTFILE}.
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
the lines are appended to the history file,
otherwise the history file is overwritten.
@ -88,11 +98,11 @@ lines. If @code{HISTFILESIZE} is not set, no truncation is performed.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
The @code{history} builtin can be used to display or modify the history
The @code{history} builtin may be used to display or modify the history
list and manipulate the history file.
When using the command-line editing, search commands
When using command-line editing, search commands
are available in each editing mode that provide access to the
history list.
history list (@pxref{Commands For History}).
The shell allows control over which commands are saved on the history
list. The @code{HISTCONTROL} and @code{HISTIGNORE}
@ -105,19 +115,20 @@ semicolons where necessary to preserve syntactic correctness.
The @code{lithist}
shell option causes the shell to save the command with embedded newlines
instead of semicolons.
The @code{shopt} builtin is used to set these options.
@xref{Bash Builtins}, for a description of @code{shopt}.
@node Bash History Builtins
@section Bash History Builtins
@cindex history builtins
Bash provides two builtin commands that allow you to manipulate the
Bash provides two builtin commands which manipulate the
history list and history file.
@table @code
@item fc
@comment btindex fc
@btindex fc
@example
@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@ -149,25 +160,29 @@ that typing @samp{r cc} runs the last command beginning with @code{cc}
and typing @samp{r} re-executes the last command (@pxref{Aliases}).
@item history
@comment btindex history
@btindex history
@example
history [-c] [@var{n}]
history [@var{n}]
history -c
history -d @var{offset}
history [-anrw] [@var{filename}]
history -ps @var{arg}
@end example
Display the history list with line numbers. Lines prefixed with
with a @samp{*} have been modified. An argument of @var{n} says
to list only the last @var{n} lines. Options, if supplied, have
the following meanings:
With no options, display the history list with line numbers.
Lines prefixed with with a @samp{*} have been modified.
An argument of @var{n} lists only the last @var{n} lines.
Options, if supplied, have the following meanings:
@table @code
@item -w
Write out the current history to the history file.
@item -c
Clear the history list. This may be combined
with the other options to replace the history list completely.
@item -r
Read the current history file and append its contents to
the history list.
@item -d @var{offset}
Delete the history entry at position @var{offset}.
@var{offset} should be specified as it appears when the history is
displayed.
@item -a
Append the new
@ -179,20 +194,24 @@ Append the history lines not already read from the history file
to the current history list. These are lines appended to the history
file since the beginning of the current Bash session.
@item -c
Clear the history list. This may be combined
with the other options to replace the history list completely.
@item -r
Read the current history file and append its contents to
the history list.
@item -w
Write out the current history to the history file.
@item -p
Perform history substitution on the @var{arg}s and display the result
on the standard output, without storing the results in the history list.
@item -s
The @var{arg}s are added to the end of
the history list as a single entry.
@item -p
Perform history substitution on the @var{arg}s and display the result
on the standard output, without storing the results in the history list.
@end table
When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is
used, if @var{filename}
is given, then it is used as the history file. If not, then
the value of the @code{HISTFILE} variable is used.
@ -309,6 +328,26 @@ may be omitted if the word designator begins with a @samp{^}, @samp{$},
of the line, with the first word being denoted by 0 (zero). Words are
inserted into the current line separated by single spaces.
@need 0.75
For example,
@table @code
@item !!
designates the preceding command. When you type this, the preceding
command is repeated in toto.
@item !!:$
designates the last argument of the preceding command. This may be
shortened to @code{!$}.
@item !fi:2
designates the second argument of the most recent command starting with
the letters @code{fi}.
@end table
@need 0.75
Here are the word designators:
@table @code
@item 0 (zero)

View File

@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
Copyright (C) 1988-1999 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@ -26,16 +26,21 @@ into another language, under the above conditions for modified versions.
@node Using History Interactively
@chapter Using History Interactively
@c @ifclear BashFeatures
@c @defcodeindex bt
@c @end ifclear
@ifset BashFeatures
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint. It should be considered a user's guide. For
information on using the GNU History Library in other programs,
see the GNU Readline Library Manual.
This chapter describes how to use the @sc{gnu} History Library
interactively, from a user's standpoint.
It should be considered a user's guide.
For information on using the @sc{gnu} History Library in other programs,
see the @sc{gnu} Readline Library Manual.
@end ifset
@ifclear BashFeatures
This chapter describes how to use the GNU History Library interactively,
from a user's standpoint. It should be considered a user's guide.
@c For
from a user's standpoint. It should be considered a user's guide.
@c For
@c information on using the GNU History Library in your own programs,
@c @pxref{Programming with GNU History}.
@end ifclear
@ -64,20 +69,25 @@ from a user's standpoint. It should be considered a user's guide.
When the @samp{-o history} option to the @code{set} builtin
is enabled (@pxref{The Set Builtin}),
the shell provides access to the @var{command history},
the list of commands previously typed. The text of the last
@code{HISTSIZE}
commands (default 500) is saved in a history list. The shell
stores each command in the history list prior to parameter and
variable expansion
the list of commands previously typed.
The value of the @code{HISTSIZE} shell variable is used as the
number of commands to save in a history list.
The text of the last @code{$HISTSIZE}
commands (default 500) is saved.
The shell stores each command in the history list prior to
parameter and variable expansion
but after history expansion is performed, subject to the
values of the shell variables
@code{HISTIGNORE} and @code{HISTCONTROL}.
When the shell starts up, the history is initialized from the
file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
@code{HISTFILE} is truncated, if necessary, to contain no more than
the number of lines specified by the value of the @code{HISTFILESIZE}
variable. When an interactive shell exits, the last
@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
The file named by the value of @code{HISTFILE} is truncated, if
necessary, to contain no more than the number of lines specified by
the value of the @code{HISTFILESIZE} variable.
When an interactive shell exits, the last
@code{$HISTSIZE} lines are copied from the history list to the file
named by @code{$HISTFILE}.
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
the lines are appended to the history file,
otherwise the history file is overwritten.
@ -89,11 +99,11 @@ lines. If @code{HISTFILESIZE} is not set, no truncation is performed.
The builtin command @code{fc} may be used to list or edit and re-execute
a portion of the history list.
The @code{history} builtin can be used to display or modify the history
The @code{history} builtin may be used to display or modify the history
list and manipulate the history file.
When using the command-line editing, search commands
When using command-line editing, search commands
are available in each editing mode that provide access to the
history list.
history list (@pxref{Commands For History}).
The shell allows control over which commands are saved on the history
list. The @code{HISTCONTROL} and @code{HISTIGNORE}
@ -106,19 +116,20 @@ semicolons where necessary to preserve syntactic correctness.
The @code{lithist}
shell option causes the shell to save the command with embedded newlines
instead of semicolons.
The @code{shopt} builtin is used to set these options.
@xref{Bash Builtins}, for a description of @code{shopt}.
@node Bash History Builtins
@section Bash History Builtins
@cindex history builtins
Bash provides two builtin commands that allow you to manipulate the
Bash provides two builtin commands which manipulate the
history list and history file.
@table @code
@item fc
@c btindex fc
@btindex fc
@example
@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@ -150,25 +161,29 @@ that typing @samp{r cc} runs the last command beginning with @code{cc}
and typing @samp{r} re-executes the last command (@pxref{Aliases}).
@item history
@c btindex history
@btindex history
@example
history [-c] [@var{n}]
history [@var{n}]
history -c
history -d @var{offset}
history [-anrw] [@var{filename}]
history -ps @var{arg}
@end example
Display the history list with line numbers. Lines prefixed with
with a @samp{*} have been modified. An argument of @var{n} says
to list only the last @var{n} lines. Options, if supplied, have
the following meanings:
With no options, display the history list with line numbers.
Lines prefixed with with a @samp{*} have been modified.
An argument of @var{n} lists only the last @var{n} lines.
Options, if supplied, have the following meanings:
@table @code
@item -w
Write out the current history to the history file.
@item -c
Clear the history list. This may be combined
with the other options to replace the history list completely.
@item -r
Read the current history file and append its contents to
the history list.
@item -d @var{offset}
Delete the history entry at position @var{offset}.
@var{offset} should be specified as it appears when the history is
displayed.
@item -a
Append the new
@ -180,20 +195,24 @@ Append the history lines not already read from the history file
to the current history list. These are lines appended to the history
file since the beginning of the current Bash session.
@item -c
Clear the history list. This may be combined
with the other options to replace the history list completely.
@item -r
Read the current history file and append its contents to
the history list.
@item -w
Write out the current history to the history file.
@item -p
Perform history substitution on the @var{arg}s and display the result
on the standard output, without storing the results in the history list.
@item -s
The @var{arg}s are added to the end of
the history list as a single entry.
@item -p
Perform history substitution on the @var{arg}s and display the result
on the standard output, without storing the results in the history list.
@end table
When the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} option is
When any of the @samp{-w}, @samp{-r}, @samp{-a}, or @samp{-n} options is
used, if @var{filename}
is given, then it is used as the history file. If not, then
the value of the @code{HISTFILE} variable is used.
@ -310,6 +329,26 @@ may be omitted if the word designator begins with a @samp{^}, @samp{$},
of the line, with the first word being denoted by 0 (zero). Words are
inserted into the current line separated by single spaces.
@need 0.75
For example,
@table @code
@item !!
designates the preceding command. When you type this, the preceding
command is repeated in toto.
@item !!:$
designates the last argument of the preceding command. This may be
shortened to @code{!$}.
@item !fi:2
designates the second argument of the most recent command starting with
the letters @code{fi}.
@end table
@need 0.75
Here are the word designators:
@table @code
@item 0 (zero)

View File

@ -1,6 +1,6 @@
@set EDITION 4.0
@set VERSION 4.0
@set UPDATED 31 December 1998
@set UPDATE-MONTH December 1998
@set EDITION 4.1
@set VERSION 4.1
@set UPDATED 2000 January 19
@set UPDATE-MONTH January 2000
@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998
@set LASTCHANGE Wed Jan 19 12:16:30 EST 2000

View File

@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet@ins.CWRU.Edu
.\"
.\" Last Change: Thu Dec 31 10:16:30 EST 1998
.\" Last Change: Tue Jun 1 13:28:03 EDT 1999
.\"
.TH READLINE 3 "1998 Dec 31" GNU
.TH READLINE 3 "1999 Jun 1" GNU
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@ -148,6 +148,7 @@ processing key bindings:
.IR SPACE ,
and
.IR TAB .
.PP
In addition to command names, readline allows keys to be bound
to a string that is inserted when the key is pressed (a \fImacro\fP).
.PP
@ -564,7 +565,7 @@ Move forward to the end of the next word. Words are composed of
alphanumeric characters (letters and digits).
.TP
.B backward\-word (M\-b)
Move back to the start of this, or the previous, word. Words are
Move back to the start of the current or previous word. Words are
composed of alphanumeric characters (letters and digits).
.TP
.B clear\-screen (C\-l)
@ -1172,9 +1173,9 @@ VI Command Mode functions
Individual \fBreadline\fP initialization file
.PD
.SH AUTHORS
Brian Fox, Free Software Foundation (primary author)
Brian Fox, Free Software Foundation
.br
bfox@ai.MIT.Edu
bfox@gnu.org
.PP
Chet Ramey, Case Western Reserve University
.br

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,8 @@ in the consistency of user interface across discrete programs that need
to provide a command line interface.
Published by the Free Software Foundation @*
675 Massachusetts Avenue, @*
Cambridge, MA 02139 USA
59 Temple Place, Suite 330, @*
Boston, MA 02111 USA
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice

View File

@ -167,6 +167,13 @@ programs. This section describes the various functions and variables
defined within the Readline library which allow a user program to add
customized functionality to Readline.
Before declaring any functions that customize Readline's behavior, or
using any functionality Readline provides in other code, an
application writer should include the file @code{<readline/readline.h>}
in any file that uses Readline's features. Since some of the definitions
in @code{readline.h} use the @code{stdio} library, the file
@code{<stdio.h>} should be included before @code{readline.h}.
@menu
* The Function Type:: C declarations to make code readable.
* Function Writing:: Variables and calling conventions.
@ -241,7 +248,9 @@ These variables are available to function writers.
@deftypevar {char *} rl_line_buffer
This is the line gathered so far. You are welcome to modify the
contents of the line, but see @ref{Allowing Undoing}.
contents of the line, but see @ref{Allowing Undoing}. The
function @code{rl_extend_line_buffer} is available to increase
the memory allocated to @code{rl_line_buffer}.
@end deftypevar
@deftypevar int rl_point
@ -282,6 +291,16 @@ The prompt Readline uses. This is set from the argument to
@code{readline ()}, and should not be assigned to directly.
@end deftypevar
@deftypevar int rl_already_prompted
If an application wishes to display the prompt itself, rather than have
Readline do it the first time @code{readline()} is called, it should set
this variable to a non-zero value after displaying the prompt.
The prompt must also be passed as the argument to @code{readline()} so
the redisplay functions can update the display properly.
The calling application is responsible for managing the value; Readline
never sets it.
@end deftypevar
@deftypevar {char *} rl_library_version
The version number of this revision of the library.
@end deftypevar
@ -447,6 +466,13 @@ several internal keymaps: @code{emacs_standard_keymap},
@code{emacs_standard_keymap} is the default, and the examples in
this manual assume that.
Since @code{readline} installs a set of default key bindings the first
time it is called, there is always the danger that a custom binding
installed before the first call to @code{readline} will be overridden.
An alternate mechanism is to install custom key bindings in an
initialization function assigned to the @code{rl_startup_hook} variable
(@pxref{Readline Variables}).
These functions manage key bindings.
@deftypefun int rl_bind_key (int key, Function *function)
@ -534,6 +560,12 @@ the list is formatted in such a way that it can be made part of an
Print the names of all bindable Readline functions to @code{rl_outstream}.
@end deftypefun
@deftypefun {char **} rl_funmap_names ()
Return a NULL terminated array of known function names. The array is
sorted. The array itself is allocated, but not the strings inside. You
should free () the array when you done, but not the pointrs.
@end deftypefun
@node Allowing Undoing
@subsection Allowing Undoing
@ -615,10 +647,19 @@ Readline thinks the screen display is correct.
@end deftypefun
@deftypefun int rl_on_new_line ()
Tell the update routines that we have moved onto a new (empty) line,
Tell the update functions that we have moved onto a new (empty) line,
usually after ouputting a newline.
@end deftypefun
@deftypefun int rl_on_new_line_with_prompt ()
Tell the update functions that we have moved onto a new line, with
@var{rl_prompt} already displayed.
This could be used by applications that want to output the prompt string
themselves, but still need Readline to know the prompt string length for
redisplay.
It should be used after setting @var{rl_already_prompted}.
@end deftypefun
@deftypefun int rl_reset_line_state ()
Reset the display state to a clean state and redisplay the current line
starting on a new line.
@ -688,7 +729,7 @@ before Readline attempts to read characters from the terminal with
@code{rl_read_key ()}.
@end deftypefun
@deftypefun rl_extend_line_buffer (int len)
@deftypefun int rl_extend_line_buffer (int len)
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
characters, possibly reallocating it if necessary.
@end deftypefun
@ -700,6 +741,8 @@ Initialize or re-initialize Readline's internal state.
@deftypefun int rl_reset_terminal (char *terminal_name)
Reinitialize Readline's idea of the terminal settings using
@var{terminal_name} as the terminal type (e.g., @code{vt100}).
If @var{terminal_name} is NULL, the value of the @code{TERM}
environment variable is used.
@end deftypefun
@deftypefun int alphabetic (int c)
@ -1106,7 +1149,7 @@ for subsequent calls.
@deftypevar {Function *} rl_completion_entry_function
A pointer to the generator function for @code{completion_matches ()}.
@code{NULL} means to use @code{filename_entry_function ()}, the default
@code{NULL} means to use @code{filename_completion_function ()}, the default
filename completer.
@end deftypevar

View File

@ -7,10 +7,10 @@
This file documents the end user interface to the GNU command line
editing features. It is to be an appendix to manuals for programs which
use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the GNU
Readline Library.
which contains both end-user and programmer documentation for the
GNU Readline Library.
Copyright (C) 1988, 1991, 1993, 1996 Free Software Foundation, Inc.
Copyright (C) 1988-1999 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@ -36,11 +36,19 @@ into another language, under the above conditions for modified versions.
@comment If you are including this manual as an appendix, then set the
@comment variable readline-appendix.
@ifclear BashFeatures
@defcodeindex bt
@end ifclear
@node Command Line Editing
@chapter Command Line Editing
This chapter describes the basic features of the @sc{GNU}
This chapter describes the basic features of the @sc{gnu}
command line editing interface.
@ifset BashFeatures
Command line editing is provided by the Readline library, which is
used by several different programs, including Bash.
@end ifset
@menu
* Introduction and Notation:: Notation used in this text.
@ -50,6 +58,12 @@ command line editing interface.
available for binding
* Readline vi Mode:: A short description of how to make Readline
behave like the vi editor.
@ifset BashFeatures
* Programmable Completion:: How to specify the possible completions for
a specific command.
* Programmable Completion Builtins:: Builtin commands to specify how to
complete arguments for a particular command.
@end ifset
@end menu
@node Introduction and Notation
@ -63,9 +77,19 @@ produced when the @key{k} key is pressed while the Control key
is depressed.
The text @key{M-k} is read as `Meta-K' and describes the character
produced when the meta key (if you have one) is depressed, and the @key{k}
key is pressed. If you do not have a meta key, the identical keystroke
can be generated by typing @key{ESC} @i{first}, and then typing @key{k}.
produced when the Meta key (if you have one) is depressed, and the @key{k}
key is pressed.
The Meta key is labeled @key{ALT} on many keyboards.
On keyboards with two keys labeled @key{ALT} (usually to either side of
the space bar), the @key{ALT} on the left side is generally set to
work as a Meta key.
The @key{ALT} key on the right may also be configured to work as a
Meta key or may be configured as some other modifier, such as a
Compose key for typing accented characters.
If you do not have a Meta or @key{ALT} key, or another key working as
a Meta key, the identical keystroke can be generated by typing @key{ESC}
@i{first}, and then typing @key{k}.
Either process is known as @dfn{metafying} the @key{k} key.
The text @key{M-C-k} is read as `Meta-Control-k' and describes the
@ -75,6 +99,10 @@ In addition, several keys have their own names. Specifically,
@key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
stand for themselves when seen in this text, or in an init file
(@pxref{Readline Init File}).
If your keyboard lacks a @key{LFD} key, typing @key{C-j} will
produce the desired character.
The @key{RET} key may be labeled @key{Return} or @key{Enter} on
some keyboards.
@node Readline Interaction
@section Readline Interaction
@ -110,8 +138,8 @@ character appears where the cursor was, and then the cursor moves one
space to the right. If you mistype a character, you can use your
erase character to back up and delete the mistyped character.
Sometimes you may miss typing a character that you wanted to type, and
not notice your error until you have typed several other characters. In
Sometimes you may mistype a character, and
not notice the error until you have typed several other characters. In
that case, you can type @key{C-b} to move the cursor to the left, and then
correct your mistake. Afterwards, you can move the cursor to the right
with @key{C-f}.
@ -120,7 +148,7 @@ When you add text in the middle of a line, you will notice that characters
to the right of the cursor are `pushed over' to make room for the text
that you have inserted. Likewise, when you delete text behind the cursor,
characters to the right of the cursor are `pulled back' to fill in the
blank space created by the removal of the text. A list of the basic bare
blank space created by the removal of the text. A list of the bare
essentials for editing the text of an input line follows.
@table @asis
@ -128,22 +156,28 @@ essentials for editing the text of an input line follows.
Move back one character.
@item @key{C-f}
Move forward one character.
@item @key{DEL}
@item @key{DEL} or @key{Backspace}
Delete the character to the left of the cursor.
@item @key{C-d}
Delete the character underneath the cursor.
@item @w{Printing characters}
Insert the character into the line at the cursor.
@item @key{C-_}
@item @key{C-_} or @key{C-x C-u}
Undo the last editing command. You can undo all the way back to an
empty line.
@end table
@noindent
(Depending on your configuration, the @key{Backspace} key be set to
delete the character to the left of the cursor and the @key{DEL} key set
to delete the character underneath the cursor, like @key{C-d}, rather
than the character to the left of the cursor.)
@node Readline Movement Commands
@subsection Readline Movement Commands
The above table describes the most basic possible keystrokes that you need
The above table describes the most basic keystrokes that you need
in order to do editing of the input line. For your convenience, many
other commands have been added in addition to @key{C-b}, @key{C-f},
@key{C-d}, and @key{DEL}. Here are some commands for moving more rapidly
@ -175,6 +209,8 @@ operate on characters while meta keystrokes operate on words.
@dfn{Killing} text means to delete the text from the line, but to save
it away for later use, usually by @dfn{yanking} (re-inserting)
it back into the line.
(`Cut' and `paste' are more recent jargon for `kill' and `yank'.)
If the description for a command says that it `kills' text, then you can
be sure that you can get the text back in a different (or the same)
place later.
@ -194,12 +230,14 @@ Here is the list of commands for killing text.
Kill the text from the current cursor position to the end of the line.
@item M-d
Kill from the cursor to the end of the current word, or if between
Kill from the cursor to the end of the current word, or, if between
words, to the end of the next word.
Word boundaries are the same as those used by @key{M-f}.
@item M-DEL
Kill from the cursor the start of the previous word, or if between
Kill from the cursor the start of the previous word, or, if between
words, to the start of the previous word.
Word boundaries are the same as those used by @key{M-b}.
@item C-w
Kill from the cursor to the previous whitespace. This is different than
@ -231,7 +269,7 @@ start of the line, you might type @samp{M-- C-k}.
The general way to pass numeric arguments to a command is to type meta
digits before the command. If the first `digit' typed is a minus
sign (@key{-}), then the sign of the argument will be negative. Once
sign (@samp{-}), then the sign of the argument will be negative. Once
you have typed one meta digit to get the argument started, you can type
the remainder of the digits, and then the command. For example, to give
the @key{C-d} command an argument of 10, you could type @samp{M-1 0 C-d}.
@ -252,15 +290,18 @@ As each character of the search string is typed, Readline displays
the next entry from the history matching the string typed so far.
An incremental search requires only as many characters as needed to
find the desired history entry.
The characters present in the value of the @var{isearch-terminators} variable
To search backward in the history for a particular string, type
@key{C-r}. Typing @key{C-s} searches forward through the history.
The characters present in the value of the @code{isearch-terminators} variable
are used to terminate an incremental search.
If that variable has not been assigned a value, the @key{ESC} and
@key{C-J} characters will terminate an incremental search.
@key{C-g} will abort an incremental search and restore the original line.
When the search is terminated, the history entry containing the
search string becomes the current line.
To find other matching entries in the history list, type @key{C-s} or
@key{C-r} as appropriate.
To find other matching entries in the history list, type @key{C-r} or
@key{C-s} as appropriate.
This will search backward or forward in the history for the next
entry matching the search string typed so far.
Any other key sequence bound to a Readline command will terminate
@ -276,11 +317,11 @@ typed by the user or be part of the contents of the current line.
@section Readline Init File
@cindex initialization file, readline
Although the Readline library comes with a set of @code{emacs}-like
Although the Readline library comes with a set of Emacs-like
keybindings installed by default, it is possible to use a different set
of keybindings.
Any user can customize programs that use Readline by putting
commands in an @dfn{inputrc} file in his home directory.
commands in an @dfn{inputrc} file, conventionally in his home directory.
The name of this
@ifset BashFeatures
file is taken from the value of the shell variable @code{INPUTRC}. If
@ -326,6 +367,11 @@ change from the default Emacs-like key binding to use
set editing-mode vi
@end example
@ifset BashFeatures
The @w{@code{bind -V}} command lists the current Readline variable names
and values. @xref{Bash Builtins}.
@end ifset
A great deal of run-time behavior is changeable with the following
variables.
@ -363,7 +409,7 @@ them; otherwise, they are simply listed. The default limit is
@vindex convert-meta
If set to @samp{on}, Readline will convert characters with the
eighth bit set to an ASCII key sequence by stripping the eighth
bit and prepending an @key{ESC} character, converting them to a
bit and prefixing an @key{ESC} character, converting them to a
meta-prefixed key sequence. The default value is @samp{on}.
@item disable-completion
@ -469,7 +515,7 @@ completions. The default is @samp{off}.
@item Key Bindings
The syntax for controlling key bindings in the init file is
simple. First you have to know the name of the command that you
simple. First you need to find the name of the command that you
want to change. The following sections contain tables of the command
name, the default keybinding, if any, and a short description of what
the command does.
@ -480,6 +526,12 @@ command on a line in the init file. The name of the key
can be expressed in different ways, depending on which is most
comfortable for you.
@ifset BashFeatures
The @w{@code{bind -p}} command displays Readline function names and
bindings in a format that can put directly into an initialization file.
@xref{Bash Builtins}.
@end ifset
@table @asis
@item @w{@var{keyname}: @var{function-name} or @var{macro}}
@var{keyname} is the name of a key spelled out in English. For example:
@ -497,7 +549,7 @@ expressed on the right hand side (that is, to insert the text
@item @w{"@var{keyseq}": @var{function-name} or @var{macro}}
@var{keyseq} differs from @var{keyname} above in that strings
denoting an entire key sequence can be specified, by placing
the key sequence in double quotes. Some GNU Emacs style key
the key sequence in double quotes. Some @sc{gnu} Emacs style key
escapes can be used, as in the following example, but the
special character names are not recognized.
@ -515,7 +567,7 @@ the text @samp{Function Key 1}.
@end table
The following GNU Emacs style escape sequences are available when
The following @sc{gnu} Emacs style escape sequences are available when
specifying key sequences:
@table @code
@ -528,12 +580,12 @@ an escape character
@item @kbd{\\}
backslash
@item @kbd{\"}
@key{"}
@key{"}, a double quotation mark
@item @kbd{\'}
@key{'}
@key{'}, a single quote or apostrophe
@end table
In addition to the GNU Emacs style escape sequences, a second
In addition to the @sc{gnu} Emacs style escape sequences, a second
set of backslash escapes is available:
@table @code
@ -554,10 +606,10 @@ horizontal tab
@item \v
vertical tab
@item \@var{nnn}
the character whose ASCII code is the octal value @var{nnn}
the character whose @code{ASCII} code is the octal value @var{nnn}
(one to three digits)
@item \x@var{nnn}
the character whose ASCII code is the hexadecimal value @var{nnn}
the character whose @code{ASCII} code is the hexadecimal value @var{nnn}
(one to three digits)
@end table
@ -762,6 +814,17 @@ $endif
This section describes Readline commands that may be bound to key
sequences.
@ifset BashFeatures
You can list your key bindings by executing
@w{@code{bind -P}} or, for a more terse format, suitable for an
@var{inputrc} file, @w{@code{bind -p}}. (@xref{Bash Builtins}.)
@end ifset
Command names without an accompanying key sequence are unbound by default.
In the following descriptions, @var{point} refers to the current cursor
position, and @var{mark} refers to a cursor position saved by the
@code{set-mark} command.
The text between the point and mark is referred to as the @var{region}.
@node Commands For Moving
@subsection Commands For Moving
@ -783,7 +846,7 @@ Move forward to the end of the next word. Words are composed of
letters and digits.
@item backward-word (M-b)
Move back to the start of this, or the previous, word. Words are
Move back to the start of the current or previous word. Words are
composed of letters and digits.
@item clear-screen (C-l)
@ -846,9 +909,9 @@ for a string supplied by the user.
@item history-search-forward ()
Search forward through the history for the string of characters
between the start of the current line and the current cursor
position (the @var{point}). This is a non-incremental search. By
default, this command is unbound.
between the start of the current line and the point.
This is a non-incremental search.
By default, this command is unbound.
@item history-search-backward ()
Search backward through the history for the string of characters
@ -908,11 +971,11 @@ the character at the cursor, moving the
cursor forward as well. If the insertion point
is at the end of the line, then this
transposes the last two characters of the line.
Negative arguments don't work.
Negative arguments have no effect.
@item transpose-words (M-t)
Drag the word behind the cursor past the word in front of the cursor
moving the cursor over that word as well.
Drag the word before point past the word after point,
moving point past that word as well.
@item upcase-word (M-u)
Uppercase the current (or following) word. With a negative argument,
@ -934,38 +997,36 @@ capitalize the previous word, but do not move the cursor.
@ftable @code
@item kill-line (C-k)
Kill the text from the current cursor position to the end of the line.
Kill the text from point to the end of the line.
@item backward-kill-line (C-x Rubout)
Kill backward to the beginning of the line.
@item unix-line-discard (C-u)
Kill backward from the cursor to the beginning of the current line.
The killed text is saved on the kill-ring.
@item kill-whole-line ()
Kill all characters on the current line, no matter where the
cursor is. By default, this is unbound.
Kill all characters on the current line, no matter point is.
By default, this is unbound.
@item kill-word (M-d)
Kill from the cursor to the end of the current word, or if between
words, to the end of the next word. Word boundaries are the same
as @code{forward-word}.
Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as @code{forward-word}.
@item backward-kill-word (M-DEL)
Kill the word behind the cursor. Word boundaries are the same
as @code{backward-word}.
Kill the word behind point.
Word boundaries are the same as @code{backward-word}.
@item unix-word-rubout (C-w)
Kill the word behind the cursor, using white space as a word
boundary. The killed text is saved on the kill-ring.
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@item delete-horizontal-space ()
Delete all spaces and tabs around point. By default, this is unbound.
@item kill-region ()
Kill the text between the point and the @emph{mark} (saved
cursor position). This text is referred to as the @var{region}.
Kill the text in the current region.
By default, this command is unbound.
@item copy-region-as-kill ()
@ -1109,7 +1170,7 @@ the text against lines from the history list for possible
completion matches.
@item complete-into-braces (M-@{)
Perform filename completion and return the list of possible completions
Perform filename completion and insert the list of possible completions
enclosed within braces so the list is available to the shell
(@pxref{Brace Expansion}).
@ -1138,7 +1199,7 @@ in the macro appear as if typed at the keyboard.
@ftable @code
@item re-read-init-file (C-x C-r)
Read in the contents of the inputrc file, and incorporate
Read in the contents of the @var{inputrc} file, and incorporate
any bindings or variable assignments found there.
@item abort (C-g)
@ -1192,7 +1253,8 @@ The value of the @code{comment-begin}
variable is inserted at the beginning of the current line,
and the line is accepted as if a newline had been typed.
@ifset BashFeatures
This makes the current line a shell comment.
The default value of @code{comment-begin} causes this command
to make the current line a shell comment.
@end ifset
@item dump-functions ()
@ -1285,3 +1347,283 @@ switches you into `command' mode, where you can edit the text of the
line with the standard @code{vi} movement keys, move to previous
history lines with @samp{k} and subsequent lines with @samp{j}, and
so forth.
@ifset BashFeatures
@node Programmable Completion
@section Programmable Completion
@cindex programmable completion
When word completion is attempted for an argument to a command for
which a completion specification (a @var{compspec}) has been defined
using the @code{complete} builtin (@pxref{Programmable Completion Builtins}),
the programmable completion facilities are invoked.
First, the command name is identified.
If a compspec has been defined for that command, the
compspec is used to generate the list of possible completions for the word.
If the command word is a full pathname, a compspec for the full
pathname is searched for first.
If no compspec is found for the full pathname, an attempt is made to
find a compspec for the portion following the final slash.
Once a compspec has been found, it is used to generate the list of
matching words.
If a compspec is not found, the default Bash completion
described above (@pxref{Commands For Completion}) is performed.
First, the actions specified by the compspec are used.
Only matches which are prefixed by the word being completed are
returned.
When the @samp{-f} or @samp{-d} option is used for filename or
directory name completion, the shell variable @code{FIGNORE} is
used to filter the matches.
@xref{Bash Variables}, for a description of @code{FIGNORE}.
Any completions specified by a filename expansion pattern to the
@samp{-G} option are generated next.
The words generated by the pattern need not match the word being completed.
The @code{GLOBIGNORE} shell variable is not used to filter the matches,
but the @code{FIGNORE} shell variable is used.
Next, the string specified as the argument to the @samp{-W} option
is considered.
The string is first split using the characters in the @code{IFS}
special variable as delimiters.
Shell quoting is honored.
Each word is then expanded using
brace expansion, tilde expansion, parameter and variable expansion,
command substitution, arithmetic expansion, and pathname expansion,
as described above (@pxref{Shell Expansions}).
The results are split using the rules described above
(@pxref{Word Splitting}).
The results of the expansion are prefix-matched against the word being
completed, and the matching words become the possible completions.
After these matches have been generated, any shell function or command
specified with the @samp{-F} and @samp{-C} options is invoked.
When the command or function is invoked, the @code{COMP_LINE} and
@code{COMP_POINT} variables are assigned values as described above
(@pxref{Bash Variables}).
If a shell function is being invoked, the @code{COMP_WORDS} and
@code{COMP_CWORD} variables are also set.
When the function or command is invoked, the first argument is the
name of the command whose arguments are being completed, the
second argument is the word being completed, and the third argument
is the word preceding the word being completed on the current command line.
No filtering of the generated completions against the word being completed
is performed; the function or command has complete freedom in generating
the matches.
Any function specified with @samp{-F} is invoked first.
The function may use any of the shell facilities, including the
@code{compgen} builtin described below
(@pxref{Programmable Completion Builtins}), to generate the matches.
It must put the possible completions in the @code{COMPREPLY} array
variable.
Next, any command specified with the @samp{-C} option is invoked
in an environment equivalent to command substitution.
It should print a list of completions, one per line, to
the standard output.
Backslash may be used to escape a newline, if necessary.
After all of the possible completions are generated, any filter
specified with the @samp{-X} option is applied to the list.
The filter is a pattern as used for pathname expansion; a @samp{&}
in the pattern is replaced with the text of the word being completed.
A literal @samp{&} may be escaped with a backslash; the backslash
is removed before attempting a match.
Any completion that matches the pattern will be removed from the list.
A leading @samp{!} negates the pattern; in this case any completion
not matching the pattern will be removed.
Finally, any prefix and suffix specified with the @samp{-P} and @samp{-S}
options are added to each member of the completion list, and the result is
returned to the Readline completion code as the list of possible
completions.
If a compspec is found, whatever it generates is returned to the completion
code as the full set of possible completions.
The default Bash completions are not attempted, and the Readline
default of filename completion is disabled.
@node Programmable Completion Builtins
@section Programmable Completion Builtins
@cindex completion builtins
Two builtin commands are available to manipulate the programmable completion
facilities.
@table @code
@item compgen
@btindex compgen
@example
@code{compgen [@var{option}] [@var{word}]}
@end example
Generate possible completion matches for @var{word} according to
the @var{option}s, which may be any option accepted by the
@code{complete}
builtin with the exception of @samp{-p} and @samp{-r}, and write
the matches to the standard output.
When using the @samp{-F} or @samp{-C} options, the various shell variables
set by the programmable completion facilities, while available, will not
have useful values.
The matches will be generated in the same way as if the programmable
completion code had generated them directly from a completion specification
with the same flags.
If @var{word} is specified, only those completions matching @var{word}
will be displayed.
The return value is true unless an invalid option is supplied, or no
matches were generated.
@item complete
@btindex complete
@example
@code{complete [-abcdefjkvu] [-A @var{action}] [-G @var{globpat}] [-W @var{wordlist}]
[-P @var{prefix}] [-S @var{suffix}] [-X @var{filterpat}] [-F @var{function}]
[-C @var{command}] @var{name} [@var{name} @dots{}]}
@code{complete -pr [@var{name} @dots{}]}
@end example
Specify how arguments to each @var{name} should be completed.
If the @samp{-p} option is supplied, or if no options are supplied, existing
completion specifications are printed in a way that allows them to be
reused as input.
The @samp{-r} option removes a completion specification for
each @var{name}, or, if no @var{name}s are supplied, all
completion specifications.
The process of applying these completion specifications when word completion
is attempted is described above (@pxref{Programmable Completion}).
Other options, if specified, have the following meanings.
The arguments to the @samp{-G}, @samp{-W}, and @samp{-X} options
(and, if necessary, the @samp{-P} and @samp{-S} options)
should be quoted to protect them from expansion before the
@code{complete} builtin is invoked.
@table @code
@item -A @var{action}
The @var{action} may be one of the following to generate a list of possible
completions:
@table @code
@item alias
Alias names. May also be specified as @samp{-a}.
@item arrayvar
Array variable names.
@item binding
Readline key binding names (@pxref{Bindable Readline Commands}).
@item builtin
Names of shell builtin commands. May also be specified as @samp{-b}.
@item command
Command names. May also be specified as @samp{-c}.
@item directory
Directory names. May also be specified as @samp{-d}.
@item disabled
Names of disabled shell builtins.
@item enabled
Names of enabled shell builtins.
@item export
Names of exported shell variables. May also be specified as @samp{-e}.
@item file
File names. May also be specified as @samp{-f}.
@item function
Names of shell functions.
@item helptopic
Help topics as accepted by the @code{help} builtin (@pxref{Bash Builtins}).
@item hostname
Hostnames, as taken from the file specified by the
@code{HOSTFILE} shell variable (@pxref{Bash Variables}).
@item job
Job names, if job control is active. May also be specified as @samp{-j}.
@item keyword
Shell reserved words. May also be specified as @samp{-k}.
@item running
Names of running jobs, if job control is active.
@item setopt
Valid arguments for the @samp{-o} option to the @code{set} builtin
(@pxref{The Set Builtin}).
@item shopt
Shell option names as accepted by the @code{shopt} builtin
(@pxref{Bash Builtins}).
@item signal
Signal names.
@item stopped
Names of stopped jobs, if job control is active.
@item user
User names. May also be specified as @samp{-u}.
@item variable
Names of all shell variables. May also be specified as @samp{-v}.
@end table
@item -G @var{globpat}
The filename expansion pattern @var{globpat} is expanded to generate
the possible completions.
@item -W @var{wordlist}
The @var{wordlist} is split using the characters in the
@code{IFS} special variable as delimiters, and each resultant word
is expanded.
The possible completions are the members of the resultant list which
match the word being completed.
@item -C @var{command}
@var{command} is executed in a subshell environment, and its output is
used as the possible completions.
@item -F @var{function}
The shell function @var{function} is executed in the current shell
environment.
When it finishes, the possible completions are retrieved from the value
of the @code{COMPREPLY} array variable.
@item -X @var{filterpat}
@var{filterpat} is a pattern as used for filename expansion.
It is applied to the list of possible completions generated by the
preceding options and arguments, and each completion matching
@var{filterpat} is removed from the list.
A leading @samp{!} in @var{filterpat} negates the pattern; in this
case, any completion not matching @var{filterpat} is removed.
@item -P @var{prefix}
@var{prefix} is added at the beginning of each possible completion
after all other options have been applied.
@item -S @var{suffix}
@var{suffix} is appended to each possible completion
after all other options have been applied.
@end table
The return value is true unless an invalid option is supplied, an option
other than @samp{-p} or @samp{-r} is supplied without a @var{name}
argument, an attempt is made to remove a completion specification for
a @var{name} for which no specification exists, or
an error occurs adding a completion specification.
@end table
@end ifset

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (BUFSIZ)
#include <stdio.h>
@ -76,11 +76,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
{ ISFUNC, rl_insert }, /* & */
{ ISFUNC, rl_insert }, /* ' */
{ ISFUNC, rl_insert }, /* ( */
#if defined (PAREN_MATCHING)
{ ISFUNC, rl_insert_close }, /* ) */
#else
{ ISFUNC, rl_insert }, /* ) */
#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* * */
{ ISFUNC, rl_insert }, /* + */
{ ISFUNC, rl_insert }, /* , */
@ -140,11 +136,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
/* Some more punctuation. */
{ ISFUNC, rl_insert }, /* [ */
{ ISFUNC, rl_insert }, /* \ */
#if defined (PAREN_MATCHING)
{ ISFUNC, rl_insert_close }, /* ] */
#else
{ ISFUNC, rl_insert }, /* ] */
#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* ^ */
{ ISFUNC, rl_insert }, /* _ */
{ ISFUNC, rl_insert }, /* ` */
@ -180,11 +172,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
/* Final punctuation. */
{ ISFUNC, rl_insert }, /* { */
{ ISFUNC, rl_insert }, /* | */
#if defined (PAREN_MATCHING)
{ ISFUNC, rl_insert_close }, /* } */
#else
{ ISFUNC, rl_insert }, /* } */
#endif /* !PAREN_MATCHING */
{ ISFUNC, rl_insert }, /* ~ */
{ ISFUNC, rl_rubout }, /* RUBOUT */

View File

@ -0,0 +1,6 @@
2000-07-09 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* Import of readline 4.1.
New files: excallback.c, rlfe.c.

View File

@ -1,5 +1,22 @@
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
#
# This is the Makefile for the readline examples subdirectory.
#
# Copyright (C) 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
SHELL = @MAKE_SHELL@
RM = rm -f
@ -11,7 +28,7 @@ BUILD_DIR = .
DEFS = @DEFS@
CC = @CC@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DREADLINE_LIBRARY
CPPFLAGS = @CPPFLAGS@
INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
@ -19,6 +36,9 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
LDFLAGS = -g -L..
READLINE_LIB = ../libreadline.a
HISTORY_LIB = ../libhistory.a
TERMCAP_LIB = @TERMCAP_LIB@
.c.o:
@ -39,12 +59,12 @@ fileman: fileman.o
rltest: rltest.o
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline $(TERMCAP_LIB)
rlversion: rlversion.o
rlversion: rlversion.o $(READLINE_LIB)
$(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB)
clean mostlyclean:
$(RM) $(OBJECTS)
$(RM) $(EXECUTABLES)
$(RM) $(EXECUTABLES) *.exe
distclean maintainer-clean: clean
$(RM) Makefile
@ -53,3 +73,13 @@ fileman.o: fileman.c
rltest.o: rltest.c
rl.o: rl.c
rlversion.o: rlversion.c
# Stuff for Per Bothner's `rlfe' program
rlfe: rlfe.o $(READLINE_LIB) $(HISTORY_LIB)
$(CC) $(LDFLAGS) -o $@ rlfe.o -lreadline -lhistory ${TERMCAP_LIB}
rlfe.o: rlfe.c
rlfe.o: $(top_srcdir)/readline.h
rlfe.o: $(top_srcdir)/history.h

View File

@ -1,22 +1,22 @@
/* fileman.c -- A tiny application which demonstrates how to use the
GNU Readline library. This application interactively allows users
to manipulate files and their modes. */
/*
* Remove the next line if you're compiling this against an installed
* libreadline.a
*/
#define READLINE_LIBRARY
#ifdef HAVE_CONFIG_H
#include <config.h>
# include <config.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
# include <sys/file.h>
#endif
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
@ -26,6 +26,10 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#ifdef READLINE_LIBRARY
# include "readline.h"
# include "history.h"
@ -34,7 +38,6 @@
# include <readline/history.h>
#endif
extern char *getwd ();
extern char *xmalloc ();
/* The names of functions that actually do the manipulation. */
@ -300,7 +303,12 @@ com_view (arg)
if (!valid_argument ("view", arg))
return 1;
#if defined (__MSDOS__)
/* more.com doesn't grok slashes in pathnames */
sprintf (syscom, "less %s", arg);
#else
sprintf (syscom, "more %s", arg);
#endif
return (system (syscom));
}
@ -406,7 +414,7 @@ com_pwd (ignore)
{
char dir[1024], *s;
s = getwd (dir);
s = getcwd (dir, sizeof(dir) - 1);
if (s == 0)
{
printf ("Error getting pwd: %s\n", dir);

View File

@ -2,15 +2,9 @@
* rl - command-line interface to read a line from the standard input
* (or another fd) using readline.
*
* usage: rl [-p prompt] [-u unit] [-d default]
* usage: rl [-p prompt] [-u unit] [-d default] [-n nchars]
*/
/*
* Remove the next line if you're compiling this against an installed
* libreadline.a
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@ -18,8 +12,14 @@
#include <stdio.h>
#include <sys/types.h>
#include "posixstat.h"
#include "readline.h"
#include "history.h"
#if defined (READLINE_LIBRARY)
# include "readline.h"
# include "history.h"
#else
# include <readline/readline.h>
# include <readline/history.h>
#endif
extern int optind;
extern char *optarg;
@ -40,22 +40,24 @@ set_deftext ()
deftext = (char *)NULL;
rl_startup_hook = (Function *)NULL;
}
return 0;
}
static void
usage()
{
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n",
fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default] [-n nchars]\n",
progname, progname);
}
int
main (argc, argv)
int argc;
char **argv;
{
char *temp, *prompt;
struct stat sb;
int opt, fd;
int opt, fd, nch;
FILE *ifp;
progname = strrchr(argv[0], '/');
@ -66,10 +68,10 @@ main (argc, argv)
/* defaults */
prompt = "readline$ ";
fd = 0;
fd = nch = 0;
deftext = (char *)0;
while ((opt = getopt(argc, argv, "p:u:d:")) != EOF)
while ((opt = getopt(argc, argv, "p:u:d:n:")) != EOF)
{
switch (opt)
{
@ -87,6 +89,14 @@ main (argc, argv)
case 'd':
deftext = optarg;
break;
case 'n':
nch = atoi(optarg);
if (nch < 0)
{
fprintf (stderr, "%s: bad value for -n: `%s'\n", progname, optarg);
exit (2);
}
break;
default:
usage ();
exit (2);
@ -107,6 +117,9 @@ main (argc, argv)
if (deftext && *deftext)
rl_startup_hook = set_deftext;
if (nch > 0)
rl_num_chars_to_read = nch;
temp = readline (prompt);
/* Test for EOF. */

View File

@ -4,20 +4,20 @@
/* */
/* **************************************************************** */
/*
* Remove the next line if you're compiling this against an installed
* libreadline.a
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
#endif
#include <stdio.h>
#include <sys/types.h>
#include "readline.h"
#include "history.h"
#ifdef READLINE_LIBRARY
# include "readline.h"
# include "history.h"
#else
# include <readline/readline.h>
# include <readline/history.h>
#endif
extern HIST_ENTRY **history_list ();

View File

@ -2,8 +2,6 @@
* rlversion -- print out readline's version number
*/
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@ -12,7 +10,11 @@
#include <sys/types.h>
#include "posixstat.h"
#include "readline.h"
#ifdef READLINE_LIBRARY
# include "readline.h"
#else
# include <readline/readline.h>
#endif
main()
{

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,15 +18,13 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
extern char *xmalloc (), *xrealloc ();
#if !defined (BUFSIZ)
#include <stdio.h>
#endif /* BUFSIZ */
@ -40,6 +38,14 @@ extern char *xmalloc (), *xrealloc ();
#include "rlconf.h"
#include "readline.h"
#include "xmalloc.h"
#ifdef __STDC__
typedef int QSFUNC (const void *, const void *);
#else
typedef int QSFUNC ();
#endif
extern int _rl_qsort_string_compare ();
FUNMAP **funmap;
@ -240,7 +246,7 @@ rl_funmap_names ()
result[result_index + 1] = (char *)NULL;
}
qsort (result, result_index, sizeof (char *), _rl_qsort_string_compare);
qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
return (result);
}

View File

@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@ -50,6 +50,9 @@
#include "history.h"
#include "histlib.h"
#include "rlshell.h"
#include "xmalloc.h"
#define HISTORY_WORD_DELIMITERS " \t\n;&()|<>"
#define HISTORY_QUOTE_CHARACTERS "\"'`"
@ -60,15 +63,10 @@ static char *subst_rhs;
static int subst_lhs_len;
static int subst_rhs_len;
static char *get_history_word_specifier ();
static char *history_find_word ();
static char *get_history_word_specifier __P((char *, char *, int *));
static char *history_find_word __P((char *, int));
extern int history_offset;
extern char *single_quote ();
static char *quote_breaks ();
extern char *xmalloc (), *xrealloc ();
static char *quote_breaks __P((char *));
/* Variables exported by this file. */
/* The character that represents the start of a history expansion

View File

@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@ -35,7 +35,7 @@
#ifndef _MINIX
# include <sys/file.h>
#endif
#include <sys/stat.h>
#include "posixstat.h"
#include <fcntl.h>
#if defined (HAVE_STDLIB_H)
@ -54,15 +54,19 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
#if defined (__EMX__)
/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
on win 95/98/nt), we want to open files with O_BINARY mode so that there
is no \n -> \r\n conversion performed. On other systems, we don't want to
mess around with O_BINARY at all, so we ensure that it's defined to 0. */
#if defined (__EMX__) || defined (__CYGWIN__)
# ifndef O_BINARY
# define O_BINARY 0
# endif
#else /* !__EMX__ */
/* If we're not compiling for __EMX__, we don't want this at all. Ever. */
#else /* !__EMX__ && !__CYGWIN__ */
# undef O_BINARY
# define O_BINARY 0
#endif /* !__EMX__ */
#endif /* !__EMX__ && !__CYGWIN__ */
#include <errno.h>
#if !defined (errno)
@ -72,10 +76,8 @@ extern int errno;
#include "history.h"
#include "histlib.h"
/* Functions imported from shell.c */
extern char *get_env_value ();
extern char *xmalloc (), *xrealloc ();
#include "rlshell.h"
#include "xmalloc.h"
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
@ -105,7 +107,11 @@ history_filename (filename)
return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
strcpy (return_val, home);
return_val[home_len] = '/';
#if defined (__MSDOS__)
strcpy (return_val + home_len + 1, "_history");
#else
strcpy (return_val + home_len + 1, ".history");
#endif
return (return_val);
}
@ -132,7 +138,7 @@ read_history_range (filename, from, to)
{
register int line_start, line_end;
char *input, *buffer;
int file, current_line;
int file, current_line, chars_read;
struct stat finfo;
size_t file_size;
@ -140,16 +146,6 @@ read_history_range (filename, from, to)
input = history_filename (filename);
file = open (input, O_RDONLY|O_BINARY, 0666);
#ifdef __MSDOS__
/* MSDOS doesn't allow leading dots in file names. Try again
with the dot replaced by an underscore. */
if (file < 0 && !filename)
{
input[strlen (input) - 8] = '_';
file = open (input, O_RDONLY|O_BINARY, 0666);
}
#endif
if ((file < 0) || (fstat (file, &finfo) == -1))
goto error_and_exit;
@ -165,11 +161,9 @@ read_history_range (filename, from, to)
}
buffer = xmalloc (file_size + 1);
#if 0
if (read (file, buffer, file_size) != file_size)
#else
if (read (file, buffer, file_size) < 0)
#endif
chars_read = read (file, buffer, file_size);
if (chars_read < 0)
{
error_and_exit:
if (file >= 0)
@ -185,15 +179,15 @@ read_history_range (filename, from, to)
/* Set TO to larger than end of file if negative. */
if (to < 0)
to = file_size;
to = chars_read;
/* Start at beginning of file, work to end. */
line_start = line_end = current_line = 0;
/* Skip lines until we are at FROM. */
while (line_start < file_size && current_line < from)
while (line_start < chars_read && current_line < from)
{
for (line_end = line_start; line_end < file_size; line_end++)
for (line_end = line_start; line_end < chars_read; line_end++)
if (buffer[line_end] == '\n')
{
current_line++;
@ -204,7 +198,7 @@ read_history_range (filename, from, to)
}
/* If there are lines left to gobble, then gobble them now. */
for (line_end = line_start; line_end < file_size; line_end++)
for (line_end = line_start; line_end < chars_read; line_end++)
if (buffer[line_end] == '\n')
{
buffer[line_end] = '\0';
@ -243,19 +237,13 @@ history_truncate_file (fname, lines)
filename = history_filename (fname);
file = open (filename, O_RDONLY|O_BINARY, 0666);
#ifdef __MSDOS__
/* MSDOS doesn't allow leading dots in file names. Try again
with the dot replaced by an underscore. */
if (file < 0 && !fname)
{
filename[strlen (filename) - 8] = '_';
file = open (filename, O_RDONLY|O_BINARY, 0666);
}
#endif
if (file == -1 || fstat (file, &finfo) == -1)
goto truncate_exit;
/* Don't try to truncate non-regular files. */
if (S_ISREG(finfo.st_mode) == 0)
goto truncate_exit;
file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */
@ -299,11 +287,11 @@ history_truncate_file (fname, lines)
truncate to. */
if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1))
{
write (file, buffer + i, file_size - i);
write (file, buffer + i, chars_read - i);
#if defined (__BEOS__)
/* BeOS ignores O_TRUNC. */
ftruncate (file, file_size - i);
ftruncate (file, chars_read - i);
#endif
close (file);
@ -334,23 +322,8 @@ history_do_write (filename, nelements, overwrite)
if ((file = open (output, mode, 0600)) == -1)
{
#ifdef __MSDOS__
/* MSDOS doesn't allow leading dots in file names. If this is
the default file name, try again with the dot replaced by an
underscore. */
if (!filename)
{
output[strlen (output) - 8] = '_';
if ((file = open (output, mode, 0600)) == -1)
{
FREE (output);
return (errno);
}
}
#else
FREE (output);
return (errno);
#endif
}
if (nelements > history_length)

View File

@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_HISTLIB_H_)
#define _HISTLIB_H_
@ -31,8 +31,11 @@ typedef char *CPFunction ();
typedef char **CPPFunction ();
#endif /* _FUNCTION_DEF */
#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#define STREQN(a, b, n) (((n) == 0) ? (1) \
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
#ifndef savestring
# ifndef strcpy
@ -79,4 +82,7 @@ extern char *strchr ();
#define HISTORY_APPEND 0
#define HISTORY_OVERWRITE 1
/* Some variable definitions shared across history source files. */
extern int history_offset;
#endif /* !_HISTLIB_H_ */

View File

@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
/* The goal is to make the implementation transparent, so that you
don't have to know what data types are used, just what functions
@ -53,7 +53,7 @@
#include "history.h"
#include "histlib.h"
extern char *xmalloc (), *xrealloc ();
#include "xmalloc.h"
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50

View File

@ -6,7 +6,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -17,7 +17,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _HISTORY_H_
#define _HISTORY_H_
@ -119,7 +119,7 @@ extern int where_history __P((void));
/* Return the history entry at the current position, as determined by
history_offset. If there is no entry there, return a NULL pointer. */
HIST_ENTRY *current_history __P((void));
extern HIST_ENTRY *current_history __P((void));
/* Return the history entry which is logically at OFFSET in the history
array. OFFSET is relative to history_base. */
@ -132,7 +132,7 @@ extern int history_total_bytes __P((void));
/* Moving around the history list. */
/* Set the position in the history list to POS. */
int history_set_pos __P((int));
extern int history_set_pos __P((int));
/* Back up history_offset to the previous history entry, and return
a pointer to that entry. If there is no previous entry, return
@ -187,7 +187,7 @@ extern int write_history __P((char *));
/* Append NELEMENT entries to FILENAME. The entries appended are from
the end of the list minus NELEMENTs up to the end of the list. */
int append_history __P((int, char *));
extern int append_history __P((int, char *));
/* Truncate the history file, leaving only the last NLINES lines. */
extern int history_truncate_file __P((char *, int));

View File

@ -7,7 +7,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
@ -47,9 +47,6 @@
#include "history.h"
#include "histlib.h"
/* Variables imported from other history library files. */
extern int history_offset;
/* The list of alternate characters that can delimit a history search
string. */
char *history_search_delimiter_chars = (char *)NULL;

View File

@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -67,39 +67,15 @@ extern int errno;
/* Some standard library routines. */
#include "readline.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
/* What kind of non-blocking I/O do we have? */
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
# define O_NDELAY O_NONBLOCK /* Posix style */
#endif
/* Functions imported from other files in the library. */
extern char *xmalloc (), *xrealloc ();
/* Variables and functions from macro.c. */
extern void _rl_add_macro_char ();
extern void _rl_with_macro_input ();
extern int _rl_next_macro_key ();
extern int _rl_defining_kbd_macro;
#if defined (VI_MODE)
extern void _rl_vi_set_last ();
extern int _rl_vi_textmod_command ();
#endif /* VI_MODE */
extern FILE *rl_instream, *rl_outstream;
extern Function *rl_last_func;
extern int rl_key_sequence_length;
extern int rl_pending_input;
extern int rl_editing_mode;
extern Keymap _rl_keymap;
extern int _rl_convert_meta_chars_to_ascii;
#if defined (__GO32__) && !defined (HAVE_SELECT)
# include <pc.h>
#endif /* __GO32__ */
/* Non-null means it is a pointer to a function to run while waiting for
character input. */
Function *rl_event_hook = (Function *)NULL;
@ -176,17 +152,6 @@ rl_unget_char (key)
static void
rl_gather_tyi ()
{
#if defined (__GO32__) && !defined (HAVE_SELECT)
char input;
if (isatty (0) && kbhit () && ibuffer_space ())
{
int i;
i = (*rl_getc_function) (rl_instream);
rl_stuff_char (i);
}
#else /* !__GO32__ */
int tty;
register int tem, result;
int chars_avail;
@ -255,7 +220,6 @@ rl_gather_tyi ()
if (chars_avail)
rl_stuff_char (input);
}
#endif /* !__GO32__ */
}
/* Is there input available to be read on the readline input file
@ -394,14 +358,9 @@ int
rl_getc (stream)
FILE *stream;
{
int result, flags;
int result;
unsigned char c;
#if defined (__GO32__) && !defined (HAVE_TERMIOS_H)
if (isatty (0))
return (getkey () & 0x7F);
#endif /* __GO32__ */
while (1)
{
result = read (fileno (stream), &c, sizeof (unsigned char));
@ -420,40 +379,31 @@ rl_getc (stream)
#endif
#if defined (EWOULDBLOCK)
if (errno == EWOULDBLOCK)
# define X_EWOULDBLOCK EWOULDBLOCK
#else
# define X_EWOULDBLOCK -99
#endif
#if defined (EAGAIN)
# define X_EAGAIN EAGAIN
#else
# define X_EAGAIN -99
#endif
if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
{
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
if (unset_nodelay_mode (fileno (stream)) < 0)
return (EOF);
if (flags & O_NDELAY)
{
flags &= ~O_NDELAY;
fcntl (fileno (stream), F_SETFL, flags);
continue;
}
continue;
}
#endif /* EWOULDBLOCK */
#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
if (errno == EAGAIN)
{
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
return (EOF);
if (flags & O_NONBLOCK)
{
flags &= ~O_NONBLOCK;
fcntl (fileno (stream), F_SETFL, flags);
continue;
}
}
#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
#undef X_EWOULDBLOCK
#undef X_EAGAIN
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
/* 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__ */
}
}

View File

@ -12,7 +12,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -23,7 +23,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -48,24 +48,17 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
/* Variables exported to other files in the readline library. */
unsigned char *_rl_isearch_terminators = (unsigned char *)NULL;
/* Variables imported from other files in the readline library. */
extern Keymap _rl_keymap;
extern HIST_ENTRY *saved_line_for_history;
extern int rl_line_buffer_len;
extern int rl_point, rl_end;
extern char *rl_line_buffer;
extern int rl_execute_next ();
extern void rl_extend_line_buffer ();
extern int _rl_input_available ();
extern char *xmalloc (), *xrealloc ();
static int rl_search_history ();
/* Forward declarations */
static int rl_search_history __P((int, int));
/* Last line found by the current incremental search, so we don't `find'
identical lines many times in a row. */

View File

@ -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"
/* **************************************************************** */
/* */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,11 +18,15 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined (READLINE_LIBRARY)
# include "rlstdc.h"
# include "chardefs.h"
@ -97,4 +101,8 @@ extern Keymap rl_get_keymap __P((void));
/* Set the current keymap to MAP. */
extern void rl_set_keymap __P((Keymap));
#ifdef __cplusplus
}
#endif
#endif /* _KEYMAPS_H_ */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -46,17 +46,8 @@
#include "readline.h"
#include "history.h"
extern int _rl_last_command_was_kill;
extern int rl_editing_mode;
extern int rl_explicit_arg;
extern Function *rl_last_func;
extern void _rl_init_argument ();
extern int _rl_set_mark_at_pos ();
extern void _rl_fix_point ();
extern void _rl_abort_internal ();
extern char *xmalloc (), *xrealloc ();
#include "rlprivate.h"
#include "xmalloc.h"
/* **************************************************************** */
/* */
@ -385,10 +376,12 @@ int
rl_kill_region (count, ignore)
int count, ignore;
{
int r;
int r, npoint;
npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
_rl_fix_point (1);
rl_point = npoint;
return r;
}
@ -503,7 +496,9 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
{
register HIST_ENTRY *entry;
char *arg;
int i;
int i, pos;
pos = where_history ();
if (history_skip)
{
@ -512,16 +507,10 @@ rl_yank_nth_arg_internal (count, ignore, history_skip)
}
entry = previous_history ();
if (entry)
{
if (history_skip)
{
for (i = 0; i < history_skip; i++)
next_history ();
}
next_history ();
}
else
history_set_pos (pos);
if (entry == 0)
{
ding ();
return -1;

View File

@ -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,20 +46,11 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.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 ();
/* **************************************************************** */
/* */
/* Hacking Keyboard Macros */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -27,6 +27,8 @@
#include <sys/types.h>
#include <stdio.h>
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
@ -44,13 +46,9 @@
#include <ctype.h>
#include "rldefs.h"
extern int _rl_convert_meta_chars_to_ascii;
extern int _rl_output_meta_chars;
extern int _rl_meta_flag;
/* Functions imported from shell.c */
extern char *get_env_value ();
#include "readline.h"
#include "rlshell.h"
#include "rlprivate.h"
#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
@ -70,12 +68,11 @@ static char *legal_lang_values[] =
"iso88599",
"iso885910",
"koi8r",
"koi8-r",
0
};
static char *normalize_codeset ();
static char *find_codeset ();
static char *normalize_codeset __P((char *));
static char *find_codeset __P((char *, size_t *));
#endif /* !HAVE_SETLOCALE */
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,23 +18,11 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#include "rlconf.h"
#if !defined (PAREN_MATCHING)
extern int rl_insert ();
int
rl_insert_close (count, invoking_key)
int count, invoking_key;
{
return (rl_insert (count, invoking_key));
}
#else /* PAREN_MATCHING */
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
@ -64,8 +52,9 @@ extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
#include "readline.h"
#include "rlprivate.h"
extern int rl_explicit_arg;
static int find_matching_open __P((char *, int, int));
/* Non-zero means try to blink the matching open parenthesis when the
close parenthesis is inserted. */
@ -75,7 +64,25 @@ int rl_blink_matching_paren = 1;
int rl_blink_matching_paren = 0;
#endif /* !HAVE_SELECT */
static int find_matching_open ();
/* Change emacs_standard_keymap to have bindings for paren matching when
ON_OR_OFF is 1, change them back to self_insert when ON_OR_OFF == 0. */
void
_rl_enable_paren_matching (on_or_off)
int on_or_off;
{
if (on_or_off)
{ /* ([{ */
rl_bind_key_in_map (')', rl_insert_close, emacs_standard_keymap);
rl_bind_key_in_map (']', rl_insert_close, emacs_standard_keymap);
rl_bind_key_in_map ('}', rl_insert_close, emacs_standard_keymap);
}
else
{ /* ([{ */
rl_bind_key_in_map (')', rl_insert, emacs_standard_keymap);
rl_bind_key_in_map (']', rl_insert, emacs_standard_keymap);
rl_bind_key_in_map ('}', rl_insert, emacs_standard_keymap);
}
}
int
rl_insert_close (count, invoking_key)
@ -152,5 +159,3 @@ find_matching_open (string, from, closer)
}
return (i);
}
#endif /* PAREN_MATCHING */

View File

@ -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>. */

View File

@ -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_

View File

@ -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. */

View File

@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -47,7 +47,6 @@
# include <locale.h>
#endif
#include <signal.h>
#include <stdio.h>
#include "posixjmp.h"
@ -63,119 +62,27 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "rlshell.h"
#include "xmalloc.h"
#ifndef RL_LIBRARY_VERSION
# define RL_LIBRARY_VERSION "4.0"
# define RL_LIBRARY_VERSION "4.1"
#endif
/* Evaluates its arguments multiple times. */
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* NOTE: Functions and variables prefixed with `_rl_' are
pseudo-global: they are global so they can be shared
between files in the readline library, but are not intended
to be visible to readline callers. */
/* Variables and functions imported from terminal.c */
extern int _rl_init_terminal_io ();
extern void _rl_enable_meta_key ();
#ifdef _MINIX
extern void _rl_output_character_function ();
#else
extern int _rl_output_character_function ();
#endif
extern int _rl_enable_meta;
extern int _rl_term_autowrap;
extern int screenwidth, screenheight, screenchars;
/* Variables and functions imported from rltty.c. */
extern void rl_prep_terminal (), rl_deprep_terminal ();
extern void rltty_set_default_bindings ();
/* Functions imported from util.c. */
extern void _rl_abort_internal ();
extern void rl_extend_line_buffer ();
extern int alphabetic ();
/* Functions imported from bind.c. */
extern void _rl_bind_if_unbound ();
/* Functions imported from input.c. */
extern int _rl_any_typein ();
extern void _rl_insert_typein ();
extern int rl_read_key ();
/* Functions imported from nls.c */
extern int _rl_init_eightbit ();
/* Functions imported from shell.c */
extern char *get_env_value ();
/* External redisplay functions and variables from display.c */
extern void _rl_move_vert ();
extern void _rl_update_final ();
extern void _rl_clear_to_eol ();
extern void _rl_clear_screen ();
extern void _rl_erase_entire_line ();
extern void _rl_erase_at_end_of_line ();
extern void _rl_move_cursor_relative ();
extern int _rl_vis_botlin;
extern int _rl_last_c_pos;
extern int _rl_horizontal_scroll_mode;
extern int rl_display_fixed;
extern int _rl_suppress_redisplay;
extern char *rl_display_prompt;
/* Variables imported from complete.c. */
extern char *rl_completer_word_break_characters;
extern char *rl_basic_word_break_characters;
extern int rl_completion_query_items;
extern int rl_complete_with_tilde_expansion;
/* Variables and functions from macro.c. */
extern void _rl_add_macro_char ();
extern void _rl_with_macro_input ();
extern int _rl_next_macro_key ();
extern int _rl_defining_kbd_macro;
#if defined (VI_MODE)
/* Functions imported from vi_mode.c. */
extern void _rl_vi_set_last ();
extern void _rl_vi_reset_last ();
extern void _rl_vi_done_inserting ();
extern int _rl_vi_textmod_command ();
extern void _rl_vi_initialize_line ();
#endif /* VI_MODE */
extern UNDO_LIST *rl_undo_list;
extern int _rl_doing_an_undo;
/* Forward declarations used in this file. */
void _rl_free_history_entry ();
void _rl_free_history_entry __P((HIST_ENTRY *));
int _rl_dispatch ();
int _rl_init_argument ();
static char *readline_internal __P((void));
static void readline_initialize_everything __P((void));
static void start_using_history __P((void));
static void bind_arrow_keys __P((void));
static int rl_change_case __P((int, int));
static char *readline_internal ();
static void readline_initialize_everything ();
static void start_using_history ();
static void bind_arrow_keys ();
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
static void readline_default_bindings ();
#endif /* !__GO32__ */
#if defined (__GO32__)
# include <go32.h>
# include <pc.h>
# if !defined (__DJGPP__)
# undef HANDLE_SIGNALS
# endif /* !__DJGPP__ */
#endif /* __GO32__ */
extern char *xmalloc (), *xrealloc ();
static void readline_default_bindings __P((void));
/* **************************************************************** */
/* */
@ -185,6 +92,8 @@ extern char *xmalloc (), *xrealloc ();
char *rl_library_version = RL_LIBRARY_VERSION;
int rl_gnu_readline_p = 1;
/* A pointer to the keymap that is currently in use.
By default, it is the standard emacs keymap. */
Keymap _rl_keymap = emacs_standard_keymap;
@ -247,6 +156,10 @@ int readline_echoing_p = 1;
char *rl_prompt;
int rl_visible_prompt_length = 0;
/* Set to non-zero by calling application if it has already printed rl_prompt
and does not want readline to do it the first time. */
int rl_already_prompted = 0;
/* The number of characters read in order to type this complete command. */
int rl_key_sequence_length = 0;
@ -292,6 +205,10 @@ Keymap rl_executing_keymap;
/* Non-zero means to erase entire line, including prompt, on empty input lines. */
int rl_erase_empty_line = 0;
/* Non-zero means to read only this many characters rather than up to a
character bound to accept-line. */
int rl_num_chars_to_read;
/* Line buffer and maintenence. */
char *rl_line_buffer = (char *)NULL;
int rl_line_buffer_len = 0;
@ -371,6 +288,8 @@ readline (prompt)
STATIC_CALLBACK void
readline_internal_setup ()
{
char *nprompt;
_rl_in_stream = rl_instream;
_rl_out_stream = rl_outstream;
@ -379,15 +298,20 @@ readline_internal_setup ()
if (readline_echoing_p == 0)
{
if (rl_prompt)
if (rl_prompt && rl_already_prompted == 0)
{
fprintf (_rl_out_stream, "%s", rl_prompt);
nprompt = _rl_strip_prompt (rl_prompt);
fprintf (_rl_out_stream, "%s", nprompt);
fflush (_rl_out_stream);
free (nprompt);
}
}
else
{
rl_on_new_line ();
if (rl_prompt && rl_already_prompted)
rl_on_new_line_with_prompt ();
else
rl_on_new_line ();
(*rl_redisplay_function) ();
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
@ -479,7 +403,7 @@ readline_internal_charloop ()
}
lastc = c;
_rl_dispatch (c, _rl_keymap);
_rl_dispatch ((unsigned char)c, _rl_keymap);
/* If there was no change in _rl_last_command_was_kill, then no kill
has taken place. Note that if input is pending we are reading
@ -494,6 +418,12 @@ readline_internal_charloop ()
rl_vi_check ();
#endif /* VI_MODE */
if (rl_num_chars_to_read && rl_end >= rl_num_chars_to_read)
{
(*rl_redisplay_function) ();
rl_newline (1, '\n');
}
if (rl_done == 0)
(*rl_redisplay_function) ();
@ -691,6 +621,7 @@ rl_initialize ()
return 0;
}
#if 0
#if defined (__EMX__)
static void
_emx_build_environ ()
@ -714,14 +645,17 @@ _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. */
@ -747,10 +681,8 @@ readline_initialize_everything ()
/* Initialize the terminal interface. */
_rl_init_terminal_io ((char *)NULL);
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
/* Bind tty characters to readline functions. */
readline_default_bindings ();
#endif /* !__GO32__ || HAVE_TERMIOS_H */
/* Initialize the function names. */
rl_initialize_funmap ();
@ -799,6 +731,17 @@ bind_arrow_keys_internal ()
{
Function *f;
#if defined (__MSDOS__)
f = rl_function_of_keyseq ("\033[0A", _rl_keymap, (int *)NULL);
if (!f || f == rl_do_lowercase_version)
{
_rl_bind_if_unbound ("\033[0A", rl_get_previous_history);
_rl_bind_if_unbound ("\033[0B", rl_backward);
_rl_bind_if_unbound ("\033[0C", rl_forward);
_rl_bind_if_unbound ("\033[0D", rl_get_next_history);
}
#endif
f = rl_function_of_keyseq ("\033[A", _rl_keymap, (int *)NULL);
if (!f || f == rl_do_lowercase_version)
{
@ -1123,6 +1066,10 @@ rl_forward (count, key)
else
rl_point = end;
}
if (rl_end < 0)
rl_end = 0;
return 0;
}
@ -1257,35 +1204,14 @@ int
rl_refresh_line (ignore1, ignore2)
int ignore1, ignore2;
{
int curr_line, nleft;
int curr_line;
/* Find out whether or not there might be invisible characters in the
editing buffer. */
if (rl_display_prompt == rl_prompt)
nleft = _rl_last_c_pos - screenwidth - rl_visible_prompt_length;
else
nleft = _rl_last_c_pos - screenwidth;
if (nleft > 0)
curr_line = 1 + nleft / screenwidth;
else
curr_line = 0;
curr_line = _rl_current_display_line ();
_rl_move_vert (curr_line);
_rl_move_cursor_relative (0, the_line); /* XXX is this right */
#if defined (__GO32__) && !defined (__DJGPP__)
{
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__ || __DJGPP__ */
_rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
#endif /* !__GO32__ || __DJGPP__ */
rl_forced_update_display ();
rl_display_fixed = 1;
@ -1423,7 +1349,14 @@ rl_quoted_insert (count, key)
{
int c;
#if defined (HANDLE_SIGNALS)
_rl_disable_tty_signals ();
#endif
c = rl_read_key ();
#if defined (HANDLE_SIGNALS)
_rl_restore_tty_signals ();
#endif
return (rl_insert (count, c));
}
@ -1617,8 +1550,6 @@ rl_insert_comment (count, key)
#define DownCase 2
#define CapCase 3
static int rl_change_case ();
/* Uppercase the word at point. */
int
rl_upcase_word (count, key)

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_READLINE_H_)
#define _READLINE_H_
@ -192,7 +192,7 @@ extern int rl_noninc_reverse_search __P((int, int));
extern int rl_noninc_forward_search_again __P((int, int));
extern int rl_noninc_reverse_search_again __P((int, int));
/* Not available unless readline is compiled -DPAREN_MATCHING. */
/* Bindable command used when inserting a matching close character. */
extern int rl_insert_close __P((int, int));
/* Not available unless READLINE_CALLBACKS is defined. */
@ -331,11 +331,12 @@ extern int rl_modifying __P((int, int));
/* Functions for redisplay. */
extern void rl_redisplay __P((void));
extern int rl_on_new_line __P((void));
extern int rl_on_new_line_with_prompt __P((void));
extern int rl_forced_update_display __P((void));
extern int rl_clear_message __P((void));
extern int rl_reset_line_state __P((void));
#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...);
#else
extern int rl_message ();
@ -405,6 +406,9 @@ extern char *filename_completion_function __P((char *, int));
/* The version of this incarnation of the readline library. */
extern char *rl_library_version;
/* True if this is real GNU readline. */
extern int rl_gnu_readline_p;
/* The name of the calling program. You should initialize this to
whatever was in argv[0]. It is used when parsing conditionals. */
extern char *rl_readline_name;
@ -468,6 +472,15 @@ extern Keymap rl_binding_keymap;
rl_newline. */
extern int rl_erase_empty_line;
/* If non-zero, the application has already printed the prompt (rl_prompt)
before calling readline, so readline should not output it the first time
redisplay is done. */
extern int rl_already_prompted;
/* A non-zero value means to read only this many characters rather than
up to a character bound to accept-line. */
extern int rl_num_chars_to_read;
/* Variables to control readline signal handling. */
/* If non-zero, readline will install its own signal handlers for
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
@ -610,8 +623,10 @@ extern int rl_inhibit_completion;
#define SINGLE_MATCH 1
#define MULT_MATCH 2
#if 0
#if !defined (savestring)
extern char *savestring (); /* XXX backwards compatibility */
extern char *savestring __P((char *)); /* XXX backwards compatibility */
#endif
#endif
#ifdef __cplusplus

View File

@ -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

View File

@ -10,7 +10,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -21,7 +21,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RLDEFS_H_)
#define _RLDEFS_H_
@ -122,7 +122,8 @@ extern char *xmalloc ();
#if !defined (STREQ)
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#define STREQN(a, b, n) (((n) == 0) ? (1) \
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
#if !defined (FREE)

View File

@ -7,7 +7,7 @@
Bash is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Bash; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_RL_STDC_H_)
#define _RL_STDC_H_
@ -28,52 +28,12 @@
and traditional C compilers with something like this:
extern char *func __P((char *, char *, int)); */
#if defined (__STDC__)
# if !defined (__P)
#if !defined (__P)
# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
# define __P(protos) protos
# endif
# define __STRING(x) #x
# if !defined (__GNUC__)
# define inline
# endif
#else /* !__STDC__ */
# if !defined (__P)
# else
# define __P(protos) ()
# endif
# define __STRING(x) "x"
#if defined (__GNUC__) /* gcc with -traditional */
# if !defined (const)
# define const __const
# endif
# if !defined (inline)
# define inline __inline
# endif
# if !defined (signed)
# define signed __signed
# endif
# if !defined (volatile)
# define volatile __volatile
# endif
#else /* !__GNUC__ */
# if !defined (const)
# define const
# endif
# if !defined (inline)
# define inline
# endif
# if !defined (signed)
# define signed
# endif
# if !defined (volatile)
# define volatile
# endif
#endif /* !__GNUC__ */
#endif /* !__STDC__ */
#endif
#endif /* !_RL_STDC_H_ */

View File

@ -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,12 @@
#include "rltty.h"
#include "readline.h"
#include "rlprivate.h"
#if !defined (errno)
extern int errno;
#endif /* !errno */
extern int readline_echoing_p;
extern int _rl_eof_char;
extern int _rl_enable_keypad, _rl_enable_meta;
extern void _rl_control_keypad ();
#if defined (__GO32__)
# include <pc.h>
# if !defined (__DJGPP__)
# undef HANDLE_SIGNALS
# endif /* !__DJGPP__ */
#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;
@ -106,6 +90,7 @@ block_sigint ()
# endif /* HAVE_USG_SIGHOLD */
# endif /* !HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
sigint_blocked = 1;
}
@ -113,7 +98,7 @@ block_sigint ()
static void
release_sigint ()
{
if (!sigint_blocked)
if (sigint_blocked == 0)
return;
#if defined (HAVE_POSIX_SIGNALS)
@ -140,25 +125,27 @@ release_sigint ()
/* Non-zero means that the terminal is in a prepped state. */
static int terminal_prepped;
static _RL_TTY_CHARS _rl_tty_chars, _rl_last_tty_chars;
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
and output is suspended. */
#if defined (__ksr1__)
static int ksrflow;
#endif
#if defined (TIOCGWINSZ)
/* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. */
static void
set_winsize (tty)
int tty;
{
#if defined (TIOCGWINSZ)
struct winsize w;
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
}
#endif /* TIOCGWINSZ */
}
#if defined (NEW_TTY_DRIVER)
@ -186,6 +173,42 @@ struct bsdtty {
static TIOTYPE otio;
static void
save_tty_chars (tiop)
TIOTYPE *tiop;
{
_rl_last_tty_chars = _rl_tty_chars;
if (tiop->flags & SGTTY_SET)
{
_rl_tty_chars.t_erase = tiop->sgttyb.sg_erase;
_rl_tty_chars.t_kill = tiop->sgttyb.sg_kill;
}
if (tiop->flags & TCHARS_SET)
{
_rl_tty_chars.t_intr = tiop->tchars.t_intrc;
_rl_tty_chars.t_quit = tiop->tchars.t_quitc;
_rl_tty_chars.t_start = tiop->tchars.t_startc;
_rl_tty_chars.t_stop = tiop->tchars.t_stopc
_rl_tty_chars.t_eof = tiop->tchars.t_eofc;
_rl_tty_chars.t_eol = '\n';
_rl_tty_chars.t_eol2 = tiop->tchars.t_brkc;
}
if (tiop->flags & LTCHARS_SET)
{
_rl_tty_chars.t_susp = tiop->ltchars.t_suspc;
_rl_tty_chars.t_dsusp = tiop->ltchars.t_dsuspc;
_rl_tty_chars.t_reprint = tiop->ltchars.t_rprntc;
_rl_tty_chars.t_flush = tiop->ltchars.t_flushc;
_rl_tty_chars.t_werase = tiop->ltchars.t_werasc;
_rl_tty_chars.t_lnext = tiop->ltchars.t_lnextc;
}
_rl_tty_chars.t_status = -1;
}
static int
get_tty_settings (tty, tiop)
int tty;
@ -262,7 +285,6 @@ prepare_terminal_settings (meta_flag, otio, tiop)
int meta_flag;
TIOTYPE otio, *tiop;
{
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
/* Copy the original settings to the structure we're going to use for
@ -328,7 +350,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__ || HAVE_TERMIOS_H */
}
#else /* !defined (NEW_TTY_DRIVER) */
@ -365,12 +386,59 @@ static TIOTYPE otio;
# define OUTPUT_BEING_FLUSHED(tp) 0
#endif
static void
save_tty_chars (tiop)
TIOTYPE *tiop;
{
_rl_last_tty_chars = _rl_tty_chars;
_rl_tty_chars.t_eof = tiop->c_cc[VEOF];
_rl_tty_chars.t_eol = tiop->c_cc[VEOL];
#ifdef VEOL2
_rl_tty_chars.t_eol2 = tiop->c_cc[VEOL2];
#endif
_rl_tty_chars.t_erase = tiop->c_cc[VERASE];
#ifdef VWERASE
_rl_tty_chars.t_werase = tiop->c_cc[VWERASE];
#endif
_rl_tty_chars.t_kill = tiop->c_cc[VKILL];
#ifdef VREPRINT
_rl_tty_chars.t_reprint = tiop->c_cc[VREPRINT];
#endif
_rl_tty_chars.t_intr = tiop->c_cc[VINTR];
_rl_tty_chars.t_quit = tiop->c_cc[VQUIT];
#ifdef VSUSP
_rl_tty_chars.t_susp = tiop->c_cc[VSUSP];
#endif
#ifdef VDSUSP
_rl_tty_chars.t_dsusp = tiop->c_cc[VDSUSP];
#endif
#ifdef VSTART
_rl_tty_chars.t_start = tiop->c_cc[VSTART];
#endif
#ifdef VSTOP
_rl_tty_chars.t_stop = tiop->c_cc[VSTOP];
#endif
#ifdef VLNEXT
_rl_tty_chars.t_lnext = tiop->c_cc[VLNEXT];
#endif
#ifdef VDISCARD
_rl_tty_chars.t_flush = tiop->c_cc[VDISCARD];
#endif
#ifdef VSTATUS
_rl_tty_chars.t_status = tiop->c_cc[VSTATUS];
#endif
}
#if defined (_AIX) || defined (_AIX41)
/* Currently this is only used on AIX */
static void
rltty_warning (msg)
char *msg;
{
fprintf (stderr, "readline: warning: %s\n", msg);
}
#endif
#if defined (_AIX)
void
@ -386,16 +454,12 @@ TIOTYPE *tp;
#endif
static int
get_tty_settings (tty, tiop)
_get_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
int ioctl_ret;
#if defined (TIOCGWINSZ)
set_winsize (tty);
#endif
while (1)
{
ioctl_ret = GETATTR (tty, tiop);
@ -419,6 +483,21 @@ get_tty_settings (tty, tiop)
break;
}
return 0;
}
static int
get_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
#if defined (TIOCGWINSZ)
set_winsize (tty);
#endif
if (_get_tty_settings (tty, tiop) < 0)
return -1;
#if defined (_AIX)
setopost(tiop);
#endif
@ -427,7 +506,7 @@ get_tty_settings (tty, tiop)
}
static int
set_tty_settings (tty, tiop)
_set_tty_settings (tty, tiop)
int tty;
TIOTYPE *tiop;
{
@ -437,7 +516,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)
@ -454,7 +543,7 @@ set_tty_settings (tty, tiop)
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
#endif /* !TERMIOS_TTY_DRIVER */
#endif
#endif /* 0 */
return 0;
}
@ -526,7 +615,6 @@ void
rl_prep_terminal (meta_flag)
int meta_flag;
{
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
int tty;
TIOTYPE tio;
@ -546,6 +634,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)
@ -561,14 +651,12 @@ rl_prep_terminal (meta_flag)
terminal_prepped = 1;
release_sigint ();
#endif /* !__GO32__ || HAVE_TERMIOS_H */
}
/* Restore the terminal's normal settings and modes. */
void
rl_deprep_terminal ()
{
#if !defined (__GO32__) || defined (HAVE_TERMIOS_H)
int tty;
if (!terminal_prepped)
@ -593,7 +681,6 @@ rl_deprep_terminal ()
terminal_prepped = 0;
release_sigint ();
#endif /* !__GO32__ || HAVE_TERMIOS_H */
}
/* **************************************************************** */
@ -731,3 +818,54 @@ rltty_set_default_bindings (kmap)
}
#endif /* !NEW_TTY_DRIVER */
}
#if defined (HANDLE_SIGNALS)
#if defined (NEW_TTY_DRIVER)
int
_rl_disable_tty_signals ()
{
return 0;
}
int
_rl_restore_tty_signals ()
{
return 0;
}
#else
static TIOTYPE sigstty, nosigstty;
static int tty_sigs_disabled = 0;
int
_rl_disable_tty_signals ()
{
if (tty_sigs_disabled)
return 0;
if (_get_tty_settings (fileno (rl_instream), &sigstty) < 0)
return -1;
nosigstty = sigstty;
nosigstty.c_lflag &= ~ISIG;
if (_set_tty_settings (fileno (rl_instream), &nosigstty) < 0)
return (_set_tty_settings (fileno (rl_instream), &sigstty));
tty_sigs_disabled = 1;
return 0;
}
int
_rl_restore_tty_signals ()
{
if (tty_sigs_disabled == 0)
return 0;
return (_set_tty_settings (fileno (rl_instream), &sigstty));
}
#endif /* !NEW_TTY_DRIVER */
#endif /* HANDLE_SIGNALS */

View File

@ -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_ */

View File

@ -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 */

View File

@ -7,7 +7,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -18,7 +18,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
extern char *strcpy ();
extern char *xmalloc ();

View File

@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -43,30 +43,51 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
#ifdef abs
# undef abs
#endif
#define abs(x) (((x) >= 0) ? (x) : -(x))
extern char *xmalloc (), *xrealloc ();
/* Variables imported from readline.c */
extern int rl_point, rl_end, rl_line_buffer_len;
extern int rl_editing_mode;
extern char *rl_prompt;
extern char *rl_line_buffer;
extern HIST_ENTRY *saved_line_for_history;
extern Function *rl_last_func;
/* Functions imported from the rest of the library. */
extern int _rl_free_history_entry ();
extern char *_rl_make_prompt_for_search ();
extern void rl_extend_line_buffer ();
extern int _rl_free_history_entry __P((HIST_ENTRY *));
static char *noninc_search_string = (char *) NULL;
static int noninc_history_pos;
static char *prev_line_found = (char *) NULL;
static int rl_history_search_len;
static int rl_history_search_pos;
static char *history_search_string;
static int history_string_size;
/* Make the data from the history entry ENTRY be the contents of the
current line. This doesn't do anything with rl_point; the caller
must set it. */
static void
make_history_line_current (entry)
HIST_ENTRY *entry;
{
int line_len;
line_len = strlen (entry->line);
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
strcpy (rl_line_buffer, entry->line);
rl_undo_list = (UNDO_LIST *)entry->data;
rl_end = line_len;
if (saved_line_for_history)
_rl_free_history_entry (saved_line_for_history);
saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Search the history list for STRING starting at absolute history position
POS. If STRING begins with `^', the search must match STRING at the
beginning of a history line, otherwise a full substring match is performed
@ -102,7 +123,7 @@ noninc_dosearch (string, dir)
char *string;
int dir;
{
int oldpos, pos, line_len;
int oldpos, pos;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
@ -132,19 +153,10 @@ noninc_dosearch (string, dir)
#endif
history_set_pos (oldpos);
line_len = strlen (entry->line);
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
strcpy (rl_line_buffer, entry->line);
make_history_line_current (entry);
rl_undo_list = (UNDO_LIST *)entry->data;
rl_end = strlen (rl_line_buffer);
rl_point = 0;
rl_clear_message ();
if (saved_line_for_history)
_rl_free_history_entry (saved_line_for_history);
saved_line_for_history = (HIST_ENTRY *)NULL;
}
/* Search non-interactively through the history list. DIR < 0 means to
@ -235,8 +247,7 @@ noninc_search (dir, pchar)
{
/* We want to start the search from the current history position. */
noninc_history_pos = where_history ();
if (noninc_search_string)
free (noninc_search_string);
FREE (noninc_search_string);
noninc_search_string = savestring (rl_line_buffer);
}
@ -295,59 +306,84 @@ rl_noninc_reverse_search_again (count, key)
}
static int
rl_history_search_internal (count, direction)
int count, direction;
rl_history_search_internal (count, dir)
int count, dir;
{
HIST_ENTRY *temp, *old_temp;
int line_len;
HIST_ENTRY *temp;
int ret, oldpos;
maybe_save_line ();
temp = (HIST_ENTRY *)NULL;
temp = old_temp = (HIST_ENTRY *)NULL;
/* Search COUNT times through the history for a line whose prefix
matches history_search_string. When this loop finishes, TEMP,
if non-null, is the history line to copy into the line buffer. */
while (count)
{
temp = (direction < 0) ? previous_history () : next_history ();
if (temp == 0)
break;
/* On an empty prefix, make this the same as previous-history. */
if (rl_point == 0)
{
count--;
continue;
}
if (STREQN (rl_line_buffer, temp->line, rl_point))
{
/* Don't find multiple instances of the same line. */
if (prev_line_found && STREQ (prev_line_found, temp->line))
continue;
if (direction < 0)
old_temp = temp;
prev_line_found = temp->line;
count--;
}
ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir);
if (ret == -1)
break;
/* Get the history entry we found. */
rl_history_search_pos = ret;
oldpos = where_history ();
history_set_pos (rl_history_search_pos);
temp = current_history ();
history_set_pos (oldpos);
/* Don't find multiple instances of the same line. */
if (prev_line_found && STREQ (prev_line_found, temp->line))
continue;
prev_line_found = temp->line;
count--;
}
/* If we didn't find anything at all, return. */
if (temp == 0)
{
if (direction < 0 && old_temp)
temp = old_temp;
else
{
maybe_unsave_line ();
ding ();
return 1;
}
maybe_unsave_line ();
ding ();
/* If you don't want the saved history line (last match) to show up
in the line buffer after the search fails, change the #if 0 to
#if 1 */
#if 0
if (rl_point > rl_history_search_len)
{
rl_point = rl_end = rl_history_search_len;
rl_line_buffer[rl_end] = '\0';
}
#else
rl_point = rl_history_search_len; /* maybe_unsave_line changes it */
#endif
return 1;
}
line_len = strlen (temp->line);
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
strcpy (rl_line_buffer, temp->line);
rl_undo_list = (UNDO_LIST *)temp->data;
rl_end = line_len;
/* Copy the line we found into the current line buffer. */
make_history_line_current (temp);
rl_point = rl_history_search_len;
return 0;
}
static void
rl_history_search_reinit ()
{
rl_history_search_pos = where_history ();
rl_history_search_len = rl_point;
prev_line_found = (char *)NULL;
if (rl_point)
{
if (rl_history_search_len >= history_string_size - 2)
{
history_string_size = rl_history_search_len + 2;
history_search_string = xrealloc (history_search_string, history_string_size);
}
history_search_string[0] = '^';
strncpy (history_search_string + 1, rl_line_buffer, rl_point);
history_search_string[rl_point + 1] = '\0';
}
}
/* Search forward in the history for the string of characters
from the start of the line to rl_point. This is a non-incremental
search. */
@ -357,8 +393,13 @@ rl_history_search_forward (count, ignore)
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward)
prev_line_found = (char *)NULL;
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit ();
if (rl_history_search_len == 0)
return (rl_get_next_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
}
@ -371,7 +412,12 @@ rl_history_search_backward (count, ignore)
{
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_backward)
prev_line_found = (char *)NULL;
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit ();
if (rl_history_search_len == 0)
return (rl_get_previous_history (count, ignore));
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
}

View File

@ -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)
@ -45,13 +45,21 @@
# include <strings.h>
#endif /* !HAVE_STRING_H */
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include "rlshell.h"
#include "xmalloc.h"
#if !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid ();
#endif /* !HAVE_GETPW_DECLS */
extern char *xmalloc ();
#ifndef NULL
# define NULL 0
#endif
/* All of these functions are resolved from bash if we are linking readline
as part of bash. */
@ -64,7 +72,7 @@ single_quote (string)
register int c;
char *result, *r, *s;
result = (char *)xmalloc (3 + (3 * strlen (string)));
result = (char *)xmalloc (3 + (4 * strlen (string)));
r = result;
*r++ = '\'';
@ -132,3 +140,37 @@ get_home_dir ()
home_dir = entry->pw_dir;
return (home_dir);
}
#if !defined (O_NDELAY)
# if defined (FNDELAY)
# define O_NDELAY FNDELAY
# endif
#endif
int
unset_nodelay_mode (fd)
int fd;
{
int flags, bflags;
if ((flags = fcntl (fd, F_GETFL, 0)) < 0)
return -1;
bflags = 0;
#ifdef O_NONBLOCK
bflags |= O_NONBLOCK;
#endif
#ifdef O_NDELAY
bflags |= O_NDELAY;
#endif
if (flags & bflags)
{
flags &= ~bflags;
return (fcntl (fd, F_SETFL, flags));
}
return 0;
}

View File

@ -15,7 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
RL_LIBRARY_VERSION = @LIBVERSION@
RL_LIBRARY_NAME = readline
@ -75,9 +76,9 @@ SHLIB_LIBVERSION = @SHLIB_LIBVERSION@
SHLIB_STATUS = @SHLIB_STATUS@
# shared library versioning
SHLIB_MAJOR= 4
SHLIB_MAJOR= @SHLIB_MAJOR@
# shared library systems like SVR4's do not use minor versions
SHLIB_MINOR= .0
SHLIB_MINOR= .@SHLIB_MINOR@
# For libraries which include headers from other libraries.
INCLUDES = -I. -I.. -I$(topdir) -I$(includedir)
@ -112,7 +113,7 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \
# The header files for this library.
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \
ansi_stdlib.h tcap.h
ansi_stdlib.h tcap.h xmalloc.h rlprivate.h rlshell.h
SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so
SHARED_TILDEOBJ = tilde.so
@ -131,7 +132,7 @@ unsupported:
@echo "Your system and compiler (${host_os}-${CC}) are not supported by the"
@echo "${topdir}/support/shobj-conf script."
@echo "If your operating system provides facilities for creating"
@echo "shared libraries, please update the script and re-run configure.
@echo "shared libraries, please update the script and re-run configure."
@echo "Please send the changes you made to bash-maintainers@gnu.org"
@echo "for inclusion in future bash and readline releases."
@ -222,6 +223,8 @@ macro.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
macro.so: $(topdir)/tilde.h $(topdir)/history.h
nls.so: $(topdir)/ansi_stdlib.h
nls.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h
nls.o: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
nls.o: $(topdir)/tilde.h $(topdir)/history.h $(topdir)/rlstdc.h
parens.so: $(topdir)/rlconf.h ${BUILD_DIR}/config.h
parens.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h
parens.so: $(topdir)/tilde.h
@ -257,6 +260,54 @@ vi_mode.so: $(topdir)/history.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h
xmalloc.so: ${BUILD_DIR}/config.h
xmalloc.so: $(topdir)/ansi_stdlib.h
bind.so: $(topdir)/rlshell.h
histfile.so: $(topdir)/rlshell.h
nls.so: $(topdir)/rlshell.h
readline.so: $(topdir)/rlshell.h
shell.so: $(topdir)/rlshell.h
terminal.so: $(topdir)/rlshell.h
histexpand.so: $(topdir)/rlshell.h
bind.so: $(topdir)/rlprivate.h
callback.so: $(topdir)/rlprivate.h
complete.so: $(topdir)/rlprivate.h
display.so: $(topdir)/rlprivate.h
input.so: $(topdir)/rlprivate.h
isearch.so: $(topdir)/rlprivate.h
kill.so: $(topdir)/rlprivate.h
macro.so: $(topdir)/rlprivate.h
nls.so: $(topdir)/rlprivate.h
parens.so: $(topdir)/rlprivate.h
readline.so: $(topdir)/rlprivate.h
rltty.so: $(topdir)/rlprivate.h
search.so: $(topdir)/rlprivate.h
signals.so: $(topdir)/rlprivate.h
terminal.so: $(topdir)/rlprivate.h
undo.so: $(topdir)/rlprivate.h
util.so: $(topdir)/rlprivate.h
vi_mode.so: $(topdir)/rlprivate.h
bind.so: $(topdir)/xmalloc.h
complete.so: $(topdir)/xmalloc.h
display.so: $(topdir)/xmalloc.h
funmap.so: $(topdir)/xmalloc.h
histexpand.so: $(topdir)/xmalloc.h
histfile.so: $(topdir)/xmalloc.h
history.so: $(topdir)/xmalloc.h
input.so: $(topdir)/xmalloc.h
isearch.so: $(topdir)/xmalloc.h
keymaps.so: $(topdir)/xmalloc.h
kill.so: $(topdir)/xmalloc.h
macro.so: $(topdir)/xmalloc.h
readline.so: $(topdir)/xmalloc.h
savestring.so: $(topdir)/xmalloc.h
search.so: $(topdir)/xmalloc.h
shell.so: $(topdir)/xmalloc.h
tilde.so: $(topdir)/xmalloc.h
tilde.so: $(topdir)/xmalloc.h
util.so: $(topdir)/xmalloc.h
vi_mode.so: $(topdir)/xmalloc.h
readline.so: $(topdir)/readline.c
vi_mode.so: $(topdir)/vi_mode.c
funmap.so: $(topdir)/funmap.c

View File

@ -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__) && !defined(__DJGPP__)
# undef HANDLE_SIGNALS
#endif /* __GO32__ && !__DJGPP__ */
#if defined (HANDLE_SIGNALS)
/* Some standard library routines. */
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#if !defined (RETSIGTYPE)
# if defined (VOID_SIGHANDLER)
# define RETSIGTYPE void
@ -67,19 +65,15 @@
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
typedef RETSIGTYPE SigHandler ();
extern int readline_echoing_p;
extern int rl_pending_input;
extern int _rl_meta_flag;
#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 */
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 ();
static SigHandler *rl_set_sighandler ();
static SigHandler *rl_set_sighandler __P((int, SigHandler *, sighandler_cxt *));
/* Exported variables for use by applications. */
@ -103,14 +97,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;
@ -167,6 +153,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. */
@ -234,6 +224,7 @@ rl_set_sighandler (sig, handler, ohandler)
SigHandler *handler;
sighandler_cxt *ohandler;
{
sighandler_cxt old_handler;
#if defined (HAVE_POSIX_SIGNALS)
struct sigaction act;
@ -241,10 +232,17 @@ rl_set_sighandler (sig, handler, ohandler)
act.sa_flags = 0;
sigemptyset (&act.sa_mask);
sigemptyset (&ohandler->sa_mask);
sigaction (sig, &act, ohandler);
sigaction (sig, &act, &old_handler);
#else
ohandler->sa_handler = (SigHandler *)signal (sig, handler);
old_handler.sa_handler = (SigHandler *)signal (sig, handler);
#endif /* !HAVE_POSIX_SIGNALS */
/* XXX -- assume we have memcpy */
/* If rl_set_signals is called twice in a row, don't set the old handler to
rl_signal_handler, because that would cause infinite recursion. */
if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
return (ohandler->sa_handler);
}

View File

@ -35,6 +35,19 @@
# (but try to keep the structure clean).
#
# Use $HOST_CC if defined. $CC may point to a cross-compiler
if test x"$CC_FOR_BUILD" = x; then
if test x"$HOST_CC" != x; then
CC_FOR_BUILD="$HOST_CC"
else
if test x"$CC" != x; then
CC_FOR_BUILD="$CC"
else
CC_FOR_BUILD=cc
fi
fi
fi
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@ -57,7 +70,8 @@ esac
REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
dummy=dummy-$$
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
# is contrary to all other versions of uname
@ -81,9 +95,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
i?86:OpenBSD:*:*)
echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i?86:FreeBSD:*:*)
echo ${UNAME_MACHINE}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
sparc:NetBSD:*:*)
echo sparc-unknown-netbsd${UNAME_RELEASE}
exit 0 ;;
@ -151,17 +162,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:QNX:*:42*)
echo i386-qssl-qnx`echo ${UNAME_VERSION}`
exit 0 ;;
BeBox:BeOS:*:*)
echo powerpc-be-beos
Alpha*:Windows:NT:*:SP*)
echo alpha-pc-opennt
exit 0 ;;
BeMac:BeOS:*:*)
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*)
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
*:Windows:NT:*:SP*)
echo intel-pc-opennt
exit 0 ;;
# end cases added for Bash
alpha:OSF1:*:*)
@ -172,7 +177,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <<EOF >dummy.s
cat <<EOF >$dummy.s
.globl main
.ent main
main:
@ -189,9 +194,9 @@ main:
ret \$31,(\$26),1
.end main
EOF
${CC-cc} dummy.s -o dummy 2>/dev/null
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./dummy
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
@ -210,9 +215,15 @@ EOF
;;
esac
fi
rm -f dummy.s dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
@ -255,7 +266,7 @@ EOF
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
@ -263,9 +274,12 @@ EOF
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE:*:*:dcosx)
NILE:*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@ -287,7 +301,7 @@ EOF
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*|sun:SunOS:*:*)
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
sun*:*:4.2BSD:*)
@ -309,19 +323,45 @@ EOF
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-atari-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-sun-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-apple-openbsd${UNAME_RELEASE}
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
@ -329,15 +369,15 @@ EOF
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
Power?Macintosh:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-unknown-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:"Mac OS":*:*)
echo `uname -p`-apple-macos${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
macppc:NetBSD:*:*)
echo powerpc-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
@ -347,12 +387,16 @@ EOF
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:*)
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
@ -367,10 +411,10 @@ EOF
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
@ -389,13 +433,14 @@ EOF
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
@ -422,7 +467,7 @@ EOF
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
@ -433,8 +478,8 @@ EOF
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
@ -443,7 +488,8 @@ EOF
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
@ -484,17 +530,46 @@ EOF
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/78? | 9000/80[24] | 9000/8[67]1 | 9000/8[78]9 | 9000/893 )
HP_ARCH=hppa2.0 ;;
9000/7?? | 9000/8?[13679] | 9000/892 )
HP_ARCH=hppa1.1 ;;
9000/[68]?? ) HP_ARCH=hppa1.0 ;;
9000/[678][0-9][0-9])
sed 's/^ //' << EOF >$dummy.c
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
rm -f $dummy.c $dummy
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
@ -519,8 +594,8 @@ EOF
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@ -529,6 +604,9 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
*9??*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
@ -537,14 +615,17 @@ EOF
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-pc-osf1mk
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-pc-osf1
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
hppa*:OpenBSD:*:*)
echo hppa-unknown-openbsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
@ -577,11 +658,14 @@ EOF
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*T3E:*:*:*)
echo alpha-cray-unicosmk${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
@ -591,14 +675,26 @@ EOF
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp3[0-9][05]:OpenBSD:*:*)
echo m68k-hp-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
if test -x /usr/bin/objformat; then
if test "elf" = "`/usr/bin/objformat`"; then
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0
fi
fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
@ -607,14 +703,23 @@ EOF
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-pc-cygwin32
echo ${UNAME_MACHINE}-pc-cygwin32
exit 0 ;;
i*:MINGW*:*)
echo i386-pc-mingw32
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
echo powerpcle-unknown-cygwin
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
@ -622,9 +727,17 @@ EOF
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# uname on the ARM produces all sorts of strangeness, and we need to
# filter it out.
case "$UNAME_MACHINE" in
armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
arm* | sa110*) UNAME_MACHINE="arm" ;;
esac
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
ld_help_string=`cd /; ld --help 2>&1`
ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g
@ -632,15 +745,46 @@ EOF
s/ .*//
p'`
case "$ld_supported_emulations" in
*ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;;
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
esac
elf32ppc | elf32ppclinux)
# Determine Lib Version
cat >$dummy.c <<EOF
#include <features.h>
#if defined(__GLIBC__)
extern char __libc_version[];
extern char __libc_release[];
#endif
main(argc, argv)
int argc;
char *argv[];
{
#if defined(__GLIBC__)
printf("%s %s\n", __libc_version, __libc_release);
#else
printf("unkown\n");
#endif
return 0;
}
EOF
LIBC=""
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy | grep 1\.99 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f $dummy.c $dummy
echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
esac
if test "${UNAME_MACHINE}" = "alpha" ; then
sed 's/^ //' <<EOF >dummy.s
sed 's/^ //' <<EOF >$dummy.s
.globl main
.ent main
main:
@ -658,9 +802,9 @@ EOF
.end main
EOF
LIBC=""
${CC-cc} dummy.s -o dummy 2>/dev/null
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./dummy
./$dummy
case "$?" in
7)
UNAME_MACHINE="alpha"
@ -679,20 +823,21 @@ EOF
;;
esac
objdump --private-headers dummy | \
objdump --private-headers $dummy | \
grep ld.so.1 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f dummy.s dummy
rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
cat >$dummy.c <<EOF
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __MIPSEB__
printf ("%s-unknown-linux-gnu\n", argv[1]);
#endif
@ -702,8 +847,8 @@ main(argc, argv)
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
@ -722,12 +867,13 @@ EOF
;;
esac
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
cat >$dummy.c <<EOF
#include <features.h>
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __cplusplus
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
@ -744,8 +890,8 @@ main(argc, argv)
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
@ -754,9 +900,9 @@ EOF
exit 0 ;;
# added by chet for bash based on usenet posting from <hops@sco.com> and
# documentation on SCO's web site -- UnixWare 7 (SVR5)
i?86:UnixWare:5*:*)
echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
exit 0 ;;
# i?86:UnixWare:5*:*)
# echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
# exit 0 ;;
i?86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
@ -772,6 +918,14 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:5:7*)
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@ -781,6 +935,10 @@ EOF
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
@ -827,7 +985,7 @@ EOF
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i?86:LynxOS:2.*:*)
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
echo i386-pc-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
@ -872,23 +1030,40 @@ EOF
news*:NEWS-OS:*:6*)
echo mips-sony-newsos6
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-apple-beos
exit 0 ;;
BeMac:BeOS:*:*)
echo powerpc-apple-beos
exit 0 ;;
BePC:BeOS:*:*)
echo i586-pc-beos
exit 0 ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit 0 ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
@ -930,7 +1105,10 @@ main ()
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
@ -1097,8 +1275,8 @@ main ()
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.

View File

@ -98,6 +98,16 @@ case $os in
os=
basic_machine=$1
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=vxworks
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
@ -121,6 +131,9 @@ case $os in
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@ -149,19 +162,27 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| hppa2.0 | alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
| 580 | i960 | h8300 \
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
| mips64vr5000 | miprs64vr5000el | mcore \
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
| thumb | d10v)
basic_machine=$basic_machine-unknown
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[3456]86)
i[34567]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
@ -170,30 +191,53 @@ case $basic_machine in
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
| alpha-* | alphaev5-* | alphaev56-* | alphapca56-* | alphaev6-* \
| we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* | f301-* \
| butterfly-bbn* \
| cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
# FIXME: clean up the formatting here.
vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
| xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
| alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
| clipper-* | orion-* \
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
| mipstx39-* | mipstx39el-* | mcore-* \
| f301-* | armv*-* | t3e-* \
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
| thumb-* | v850-* | d30v-* | tic30-* | c30-* )
;;
# BEGIN cases added for Bash
butterfly-bbn* | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \
| tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \
| concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \
| *-convex | sx4*-nec)
| *-convex | sx[45]*-nec )
;;
# END cases added for Bash
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
@ -212,13 +256,9 @@ case $basic_machine in
# basic_machine=m68k-cbm
basic_machine=m68k-unknown
;;
amigaos)
basic_machine=m68k-unknown
os=-amigaos
;;
amigados)
amigaos | amigados)
basic_machine=m68k-cbm
os=-amigados
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-cbm
@ -228,6 +268,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -307,6 +351,10 @@ case $basic_machine in
encore | umax | mmax | multimax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
@ -325,6 +373,14 @@ case $basic_machine in
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
@ -340,13 +396,30 @@ case $basic_machine in
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
@ -355,6 +428,14 @@ case $basic_machine in
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
ibm032-*)
basic_machine=ibmrt-ibm
;;
@ -363,22 +444,38 @@ case $basic_machine in
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
i[34567]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
i[34567]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
i[34567]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
i[34567]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
i386-go32 | go32)
basic_machine=i386-unknown
os=-go32
;;
i386-mingw32 | mingw32)
basic_machine=i386-unknown
os=-mingw32
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
@ -410,13 +507,17 @@ case $basic_machine in
miniframe)
basic_machine=m68000-convergent
;;
*mint | *MiNT)
basic_machine=m68k-atari
os=-mint
;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux
os=-linux-gnu
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
@ -424,10 +525,26 @@ case $basic_machine in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
msdos)
basic_machine=i386-unknown
os=-msdos
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-corel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
@ -440,6 +557,10 @@ case $basic_machine in
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
@ -465,6 +586,10 @@ case $basic_machine in
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
np1)
basic_machine=np1-gould
;;
@ -476,6 +601,18 @@ case $basic_machine in
basic_machine=i386-pc
os=-sco3.2v4
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
@ -490,28 +627,26 @@ case $basic_machine in
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
pentium | p5 | k5 | k6 | nexen)
basic_machine=i586-intel
;;
pentiumpro | p6)
basic_machine=i686-intel
pentiumpro | p6 | 6x86)
basic_machine=i686-pc
;;
pentiumii | pentium2)
basic_machine=i786-pc
;;
pentium-* | p5-*)
pentium-* | p5-* | k5-* | k6-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
pentiumpro-* | p6-* | 6x86*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
pentiumii-* | pentium2-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
@ -519,24 +654,32 @@ case $basic_machine in
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sequent)
basic_machine=i386-sequent
;;
@ -544,6 +687,10 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sparclite-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
@ -551,6 +698,13 @@ case $basic_machine in
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
sun2)
basic_machine=m68000-sun
;;
@ -595,6 +749,16 @@ case $basic_machine in
basic_machine=i386-sequent
os=-dynix
;;
t3e)
basic_machine=t3e-cray
os=-unicos
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
@ -614,6 +778,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-sysv5uw7
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
@ -637,13 +805,25 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
xps | xps100)
basic_machine=xps100-honeywell
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
@ -651,8 +831,17 @@ case $basic_machine in
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
mips)
if test "x$os" = "x-linux" ; then
if test "x$os" = "x-linux-gnu" ; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
@ -673,10 +862,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
sparc)
sparc | sparcv9)
basic_machine=sparc-sun
;;
cydra)
cydra)
basic_machine=cydra-cydrome
;;
orion)
@ -685,6 +874,16 @@ case $basic_machine in
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
@ -717,7 +916,7 @@ case $os in
-solaris)
os=-solaris2
;;
svr4*)
-svr4*)
os=-sysv4
;;
-unixware | -uw | -unixware2* | -uw2*)
@ -726,6 +925,9 @@ case $os in
-unixware7* | -uw7*)
os=-sysv5uw7
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
@ -736,18 +938,31 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv* | -qnx* | -powerux* | -beos* | -rhapsody* \
| -superux* )
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
# BEGIN CASES ADDED FOR Bash
-qnx* | -powerux* | -superux* )
;;
# END CASES ADDED FOR Bash
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -macos* | -mpw* | -magic* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
@ -772,11 +987,14 @@ case $os in
-acis*)
os=-aos
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
@ -806,9 +1024,18 @@ case $os in
# This must come after -sysvr[45].
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -*MiNT)
os=-mint
;;
-none)
;;
*)
@ -837,7 +1064,7 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
pdp11-*)
pdp11-*)
os=-none
;;
*-dec | vax-*)
@ -855,6 +1082,15 @@ case $basic_machine in
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
@ -867,6 +1103,15 @@ case $basic_machine in
*-ibm)
os=-aix
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
@ -909,19 +1154,19 @@ case $basic_machine in
*-next)
os=-nextstep3
;;
*-gould)
*-gould)
os=-sysv
;;
*-highlevel)
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
*-sgi)
os=-irix
;;
*-siemens)
*-siemens)
os=-sysv4
;;
*-masscomp)
@ -930,6 +1175,18 @@ case $basic_machine in
f301-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
@ -954,6 +1211,9 @@ case $basic_machine in
-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
@ -984,6 +1244,15 @@ case $basic_machine in
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -*MiNT)
vendor=atari
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;

View File

@ -49,7 +49,7 @@ LN="ln -s"
if [ -z "$uninstall" ]; then
${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
if [ -f "$INSTALLDIR/$LIBNAME" ]; then
${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF}
${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}.${OLDSUFF}
fi
fi
@ -63,6 +63,14 @@ fi
# post-install/uninstall
# HP-UX requires that a shared library have execute permission
case "$host_os" in
hpux*) if [ -z "$uninstall" ]; then
chmod 755 ${INSTALLDIR}/${LIBNAME}
fi ;;
*) ;;
esac
case "$LIBNAME" in
*.*.[0-9].[0-9]) # libname.so.M.N
LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M
@ -71,6 +79,9 @@ case "$LIBNAME" in
*.*.[0-9]) # libname.so.M
LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so
;;
*.[0-9]) # libname.M
LINK1=`echo $LIBNAME | sed 's:\(.*\)\.[0-9]:\1:'` # libname
;;
esac
#
@ -91,7 +102,7 @@ case "$host_os" in
fi
;;
solaris2*|aix4.[2-9]*|hpux1*)
solaris2*|aix4.[2-9]*|osf*|irix[56]*)
# libname.so -> libname.so.M
${echo} ${RM} ${INSTALLDIR}/$LINK1
if [ -z "$uninstall" ]; then
@ -99,6 +110,38 @@ solaris2*|aix4.[2-9]*|hpux1*)
fi
;;
# FreeBSD 3.x can have either a.out or ELF shared libraries
freebsd3*)
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
# libname.so -> libname.so.M
${echo} ${RM} ${INSTALLDIR}/$LINK1
if [ -z "$uninstall" ]; then
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
fi
else
# libname.so.M -> libname.so.M.N
${echo} ${RM} ${INSTALLDIR}/$LINK2
if [ -z "$uninstall" ]; then
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK2
fi
# libname.so -> libname.so.M.N
${echo} ${RM} ${INSTALLDIR}/$LINK1
if [ -z "$uninstall" ]; then
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1
fi
fi
;;
hpux1*)
# libname.sl -> libname.M
${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
if [ -z "$uninstall" ]; then
${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LINK1}.sl
fi
;;
*) ;;
esac

View File

@ -62,9 +62,9 @@ sunos4*)
sunos5*-gcc*|solaris2*-gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-i'
SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
SHLIB_XLDFLAGS='-R $(libdir)'
# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
@ -73,7 +73,7 @@ sunos5*|solaris2*)
SHOBJ_LD=/usr/ccs/bin/ld
SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
SHLIB_XLDFLAGS='-R $(libdir)'
# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
@ -86,13 +86,32 @@ freebsd2* | netbsd* | openbsd*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
# FreeBSD-3.x can have either a.out or ELF object files
#freebsd3*)
# SHOBJ_CFLAGS=-fpic
# SHOBJ_LD='${CC}'
# SHOBJ_LDFLAGS='-shared'
#
# SHLIB_XLDFLAGS='-R$(libdir)'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
# ;;
# FreeBSD-3.x ELF
freebsd3*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_XLDFLAGS='-R$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
else
SHOBJ_LDFLAGS='-shared'
SHLIB_XLDFLAGS='-R$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
fi
;;
linux*)
@ -142,6 +161,15 @@ bsdi4*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
osf*-gcc*)
# Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
osf*)
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
@ -187,7 +215,9 @@ irix[56]*-gcc*)
irix[56]*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
# SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
# Change from David Kaelbling <drk@sgi.com>
SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
@ -306,7 +336,7 @@ dgux*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
msdosdjgpp*)
msdos*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
;;

View File

@ -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_

View File

@ -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"
@ -57,10 +55,6 @@
# include <sys/ioctl.h>
#endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
#if defined (__GO32__)
# include <pc.h>
#endif
#include "rltty.h"
#include "tcap.h"
@ -68,21 +62,8 @@
#include "readline.h"
#include "history.h"
/* Variables and functions imported from readline.c */
extern FILE *_rl_in_stream, *_rl_out_stream;
extern int readline_echoing_p;
extern int _rl_bell_preference;
extern Keymap _rl_keymap;
/* Functions imported from bind.c */
extern void _rl_bind_if_unbound ();
/* Functions imported from shell.c */
extern void set_lines_and_columns ();
extern char *get_env_value ();
/* Functions imported from display.c */
extern void _rl_redisplay_after_sigwinch ();
#include "rlprivate.h"
#include "rlshell.h"
/* **************************************************************** */
/* */
@ -90,15 +71,13 @@ extern void _rl_redisplay_after_sigwinch ();
/* */
/* **************************************************************** */
#ifndef __DJGPP__
static char *term_buffer = (char *)NULL;
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;
#endif
static int tcap_initialized;
#if !defined (__linux__)
# if defined (__EMX__) || defined (NEED_EXTERN_PC)
@ -158,6 +137,22 @@ int _rl_enable_keypad;
/* Non-zero means the user wants to enable a meta key. */
int _rl_enable_meta = 1;
#if defined (__EMX__)
static void
_emx_get_screensize (swp, shp)
int *swp, *shp;
{
int sz[2];
_scrsize (sz);
if (swp)
*swp = sz[0];
if (shp)
*shp = sz[1];
}
#endif
/* Get readline's idea of the screen size. TTY is a file descriptor open
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
@ -170,9 +165,6 @@ _rl_get_screen_size (tty, ignore_env)
#if defined (TIOCGWINSZ)
struct winsize window_size;
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
int sz[2];
#endif
#if defined (TIOCGWINSZ)
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
@ -183,9 +175,7 @@ _rl_get_screen_size (tty, ignore_env)
#endif /* TIOCGWINSZ */
#if defined (__EMX__)
_scrsize (sz);
screenwidth = sz[0];
screenheight = sz[1];
_emx_get_screensize (&screenwidth, &screenheight);
#endif
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
@ -195,11 +185,7 @@ _rl_get_screen_size (tty, ignore_env)
if (ignore_env == 0 && (ss = get_env_value ("COLUMNS")))
screenwidth = atoi (ss);
#if defined(__DJGPP__)
tty = tty;
if (screenwidth <= 0)
screenwidth = ScreenCols ();
#else
#if !defined (__DJGPP__)
if (screenwidth <= 0 && term_string_buffer)
screenwidth = tgetnum ("co");
#endif
@ -212,10 +198,7 @@ _rl_get_screen_size (tty, ignore_env)
if (ignore_env == 0 && (ss = get_env_value ("LINES")))
screenheight = atoi (ss);
#if defined(__DJGPP__)
if (screenheight <= 0)
screenheight = ScreenRows ();
#else
#if !defined (__DJGPP__)
if (screenheight <= 0 && term_string_buffer)
screenheight = tgetnum ("li");
#endif
@ -233,7 +216,7 @@ _rl_get_screen_size (tty, ignore_env)
do a pair of putenv () or setenv () calls. */
set_lines_and_columns (screenheight, screenwidth);
if (!_rl_term_autowrap)
if (_rl_term_autowrap == 0)
screenwidth--;
screenchars = screenwidth * screenheight;
@ -271,32 +254,32 @@ struct _tc_string {
search algorithm to something smarter. */
static struct _tc_string tc_strings[] =
{
"DC", &term_DC,
"IC", &term_IC,
"ce", &term_clreol,
"cl", &term_clrpag,
"cr", &term_cr,
"dc", &term_dc,
"ei", &term_ei,
"ic", &term_ic,
"im", &term_im,
"kd", &term_kd,
"kh", &term_kh, /* home */
"kH", &term_kH, /* end */
"kl", &term_kl,
"kr", &term_kr,
"ku", &term_ku,
"ks", &term_ks,
"ke", &term_ke,
"le", &term_backspace,
"mm", &term_mm,
"mo", &term_mo,
{ "DC", &term_DC },
{ "IC", &term_IC },
{ "ce", &term_clreol },
{ "cl", &term_clrpag },
{ "cr", &term_cr },
{ "dc", &term_dc },
{ "ei", &term_ei },
{ "ic", &term_ic },
{ "im", &term_im },
{ "kd", &term_kd },
{ "kh", &term_kh }, /* home */
{ "kH", &term_kH }, /* end */
{ "kl", &term_kl },
{ "kr", &term_kr },
{ "ku", &term_ku },
{ "ks", &term_ks },
{ "ke", &term_ke },
{ "le", &term_backspace },
{ "mm", &term_mm },
{ "mo", &term_mo },
#if defined (HACK_TERMCAP_MOTION)
"nd", &term_forward_char,
{ "nd", &term_forward_char },
#endif
"pc", &term_pc,
"up", &term_up,
"vb", &visible_bell,
{ "pc", &term_pc },
{ "up", &term_up },
{ "vb", &visible_bell },
};
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
@ -307,9 +290,7 @@ static void
get_term_capabilities (bp)
char **bp;
{
#if defined(__DJGPP__)
bp = bp;
#else
#if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */
register int i;
for (i = 0; i < NUM_TC_STRINGS; i++)
@ -318,66 +299,87 @@ get_term_capabilities (bp)
tcap_initialized = 1;
}
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
int
_rl_init_terminal_io (terminal_name)
char *terminal_name;
{
#if defined (__GO32__)
terminal_name = terminal_name;
screenwidth = screenheight = 0;
_rl_get_screen_size (rl_instream ? fileno (rl_instream) : 0, 0);
term_cr = "\r";
term_im = term_ei = term_ic = term_IC = (char *)NULL;
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
/* Does the __GO32__ have a meta key? I don't know. */
term_has_meta = 0;
term_mm = term_mo = (char *)NULL;
/* It probably has arrow keys, but I don't know what they are. */
term_ku = term_kd = term_kr = term_kl = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif /* HACK_TERMCAP_MOTION */
terminal_can_insert = _rl_term_autowrap = 0;
return 0;
#else /* !__GO32__ */
char *term, *buffer;
int tty;
int tty, tgetent_ret;
Keymap xkeymap;
term = terminal_name ? terminal_name : get_env_value ("TERM");
if (term_string_buffer == 0)
term_string_buffer = xmalloc (2032);
if (term_buffer == 0)
term_buffer = xmalloc (4080);
buffer = term_string_buffer;
term_clrpag = term_cr = term_clreol = (char *)NULL;
tty = rl_instream ? fileno (rl_instream) : 0;
screenwidth = screenheight = 0;
if (term == 0)
term = "dumb";
if (tgetent (term_buffer, term) <= 0)
/* I've separated this out for later work on not calling tgetent at all
if the calling application has supplied a custom redisplay function,
(and possibly if the application has supplied a custom input function). */
if (CUSTOM_REDISPLAY_FUNC())
{
tgetent_ret = -1;
}
else
{
if (term_string_buffer == 0)
term_string_buffer = xmalloc(2032);
if (term_buffer == 0)
term_buffer = xmalloc(4080);
buffer = term_string_buffer;
tgetent_ret = tgetent (term_buffer, term);
}
if (tgetent_ret <= 0)
{
FREE (term_string_buffer);
FREE (term_buffer);
buffer = term_buffer = term_string_buffer = (char *)NULL;
dumb_term = 1;
screenwidth = 79;
screenheight = 24;
screenchars = 79 * 24;
_rl_term_autowrap = 0; /* used by _rl_get_screen_size */
#if defined (__EMX__)
_emx_get_screensize (&screenwidth, &screenheight);
screenwidth--;
#else /* !__EMX__ */
_rl_get_screen_size (tty, 0);
#endif /* !__EMX__ */
/* Defaults. */
if (screenwidth <= 0 || screenheight <= 0)
{
screenwidth = 79;
screenheight = 24;
}
/* Everything below here is used by the redisplay code (tputs). */
screenchars = screenwidth * screenheight;
term_cr = "\r";
term_im = term_ei = term_ic = term_IC = (char *)NULL;
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
term_ku = term_kd = term_kl = term_kr = (char *)NULL;
term_mm = term_mo = (char *)NULL;
#if defined (HACK_TERMCAP_MOTION)
term_forward_char = (char *)NULL;
#endif
terminal_can_insert = 0;
terminal_can_insert = term_has_meta = 0;
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if term_IC or term_DC is defined, but just in case we
change that later... */
PC = '\0';
BC = term_backspace = "\b";
UP = term_up;
return 0;
}
@ -392,10 +394,6 @@ _rl_init_terminal_io (terminal_name)
if (!term_cr)
term_cr = "\r";
tty = rl_instream ? fileno (rl_instream) : 0;
screenwidth = screenheight = 0;
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
_rl_get_screen_size (tty, 0);
@ -438,7 +436,6 @@ _rl_init_terminal_io (terminal_name)
_rl_keymap = xkeymap;
#endif /* !__GO32__ */
return 0;
}
@ -484,6 +481,7 @@ _rl_output_character_function (c)
return putc (c, _rl_out_stream);
}
#endif /* !_MINIX */
/* Write COUNT characters from STRING to the output stream. */
void
_rl_output_some_chars (string, count)
@ -500,12 +498,10 @@ _rl_backspace (count)
{
register int i;
#if !defined (__GO32__)
if (term_backspace)
for (i = 0; i < count; i++)
tputs (term_backspace, 1, _rl_output_character_function);
else
#endif /* !__GO32__ */
for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream);
return 0;
@ -535,16 +531,11 @@ ding ()
default:
break;
case VISIBLE_BELL:
#if defined (__GO32__)
ScreenVisualBell ();
break;
#else
if (visible_bell)
{
tputs (visible_bell, 1, _rl_output_character_function);
break;
}
#endif
/* FALLTHROUGH */
case AUDIBLE_BELL:
fprintf (stderr, "\007");
@ -565,7 +556,7 @@ ding ()
void
_rl_enable_meta_key ()
{
#if !defined(__DJGPP__)
#if !defined (__DJGPP__)
if (term_has_meta && term_mm)
tputs (term_mm, 1, _rl_output_character_function);
#endif
@ -575,9 +566,7 @@ void
_rl_control_keypad (on)
int on;
{
#if defined(__DJGPP__)
on = on;
#else
#if !defined (__DJGPP__)
if (on && term_ks)
tputs (term_ks, 1, _rl_output_character_function);
else if (!on && term_ke)

View File

@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 1, or (at your option) any
Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if defined (HAVE_CONFIG_H)
# include <config.h>
@ -47,12 +47,22 @@
#include "tilde.h"
#if defined (TEST) || defined (STATIC_MALLOC)
static char *xmalloc (), *xrealloc ();
#else
# if defined __STDC__
extern char *xmalloc (int);
extern char *xrealloc (void *, int);
# else
extern char *xmalloc (), *xrealloc ();
# endif /* !__STDC__ */
#endif /* TEST || STATIC_MALLOC */
#if !defined (HAVE_GETPW_DECLS)
extern struct passwd *getpwuid (), *getpwnam ();
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
extern char *xmalloc ();
# ifndef strcpy
extern char *strcpy ();
# endif
@ -67,17 +77,11 @@ extern char *strcpy ();
# endif /* !__STDC__ */
#endif /* !NULL */
#if defined (TEST) || defined (STATIC_MALLOC)
static char *xmalloc (), *xrealloc ();
#else
extern char *xmalloc (), *xrealloc ();
#endif /* TEST || STATIC_MALLOC */
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
extern char *get_home_dir ();
extern char *get_env_value ();
extern char *get_home_dir __P((void));
extern char *get_env_value __P((char *));
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
@ -122,7 +126,9 @@ tilde_find_prefix (string, len)
int *len;
{
register int i, j, string_len;
register char **prefixes = tilde_additional_prefixes;
register char **prefixes;
prefixes = tilde_additional_prefixes;
string_len = strlen (string);
*len = 0;
@ -161,7 +167,11 @@ tilde_find_suffix (string)
for (i = 0; i < string_len; i++)
{
#if defined (__MSDOS__)
if (string[i] == '/' || string[i] == '\\' /* || !string[i] */)
#else
if (string[i] == '/' /* || !string[i] */)
#endif
break;
for (j = 0; suffixes && suffixes[j]; j++)
@ -225,11 +235,18 @@ tilde_expand (string)
free (tilde_word);
len = strlen (expansion);
if ((result_index + len + 1) > result_size)
result = xrealloc (result, 1 + (result_size += (len + 20)));
#ifdef __CYGWIN32__
/* Fix for Cygwin to prevent ~user/xxx from expanding to //xxx when
$HOME for `user' is /. On cygwin, // denotes a network drive. */
if (len > 1 || *expansion != '/' || *string != '/')
#endif
{
if ((result_index + len + 1) > result_size)
result = xrealloc (result, 1 + (result_size += (len + 20)));
strcpy (result + result_index, expansion);
result_index += len;
strcpy (result + result_index, expansion);
result_index += len;
}
free (expansion);
}
@ -250,7 +267,11 @@ isolate_tilde_prefix (fname, lenp)
int i;
ret = xmalloc (strlen (fname));
#if defined (__MSDOS__)
for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++)
#else
for (i = 1; fname[i] && fname[i] != '/'; i++)
#endif
ret[i - 1] = fname[i];
ret[i - 1] = '\0';
if (lenp)
@ -271,7 +292,7 @@ glue_prefix_and_suffix (prefix, suffix, suffind)
plen = (prefix && *prefix) ? strlen (prefix) : 0;
slen = strlen (suffix + suffind);
ret = xmalloc (plen + slen + 1);
if (prefix && *prefix)
if (plen)
strcpy (ret, prefix);
strcpy (ret + plen, suffix + suffind);
return ret;

View File

@ -8,7 +8,7 @@
The Library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
The Library is distributed in the hope that it will be useful, but
@ -19,11 +19,27 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#if !defined (_TILDE_H_)
# define _TILDE_H_
#ifdef __cplusplus
extern "C" {
#endif
/* A function can be defined using prototypes and compile on both ANSI C
and traditional C compilers with something like this:
extern char *func __P((char *, char *, int)); */
#if !defined (__P)
# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
# define __P(protos) protos
# else
# define __P(protos) ()
# endif
#endif
/* Function pointers can be declared as (Function *)foo. */
#if !defined (_FUNCTION_DEF)
# define _FUNCTION_DEF
@ -56,10 +72,14 @@ extern char **tilde_additional_prefixes;
extern char **tilde_additional_suffixes;
/* Return a new string which is the result of tilde expanding STRING. */
extern char *tilde_expand ();
extern char *tilde_expand __P((char *));
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
extern char *tilde_expand_word ();
extern char *tilde_expand_word __P((char *));
#ifdef __cplusplus
}
#endif
#endif /* _TILDE_H_ */

View File

@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
@ -47,6 +47,8 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
/* Non-zero tells rl_delete_text and rl_insert_text to not add to

View File

@ -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,25 +52,11 @@
/* Some standard library routines. */
#include "readline.h"
#include "rlprivate.h"
#include "xmalloc.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 ();
/* **************************************************************** */
/* */
/* Utility Functions */

View File

@ -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>

View File

@ -8,7 +8,7 @@
The GNU Readline Library is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 1, or
as published by the Free Software Foundation; either version 2, or
(at your option) any later version.
The GNU Readline Library is distributed in the hope that it will be
@ -19,7 +19,7 @@
The GNU General Public License is often shipped with GNU software, and
is generally kept in a file called COPYING or LICENSE. If you do not
have a copy of the license, write to the Free Software Foundation,
675 Mass Ave, Cambridge, MA 02139, USA. */
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
/* **************************************************************** */
@ -54,6 +54,9 @@
#include "readline.h"
#include "history.h"
#include "rlprivate.h"
#include "xmalloc.h"
#ifndef _rl_digit_p
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
#endif
@ -74,26 +77,6 @@
#define exchange(x, y) do {int temp = x; x = y; y = temp;} while (0)
#endif
extern char *xmalloc (), *xrealloc ();
/* Variables imported from readline.c */
extern int rl_point, rl_end, rl_mark;
extern FILE *rl_instream;
extern int rl_line_buffer_len, rl_explicit_arg, rl_numeric_arg;
extern Keymap _rl_keymap;
extern char *rl_prompt;
extern char *rl_line_buffer;
extern int rl_arg_sign;
extern int _rl_doing_an_undo;
extern int _rl_undo_group_level;
extern void _rl_dispatch ();
extern int _rl_char_search_internal ();
extern void rl_extend_line_buffer ();
extern int rl_vi_check ();
/* Non-zero means enter insertion mode. */
static int _rl_vi_doing_insert;
@ -131,7 +114,7 @@ static char *vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~";
/* Arrays for the saved marks. */
static int vi_mark_chars[27];
static int rl_digit_loop1 ();
static int rl_digit_loop1 __P((void));
void
_rl_vi_initialize_line ()
@ -1043,7 +1026,7 @@ rl_vi_char_search (count, key)
if (vi_redoing)
target = _rl_vi_last_search_char;
else
_rl_vi_last_search_char = target = rl_getc (rl_instream);
_rl_vi_last_search_char = target = (*rl_getc_function) (rl_instream);
switch (key)
{
@ -1159,7 +1142,7 @@ rl_vi_change_char (count, key)
if (vi_redoing)
c = _rl_vi_last_replacement;
else
_rl_vi_last_replacement = c = rl_getc (rl_instream);
_rl_vi_last_replacement = c = (*rl_getc_function) (rl_instream);
if (c == '\033' || c == CTRL ('C'))
return -1;

View File

@ -7,7 +7,7 @@
Readline is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 1, or (at your option) any
Free Software Foundation; either version 2, or (at your option) any
later version.
Readline is distributed in the hope that it will be useful, but
@ -17,7 +17,8 @@
You should have received a copy of the GNU General Public License
along with Readline; see the file COPYING. If not, write to the Free
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */
#define READLINE_LIBRARY
#if defined (HAVE_CONFIG_H)
#include <config.h>
@ -31,7 +32,7 @@
# include "ansi_stdlib.h"
#endif /* HAVE_STDLIB_H */
static void memory_error_and_abort ();
#include "xmalloc.h"
/* **************************************************************** */
/* */
@ -39,6 +40,14 @@ static void memory_error_and_abort ();
/* */
/* **************************************************************** */
static void
memory_error_and_abort (fname)
char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
}
/* Return a pointer to free()able block of memory large enough
to hold BYTES number of bytes. If the memory cannot be allocated,
print an error message and abort. */
@ -56,7 +65,7 @@ xmalloc (bytes)
char *
xrealloc (pointer, bytes)
char *pointer;
PTR_T pointer;
int bytes;
{
char *temp;
@ -68,19 +77,11 @@ xrealloc (pointer, bytes)
return (temp);
}
static void
memory_error_and_abort (fname)
char *fname;
{
fprintf (stderr, "%s: out of virtual memory\n", fname);
exit (2);
}
/* Use this as the function to call when adding unwind protects so we
don't need to know what free() returns. */
void
xfree (string)
char *string;
PTR_T string;
{
if (string)
free (string);