diff options
Diffstat (limited to 'readline')
57 files changed, 3715 insertions, 1624 deletions
diff --git a/readline/CHANGELOG b/readline/CHANGELOG index 8094590..479e6c0 100644 --- a/readline/CHANGELOG +++ b/readline/CHANGELOG @@ -75,3 +75,142 @@ examples/Makefile.in --- configure.in - bumped LIBVERSION up to 2.2 + + 4/18 + ---- +[readline-2.2 released] + + 4/20 + ---- +Makefile.in + - make `libhistory.a' a dependency of `install' + - fixed a typo in the recipe for `install' that copied libreadline.a + to libhistory.old right after installing it + + 4/27 + ---- +doc/Makefile.in + - install {readline,history}.info out of the source directory if + they are not found in the current (build) directory -- only an + issue if the libraries are built in a different directory than + the source directory + + 5/1 + --- +support/shobj-conf + - script from the bash distribution to do shared object and library + configuration + +shlib/Makefile.in + - new directory and makefile to handle building shared versions of + libreadline and libhistory, controlled by support/shobj-conf + + 5/7 + --- +doc/Makefile.in + - set SHELL to /bin/sh, rather than relying on make to be correct + + 5/14 + ---- +savestring.c + - new file, moved from shell.c, for backwards compatibility + +Makefile.in, shlib/Makefile.in + - make sure savestring.c is compiled and added to libreadline and + libhistory + +[THERE ARE NO MORE #ifdef SHELL LINES IN THE C SOURCE FILES.] + + 5/15 + ---- +README + - updated description of shared library creation for the new scheme + +[THERE ARE NO MORE #ifdef SHELL LINES IN ANY OF THE SOURCE FILES.] + +Makefile.in + - bumped SHLIB_MAJOR up to 4 since we've augmented the library + API + - rlconf.h is now one of the installed headers, so applications can + find out whether things like vi-mode are available in the installed + libreadline + + 5/20 + ---- +configure.in + - changed RL_LIBRARY_VERSION to 4.0 to match the version of the + installed shared libraries + + 6/5 + --- +rlstdc.h + - new file + +Makefile.in + - rlstdc.h is now one of the installed headers + + 8/3 + --- +shlib/Makefile.in + - made the suffix rule that creates xx.so from xx.c write the + compiler output to `a.o', which is then mv'd to xx.so, because + some compilers (Sun WSpro 4.2, for example) don't allow any + suffixes other than `.o' for `cc -c' (not even `a.out') + + 9/15 + ---- + +Makefile.in + - AR and ARFLAGS are now substituted by configure, used in recipes + that build the libraries + +configure.in + - use AC_CHECK_PROG to check for ar + - set ARFLAGS if it has not already been set in the environment + + 10/5 + ---- +Makefile.in + - removed savestring.o from object file list + + 10/28 + ----- +shlib/Makefile.in + - don't use a fixed filename in the .c.so suffix rule to avoid + problems with parallel makes + + 12/21 + ----- +support/shlib-install + - new script to install shared readline and history libraries + +shlib/Makefile.in + - changed to call shlib-install for install and uninstall targets + +[readline-4.0-beta1 frozen] + + 12/22 + ----- +configure.in + - call AC_SUBST for SHOBJ_XLDFLAGS and SHLIB_LIBS + +shlib/Makefile.in + - SHOBJ_XLDFLAGS and SHLIB_LIBS are now substituted by configure + - add $(SHLIB_LIBS) at end of command line that builds the shared + libraries (currently needed only by AIX 4.2) + + 12/31 + ----- +MANIFEST, MANIFEST.doc + - the TOC html files are no longer generated and no longer part of + the distribution + + 2/18/1999 + --------- +configure.in + - set MAKE_SHELL to /bin/sh and substitute into the Makefiles + +Makefile.in,{doc,examples,shlib}/Makefile.in + - set SHELL from @MAKE_SHELL@ + +[readline-4.0 released] diff --git a/readline/CHANGES b/readline/CHANGES index 382406e..65339c2 100644 --- a/readline/CHANGES +++ b/readline/CHANGES @@ -1,22 +1,131 @@ -This document details the changes between this version, readline-2.2.1, +This document details the changes between this version, readline-4.0, and the previous version, readline-2.2. 1. Changes to Readline -a. The `make install' target was corrected so that it did not move the - newly-installed libreadline.a to libhistory.old +a. The version number is now 4.0, to match the major and minor version + numbers on the shared readline and history libraries. Future + releases will maintain the identical numbering. -b. The `make install' target for the documentation will now install the - info files from the source directory if they do not appear in the - build directory, since they are shipped in the readline tar file. +b. Fixed a typo in the `make install' recipe that copied libreadline.a + to libhistory.old right after installing it. -c. Fixed a problem with redisplay that showed up when the prompt string was - longer than the screen width and the prompt contained invisible characters. +c. The readline and history info files are now installed out of the source + directory if they are not found in the build directory. -d. Fixed a problem with the paren matching code -- the blink was far too - short (it's specified in microseconds, not milliseconds, Chet!). +d. The library no longer exports a function named `savestring' -- backwards + compatibility be damned. ------------------------------------------------------------------------------- +e. There is no longer any #ifdef SHELL code in the source files. + +f. Some changes were made to the key binding code to fix memory leaks and + better support Win32 systems. + +g. Fixed a silly typo in the paren matching code -- it's microseconds, not + milliseconds. + +h. The readline library should be compilable by C++ compilers. + +i. The readline.h public header file now includes function prototypes for + all readline functions, and some changes were made to fix errors in the + source files uncovered by the use of prototypes. + +j. The maximum numeric argument is now clamped at 1000000. + +k. Fixes to rl_yank_last_arg to make it behave better. + +l. Fixed a bug in the display code that caused core dumps if the prompt + string length exceeded 1024 characters. + +m. The menu completion code was fixed to properly insert a single completion + if there is only one match. + +n. A bug was fixed that caused the display code to improperly display tabs + after newlines. + +o. A fix was made to the completion code in which a typo caused the wrong + value to be passed to the function that computed the longest common + prefix of the list of matches. + +p. The completion code now checks the value of rl_filename_completion_desired, + which is set by application-supplied completion functions to indicate + that filename completion is being performed, to decide whether or not to + call an application-supplied `ignore completions' function. + +q. Code was added to the history library to catch history substitutions + using `&' without a previous history substitution or search having been + performed. + + +2. New Features in Readline + +a. There is a new script, support/shobj-conf, to do system-specific shared + object and library configuration. It generates variables for configure + to substitute into makefiles. The README file provides a detailed + explanation of the shared library creation process. + +b. Shared libraries and objects are now built in the `shlib' subdirectory. + There is a shlib/Makefile.in to control the build process. `make shared' + from the top-level directory is still the right way to build shared + versions of the libraries. + +c. rlconf.h is now installed, so applications can find out which features + have been compiled into the installed readline and history libraries. + +d. rlstdc.h is now an installed header file. + +e. Many changes to the signal handling: + o Readline now catches SIGQUIT and cleans up the tty before returning; + o A new variable, rl_catch_signals, is available to application writers + to indicate to readline whether or not it should install its own + signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, + SIGTTIN, and SIGTTOU; + o A new variable, rl_catch_sigwinch, is available to application + writers to indicate to readline whether or not it should install its + own signal handler for SIGWINCH, which will chain to the calling + applications's SIGWINCH handler, if one is installed; + o There is a new function, rl_free_line_state, for application signal + handlers to call to free up the state associated with the current + line after receiving a signal; + o There is a new function, rl_cleanup_after_signal, to clean up the + display and terminal state after receiving a signal; + o There is a new function, rl_reset_after_signal, to reinitialize the + terminal and display state after an application signal handler + returns and readline continues + +f. There is a new function, rl_resize_terminal, to reset readline's idea of + the screen size after a SIGWINCH. + +g. New public functions: rl_save_prompt and rl_restore_prompt. These were + previously private functions with a `_' prefix. These functions are + used when an application wants to write a message to the `message area' + with rl_message and have the prompt restored correctly when the message + is erased. + +h. New function hook: rl_pre_input_hook, called just before readline starts + reading input, after initialization. + +i. New function hook: rl_display_matches_hook, called when readline would + display the list of completion matches. The new function + rl_display_match_list is what readline uses internally, and is available + for use by application functions called via this hook. + +j. New bindable function, delete-char-or-list, like tcsh. + +k. A new variable, rl_erase_empty_line, which, if set by an application using + readline, will cause readline to erase, prompt and all, lines on which the + only thing typed was a newline. + +l. There is a new script, support/shlib-install, to install and uninstall + the shared readline and history libraries. + +m. A new bindable variable, `isearch-terminators', which is a string + containing the set of characters that should terminate an incremental + search without being executed as a command. + +n. A new bindable function, forward-backward-delete-char. + +------------------------------------------------------------------------------- This document details the changes between this version, readline-2.2, and the previous version, readline-2.1. diff --git a/readline/MANIFEST b/readline/MANIFEST index e9e1c40..f23ff41 100644 --- a/readline/MANIFEST +++ b/readline/MANIFEST @@ -4,6 +4,7 @@ doc d examples d support d +shlib d COPYING f README f MANIFEST f @@ -27,6 +28,7 @@ posixstat.h f readline.h f rlconf.h f rldefs.h f +rlstdc.h f rltty.h f rlwinsize.h f tcap.h f @@ -45,6 +47,7 @@ nls.c f parens.c f readline.c f rltty.c f +savestring.c f search.c f shell.c f signals.c f @@ -60,13 +63,17 @@ history.c f histexpand.c f histfile.c f histsearch.c f +shlib/Makefile.in f support/config.guess f support/config.sub f support/install.sh f support/mkdirs f support/mkdist f +support/shobj-conf f +support/shlib-install f doc/Makefile.in f doc/texinfo.tex f +doc/manvers.texinfo f doc/rlman.texinfo f doc/rltech.texinfo f doc/rluser.texinfo f @@ -81,5 +88,16 @@ examples/fileman.c f examples/manexamp.c f examples/rltest.c f examples/rl.c f +examples/rlversion.c f examples/histexamp.c f examples/Inputrc f +# formatted documentation, from MANIFEST.doc +doc/readline.ps f +doc/history.ps f +doc/readline.dvi f +doc/history.dvi f +doc/readline.info f +doc/history.info f +doc/readline.html f +doc/history.html f +doc/readline.0 f diff --git a/readline/Makefile.in b/readline/Makefile.in index ae402fd..5c667ed 100644 --- a/readline/Makefile.in +++ b/readline/Makefile.in @@ -28,13 +28,15 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ CC = @CC@ -LD = ld # needed when building shared libraries RANLIB = @RANLIB@ -AR = ar +AR = @AR@ +ARFLAGS = @ARFLAGS@ RM = rm -f CP = cp MV = mv +SHELL = @MAKE_SHELL@ + prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -47,8 +49,6 @@ infodir = @infodir@ man3dir = $(mandir)/man3 -SHELL = /bin/sh - # Programs to make tags files. ETAGS = etags -tw CTAGS = ctags -tw @@ -56,7 +56,6 @@ CTAGS = ctags -tw CFLAGS = @CFLAGS@ LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@ DEFS = @DEFS@ LOCAL_DEFS = @LOCAL_DEFS@ @@ -66,34 +65,14 @@ INCLUDES = -I. -I$(srcdir) -I$(includedir) CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS) -# these two options need tweaking for compiler/OS versions other than gcc -# and SunOS4 -PICFLAG= -fpic # -pic for some versions of cc -SHLIB_OPTS= -assert pure-text -ldl # -Bshareable for some versions of gcc - -MAJOR= 3 -# shared library systems like SVR4's do not use minor versions -MINOR= .0 - -.SUFFIXES: .so - .c.o: + ${RM} $@ $(CC) -c $(CCFLAGS) $< -.c.so: - -mv $*.o z$*.o - $(CC) -c $(PICFLAG) $(CCFLAGS) $< - mv $*.o $@ - -mv z$*.o $*.o - # The name of the main library target. LIBRARY_NAME = libreadline.a STATIC_LIBS = libreadline.a libhistory.a -SHARED_READLINE = libreadline.so.$(MAJOR)$(MINOR) -SHARED_HISTORY = libhistory.so.$(MAJOR)$(MINOR) -SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY) - # The C code source files for this library. CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \ $(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \ @@ -104,65 +83,50 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \ $(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \ $(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \ $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \ - $(srcdir)/shell.c $(srcdir)/tilde.c + $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c # The header files for this library. HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \ posixstat.h posixdir.h posixjmp.h tilde.h rlconf.h rltty.h \ - ansi_stdlib.h tcap.h + ansi_stdlib.h tcap.h rlstdc.h -HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o +HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o TILDEOBJ = tilde.o OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \ rltty.o complete.o bind.o isearch.o display.o signals.o \ util.o kill.o undo.o macro.o input.o callback.o terminal.o \ nls.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) -SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so -SHARED_TILDEOBJ = tilde.so -SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \ - rltty.so complete.so bind.so isearch.so display.so signals.so \ - util.so kill.so undo.so macro.so input.so callback.so terminal.so \ - nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) - # The texinfo files which document this library. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo DOCOBJECT = doc/readline.dvi DOCSUPPORT = doc/Makefile DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT) -CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile +CREATED_MAKEFILES = Makefile doc/Makefile examples/Makefile shlib/Makefile CREATED_CONFIGURE = config.status config.h config.cache config.log \ stamp-config stamp-h CREATED_TAGS = TAGS tags -INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h +INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \ + rlstdc.h rlconf.h ########################################################################## all: static static: $(STATIC_LIBS) -shared: $(SHARED_LIBS) libreadline.a: $(OBJECTS) $(RM) $@ - $(AR) cr $@ $(OBJECTS) + $(AR) $(ARFLAGS) $@ $(OBJECTS) -test -n "$(RANLIB)" && $(RANLIB) $@ libhistory.a: $(HISTOBJ) xmalloc.o $(RM) $@ - $(AR) cr $@ $(HISTOBJ) xmalloc.o + $(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o -test -n "$(RANLIB)" && $(RANLIB) $@ -$(SHARED_READLINE): $(SHARED_OBJ) - $(RM) $@ - $(LD) ${SHLIB_OPTS} -o $@ $(SHARED_OBJ) - -$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so - $(RM) $@ - $(LD) ${SHLIB_OPTS} -o $@ $(SHARED_HISTOBJ) xmalloc.so - readline: $(OBJECTS) readline.h rldefs.h chardefs.h $(CC) $(CCFLAGS) -o $@ ./examples/rl.c ./libreadline.a -ltermcap @@ -187,6 +151,10 @@ stamp-h: config.status $(srcdir)/config.h.in #$(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 + -( cd shlib ; ${MAKE} ${MFLAGS} all ) + documentation: force -test -d doc || mkdir doc -( cd doc && $(MAKE) $(MFLAGS) ) @@ -233,13 +201,10 @@ uninstall: ${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS) install-shared: installdirs shared - -$(MV) $(libdir)/$(SHARED_HISTORY) $(libdir)/$(SHARED_HISTORY).old - $(INSTALL_DATA) $(SHARED_HISTORY) $(libdir)/$(SHARED_HISTORY) - -$(MV) $(libdir)/$(SHARED_READLINE) $(libdir)/$(SHARED_READLINE).old - $(INSTALL_DATA) $(SHARED_READLINE) $(libdir)/$(SHARED_READLINE) + -( cd shlib ; ${MAKE} ${MFLAGS} install ) uninstall-shared: - -test -n "$(libdir)" && cd $(libdir) && ${RM} ${SHARED_LIBS} + -( cd shlib; ${MAKE} ${MFLAGS} uninstall ) TAGS: force $(ETAGS) $(CSOURCES) $(HSOURCES) @@ -249,15 +214,17 @@ tags: force clean: force $(RM) $(OBJECTS) $(STATIC_LIBS) - $(RM) $(SHARED_OBJ) $(SHARED_LIBS) + -( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) mostlyclean: clean + -( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) distclean maintainer-clean: clean + -( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) $(RM) Makefile @@ -285,89 +252,89 @@ dist: force # Dependencies bind.o: ansi_stdlib.h posixstat.h bind.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -bind.o: readline.h keymaps.h chardefs.h tilde.h +bind.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h bind.o: history.h callback.o: rlconf.h callback.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -callback.o: readline.h keymaps.h chardefs.h tilde.h +callback.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h complete.o: ansi_stdlib.h posixdir.h posixstat.h complete.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -complete.o: readline.h keymaps.h chardefs.h tilde.h +complete.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h display.o: ansi_stdlib.h posixstat.h display.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h display.o: tcap.h display.o: readline.h keymaps.h chardefs.h tilde.h -display.o: history.h +display.o: history.h rlstdc.h funmap.o: readline.h keymaps.h chardefs.h tilde.h -funmap.o: rlconf.h ansi_stdlib.h +funmap.o: rlconf.h ansi_stdlib.h rlstdc.h funmap.o: ${BUILD_DIR}/config.h histexpand.o: ansi_stdlib.h -histexpand.o: history.h histlib.h +histexpand.o: history.h histlib.h rlstdc.h histexpand.o: ${BUILD_DIR}/config.h histfile.o: ansi_stdlib.h -histfile.o: history.h histlib.h +histfile.o: history.h histlib.h rlstdc.h histfile.o: ${BUILD_DIR}/config.h history.o: ansi_stdlib.h -history.o: history.h histlib.h +history.o: history.h histlib.h rlstdc.h history.o: ${BUILD_DIR}/config.h histsearch.o: ansi_stdlib.h -histsearch.o: history.h histlib.h +histsearch.o: history.h histlib.h rlstdc.h histsearch.o: ${BUILD_DIR}/config.h input.o: ansi_stdlib.h input.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -input.o: readline.h keymaps.h chardefs.h tilde.h +input.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h isearch.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h isearch.o: readline.h keymaps.h chardefs.h tilde.h -isearch.o: ansi_stdlib.h history.h +isearch.o: ansi_stdlib.h history.h rlstdc.h keymaps.o: emacs_keymap.c vi_keymap.c keymaps.o: keymaps.h chardefs.h rlconf.h ansi_stdlib.h keymaps.o: readline.h keymaps.h chardefs.h tilde.h -keymaps.o: ${BUILD_DIR}/config.h +keymaps.o: ${BUILD_DIR}/config.h rlstdc.h kill.o: ansi_stdlib.h kill.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h kill.o: readline.h keymaps.h chardefs.h tilde.h -kill.o: history.h +kill.o: history.h rlstdc.h macro.o: ansi_stdlib.h macro.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h macro.o: readline.h keymaps.h chardefs.h tilde.h -macro.o: history.h +macro.o: history.h rlstdc.h nls.o: ansi_stdlib.h nls.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h parens.o: rlconf.h parens.o: ${BUILD_DIR}/config.h -parens.o: readline.h keymaps.h chardefs.h tilde.h +parens.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h readline.o: readline.h keymaps.h chardefs.h tilde.h readline.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -readline.o: history.h +readline.o: history.h rlstdc.h readline.o: posixstat.h ansi_stdlib.h posixjmp.h rltty.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h rltty.o: rltty.h -rltty.o: readline.h keymaps.h chardefs.h tilde.h +rltty.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h search.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h search.o: readline.h keymaps.h chardefs.h tilde.h -search.o: ansi_stdlib.h history.h +search.o: ansi_stdlib.h history.h rlstdc.h shell.o: ${BUILD_DIR}/config.h shell.o: ansi_stdlib.h signals.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h signals.o: readline.h keymaps.h chardefs.h tilde.h -signals.o: history.h +signals.o: history.h rlstdc.h terminal.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h terminal.o: tcap.h terminal.o: readline.h keymaps.h chardefs.h tilde.h -terminal.o: history.h +terminal.o: history.h rlstdc.h tilde.o: ansi_stdlib.h tilde.o: ${BUILD_DIR}/config.h tilde.o: tilde.h undo.o: ansi_stdlib.h undo.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h undo.o: readline.h keymaps.h chardefs.h tilde.h -undo.o: history.h +undo.o: history.h rlstdc.h util.o: posixjmp.h ansi_stdlib.h util.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h -util.o: readline.h keymaps.h chardefs.h tilde.h +util.o: readline.h keymaps.h chardefs.h tilde.h rlstdc.h vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h vi_mode.o: readline.h keymaps.h chardefs.h tilde.h -vi_mode.o: history.h ansi_stdlib.h +vi_mode.o: history.h ansi_stdlib.h rlstdc.h xmalloc.o: ${BUILD_DIR}/config.h xmalloc.o: ansi_stdlib.h @@ -396,95 +363,10 @@ history.o: $(srcdir)/history.c histexpand.o: $(srcdir)/histexpand.c histfile.o: $(srcdir)/histfile.c histsearch.o: $(srcdir)/histsearch.c +savestring.o: $(srcdir)/savestring.c shell.o: $(srcdir)/shell.c tilde.o: $(srcdir)/tilde.c -bind.so: ansi_stdlib.h posixstat.h -bind.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -bind.so: readline.h keymaps.h chardefs.h tilde.h -bind.so: history.h -callback.so: rlconf.h -callback.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -callback.so: readline.h keymaps.h chardefs.h tilde.h -complete.so: ansi_stdlib.h posixdir.h posixstat.h -complete.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -complete.so: readline.h keymaps.h chardefs.h tilde.h -display.so: ansi_stdlib.h posixstat.h -display.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -display.so: tcap.h -display.so: readline.h keymaps.h chardefs.h tilde.h -display.so: history.h -funmap.so: readline.h keymaps.h chardefs.h tilde.h -funmap.so: rlconf.h ansi_stdlib.h -funmap.so: ${BUILD_DIR}/config.h -histexpand.so: ansi_stdlib.h -histexpand.so: history.h histlib.h -histexpand.so: ${BUILD_DIR}/config.h -histfile.so: ansi_stdlib.h -histfile.so: history.h histlib.h -histfile.so: ${BUILD_DIR}/config.h -history.so: ansi_stdlib.h -history.so: history.h histlib.h -history.so: ${BUILD_DIR}/config.h -histsearch.so: ansi_stdlib.h -histsearch.so: history.h histlib.h -histsearch.so: ${BUILD_DIR}/config.h -input.so: ansi_stdlib.h -input.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -input.so: readline.h keymaps.h chardefs.h tilde.h -isearch.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -isearch.so: readline.h keymaps.h chardefs.h tilde.h -isearch.so: ansi_stdlib.h history.h -keymaps.so: emacs_keymap.c vi_keymap.c -keymaps.so: keymaps.h chardefs.h rlconf.h ansi_stdlib.h -keymaps.so: readline.h keymaps.h chardefs.h tilde.h -keymaps.so: ${BUILD_DIR}/config.h -kill.so: ansi_stdlib.h -kill.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -kill.so: readline.h keymaps.h chardefs.h tilde.h -kill.so: history.h -macro.so: ansi_stdlib.h -macro.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -macro.so: readline.h keymaps.h chardefs.h tilde.h -macro.so: history.h -nls.so: ansi_stdlib.h -nls.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -parens.so: rlconf.h -parens.so: ${BUILD_DIR}/config.h -parens.so: readline.h keymaps.h chardefs.h tilde.h -readline.so: readline.h keymaps.h chardefs.h tilde.h -readline.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -readline.so: history.h -readline.so: posixstat.h ansi_stdlib.h posixjmp.h -rltty.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -rltty.so: rltty.h -rltty.so: readline.h keymaps.h chardefs.h tilde.h -search.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -search.so: readline.h keymaps.h chardefs.h tilde.h -search.so: ansi_stdlib.h history.h -signals.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -signals.so: readline.h keymaps.h chardefs.h tilde.h -signals.so: history.h -terminal.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -terminal.so: tcap.h -terminal.so: readline.h keymaps.h chardefs.h tilde.h -terminal.so: history.h -tilde.so: ansi_stdlib.h -tilde.so: ${BUILD_DIR}/config.h -tilde.so: tilde.h -undo.so: ansi_stdlib.h -undo.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -undo.so: readline.h keymaps.h chardefs.h tilde.h -undo.so: history.h -util.so: posixjmp.h ansi_stdlib.h -util.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -util.so: readline.h keymaps.h chardefs.h tilde.h -vi_mode.so: rldefs.h ${BUILD_DIR}/config.h rlconf.h -vi_mode.so: readline.h keymaps.h chardefs.h tilde.h -vi_mode.so: history.h ansi_stdlib.h -xmalloc.so: ${BUILD_DIR}/config.h -xmalloc.so: ansi_stdlib.h - readline.o: readline.c vi_mode.o: vi_mode.c funmap.o: funmap.c @@ -510,61 +392,6 @@ history.o: history.c histexpand.o: histexpand.c histfile.o: histfile.c histsearch.o: histsearch.c +savestring.o: savestring.c shell.o: shell.c tilde.o: tilde.c - -readline.so: $(srcdir)/readline.c -vi_mode.so: $(srcdir)/vi_mode.c -funmap.so: $(srcdir)/funmap.c -keymaps.so: $(srcdir)/keymaps.c -parens.so: $(srcdir)/parens.c -search.so: $(srcdir)/search.c -rltty.so: $(srcdir)/rltty.c -complete.so: $(srcdir)/complete.c -bind.so: $(srcdir)/bind.c -isearch.so: $(srcdir)/isearch.c -display.so: $(srcdir)/display.c -signals.so: $(srcdir)/signals.c -util.so: $(srcdir)/util.c -kill.so: $(srcdir)/kill.c -undo.so: $(srcdir)/undo.c -macro.so: $(srcdir)/macro.c -input.so: $(srcdir)/input.c -callback.so: $(srcdir)/callback.c -terminal.so: $(srcdir)/terminal.c -nls.so: $(srcdir)/nls.c -xmalloc.so: $(srcdir)/xmalloc.c -history.so: $(srcdir)/history.c -histexpand.so: $(srcdir)/histexpand.c -histfile.so: $(srcdir)/histfile.c -histsearch.so: $(srcdir)/histsearch.c -shell.so: $(srcdir)/shell.c -tilde.so: $(srcdir)/tilde.c - -readline.so: readline.c -vi_mode.so: vi_mode.c -funmap.so: funmap.c -keymaps.so: keymaps.c -parens.so: parens.c -search.so: search.c -rltty.so: rltty.c -complete.so: complete.c -bind.so: bind.c -isearch.so: isearch.c -display.so: display.c -signals.so: signals.c -util.so: util.c -kill.so: kill.c -undo.so: undo.c -macro.so: macro.c -input.so: input.c -callback.so: callback.c -terminal.so: terminal.c -nls.so: nls.c -xmalloc.so: xmalloc.c -history.so: history.c -histexpand.so: histexpand.c -histfile.so: histfile.c -histsearch.so: histsearch.c -shell.so: shell.c -tilde.so: tilde.c diff --git a/readline/README b/readline/README index f19f925..56565b2 100644 --- a/readline/README +++ b/readline/README @@ -1,7 +1,7 @@ Introduction ============ -This is the Gnu Readline library, version 2.2 +This is the Gnu Readline library, version 4.0. 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 @@ -34,8 +34,8 @@ may work: Read the file INSTALL in this directory for more information about how to customize and control the build process. -The file rlconf.h contains defines that enable and disable certain -Readline features. +The file rlconf.h contains C preprocessor defines that enable and disable +certain Readline features. Examples ======== @@ -49,32 +49,83 @@ Shared Libraries ================ There is skeletal support for building shared versions of the -Readline and History libraries. - -Typing `make shared' will cause shared versions of the Readline and -History libraries to be built on SunOS 4.1.x. For versions of Unix -other than SunOS, you will have to make some changes to Makefile.in. -The relevant variables are: - -PICFLAG Options to give to the compiler to produce position-independent - code. The value `-fpic' works for most versions of gcc. -SHLIB_OPTS Options to give to the linker to produce a shared library. - The value `-assert pure-text -ldl' works on SunOS 4.1.x. - The value `-Bshareable' works for some versions of GNU ld. - -MAJOR The major version number of the shared library. You should - not need to change this. -MINOR The minor version number of the shared library. Some systems, - such as SVR4 and its descendents (e.g., Solaris, Unixware), - do not use minor version numbers. For those systems, this - variable should be left unset. - -LD The linker. The value of `ld' is correct for SunOS 4.1.x. - You may need to change it to `gcc'; make sure to change - SHLIB_OPTS if you do so. - -Once you have edited Makefile.in, type `make Makefile' to rebuild the -Makefile, then `make shared' to build the shared libraries. +Readline and History libraries. The configure script creates +a Makefile in the `shlib' subdirectory, and typing `make shared' +will cause shared versions of the Readline and History libraries +to be built on supported platforms. + +Configure calls the script support/shobj-conf to test whether or +not shared library creation is supported and to generate the values +of variables that are substituted into shlib/Makefile. If you +try to build shared libraries on an unsupported platform, `make' +will display a message asking you to update support/shobj-conf for +your platform. + +If you need to update support/shobj-conf, you will need to create +a `stanza' for your operating system and compiler. The script uses +the value of host_os and ${CC} as determined by configure. For +instance, FreeBSD 2.2.5 with any version of gcc is identified as +`freebsd2.2.5-gcc*'. + +In the stanza for your operating system-compiler pair, you will need to +define several variables. They are: + +SHOBJ_CC The C compiler used to compile source files into shareable + object files. This is normally set to the value of ${CC} + by configure, and should not need to be changed. + +SHOBJ_CFLAGS Flags to pass to the C compiler ($SHOBJ_CC) to create + position-independent code. If you are using gcc, this + should probably be set to `-fpic'. + +SHOBJ_LD The link editor to be used to create the shared library from + the object files created by $SHOBJ_CC. If you are using + gcc, a value of `gcc' will probably work. + +SHOBJ_LDFLAGS Flags to pass to SHOBJ_LD to enable shared object creation. + If you are using gcc, `-shared' may be all that is necessary. + These should be the flags needed for generic shared object + creation. + +SHLIB_XLDFLAGS Additional flags to pass to SHOBJ_LD for shared library + creation. Many systems use the -R option to the link + editor to embed a path within the library for run-time + library searches. A reasonable value for such systems would + be `-R$(libdir)'. + +SHLIB_LIBS Any additional libraries that shared libraries should be + linked against when they are created. + +SHLIB_LIBSUFF The suffix to add to `libreadline' and `libhistory' when + generating the filename of the shared library. Many systems + use `so'; HP-UX uses `sl'. + +SHLIB_LIBVERSION The string to append to the filename to indicate the version + of the shared library. It should begin with $(SHLIB_LIBSUFF), + and possibly include version information that allows the + run-time loader to load the version of the shared library + appropriate for a particular program. Systems using shared + libraries similar to SunOS 4.x use major and minor library + version numbers; for those systems a value of + `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' is appropriate. + Systems based on System V Release 4 don't use minor version + numbers; use `$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' on those systems. + Other Unix versions use different schemes. + +SHLIB_STATUS Set this to `supported' when you have defined the other + necessary variables. Make uses this to determine whether + or not shared library creation should be attempted. + +You should look at the existing stanzas in support/shobj-conf for ideas. + +Once you have updated support/shobj-conf, re-run configure and type +`make shared'. The shared libraries will be created in the shlib +subdirectory. + +Since shared libraries are not created on all platforms, `make install' +will not automatically install the shared libraries. To install them, +change the current directory to shlib and type `make install'. Running +`make install-shared' from the top-level build directory will also work. Documentation ============= @@ -93,7 +144,7 @@ Bug reports for Readline should be sent to: When reporting a bug, please include the following information: - * the version number and release status of Readline (e.g., 2.2-release) + * the version number and release status of Readline (e.g., 4.0-release) * the machine and OS that it is running on * a list of the compilation flags or the contents of `config.h', if appropriate diff --git a/readline/aclocal.m4 b/readline/aclocal.m4 index 822ead0..c277a0c 100644 --- a/readline/aclocal.m4 +++ b/readline/aclocal.m4 @@ -26,7 +26,7 @@ main() exit(fl != 1); } ], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no, - [AC_MSG_ERROR(cannot check dup2 if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no) bash_cv_dup2_broken=no]) ]) AC_MSG_RESULT($bash_cv_dup2_broken) @@ -129,7 +129,7 @@ main() exit(ok ? 0 : 5); } ], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes, - [AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no) bash_cv_pgrp_pipe=no]) ]) AC_MSG_RESULT($bash_cv_pgrp_pipe) @@ -187,7 +187,7 @@ main() #endif exit(1); }], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long, - [AC_MSG_ERROR(cannot check quad_t if cross compiling -- defaulting to long) + [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long) bash_cv_type_rlimit=long])]) ]) AC_MSG_RESULT($bash_cv_type_rlimit) @@ -211,7 +211,7 @@ AC_CACHE_VAL(bash_cv_decl_under_sys_siglist, #include <unistd.h> #endif], [ char *msg = _sys_siglist[2]; ], bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no, - [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl + [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl AC_MSG_RESULT($bash_cv_decl_under_sys_siglist) if test $bash_cv_decl_under_sys_siglist = yes; then AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED) @@ -237,7 +237,7 @@ char *msg = (char *)_sys_siglist[2]; exit(msg == 0); }], bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no, - [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no) bash_cv_under_sys_siglist=no])]) AC_MSG_RESULT($bash_cv_under_sys_siglist) if test $bash_cv_under_sys_siglist = yes; then @@ -264,7 +264,7 @@ char *msg = sys_siglist[2]; exit(msg == 0); }], bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no, - [AC_MSG_ERROR(cannot check for sys_siglist if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no) bash_cv_sys_siglist=no])]) AC_MSG_RESULT($bash_cv_sys_siglist) if test $bash_cv_sys_siglist = yes; then @@ -325,7 +325,7 @@ dir = opendir("/tmp/not_a_directory"); unlink("/tmp/not_a_directory"); exit (dir == 0); }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no, - [AC_MSG_ERROR(cannot check opendir if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no) bash_cv_opendir_not_robust=no] )]) AC_MSG_RESULT($bash_cv_opendir_not_robust) @@ -356,109 +356,47 @@ fi AC_DEFUN(BASH_TYPE_INT32_T, [ -if test "X$bash_cv_type_int32_t" = "X"; then -_bash_needmsg=yes +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) else -AC_MSG_CHECKING(which builtin C type is 32 bits wide) -_bash_needmsg= -fi -AC_CACHE_VAL(bash_cv_type_int32_t, -[AC_TRY_RUN([ -main() -{ -#if SIZEOF_INT == 4 -exit (0); -#else -# if SIZEOF_LONG == 4 -exit (1); -# else -# error cannot find 32 bit type... -# endif -#endif -}], bash_cv_type_int32_t=int, bash_cv_type_int32_t=long, - [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) - bash_cv_type_int32_t=int] -)]) -if test "X$_bash_needmsg" = "Xyes"; then -AC_MSG_CHECKING(which builtin C type is 32 bits wide) -fi -AC_MSG_RESULT($bash_cv_type_int32_t); -if test "$bash_cv_type_int32_t" = "int"; then -AC_DEFINE(int32_t, int) -else -AC_DEFINE(int32_t, long) + AC_CHECK_TYPE(int32_t, int) fi ]) AC_DEFUN(BASH_TYPE_U_INT32_T, [ -if test "X$bash_cv_type_u_int32_t" = "X"; then -_bash_needmsg=yes -else -AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide) -_bash_needmsg= -fi -AC_CACHE_VAL(bash_cv_type_u_int32_t, -[AC_TRY_RUN([ -main() -{ -#if SIZEOF_INT == 4 -exit (0); -#else -# if SIZEOF_LONG == 4 -exit (1); -# else -# error cannot find 32 bit type... -# endif -#endif -}], bash_cv_type_u_int32_t=int, bash_cv_type_u_int32_t=long, - [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) - bash_cv_type_u_int32_t=int] -)]) -if test "X$_bash_needmsg" = "Xyes"; then -AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide) -fi -AC_MSG_RESULT($bash_cv_type_u_int32_t); -if test "$bash_cv_type_u_int32_t" = "int"; then -AC_DEFINE(u_int32_t, unsigned int) +if test "$ac_cv_sizeof_int" = 4; then + AC_CHECK_TYPE(u_int32_t, unsigned int) +elif test "$ac_cv_sizeof_long" = 4; then + AC_CHECK_TYPE(u_int32_t, unsigned long) else -AC_DEFINE(u_int32_t, unsigned long) + AC_CHECK_TYPE(u_int32_t, unsigned int) fi ]) AC_DEFUN(BASH_TYPE_PTRDIFF_T, [ -if test "X$bash_cv_type_ptrdiff_t" = "X"; then -_bash_needmsg=yes +if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then + AC_CHECK_TYPE(ptrdiff_t, int) +elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then + AC_CHECK_TYPE(ptrdiff_t, long) else -AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t) -_bash_needmsg= + AC_CHECK_TYPE(ptrdiff_t, int) fi -AC_CACHE_VAL(bash_cv_type_ptrdiff_t, -[AC_TRY_RUN([ -main() -{ -#if SIZEOF_CHAR_P == SIZEOF_INT -exit (0); -#else -# if SIZEOF_CHAR_P == SIZEOF_LONG -exit (1); -# else -# error cannot find type for pointer arithmetic... -# endif -#endif -}], bash_cv_type_ptrdiff_t=int, bash_cv_type_ptrdiff_t=long, - [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) - bash_cv_type_ptrdiff_t=int] -)]) -if test "X$_bash_needmsg" = "Xyes"; then -AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t) -fi -AC_MSG_RESULT($bash_cv_type_ptrdiff_t); -if test "$bash_cv_type_ptrdiff_t" = "int"; then -AC_DEFINE(ptrdiff_t, int) +]) + +AC_DEFUN(BASH_TYPE_BITS64_T, +[ +if test "$ac_sv_sizeof_char_p" = 8; then + AC_CHECK_TYPE(bits64_t, char *) +elif test "$ac_cv_sizeof_double" = 8; then + AC_CHECK_TYPE(bits64_t, double) +elif test "$ac_cv_sizeof_long" = 8; then + AC_CHECK_TYPE(bits64_t, long) else -AC_DEFINE(ptrdiff_t, long) + AC_CHECK_TYPE(bits64_t, double) fi ]) @@ -548,7 +486,7 @@ s = getenv("ABCDE"); exit(s == 0); /* force optimizer to leave getenv in */ } ], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no, - [AC_MSG_ERROR(cannot check getenv redefinition if cross compiling -- defaulting to yes) + [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes) bash_cv_getenv_redef=yes] )]) AC_MSG_RESULT($bash_cv_getenv_redef) @@ -574,7 +512,7 @@ pf = (_bashfunc) printf; exit(pf == 0); } ], bash_cv_printf_declared=yes, bash_cv_printf_declared=no, - [AC_MSG_ERROR(cannot check printf declaration if cross compiling -- defaulting to yes) + [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes) bash_cv_printf_declared=yes] )]) AC_MSG_RESULT($bash_cv_printf_declared) @@ -593,7 +531,7 @@ long maxfds = ulimit(4, 0L); exit (maxfds == -1L); } ], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no, - [AC_MSG_ERROR(cannot check ulimit if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no) bash_cv_ulimit_maxfds=no] )]) AC_MSG_RESULT($bash_cv_ulimit_maxfds) @@ -690,7 +628,7 @@ main() exit (popen_called); } ], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes, - [AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no) bash_cv_getcwd_calls_popen=no] )]) AC_MSG_RESULT($bash_cv_getcwd_calls_popen) @@ -814,7 +752,7 @@ main() exit(nsigint != 2); } ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes, - [AC_MSG_ERROR(cannot check signal handling if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no) bash_cv_must_reinstall_sighandlers=no] )]) AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers) @@ -883,7 +821,7 @@ exit(1); exit(0); }], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing, - [AC_MSG_ERROR(cannot check job control if cross-compiling -- defaulting to missing) + [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing) bash_cv_job_control_missing=missing] )]) AC_MSG_RESULT($bash_cv_job_control_missing) @@ -928,7 +866,7 @@ close(fd); unlink ("/tmp/sh-np-autoconf"); exit(0); }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing, - [AC_MSG_ERROR(cannot check for named pipes if cross-compiling -- defaulting to missing) + [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing) bash_cv_sys_named_pipes=missing] )]) AC_MSG_RESULT($bash_cv_sys_named_pipes) @@ -979,7 +917,7 @@ siglongjmp(xx, 10); exit(1); #endif }], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing, - [AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing) + [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing) bash_cv_func_sigsetjmp=missing] )]) AC_MSG_RESULT($bash_cv_func_sigsetjmp) @@ -1246,7 +1184,7 @@ char *v[]; exit (r1 > 0 && r2 > 0); } ], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no, - [AC_MSG_ERROR(cannot check strcoll if cross compiling -- defaulting to no) + [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no) bash_cv_func_strcoll_broken=no] )]) AC_MSG_RESULT($bash_cv_func_strcoll_broken) @@ -1336,9 +1274,28 @@ main () #endif } ], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no, - AC_MSG_ERROR(cannot check restartable syscalls if cross compiling)) + AC_MSG_WARN(cannot check restartable syscalls if cross compiling)) ]) if test $bash_cv_sys_restartable_syscalls = yes; then AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) fi ]) +dnl +dnl Check for 64-bit off_t -- used for malloc alignment +dnl +dnl C does not allow duplicate case labels, so the compile will fail if +dnl sizeof(off_t) is > 4. +dnl +AC_DEFUN(BASH_CHECK_OFF_T_64, +[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64, +AC_TRY_COMPILE([ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <sys/types.h> +],[ +switch (0) case 0: case (sizeof (off_t) <= 4):; +], bash_cv_off_t_64=no, bash_cv_off_t_64=yes)) +if test $bash_cv_off_t_64 = yes; then + AC_DEFINE(HAVE_OFF_T_64) +fi]) diff --git a/readline/bind.c b/readline/bind.c index 300530a..f446dc8 100644 --- a/readline/bind.c +++ b/readline/bind.c @@ -83,6 +83,7 @@ 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; @@ -207,13 +208,17 @@ rl_unbind_function_in_map (func, map) Function *func; Keymap map; { - register int i; + register int i, rval; - for (i = 0; i < KEYMAP_SIZE; i++) + for (i = rval = 0; i < KEYMAP_SIZE; i++) { if (map[i].type == ISFUNC && map[i].function == func) - map[i].function = (Function *)NULL; + { + map[i].function = (Function *)NULL; + rval = 1; + } } + return rval; } int @@ -222,7 +227,6 @@ rl_unbind_command_in_map (command, map) Keymap map; { Function *func; - register int i; func = rl_named_function (command); if (func == 0) @@ -663,7 +667,11 @@ _rl_read_file (filename, sizep) i = read (file, buffer, file_size); close (file); +#if 0 if (i < file_size) +#else + if (i < 0) +#endif { free (buffer); return ((char *)NULL); @@ -727,6 +735,8 @@ _rl_read_init_file (filename, include_level) openname = tilde_expand (filename); buffer = _rl_read_file (openname, &file_size); + free (openname); + if (buffer == 0) return (errno); @@ -1338,7 +1348,34 @@ rl_variable_bind (name, value) 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; + 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); + } + /* For the time being, unknown variable names are simply ignored. */ return 0; } @@ -1492,7 +1529,7 @@ _rl_get_keyname (key) int key; { char *keyname; - int i, c, v; + int i, c; keyname = (char *)xmalloc (8); @@ -1897,6 +1934,21 @@ rl_variable_dumper (print_readably) fprintf (rl_outstream, "set keymap %s\n", kname ? kname : "none"); else fprintf (rl_outstream, "keymap is set to `%s'\n", kname ? kname : "none"); + + /* isearch-terminators */ + if (_rl_isearch_terminators) + { + char *disp; + + disp = _rl_untranslate_macro_value (_rl_isearch_terminators); + + if (print_readably) + fprintf (rl_outstream, "set isearch-terminators \"%s\"\n", disp); + else + fprintf (rl_outstream, "isearch-terminators is set to \"%s\"\n", disp); + + free (disp); + } } /* Print all of the current variables and their values to diff --git a/readline/callback.c b/readline/callback.c index 34dbc72..6915be4 100644 --- a/readline/callback.c +++ b/readline/callback.c @@ -36,7 +36,7 @@ #include "rldefs.h" #include "readline.h" -extern void readline_internal_startup (); +extern void readline_internal_setup (); extern char *readline_internal_teardown (); extern int readline_internal_char (); extern void _rl_init_line_state (); diff --git a/readline/complete.c b/readline/complete.c index 985e898..714a2bf 100644 --- a/readline/complete.c +++ b/readline/complete.c @@ -85,6 +85,15 @@ extern void _rl_move_vert (); extern int _rl_vis_botlin; extern int rl_display_fixed; +/* 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. + This function is called instead of actually doing the display. + It takes three arguments: (char **matches, int num_matches, int max_length) + where MATCHES is the array of strings that matched, NUM_MATCHES is the + number of strings in that array, and MAX_LENGTH is the length of the + longest string in that array. */ +VFunction *rl_completion_display_matches_hook = (VFunction *)NULL; + /* Forward declarations for functions defined and used in this file. */ char *filename_completion_function (); char **completion_matches (); @@ -674,6 +683,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) we are doing filename completion and the application has defined a filename dequoting function. */ temp = (char *)NULL; + if (found_quote && our_func == (Function *)filename_completion_function && rl_filename_dequoting_function) { @@ -682,7 +692,7 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) text = temp; /* not freeing text is not a memory leak */ } - matches = completion_matches (text, our_func); + matches = completion_matches (text, (CPFunction *)our_func); FREE (temp); return matches; } @@ -813,8 +823,7 @@ compute_lcd_of_matches (match_list, matches, text) } static int -postprocess_matches (text, matchesp, matching_filenames) - char *text; +postprocess_matches (matchesp, matching_filenames) char ***matchesp; int matching_filenames; { @@ -845,7 +854,6 @@ postprocess_matches (text, matchesp, matching_filenames) if (matches == 0 || matches[0] == 0) { FREE (matches); - ding (); *matchesp = (char **)0; return 0; } @@ -857,7 +865,7 @@ postprocess_matches (text, matchesp, matching_filenames) if (i > 1 && i < nmatch) { t = matches[0]; - compute_lcd_of_matches (matches, i - 1, text); + compute_lcd_of_matches (matches, i - 1, t); FREE (t); } } @@ -867,66 +875,19 @@ postprocess_matches (text, matchesp, matching_filenames) return (1); } -static void -display_matches (matches) +/* A convenience function for displaying a list of strings in + columnar format on readline's output stream. MATCHES is the list + of strings, in argv format, LEN is the number of strings in MATCHES, + and MAX is the length of the longest string in MATCHES. */ +void +rl_display_match_list (matches, len, max) char **matches; + int len, max; { - int len, count, limit, max, printed_len; + int count, limit, printed_len; int i, j, k, l; char *temp; - /* Move to the last visible line of a possibly-multiple-line command. */ - _rl_move_vert (_rl_vis_botlin); - - /* Handle simple case first. What if there is only one answer? */ - if (matches[1] == 0) - { - temp = printable_part (matches[0]); - crlf (); - print_filename (temp, matches[0]); - crlf (); -#if 0 - rl_on_new_line (); -#else - rl_forced_update_display (); - rl_display_fixed = 1; -#endif - return; - } - - /* There is more than one answer. Find out how many there are, - and find the maximum printed length of a single entry. */ - for (max = 0, i = 1; matches[i]; i++) - { - temp = printable_part (matches[i]); - len = strlen (temp); - - if (len > max) - max = len; - } - - len = i - 1; - - /* If there are many items, then ask the user if she really wants to - see them all. */ - if (len >= rl_completion_query_items) - { - crlf (); - fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len); - fflush (rl_outstream); - if (get_y_or_n () == 0) - { - crlf (); -#if 0 - rl_on_new_line (); -#else - rl_forced_update_display (); - rl_display_fixed = 1; -#endif - return; - } - } - /* How many items of MAX length can we fit in the screen window? */ max += 2; limit = screenwidth / max; @@ -993,13 +954,85 @@ display_matches (matches) } crlf (); } +} + +/* Display MATCHES, a list of matching filenames in argv format. This + handles the simple case -- a single match -- first. If there is more + than one match, we compute the number of strings in the list and the + length of the longest string, which will be needed by the display + function. If the application wants to handle displaying the list of + matches itself, it sets RL_COMPLETION_DISPLAY_MATCHES_HOOK to the + address of a function, and we just call it. If we're handling the + display ourselves, we just call rl_display_match_list. We also check + that the list of matches doesn't exceed the user-settable threshold, + and ask the user if he wants to see the list if there are more matches + than RL_COMPLETION_QUERY_ITEMS. */ +static void +display_matches (matches) + char **matches; +{ + int len, max, i; + char *temp; + + /* Move to the last visible line of a possibly-multiple-line command. */ + _rl_move_vert (_rl_vis_botlin); + + /* Handle simple case first. What if there is only one answer? */ + if (matches[1] == 0) + { + temp = printable_part (matches[0]); + crlf (); + print_filename (temp, matches[0]); + crlf (); + + rl_forced_update_display (); + rl_display_fixed = 1; + + return; + } + + /* There is more than one answer. Find out how many there are, + and find the maximum printed length of a single entry. */ + for (max = 0, i = 1; matches[i]; i++) + { + temp = printable_part (matches[i]); + len = strlen (temp); + + if (len > max) + max = len; + } + + len = i - 1; + + /* If the caller has defined a display hook, then call that now. */ + if (rl_completion_display_matches_hook) + { + (*rl_completion_display_matches_hook) (matches, len, max); + return; + } + + /* If there are many items, then ask the user if she really wants to + see them all. */ + if (len >= rl_completion_query_items) + { + crlf (); + fprintf (rl_outstream, "Display all %d possibilities? (y or n)", len); + fflush (rl_outstream); + if (get_y_or_n () == 0) + { + crlf (); + + rl_forced_update_display (); + rl_display_fixed = 1; + + return; + } + } + + rl_display_match_list (matches, len, max); -#if 0 - rl_on_new_line (); -#else rl_forced_update_display (); rl_display_fixed = 1; -#endif } static char * @@ -1026,11 +1059,8 @@ make_quoted_replacement (match, mtype, qc) rl_filename_quoting_desired; if (should_quote) -#if defined (SHELL) - should_quote = should_quote && (!qc || !*qc || *qc == '"' || *qc == '\''); -#else /* !SHELL */ - should_quote = should_quote && (!qc || !*qc); -#endif /* !SHELL */ + should_quote = should_quote && (!qc || !*qc || + (rl_completer_quote_characters && strchr (rl_completer_quote_characters, *qc))); if (should_quote) { @@ -1168,6 +1198,17 @@ insert_all_matches (matches, point, qc) rl_end_undo_group (); } +static void +free_match_list (matches) + char **matches; +{ + register int i; + + for (i = 0; matches[i]; i++) + free (matches[i]); + free (matches); +} + /* Complete the word at or before point. WHAT_TO_DO says what to do with the completion. `?' means list the possible completions. @@ -1210,27 +1251,34 @@ rl_complete_internal (what_to_do) text = rl_copy_text (start, end); matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char); + free (text); if (matches == 0) { ding (); FREE (saved_line_buffer); - free (text); return (0); } +#if 0 /* If we are matching filenames, our_func will have been set to filename_completion_function */ i = our_func == (Function *)filename_completion_function; - if (postprocess_matches (text, &matches, i) == 0) +#else + /* If we are matching filenames, the attempted completion function will + have set rl_filename_completion_desired to a non-zero value. The basic + filename_completion_function does this. */ + i = rl_filename_completion_desired; +#endif + + if (postprocess_matches (&matches, i) == 0) { + ding (); FREE (saved_line_buffer); - free (text); + completion_changed_buffer = 0; return (0); } - free (text); - switch (what_to_do) { case TAB: @@ -1277,9 +1325,7 @@ rl_complete_internal (what_to_do) return 1; } - for (i = 0; matches[i]; i++) - free (matches[i]); - free (matches); + free_match_list (matches); /* Check to see if the line has changed through all of this manipulation. */ if (saved_line_buffer) @@ -1358,10 +1404,10 @@ completion_matches (text, entry_function) character (usually `~'). */ char * username_completion_function (text, state) - int state; char *text; + int state; { -#if defined (__GO32__) || defined (__WIN32__) +#if defined (__GO32__) || defined (__WIN32__) || defined (__OPENNT) return (char *)NULL; #else /* !__GO32__ */ static char *username = (char *)NULL; @@ -1415,8 +1461,8 @@ username_completion_function (text, state) completion for a command. */ char * filename_completion_function (text, state) - int state; char *text; + int state; { static DIR *directory = (DIR *)NULL; static char *filename = (char *)NULL; @@ -1574,7 +1620,7 @@ filename_completion_function (text, state) strcpy (temp, users_dirname); } - strcpy (temp + dirlen, entry->d_name); /* strcat (temp, entry->d_name); */ + strcpy (temp + dirlen, entry->d_name); } else temp = savestring (entry->d_name); @@ -1649,10 +1695,17 @@ rl_menu_complete (count, ignore) matches = gen_completion_matches (orig_text, orig_start, orig_end, our_func, found_quote, quote_char); +#if 0 /* If we are matching filenames, our_func will have been set to filename_completion_function */ matching_filenames = our_func == (Function *)filename_completion_function; - if (matches == 0 || postprocess_matches (orig_text, &matches, matching_filenames) == 0) +#else + /* If we are matching filenames, the attempted completion function will + have set rl_filename_completion_desired to a non-zero value. The basic + filename_completion_function does this. */ + matching_filenames = rl_filename_completion_desired; +#endif + if (matches == 0 || postprocess_matches (&matches, matching_filenames) == 0) { ding (); FREE (matches); @@ -1686,7 +1739,7 @@ rl_menu_complete (count, ignore) if (match_list_index < 0) match_list_index += match_list_size; - if (match_list_index == 0) + if (match_list_index == 0 && match_list_size > 1) { ding (); insert_match (orig_text, orig_start, MULT_MATCH, "e_char); diff --git a/readline/configure b/readline/configure index f22bd11..cdcdf88 100755 --- a/readline/configure +++ b/readline/configure @@ -1,7 +1,10 @@ #! /bin/sh -# From configure.in for Readline 2.2, version 2.07, from autoconf version 2.12.2 -LIBVERSION=2.2 +# From configure.in for Readline 4.0, version 2.14, from autoconf version 2.13 +LIBVERSION=4.0 + + + @@ -89,7 +92,7 @@ LIBVERSION=2.2 # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.2 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -118,6 +121,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -232,6 +236,7 @@ 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 @@ -402,6 +407,11 @@ 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=*) @@ -423,7 +433,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.2" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -567,12 +577,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +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 fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -642,7 +656,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:646: checking host system type" >&5 +echo "configure:660: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -683,7 +697,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:687: checking for $ac_word" >&5 +echo "configure:701: 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 @@ -691,7 +705,8 @@ else ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -712,7 +727,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:716: checking for $ac_word" >&5 +echo "configure:731: 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 @@ -721,7 +736,8 @@ else else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -762,7 +778,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:766: checking for $ac_word" >&5 +echo "configure:782: 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 @@ -770,7 +786,8 @@ else ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" @@ -793,7 +810,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:797: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:814: 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. @@ -802,12 +819,14 @@ ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext <<EOF -#line 807 "configure" +cat > conftest.$ac_ext << EOF + +#line 825 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:830: \"$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 @@ -821,18 +840,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:831: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:856: 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:836: checking whether we are using GNU C" >&5 +echo "configure:861: 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 @@ -841,7 +866,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:845: \"$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:870: \"$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 @@ -860,7 +885,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:864: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:889: 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 @@ -892,7 +917,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:896: checking how to run the C preprocessor" >&5 +echo "configure:921: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -907,13 +932,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 911 "configure" +#line 936 "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:917: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:942: \"$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 : @@ -924,13 +949,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 928 "configure" +#line 953 "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:934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:959: \"$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 : @@ -941,13 +966,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 945 "configure" +#line 970 "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:951: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:976: \"$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 : @@ -973,17 +998,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:977: checking for minix/config.h" >&5 +echo "configure:1002: 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 982 "configure" +#line 1007 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:987: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1012: \"$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* @@ -1021,7 +1046,6 @@ EOF fi - if test "x$cross_compiling" = "xyes"; then case "${host}" in @@ -1056,20 +1080,18 @@ fi - - # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS. test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1067: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1089: 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 1073 "configure" +#line 1095 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -1087,7 +1109,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 1091 "configure" +#line 1113 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -1120,7 +1142,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:1124: checking for a BSD compatible install" >&5 +echo "configure:1146: 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 @@ -1168,12 +1190,44 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1201: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="ar" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$ARFLAGS" || ARFLAGS="cr" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1177: checking for $ac_word" >&5 +echo "configure:1231: 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 @@ -1181,7 +1235,8 @@ else ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -1200,13 +1255,16 @@ else fi +MAKE_SHELL=/bin/sh + + echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1205: checking return type of signal handlers" >&5 +echo "configure:1263: 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 1210 "configure" +#line 1268 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1223,7 +1281,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1243,12 +1301,12 @@ EOF echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:1247: checking whether stat file-mode macros are broken" >&5 +echo "configure:1305: 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 1252 "configure" +#line 1310 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1303,12 +1361,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:1307: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1365: 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 1312 "configure" +#line 1370 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -1316,7 +1374,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1341,7 +1399,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:1345: checking for opendir in -ldir" >&5 +echo "configure:1403: 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 @@ -1349,7 +1407,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 1353 "configure" +#line 1411 "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 @@ -1360,7 +1418,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1422: \"$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 @@ -1382,7 +1440,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1386: checking for opendir in -lx" >&5 +echo "configure:1444: 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 @@ -1390,7 +1448,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 1394 "configure" +#line 1452 "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 @@ -1401,7 +1459,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1463: \"$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 @@ -1427,12 +1485,12 @@ fi for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1431: checking for $ac_func" >&5 +echo "configure:1489: 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 1436 "configure" +#line 1494 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1455,7 +1513,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1517: \"$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 @@ -1481,7 +1539,7 @@ done echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:1485: checking for working strcoll" >&5 +echo "configure:1543: 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 @@ -1489,7 +1547,7 @@ else ac_cv_func_strcoll_works=no else cat > conftest.$ac_ext <<EOF -#line 1493 "configure" +#line 1551 "configure" #include "confdefs.h" #include <string.h> main () @@ -1499,7 +1557,7 @@ main () strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1561: \"$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 @@ -1528,17 +1586,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:1532: checking for $ac_hdr" >&5 +echo "configure:1590: 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 1537 "configure" +#line 1595 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1542: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1600: \"$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* @@ -1567,13 +1625,13 @@ done echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6 -echo "configure:1571: checking for type of signal functions" >&5 +echo "configure:1629: 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 1577 "configure" +#line 1635 "configure" #include "confdefs.h" #include <signal.h> int main() { @@ -1586,7 +1644,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=posix else @@ -1595,7 +1653,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 1599 "configure" +#line 1657 "configure" #include "confdefs.h" #include <signal.h> int main() { @@ -1605,7 +1663,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1667: \"$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 @@ -1614,7 +1672,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 1618 "configure" +#line 1676 "configure" #include "confdefs.h" #include <signal.h> @@ -1627,7 +1685,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=svr3 else @@ -1668,17 +1726,17 @@ fi echo $ac_n "checking if signal handlers must be reinstalled when invoked""... $ac_c" 1>&6 -echo "configure:1672: checking if signal handlers must be reinstalled when invoked" >&5 +echo "configure:1730: checking if signal handlers must be reinstalled when invoked" >&5 if eval "test \"`echo '$''{'bash_cv_must_reinstall_sighandlers'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check signal handling if cross compiling -- defaulting to no" 1>&2; exit 1; } + echo "configure: warning: cannot check signal handling if cross compiling -- defaulting to no" 1>&2 bash_cv_must_reinstall_sighandlers=no else cat > conftest.$ac_ext <<EOF -#line 1682 "configure" +#line 1740 "configure" #include "confdefs.h" #include <signal.h> @@ -1725,7 +1783,7 @@ main() } EOF -if { (eval echo configure:1729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1787: \"$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 @@ -1750,17 +1808,17 @@ fi echo $ac_n "checking for presence of POSIX-style sigsetjmp/siglongjmp""... $ac_c" 1>&6 -echo "configure:1754: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 +echo "configure:1812: checking for presence of POSIX-style sigsetjmp/siglongjmp" >&5 if eval "test \"`echo '$''{'bash_cv_func_sigsetjmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" 1>&2; exit 1; } + echo "configure: warning: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing" 1>&2 bash_cv_func_sigsetjmp=missing else cat > conftest.$ac_ext <<EOF -#line 1764 "configure" +#line 1822 "configure" #include "confdefs.h" #ifdef HAVE_UNISTD_H @@ -1801,7 +1859,7 @@ exit(1); #endif } EOF -if { (eval echo configure:1805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1863: \"$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 @@ -1824,12 +1882,12 @@ EOF fi echo $ac_n "checking for lstat""... $ac_c" 1>&6 -echo "configure:1828: checking for lstat" >&5 +echo "configure:1886: 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 1833 "configure" +#line 1891 "configure" #include "confdefs.h" #include <sys/types.h> @@ -1839,7 +1897,7 @@ int main() { lstat(".",(struct stat *)0); ; return 0; } EOF -if { (eval echo configure:1843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_func_lstat=yes else @@ -1860,12 +1918,12 @@ EOF fi echo $ac_n "checking whether programs are able to redeclare getpw functions""... $ac_c" 1>&6 -echo "configure:1864: checking whether programs are able to redeclare getpw functions" >&5 +echo "configure:1922: 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 1869 "configure" +#line 1927 "configure" #include "confdefs.h" #include <sys/types.h> #include <pwd.h> @@ -1876,7 +1934,7 @@ int main() { struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root"); ; return 0; } EOF -if { (eval echo configure:1880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_can_redecl_getpw=yes else @@ -1898,17 +1956,17 @@ fi echo $ac_n "checking whether or not strcoll and strcmp differ""... $ac_c" 1>&6 -echo "configure:1902: checking whether or not strcoll and strcmp differ" >&5 +echo "configure:1960: checking whether or not strcoll and strcmp differ" >&5 if eval "test \"`echo '$''{'bash_cv_func_strcoll_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check strcoll if cross compiling -- defaulting to no" 1>&2; exit 1; } + echo "configure: warning: cannot check strcoll if cross compiling -- defaulting to no" 1>&2 bash_cv_func_strcoll_broken=no else cat > conftest.$ac_ext <<EOF -#line 1912 "configure" +#line 1970 "configure" #include "confdefs.h" #include <stdio.h> @@ -1947,7 +2005,7 @@ char *v[]; } EOF -if { (eval echo configure:1951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2009: \"$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 @@ -1971,12 +2029,12 @@ fi echo $ac_n "checking whether signal handlers are of type void""... $ac_c" 1>&6 -echo "configure:1975: checking whether signal handlers are of type void" >&5 +echo "configure:2033: 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 1980 "configure" +#line 2038 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1991,7 +2049,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1995: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_void_sighandler=yes else @@ -2011,12 +2069,12 @@ EOF fi echo $ac_n "checking for TIOCGWINSZ in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2015: checking for TIOCGWINSZ in sys/ioctl.h" >&5 +echo "configure:2073: 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 2020 "configure" +#line 2078 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -2024,7 +2082,7 @@ int main() { int x = TIOCGWINSZ; ; return 0; } EOF -if { (eval echo configure:2028: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_tiocgwinsz_in_ioctl=yes else @@ -2045,12 +2103,12 @@ EOF fi echo $ac_n "checking for TIOCSTAT in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2049: checking for TIOCSTAT in sys/ioctl.h" >&5 +echo "configure:2107: 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 2054 "configure" +#line 2112 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -2058,7 +2116,7 @@ int main() { int x = TIOCSTAT; ; return 0; } EOF -if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_tiocstat_in_ioctl=yes else @@ -2079,12 +2137,12 @@ EOF fi echo $ac_n "checking for FIONREAD in sys/ioctl.h""... $ac_c" 1>&6 -echo "configure:2083: checking for FIONREAD in sys/ioctl.h" >&5 +echo "configure:2141: 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 2088 "configure" +#line 2146 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -2092,7 +2150,7 @@ int main() { int x = FIONREAD; ; return 0; } EOF -if { (eval echo configure:2096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_fionread_in_ioctl=yes else @@ -2113,19 +2171,19 @@ EOF fi echo $ac_n "checking for speed_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:2117: checking for speed_t in sys/types.h" >&5 +echo "configure:2175: 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 2122 "configure" +#line 2180 "configure" #include "confdefs.h" #include <sys/types.h> int main() { speed_t x; ; return 0; } EOF -if { (eval echo configure:2129: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_speed_t_in_sys_types=yes else @@ -2146,12 +2204,12 @@ EOF fi echo $ac_n "checking for struct winsize in sys/ioctl.h and termios.h""... $ac_c" 1>&6 -echo "configure:2150: checking for struct winsize in sys/ioctl.h and termios.h" >&5 +echo "configure:2208: 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 2155 "configure" +#line 2213 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ioctl.h> @@ -2159,7 +2217,7 @@ int main() { struct winsize x; ; return 0; } EOF -if { (eval echo configure:2163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_struct_winsize_header=ioctl_h else @@ -2167,7 +2225,7 @@ else cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 2171 "configure" +#line 2229 "configure" #include "confdefs.h" #include <sys/types.h> #include <termios.h> @@ -2175,7 +2233,7 @@ int main() { struct winsize x; ; return 0; } EOF -if { (eval echo configure:2179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_struct_winsize_header=termios_h else @@ -2208,12 +2266,12 @@ fi echo $ac_n "checking if struct dirent has a d_ino member""... $ac_c" 1>&6 -echo "configure:2212: checking if struct dirent has a d_ino member" >&5 +echo "configure:2270: 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 2217 "configure" +#line 2275 "configure" #include "confdefs.h" #include <stdio.h> @@ -2242,7 +2300,7 @@ struct dirent d; int z; z = d.d_ino; ; return 0; } EOF -if { (eval echo configure:2246: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_dirent_has_dino=yes else @@ -2264,12 +2322,12 @@ fi echo $ac_n "checking if struct dirent has a d_fileno member""... $ac_c" 1>&6 -echo "configure:2268: checking if struct dirent has a d_fileno member" >&5 +echo "configure:2326: 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 2273 "configure" +#line 2331 "configure" #include "confdefs.h" #include <stdio.h> @@ -2298,7 +2356,7 @@ struct dirent d; int z; z = d.d_fileno; ; return 0; } EOF -if { (eval echo configure:2302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bash_cv_dirent_has_d_fileno=yes else @@ -2327,14 +2385,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:2331: checking which library has the termcap functions" >&5 +echo "configure:2389: 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:2338: checking for tgetent in -ltermcap" >&5 +echo "configure:2396: 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 @@ -2342,7 +2400,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <<EOF -#line 2346 "configure" +#line 2404 "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 @@ -2353,7 +2411,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2415: \"$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 @@ -2372,7 +2430,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:2376: checking for tgetent in -lcurses" >&5 +echo "configure:2434: 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 @@ -2380,7 +2438,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 2384 "configure" +#line 2442 "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 @@ -2391,7 +2449,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2453: \"$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 @@ -2410,7 +2468,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:2414: checking for tgetent in -lncurses" >&5 +echo "configure:2472: 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 @@ -2418,7 +2476,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <<EOF -#line 2422 "configure" +#line 2480 "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 @@ -2429,7 +2487,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:2433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2491: \"$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 @@ -2458,7 +2516,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:2462: checking which library has the termcap functions" >&5 +echo "configure:2520: 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 @@ -2488,6 +2546,30 @@ case "$host_os" in isc*) LOCAL_CFLAGS=-Disc386 ;; esac +# shared library configuration section +# +# Shared object configuration section. These values are generated by +# ${srcdir}/support/shobj-conf +# +if test -f ${srcdir}/support/shobj-conf; then + echo $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 "$ac_t""$SHLIB_STATUS" 1>&6 +fi + BUILD_DIR=`pwd` @@ -2503,6 +2585,9 @@ BUILD_DIR=`pwd` + + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -2526,7 +2611,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -2593,7 +2678,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.2" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2604,7 +2689,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo "Makefile doc/Makefile examples/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "Makefile doc/Makefile examples/Makefile shlib/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -2617,6 +2702,7 @@ s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -2645,12 +2731,28 @@ s%@CPP@%$CPP%g s%@CROSS_COMPILING_FLAG@%$CROSS_COMPILING_FLAG%g s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@AR@%$AR%g s%@RANLIB@%$RANLIB%g +s%@MAKE_SHELL@%$MAKE_SHELL%g +s%@SHOBJ_CC@%$SHOBJ_CC%g +s%@SHOBJ_CFLAGS@%$SHOBJ_CFLAGS%g +s%@SHOBJ_LD@%$SHOBJ_LD%g +s%@SHOBJ_LDFLAGS@%$SHOBJ_LDFLAGS%g +s%@SHOBJ_XLDFLAGS@%$SHOBJ_XLDFLAGS%g +s%@SHOBJ_LIBS@%$SHOBJ_LIBS%g +s%@SHOBJ_STATUS@%$SHOBJ_STATUS%g +s%@SHLIB_STATUS@%$SHLIB_STATUS%g +s%@SHLIB_XLDFLAGS@%$SHLIB_XLDFLAGS%g +s%@SHLIB_LIBSUFF@%$SHLIB_LIBSUFF%g +s%@SHLIB_LIBVERSION@%$SHLIB_LIBVERSION%g +s%@SHLIB_LIBS@%$SHLIB_LIBS%g s%@BUILD_DIR@%$BUILD_DIR%g s%@LOCAL_CFLAGS@%$LOCAL_CFLAGS%g s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g s%@LOCAL_DEFS@%$LOCAL_DEFS%g +s%@ARFLAGS@%$ARFLAGS%g s%@LIBVERSION@%$LIBVERSION%g s%@TERMCAP_LIB@%$TERMCAP_LIB%g @@ -2694,7 +2796,7 @@ EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile examples/Makefile"} +CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile examples/Makefile shlib/Makefile"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then diff --git a/readline/configure.in b/readline/configure.in index 1e8e775..9afdaa7 100644 --- a/readline/configure.in +++ b/readline/configure.in @@ -4,8 +4,8 @@ dnl dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -AC_REVISION([for Readline 2.2, version 2.07, from autoconf version] AC_ACVERSION) -LIBVERSION=2.2 +AC_REVISION([for Readline 4.0, version 2.14, from autoconf version] AC_ACVERSION) +LIBVERSION=4.0 AC_INIT(readline.h) AC_CONFIG_HEADER(config.h) @@ -34,7 +34,6 @@ test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 AC_PROG_CC AC_MINIX - dnl BEGIN changes for CYGNUS cross-building for Cygwin dnl load up the cross-building cache file -- add more cases and cache @@ -73,15 +72,20 @@ AC_SUBST(CC_FOR_BUILD) dnl END changes for CYGNUS cross-building for Cygwin - - # If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS. test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL +AC_CHECK_PROG(AR, ar, ar) +dnl Set default for ARFLAGS, since autoconf does not have a macro for it. +dnl This allows people to set it when running configure or make +test -n "$ARFLAGS" || ARFLAGS="cr" AC_PROG_RANLIB +MAKE_SHELL=/bin/sh +AC_SUBST(MAKE_SHELL) + AC_RETSIGTYPE AC_HEADER_STAT @@ -129,6 +133,29 @@ case "$host_os" in isc*) LOCAL_CFLAGS=-Disc386 ;; esac +# shared library configuration section +# +# Shared object configuration section. These values are generated by +# ${srcdir}/support/shobj-conf +# +if test -f ${srcdir}/support/shobj-conf; then + 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}` + AC_SUBST(SHOBJ_CC) + AC_SUBST(SHOBJ_CFLAGS) + AC_SUBST(SHOBJ_LD) + AC_SUBST(SHOBJ_LDFLAGS) + AC_SUBST(SHOBJ_XLDFLAGS) + AC_SUBST(SHOBJ_LIBS) + AC_SUBST(SHOBJ_STATUS) + AC_SUBST(SHLIB_STATUS) + AC_SUBST(SHLIB_XLDFLAGS) + AC_SUBST(SHLIB_LIBSUFF) + AC_SUBST(SHLIB_LIBVERSION) + AC_SUBST(SHLIB_LIBS) + AC_MSG_RESULT($SHLIB_STATUS) +fi + BUILD_DIR=`pwd` AC_SUBST(BUILD_DIR) @@ -137,6 +164,9 @@ AC_SUBST(LOCAL_CFLAGS) AC_SUBST(LOCAL_LDFLAGS) AC_SUBST(LOCAL_DEFS) +AC_SUBST(AR) +AC_SUBST(ARFLAGS) + AC_SUBST(host_cpu) AC_SUBST(host_os) @@ -144,7 +174,7 @@ AC_SUBST(LIBVERSION) AC_SUBST(TERMCAP_LIB) -AC_OUTPUT([Makefile doc/Makefile examples/Makefile], +AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile], [ # Makefile uses this timestamp file to record whether config.h is up to date. echo > stamp-h diff --git a/readline/display.c b/readline/display.c index 00caab6..3f6fe71 100644 --- a/readline/display.c +++ b/readline/display.c @@ -280,7 +280,7 @@ rl_expand_prompt (prompt) if (local_prompt_prefix) free (local_prompt_prefix); local_prompt = local_prompt_prefix = (char *)0; - last_invisible = 0; + last_invisible = visible_length = 0; if (prompt == 0 || *prompt == 0) return (0); @@ -373,6 +373,13 @@ rl_redisplay () if (local_len > 0) { + temp = local_len + out + 2; + if (temp >= line_size) + { + line_size = (temp + 1024) - (temp % 1024); + visible_line = xrealloc (visible_line, line_size); + line = invisible_line = xrealloc (invisible_line, line_size); + } strncpy (line + out, local_prompt, local_len); out += local_len; } @@ -399,6 +406,13 @@ rl_redisplay () } pmtlen = strlen (prompt_this_line); + temp = pmtlen + out + 2; + if (temp >= line_size) + { + line_size = (temp + 1024) - (temp % 1024); + visible_line = xrealloc (visible_line, line_size); + line = invisible_line = xrealloc (invisible_line, line_size); + } strncpy (line + out, prompt_this_line, pmtlen); out += pmtlen; line[out] = '\0'; @@ -407,12 +421,12 @@ rl_redisplay () #define CHECK_LPOS() \ do { \ - lpos++; \ - if (lpos >= screenwidth) \ - { \ - inv_lbreaks[++newlines] = out; \ - lpos = 0; \ - } \ + lpos++; \ + if (lpos >= screenwidth) \ + { \ + inv_lbreaks[++newlines] = out; \ + lpos = 0; \ + } \ } while (0) /* inv_lbreaks[i] is where line i starts in the buffer. */ @@ -481,7 +495,12 @@ rl_redisplay () else if (c == '\t') { register int temp, newout; + +#if 0 newout = (out | (int)7) + 1; +#else + newout = out + 8 - lpos % 8; +#endif temp = newout - out; if (lpos + temp >= screenwidth) { @@ -501,11 +520,11 @@ rl_redisplay () } #endif else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && term_up && *term_up) - { - line[out++] = '\0'; /* XXX - sentinel */ - inv_lbreaks[++newlines] = out; - lpos = 0; - } + { + line[out++] = '\0'; /* XXX - sentinel */ + inv_lbreaks[++newlines] = out; + lpos = 0; + } else if (CTRL_CHAR (c) || c == RUBOUT) { line[out++] = '^'; @@ -616,11 +635,11 @@ rl_redisplay () { _rl_move_vert (cursor_linenum); /* If we moved up to the line with the prompt using term_up, - the physical cursor position on the screen stays the same, - but the buffer position needs to be adjusted to account - for invisible characters. */ + the physical cursor position on the screen stays the same, + but the buffer position needs to be adjusted to account + for invisible characters. */ if (cursor_linenum == 0 && wrap_offset) - _rl_last_c_pos += wrap_offset; + _rl_last_c_pos += wrap_offset; } /* We have to reprint the prompt if it contains invisible @@ -677,16 +696,16 @@ rl_redisplay () ndisp = c_pos - wrap_offset; nleft = visible_length + wrap_offset; /* Where the new cursor position will be on the screen. This can be - longer than SCREENWIDTH; if it is, lmargin will be adjusted. */ + longer than SCREENWIDTH; if it is, lmargin will be adjusted. */ phys_c_pos = c_pos - (last_lmargin ? last_lmargin : wrap_offset); t = screenwidth / 3; /* If the number of characters had already exceeded the screenwidth, - last_lmargin will be > 0. */ + last_lmargin will be > 0. */ /* If the number of characters to be displayed is more than the screen - width, compute the starting offset so that the cursor is about - two-thirds of the way across the screen. */ + width, compute the starting offset so that the cursor is about + two-thirds of the way across the screen. */ if (phys_c_pos > screenwidth - 2) { lmargin = c_pos - (2 * t); @@ -698,7 +717,7 @@ rl_redisplay () lmargin = nleft; } else if (ndisp < screenwidth - 2) /* XXX - was -1 */ - lmargin = 0; + lmargin = 0; else if (phys_c_pos < 1) { /* If we are moving back towards the beginning of the line and @@ -708,7 +727,7 @@ rl_redisplay () lmargin = nleft; } else - lmargin = last_lmargin; + lmargin = last_lmargin; /* If the first character on the screen isn't the first character in the display line, indicate this with a special character. */ @@ -716,12 +735,12 @@ rl_redisplay () line[lmargin] = '<'; /* If SCREENWIDTH characters starting at LMARGIN do not encompass - the whole line, indicate that with a special characters at the - right edge of the screen. If LMARGIN is 0, we need to take the - wrap offset into account. */ + the whole line, indicate that with a special character at the + right edge of the screen. If LMARGIN is 0, we need to take the + wrap offset into account. */ t = lmargin + M_OFFSET (lmargin, wrap_offset) + screenwidth; if (t < out) - line[t - 1] = '>'; + line[t - 1] = '>'; if (!rl_display_fixed || forced_display || lmargin != last_lmargin) { @@ -786,7 +805,7 @@ new: eddie> Oh, my little buggy says to me, as lurgid as \new first difference All are character pointers for the sake of speed. Special cases for - no differences, as well as for end of line additions must be handeled. + no differences, as well as for end of line additions must be handled. Could be made even smarter, but this works well enough */ static void @@ -814,7 +833,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) _rl_last_c_pos = 1; /* XXX */ _rl_last_v_pos++; if (old[0] && new[0]) - old[0] = new[0]; + old[0] = new[0]; } /* Find first difference. */ @@ -903,10 +922,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) lendiff needs to be adjusted. */ if (current_line == 0 && !_rl_horizontal_scroll_mode && current_invis_chars != visible_wrap_offset) - { - temp = visible_wrap_offset - current_invis_chars; - lendiff += temp; - } + lendiff += visible_wrap_offset - current_invis_chars; /* Insert (diff (len (old), len (new)) ch. */ temp = ne - nfd; @@ -935,7 +951,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) /* At the end of a line the characters do not have to be "inserted". They can just be placed on the screen. */ /* However, this screws up the rest of this block, which - assumes you've done the insert because you can. */ + assumes you've done the insert because you can. */ _rl_output_some_chars (nfd, lendiff); _rl_last_c_pos += lendiff; } @@ -995,10 +1011,13 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) _rl_last_c_pos += temp; } lendiff = (oe - old) - (ne - new); - if (_rl_term_autowrap && current_line < inv_botlin) - space_to_eol (lendiff); - else - _rl_clear_to_eol (lendiff); + if (lendiff) + { + if (_rl_term_autowrap && current_line < inv_botlin) + space_to_eol (lendiff); + else + _rl_clear_to_eol (lendiff); + } } } } @@ -1027,7 +1046,7 @@ rl_forced_update_display () register char *temp = visible_line; while (*temp) - *temp++ = '\0'; + *temp++ = '\0'; } rl_on_new_line (); forced_display++; @@ -1088,7 +1107,7 @@ _rl_move_cursor_relative (new, data) putc (data[i], rl_outstream); #endif /* HACK_TERMCAP_MOTION */ } - else if (_rl_last_c_pos != new) + else if (_rl_last_c_pos > new) _rl_backspace (_rl_last_c_pos - new); _rl_last_c_pos = new; } @@ -1253,7 +1272,7 @@ static int saved_last_invisible; static int saved_visible_length; void -_rl_save_prompt () +rl_save_prompt () { saved_local_prompt = local_prompt; saved_local_prefix = local_prompt_prefix; @@ -1265,7 +1284,7 @@ _rl_save_prompt () } void -_rl_restore_prompt () +rl_restore_prompt () { if (local_prompt) free (local_prompt); @@ -1285,14 +1304,14 @@ _rl_make_prompt_for_search (pchar) int len; char *pmt; - _rl_save_prompt (); + rl_save_prompt (); if (saved_local_prompt == 0) { len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0; pmt = xmalloc (len + 2); if (len) - strcpy (pmt, rl_prompt); + strcpy (pmt, rl_prompt); pmt[len] = pchar; pmt[len+1] = '\0'; } @@ -1301,7 +1320,7 @@ _rl_make_prompt_for_search (pchar) len = *saved_local_prompt ? strlen (saved_local_prompt) : 0; pmt = xmalloc (len + 2); if (len) - strcpy (pmt, saved_local_prompt); + strcpy (pmt, saved_local_prompt); pmt[len] = pchar; pmt[len+1] = '\0'; local_prompt = savestring (pmt); @@ -1561,6 +1580,15 @@ _rl_clean_up_for_exit () _rl_move_vert (_rl_vis_botlin); _rl_vis_botlin = 0; fflush (rl_outstream); - rl_restart_output (); + rl_restart_output (1, 0); } } + +void +_rl_erase_entire_line () +{ + cr (); + _rl_clear_to_eol (0); + cr (); + fflush (rl_outstream); +} diff --git a/readline/doc/Makefile.in b/readline/doc/Makefile.in index 2eabb41..1031472 100644 --- a/readline/doc/Makefile.in +++ b/readline/doc/Makefile.in @@ -10,6 +10,7 @@ infodir = @infodir@ mandir = @mandir@ man3dir = $(mandir)/man3 +SHELL = @MAKE_SHELL@ RM = rm -f TEXINPUTDIR = $(srcdir) @@ -25,9 +26,9 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ RLSRC = $(srcdir)/rlman.texinfo $(srcdir)/rluser.texinfo \ - $(srcdir)/rltech.texinfo + $(srcdir)/rltech.texinfo $(srcdir)/manvers.texinfo HISTSRC = $(srcdir)/hist.texinfo $(srcdir)/hsuser.texinfo \ - $(srcdir)/hstech.texinfo + $(srcdir)/hstech.texinfo $(srcdir)/manvers.texinfo # This should be a program that converts troff to an ascii-readable format NROFF = groff -Tascii @@ -42,6 +43,8 @@ HTMLOBJ = readline.html history.html HTMLTOC = readline_toc.html history_toc.html TEXTOBJ = readline.0 +INTERMEDIATE_OBJ = rlman.dvi hist.dvi + CREATED_DOCS = $(DVIOBJ) $(INFOOBJ) $(PSOBJ) $(HTMLOBJ) $(HTMLTOC) $(TEXTOBJ) .SUFFIXES: .0 .3 .ps .txt .dvi @@ -76,16 +79,14 @@ history.ps: history.dvi $(DVIPS) history.dvi readline.html: ${RLSRC} - $(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo - sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html - sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html - $(RM) rlman.html rlman_toc.html + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/rlman.texinfo + sed -e 's:rlman.html:readline.html:' rlman.html > readline.html + $(RM) rlman.html history.html: ${HISTSRC} - $(TEXI2HTML) -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo - sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html - sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html - $(RM) hist.html hist_toc.html + $(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/hist.texinfo + sed -e 's:hist.html:history.html:' hist.html > history.html + $(RM) hist.html info: $(INFOOBJ) dvi: $(DVIOBJ) @@ -101,18 +102,20 @@ clean: distclean: clean $(RM) $(CREATED_DOCS) + $(RM) $(INTERMEDIATE_OBJ) $(RM) Makefile mostlyclean: clean maintainer-clean: clean $(RM) $(CREATED_DOCS) + $(RM) $(INTERMEDIATE_OBJ) $(RM) Makefile installdirs: $(top_srcdir)/support/mkdirs -$(SHELL) $(top_srcdir)/support/mkdirs $(infodir) $(man3dir) -install: installdirs info +install: installdirs if test -f readline.info; then \ ${INSTALL_DATA} readline.info $(infodir)/readline.info; \ else \ diff --git a/readline/doc/hist.texinfo b/readline/doc/hist.texinfo index be8742f..31a0ba0 100644 --- a/readline/doc/hist.texinfo +++ b/readline/doc/hist.texinfo @@ -6,26 +6,19 @@ @setchapternewpage odd -@ignore -last change: Thu Apr 2 14:38:22 EST 1998 -@end ignore - -@set EDITION 2.2 -@set VERSION 2.2 -@set UPDATED 2 April 1998 -@set UPDATE-MONTH April 1998 +@include manvers.texinfo +@ifinfo @dircategory Libraries @direntry * History: (history). The GNU history library API @end direntry -@ifinfo 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, 1991, 1993, 1995, 1996, 1998 Free Software Foundation, Inc. +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 @@ -46,7 +39,7 @@ 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 Foundation. +by the Free Software Foundation. @end ifinfo @titlepage @@ -77,10 +70,10 @@ 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 Foundation. +by the Free Software Foundation. @vskip 0pt plus 1filll -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. +Copyright @copyright{} 1988-1999 Free Software Foundation, Inc. @end titlepage @ifinfo diff --git a/readline/doc/hsuser.texinfo b/readline/doc/hsuser.texinfo index 7c4582d..76cb63b 100644 --- a/readline/doc/hsuser.texinfo +++ b/readline/doc/hsuser.texinfo @@ -117,7 +117,7 @@ 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,7 +149,7 @@ 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 [-anrw] [@var{filename}] diff --git a/readline/doc/manvers.texinfo b/readline/doc/manvers.texinfo new file mode 100644 index 0000000..63924e3 --- /dev/null +++ b/readline/doc/manvers.texinfo @@ -0,0 +1,6 @@ +@set EDITION 4.0 +@set VERSION 4.0 +@set UPDATED 31 December 1998 +@set UPDATE-MONTH December 1998 + +@set LASTCHANGE Thu Dec 31 10:17:05 EST 1998 diff --git a/readline/doc/readline.0 b/readline/doc/readline.0 index c925d52..970d8c6 100644 --- a/readline/doc/readline.0 +++ b/readline/doc/readline.0 @@ -8,6 +8,7 @@ NNAAMMEE readline - get a line from a user with editing SSYYNNOOPPSSIISS + ##iinncclluuddee <<ssttddiioo..hh>> ##iinncclluuddee <<rreeaaddlliinnee..hh>> ##iinncclluuddee <<hhiissttoorryy..hh>> @@ -57,11 +58,10 @@ NNOOTTAATTIIOONN ments deviates from this are noted. When a command is described as _k_i_l_l_i_n_g text, the text - deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). -GNU 1998 Feb 19 1 +GNU 1998 Dec 31 1 @@ -70,6 +70,7 @@ GNU 1998 Feb 19 1 READLINE(3) READLINE(3) + deleted is saved for possible future retrieval (_y_a_n_k_i_n_g). The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not @@ -126,8 +127,7 @@ IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE - -GNU 1998 Feb 19 2 +GNU 1998 Dec 31 2 @@ -193,7 +193,7 @@ READLINE(3) READLINE(3) -GNU 1998 Feb 19 3 +GNU 1998 Dec 31 3 @@ -259,7 +259,7 @@ READLINE(3) READLINE(3) -GNU 1998 Feb 19 4 +GNU 1998 Dec 31 4 @@ -274,6 +274,18 @@ READLINE(3) READLINE(3) for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line. + iinnppuutt--mmeettaa ((OOffff)) + If set to OOnn, readline will enable eight-bit input + (that is, it will not strip the high bit from the + characters it reads), regardless of what the termi- + nal claims it can support. The name mmeettaa--ffllaagg is a + synonym for this variable. + iisseeaarrcchh--tteerrmmiinnaattoorrss ((````CC--[[CC--JJ'''')) + The string of characters that should terminate an + incremental search without subsequently executing + the character as a command. If this variable has + not been given a value, the characters _E_S_C and _C_-_J + will terminate an incremental search. kkeeyymmaapp ((eemmaaccss)) Set the current readline keymap. The set of legal keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_, @@ -288,44 +300,32 @@ READLINE(3) READLINE(3) mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff)) If set to OOnn, history lines that have been modified are displayed with a preceding asterisk (**). - mmeettaa--ffllaagg ((OOffff)) - If set to OOnn, readline will enable eight-bit input - (that is, it will not strip the high bit from the - characters it reads), regardless of what the termi- - nal claims it can support. oouuttppuutt--mmeettaa ((OOffff)) If set to OOnn, readline will display characters with - the eighth bit set directly rather than as a meta- + the eighth bit set directly rather than as a meta- prefixed escape sequence. pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff)) - If set to OOnn, readline will display completions - with matches sorted horizontally in alphabetical + If set to OOnn, readline will display completions + with matches sorted horizontally in alphabetical order, rather than down the screen. sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff)) - This alters the default behavior of the completion - functions. If set to oonn, words which have more - than one possible completion cause the matches to - be listed immediately instead of ringing the bell. + This alters the default behavior of the completion + functions. If set to oonn, words which have more + than one possible completion cause the matches to + be listed immediately instead of ringing the bell. vviissiibbllee--ssttaattss ((OOffff)) If set to OOnn, a character denoting a file's type as - reported by ssttaatt(2) is appended to the filename + reported by ssttaatt(2) is appended to the filename when listing possible completions. CCoonnddiittiioonnaall CCoonnssttrruuccttss - Readline implements a facility similar in spirit to the - conditional compilation features of the C preprocessor - which allows key bindings and variable settings to be per- - formed as the result of tests. There are four parser - directives used. - - $$iiff The $$iiff construct allows bindings to be made based - on the editing mode, the terminal being used, or - the application using readline. The text of the - test extends to the end of the line; no characters + Readline implements a facility similar in spirit to the + conditional compilation features of the C preprocessor + which allows key bindings and variable settings to be -GNU 1998 Feb 19 5 +GNU 1998 Dec 31 5 @@ -334,21 +334,28 @@ GNU 1998 Feb 19 5 READLINE(3) READLINE(3) + performed as the result of tests. There are four parser + directives used. + + $$iiff The $$iiff construct allows bindings to be made based + on the editing mode, the terminal being used, or + the application using readline. The text of the + test extends to the end of the line; no characters are required to isolate it. - mmooddee The mmooddee== form of the $$iiff directive is used - to test whether readline is in emacs or vi - mode. This may be used in conjunction with + mmooddee The mmooddee== form of the $$iiff directive is used + to test whether readline is in emacs or vi + mode. This may be used in conjunction with the sseett kkeeyymmaapp command, for instance, to set - bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_- - _c_t_l_x keymaps only if readline is starting + bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_- + _c_t_l_x keymaps only if readline is starting out in emacs mode. tteerrmm The tteerrmm== form may be used to include termi- - nal-specific key bindings, perhaps to bind - the key sequences output by the terminal's - function keys. The word on the right side - of the == is tested against the full name of + nal-specific key bindings, perhaps to bind + the key sequences output by the terminal's + function keys. The word on the right side + of the == is tested against the full name of the terminal and the portion of the terminal name before the first --. This allows _s_u_n to match both _s_u_n and _s_u_n_-_c_m_d, for instance. @@ -357,12 +364,12 @@ READLINE(3) READLINE(3) The aapppplliiccaattiioonn construct is used to include application-specific settings. Each program using the readline library sets the _a_p_p_l_i_c_a_- - _t_i_o_n _n_a_m_e, and an initialization file can - test for a particular value. This could be + _t_i_o_n _n_a_m_e, and an initialization file can + test for a particular value. This could be used to bind key sequences to functions use- - ful for a specific program. For instance, - the following command adds a key sequence - that quotes the current or previous word in + ful for a specific program. For instance, + the following command adds a key sequence + that quotes the current or previous word in Bash: $$iiff bash @@ -373,25 +380,18 @@ READLINE(3) READLINE(3) $$eennddiiff This command, as seen in the previous example, ter- minates an $$iiff command. - $$eellssee Commands in this branch of the $$iiff directive are + $$eellssee Commands in this branch of the $$iiff directive are executed if the test fails. $$iinncclluuddee - This directive takes a single filename as an argu- - ment and reads commands and bindings from that - file. For example, the following directive would + This directive takes a single filename as an argu- + ment and reads commands and bindings from that + file. For example, the following directive would read _/_e_t_c_/_i_n_p_u_t_r_c: - $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c - -SSEEAARRCCHHIINNGG - Readline provides commands for searching through the com- - mand history for lines containing a specified string. - There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_- - -GNU 1998 Feb 19 6 +GNU 1998 Dec 31 6 @@ -400,36 +400,44 @@ GNU 1998 Feb 19 6 READLINE(3) READLINE(3) - _i_n_c_r_e_m_e_n_t_a_l. + $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c + +SSEEAARRCCHHIINNGG + Readline provides commands for searching through the com- + mand history for lines containing a specified string. + There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-_i_n_c_r_e_m_e_n_- + _t_a_l. - Incremental searches begin before the user has finished + Incremental searches begin before the user has finished typing the search string. As each character of the search string is typed, readline displays the next entry from the - history matching the string typed so far. An incremental - search requires only as many characters as needed to find - the desired history entry. The Escape character is used - to terminate an incremental search. Control-J will also - terminate the search. Control-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 Control-S or Control-R as appro- - priate. This will search backward or forward in the his- - tory for the next line matching the search string typed so - far. Any other key sequence bound to a readline command - will terminate the search and execute that command. For - instance, a _n_e_w_l_i_n_e will terminate the search and accept - the line, thereby executing the command from the history - list. - - Non-incremental searches read the entire search string + history matching the string typed so far. An incremental + search requires only as many characters as needed to find + the desired history entry. The characters present in the + value of the _i_s_e_a_r_c_h_-_t_e_r_m_i_n_a_t_o_r_s variable are used to ter- + minate an incremental search. If that variable has not + been assigned a value the Escape and Control-J characters + will terminate an incremental search. Control-G will + abort an incremental search and restore the original line. + When the search is terminated, the history entry contain- + ing the search string becomes the current line. To find + other matching entries in the history list, type Control-S + or Control-R as appropriate. This will search backward or + forward in the history for the next line matching the + search string typed so far. Any other key sequence bound + to a readline command will terminate the search and exe- + cute that command. For instance, a _n_e_w_l_i_n_e will terminate + the search and accept the line, thereby executing the com- + mand from the history list. + + Non-incremental searches read the entire search string before starting to search for matching history lines. The - search string may be typed by the user or be part of the + search string may be typed by the user or be part of the contents of the current line. EEDDIITTIINNGG CCOOMMMMAANNDDSS - The following is a list of the names of the commands and - the default key sequences to which they are bound. Com- + The following is a list of the names of the commands and + the default key sequences to which they are bound. Com- mand names without an accompanying key sequence are unbound by default. @@ -443,21 +451,13 @@ EEDDIITTIINNGG CCOOMMMMAANNDDSS bbaacckkwwaarrdd--cchhaarr ((CC--bb)) Move back a character. ffoorrwwaarrdd--wwoorrdd ((MM--ff)) - Move forward to the end of the next word. Words - are composed of alphanumeric characters (letters + Move forward to the end of the next word. Words + are composed of alphanumeric characters (letters and digits). - bbaacckkwwaarrdd--wwoorrdd ((MM--bb)) - Move back to the start of this, or the previous, - word. Words are composed of alphanumeric charac- - ters (letters and digits). - cclleeaarr--ssccrreeeenn ((CC--ll)) - Clear the screen leaving the current line at the - top of the screen. With an argument, refresh the - current line without clearing the screen. -GNU 1998 Feb 19 7 +GNU 1998 Dec 31 7 @@ -466,64 +466,64 @@ GNU 1998 Feb 19 7 READLINE(3) READLINE(3) + bbaacckkwwaarrdd--wwoorrdd ((MM--bb)) + Move back to the start of this, or the previous, + word. Words are composed of alphanumeric charac- + ters (letters and digits). + cclleeaarr--ssccrreeeenn ((CC--ll)) + Clear the screen leaving the current line at the + top of the screen. With an argument, refresh the + current line without clearing the screen. rreeddrraaww--ccuurrrreenntt--lliinnee Refresh the current line. CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn)) - Accept the line regardless of where the cursor is. - If this line is non-empty, add it to the history - list. If the line is a modified history line, then + Accept the line regardless of where the cursor is. + If this line is non-empty, add it to the history + list. If the line is a modified history line, then restore the history line to its original state. pprreevviioouuss--hhiissttoorryy ((CC--pp)) - Fetch the previous command from the history list, + Fetch the previous command from the history list, moving back in the list. nneexxtt--hhiissttoorryy ((CC--nn)) - Fetch the next command from the history list, mov- + Fetch the next command from the history list, mov- ing forward in the list. bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<)) Move to the first line in the history. eenndd--ooff--hhiissttoorryy ((MM-->>)) - Move to the end of the input history, i.e., the + Move to the end of the input history, i.e., the line currently being entered. rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr)) - Search backward starting at the current line and + Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search. ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss)) - Search forward starting at the current line and - moving `down' through the history as necessary. + Search forward starting at the current line and + moving `down' through the history as necessary. This is an incremental search. nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp)) Search backward through the history starting at the - current line using a non-incremental search for a + current line using a non-incremental search for a string supplied by the user. nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn)) - Search forward through the history using a non- - incremental search for a string supplied by the + Search forward through the history using a non- + incremental search for a string supplied by the user. hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd - Search forward through the history for the string + Search forward through the history for the string of characters between the start of the current line - and the current cursor position (the _p_o_i_n_t). This + and the current cursor position (the _p_o_i_n_t). This is a non-incremental search. hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd - Search backward through the history for the string + Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. - yyaannkk--nntthh--aarrgg ((MM--CC--yy)) - Insert the first argument to the previous command - (usually the second word on the previous line) at - point (the current cursor position). With an argu- - ment _n, insert the _nth word from the previous com- - mand (the words in the previous command begin with - word 0). A negative argument inserts the _nth word - from the end of the previous command. -GNU 1998 Feb 19 8 +GNU 1998 Dec 31 8 @@ -532,24 +532,37 @@ GNU 1998 Feb 19 8 READLINE(3) READLINE(3) + yyaannkk--nntthh--aarrgg ((MM--CC--yy)) + Insert the first argument to the previous command + (usually the second word on the previous line) at + point (the current cursor position). With an argu- + ment _n, insert the _nth word from the previous com- + mand (the words in the previous command begin with + word 0). A negative argument inserts the _nth word + from the end of the previous command. yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__)) - Insert the last argument to the previous command - (the last word of the previous history entry). + Insert the last argument to the previous command + (the last word of the previous history entry). With an argument, behave exactly like yyaannkk--nntthh--aarrgg. Successive calls to yyaannkk--llaasstt--aarrgg move back through - the history list, inserting the last argument of + the history list, inserting the last argument of each line in turn. CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt ddeelleettee--cchhaarr ((CC--dd)) Delete the character under the cursor. If point is - at the beginning of the line, there are no charac- - ters in the line, and the last character typed was + at the beginning of the line, there are no charac- + ters in the line, and the last character typed was not bound to BBddeelleettee--cchhaarr, then return EEOOFF. bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt)) Delete the character behind the cursor. When given - a numeric argument, save the deleted text on the + a numeric argument, save the deleted text on the kill ring. + ffoorrwwaarrdd--bbaacckkwwaarrdd--ddeelleettee--cchhaarr + Delete the character under the cursor, unless the + cursor is at the end of the line, in which case the + character behind the cursor is deleted. By + default, this is not bound to a key. qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv)) Add the next character that you type to the line verbatim. This is how to insert characters like @@ -572,6 +585,19 @@ READLINE(3) READLINE(3) Uppercase the current (or following) word. With a negative argument, uppercase the previous word, but do not move point. + + + + +GNU 1998 Dec 31 9 + + + + + +READLINE(3) READLINE(3) + + ddoowwnnccaassee--wwoorrdd ((MM--ll)) Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but @@ -585,19 +611,6 @@ READLINE(3) READLINE(3) kkiillll--lliinnee ((CC--kk)) Kill the text from the current cursor position to the end of the line. - - - - -GNU 1998 Feb 19 9 - - - - - -READLINE(3) READLINE(3) - - bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt)) Kill backward to the beginning of the line. uunniixx--lliinnee--ddiissccaarrdd ((CC--uu)) @@ -639,6 +652,18 @@ READLINE(3) READLINE(3) Rotate the kill ring, and yank the new top. Only works following yyaannkk or yyaannkk--ppoopp. + + + +GNU 1998 Dec 31 10 + + + + + +READLINE(3) READLINE(3) + + NNuummeerriicc AArrgguummeennttss ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----)) Add this digit to the argument already accumulat- @@ -651,20 +676,8 @@ READLINE(3) READLINE(3) define the argument. If the command is followed by digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the numeric argument, but is otherwise ignored. As a - special case, if this command is immediately - - - -GNU 1998 Feb 19 10 - - - - - -READLINE(3) READLINE(3) - - - followed by a character that is neither a digit or + special case, if this command is immediately fol- + lowed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. The argument count is ini- tially one, so executing this function the first @@ -705,30 +718,36 @@ READLINE(3) READLINE(3) the list. This command is intended to be bound to TTAABB, but is unbound by default. - KKeeyybbooaarrdd MMaaccrrooss - ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (()) - Begin saving the characters typed into the current - keyboard macro. - eenndd--kkbbdd--mmaaccrroo ((CC--xx )))) - Stop saving the characters typed into the current - keyboard macro and store the definition. - ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee)) - Re-execute the last keyboard macro defined, by mak- - ing the characters in the macro appear as if typed - at the keyboard. +GNU 1998 Dec 31 11 -GNU 1998 Feb 19 11 +READLINE(3) READLINE(3) -READLINE(3) READLINE(3) + ddeelleettee--cchhaarr--oorr--lliisstt + Deletes the character under the cursor if not at + the beginning or end of the line (like ddeelleettee-- + cchhaarr). If at the end of the line, behaves identi- + cally to ppoossssiibbllee--ccoommpplleettiioonnss. This command is + unbound by default. + KKeeyybbooaarrdd MMaaccrrooss + ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (()) + Begin saving the characters typed into the current + keyboard macro. + eenndd--kkbbdd--mmaaccrroo ((CC--xx )))) + Stop saving the characters typed into the current + keyboard macro and store the definition. + ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee)) + Re-execute the last keyboard macro defined, by mak- + ing the characters in the macro appear as if typed + at the keyboard. MMiisscceellllaanneeoouuss rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr)) @@ -753,7 +772,7 @@ READLINE(3) READLINE(3) Undo all changes made to this line. This is like executing the uunnddoo command enough times to return the line to its initial state. - ttiillddee--eexxppaanndd ((MM--~~)) + ttiillddee--eexxppaanndd ((MM--&&)) Perform tilde expansion on the current word. sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>)) Set the mark to the current point. If a numeric @@ -765,6 +784,18 @@ READLINE(3) READLINE(3) cursor position is saved as the mark. cchhaarraacctteerr--sseeaarrcchh ((CC--]])) A character is read and point is moved to the next + + + +GNU 1998 Dec 31 12 + + + + + +READLINE(3) READLINE(3) + + occurrence of that character. A negative count searches for previous occurrences. cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]])) @@ -783,20 +814,8 @@ READLINE(3) READLINE(3) ment is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. dduummpp--vvaarriiaabblleess - Print all of the settable variables and their - - - -GNU 1998 Feb 19 12 - - - - - -READLINE(3) READLINE(3) - - - values to the readline output stream. If a numeric + Print all of the settable variables and their val- + ues to the readline output stream. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an _i_n_p_u_t_r_c file. @@ -830,6 +849,19 @@ DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS the bell (subject to the setting of the bbeellll--ssttyyllee vari- able). + + + + +GNU 1998 Dec 31 13 + + + + + +READLINE(3) READLINE(3) + + EEmmaaccss MMooddee Emacs Standard bindings @@ -850,18 +882,6 @@ DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS "C-P" previous-history "C-Q" quoted-insert "C-R" reverse-search-history - - - -GNU 1998 Feb 19 13 - - - - - -READLINE(3) READLINE(3) - - "C-S" forward-search-history "C-T" transpose-chars "C-U" unix-line-discard @@ -896,6 +916,18 @@ READLINE(3) READLINE(3) "M-1" digit-argument "M-2" digit-argument "M-3" digit-argument + + + +GNU 1998 Dec 31 14 + + + + + +READLINE(3) READLINE(3) + + "M-4" digit-argument "M-5" digit-argument "M-6" digit-argument @@ -916,18 +948,6 @@ READLINE(3) READLINE(3) "M-R" revert-line "M-T" transpose-words "M-U" upcase-word - - - -GNU 1998 Feb 19 14 - - - - - -READLINE(3) READLINE(3) - - "M-Y" yank-pop "M-\" delete-horizontal-space "M-~" tilde-expand @@ -962,6 +982,18 @@ READLINE(3) READLINE(3) "C-W" unix-word-rubout "C-Y" yank "C-[" vi-movement-mode + + + +GNU 1998 Dec 31 15 + + + + + +READLINE(3) READLINE(3) + + "C-_" undo " " to "~" self-insert "C-?" backward-delete-char @@ -982,18 +1014,6 @@ READLINE(3) READLINE(3) "C-R" reverse-search-history "C-S" forward-search-history "C-T" transpose-chars - - - -GNU 1998 Feb 19 15 - - - - - -READLINE(3) READLINE(3) - - "C-U" unix-line-discard "C-V" quoted-insert "C-W" unix-word-rubout @@ -1028,6 +1048,18 @@ READLINE(3) READLINE(3) "S" vi-subst "T" vi-char-search "U" revert-line + + + +GNU 1998 Dec 31 16 + + + + + +READLINE(3) READLINE(3) + + "W" vi-next-word "X" backward-delete-char "Y" vi-yank-to @@ -1048,18 +1080,6 @@ READLINE(3) READLINE(3) "l" forward-char "m" vi-set-mark "n" vi-search-again - - - -GNU 1998 Feb 19 16 - - - - - -READLINE(3) READLINE(3) - - "p" vi-put "r" vi-change-char "s" vi-subst @@ -1094,6 +1114,18 @@ BBUUGG RREEPPOORRTTSS library that you have. Once you have determined that a bug actually exists, mail + + + +GNU 1998 Dec 31 17 + + + + + +READLINE(3) READLINE(3) + + a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix, you are welcome to mail that as well! Suggestions and `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_- @@ -1117,6 +1149,40 @@ BBUUGGSS -GNU 1998 Feb 19 17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +GNU 1998 Dec 31 18 diff --git a/readline/doc/readline.3 b/readline/doc/readline.3 index bb9f759..6b36f2f 100644 --- a/readline/doc/readline.3 +++ b/readline/doc/readline.3 @@ -6,9 +6,9 @@ .\" Case Western Reserve University .\" chet@ins.CWRU.Edu .\" -.\" Last Change: Thu Feb 19 10:26:47 EST 1998 +.\" Last Change: Thu Dec 31 10:16:30 EST 1998 .\" -.TH READLINE 3 "1998 Feb 19" GNU +.TH READLINE 3 "1998 Dec 31" GNU .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -22,6 +22,7 @@ readline \- get a line from a user with editing .LP .nf .ft B +#include <stdio.h> #include <readline.h> #include <history.h> .ft @@ -380,6 +381,19 @@ When set to \fBOn\fP, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line. .TP +.B input\-meta (Off) +If set to \fBOn\fP, readline will enable eight-bit input (that is, +it will not strip the high bit from the characters it reads), +regardless of what the terminal claims it can support. The name +.B meta\-flag +is a synonym for this variable. +.TP +.B isearch\-terminators (``C\-[C\-J'') +The string of characters that should terminate an incremental +search without subsequently executing the character as a command. +If this variable has not been given a value, the characters +\fIESC\fP and \fIC\-J\fP will terminate an incremental search. +.TP .B keymap (emacs) Set the current readline keymap. The set of legal keymap names is \fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, @@ -400,11 +414,6 @@ appended. If set to \fBOn\fP, history lines that have been modified are displayed with a preceding asterisk (\fB*\fP). .TP -.B meta\-flag (Off) -If set to \fBOn\fP, readline will enable eight-bit input (that is, -it will not strip the high bit from the characters it reads), -regardless of what the terminal claims it can support. -.TP .B output\-meta (Off) If set to \fBOn\fP, readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape @@ -509,8 +518,10 @@ 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 Escape character is used to terminate an incremental search. -Control-J will also terminate the search. +The characters present in the value of the \fIisearch-terminators\fP +variable are used to terminate an incremental search. +If that variable has not been assigned a value the Escape and +Control-J characters will terminate an incremental search. Control-G will abort an incremental search and restore the original line. When the search is terminated, the history entry containing the @@ -647,6 +658,11 @@ the last character typed was not bound to \fBBdelete\-char\fP, then return Delete the character behind the cursor. When given a numeric argument, save the deleted text on the kill ring. .TP +.B forward\-backward\-delete\-char +Delete the character under the cursor, unless the cursor is at the +end of the line, in which case the character behind the cursor is +deleted. By default, this is not bound to a key. +.TP .B quoted\-insert (C\-q, C\-v) Add the next character that you type to the line verbatim. This is how to insert characters like \fBC\-q\fP, for example. @@ -798,6 +814,13 @@ of matches; a negative argument may be used to move backward through the list. This command is intended to be bound to \fBTAB\fP, but is unbound by default. +.TP +.B delete\-char\-or\-list +Deletes the character under the cursor if not at the beginning or +end of the line (like \fBdelete-char\fP). +If at the end of the line, behaves identically to +\fBpossible-completions\fP. +This command is unbound by default. .PD .SS Keyboard Macros .PP @@ -847,7 +870,7 @@ Undo all changes made to this line. This is like executing the .B undo command enough times to return the line to its initial state. .TP -.B tilde\-expand (M\-~) +.B tilde\-expand (M\-&) Perform tilde expansion on the current word. .TP .B set\-mark (C\-@, M-<space>) diff --git a/readline/doc/rlman.texinfo b/readline/doc/rlman.texinfo index dd6478a..41bafbf 100644 --- a/readline/doc/rlman.texinfo +++ b/readline/doc/rlman.texinfo @@ -6,26 +6,19 @@ @synindex vr fn @setchapternewpage odd -@ignore -last change: Thu Apr 2 14:39:03 EST 1998 -@end ignore - -@set EDITION 2.2 -@set VERSION 2.2 -@set UPDATED 2 April 1998 -@set UPDATE-MONTH April 1998 +@include manvers.texinfo +@ifinfo @dircategory Libraries @direntry * Readline: (readline). The GNU readline library API @end direntry -@ifinfo This document describes the GNU Readline Library, a utility which aids in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988, 1991, 1993, 1996, 1998 Free Software Foundation, Inc. +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 @@ -46,7 +39,7 @@ 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 Foundation. +by the Free Software Foundation. @end ifinfo @titlepage @@ -77,10 +70,10 @@ 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 Foundation. +by the Free Software Foundation. @vskip 0pt plus 1filll -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. +Copyright @copyright{} 1988-1999 Free Software Foundation, Inc. @end titlepage @ifinfo diff --git a/readline/doc/rltech.texinfo b/readline/doc/rltech.texinfo index bce5087..ea8d7f8 100644 --- a/readline/doc/rltech.texinfo +++ b/readline/doc/rltech.texinfo @@ -8,7 +8,7 @@ This document describes the GNU Readline Library, a utility for aiding in the consitency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988, 1994, 1996 Free Software Foundation, Inc. +Copyright (C) 1988, 1994, 1996, 1998, 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 @@ -47,7 +47,9 @@ in your own programs, this section is for you. * Readline Variables:: Variables accessible to custom functions. * Readline Convenience Functions:: Functions which Readline supplies to - aid in writing your own + aid in writing your own custom + functions. +* Readline Signal Handling:: How Readline behaves when it receives signals. * Custom Completers:: Supplanting or supplementing Readline's completion functions. @end menu @@ -268,6 +270,13 @@ Setting this to a value makes it the next keystroke read. This is a way to stuff a single character into the input stream. @end deftypevar +@deftypevar int rl_erase_empty_line +Setting this to a non-zero value causes Readline to completely erase +the current line, including any prompt, any time a newline is typed as +the only character on an otherwise-empty line. The cursor is moved to +the beginning of the newly-blank line. +@end deftypevar + @deftypevar {char *} rl_prompt The prompt Readline uses. This is set from the argument to @code{readline ()}, and should not be assigned to directly. @@ -300,6 +309,12 @@ If non-zero, this is the address of a function to call just before @code{readline} prints the first prompt. @end deftypevar +@deftypevar {Function *} rl_pre_input_hook +If non-zero, this is the address of a function to call after +the first prompt has been printed and just before @code{readline} +starts reading input characters. +@end deftypevar + @deftypevar {Function *} rl_event_hook If non-zero, this is the address of a function to call periodically when readline is waiting for terminal input. @@ -619,6 +634,16 @@ is also used to display numeric arguments and search strings. Clear the message in the echo area. @end deftypefun +@deftypefun void rl_save_prompt () +Save the local Readline prompt display state in preparation for +displaying a new message in the message area with @code{rl_message}. +@end deftypefun + +@deftypefun void rl_restore_prompt () +Restore the local Readline prompt display state saved by the most +recent call to @code{rl_save_prompt}. +@end deftypefun + @node Modifying Text @subsection Modifying Text @@ -689,6 +714,16 @@ Return 1 if @var{c} is a numeric character. Ring the terminal bell, obeying the setting of @code{bell-style}. @end deftypefun +@deftypefun void rl_display_match_list (char **matches, int len, int max) +A convenience function for displaying a list of strings in +columnar format on Readline's output stream. @code{matches} is the list +of strings, in argv format, such as a list of completion matches. +@code{len} is the number of strings in @code{matches}, and @code{max} +is the length of the longest string in @code{matches}. This function uses +the setting of @code{print-completions-horizontally} to select how the +matches are displayed (@pxref{Readline Init File Syntax}). +@end deftypefun + The following are implemented as macros, defined in @code{chartypes.h}. @deftypefun int uppercase_p (int c) @@ -814,6 +849,116 @@ invert_case_line (count, key) @} @end example +@node Readline Signal Handling +@section Readline Signal Handling + +Signals are asynchronous events sent to a process by the Unix kernel, +sometimes on behalf of another process. They are intended to indicate +exceptional events, like a user pressing the interrupt key on his +terminal, or a network connection being broken. There is a class of +signals that can be sent to the process currently reading input from +the keyboard. Since Readline changes the terminal attributes when it +is called, it needs to perform special processing when a signal is +received to restore the terminal to a sane state, or provide application +writers with functions to do so manually. + +Readline contains an internal signal handler that is installed for a +number of signals (@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, +@code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}). +When one of these signals is received, the signal handler +will reset the terminal attributes to those that were in effect before +@code{readline ()} was called, reset the signal handling to what it was +before @code{readline ()} was called, and resend the signal to the calling +application. +If and when the calling application's signal handler returns, Readline +will reinitialize the terminal and continue to accept input. +When a @code{SIGINT} is received, the Readline signal handler performs +some additional work, which will cause any partially-entered line to be +aborted (see the description of @code{rl_free_line_state ()}). + +There is an additional Readline signal handler, for @code{SIGWINCH}, which +the kernel sends to a process whenever the terminal's size changes (for +example, if a user resizes an @code{xterm}). The Readline @code{SIGWINCH} +handler updates Readline's internal screen size state, and then calls any +@code{SIGWINCH} signal handler the calling application has installed. +Readline calls the application's @code{SIGWINCH} signal handler without +resetting the terminal to its original state. If the application's signal +handler does more than update its idea of the terminal size and return (for +example, a @code{longjmp} back to a main processing loop), it @emph{must} +call @code{rl_cleanup_after_signal ()} (described below), to restore the +terminal state. + +Readline provides two variables that allow application writers to +control whether or not it will catch certain signals and act on them +when they are received. It is important that applications change the +values of these variables only when calling @code{readline ()}, not in +a signal handler, so Readline's internal signal state is not corrupted. + +@deftypevar int rl_catch_signals +If this variable is non-zero, Readline will install signal handlers for +@code{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGALRM}, +@code{SIGTSTP}, @code{SIGTTIN}, and @code{SIGTTOU}. + +The default value of @code{rl_catch_signals} is 1. +@end deftypevar + +@deftypevar int rl_catch_sigwinch +If this variable is non-zero, Readline will install a signal handler for +@code{SIGWINCH}. + +The default value of @code{rl_catch_sigwinch} is 1. +@end deftypevar + +If an application does not wish to have Readline catch any signals, or +to handle signals other than those Readline catches (@code{SIGHUP}, +for example), +Readline provides convenience functions to do the necessary terminal +and internal state cleanup upon receipt of a signal. + +@deftypefun void rl_cleanup_after_signal (void) +This function will reset the state of the terminal to what it was before +@code{readline ()} was called, and remove the Readline signal handlers for +all signals, depending on the values of @code{rl_catch_signals} and +@code{rl_catch_sigwinch}. +@end deftypefun + +@deftypefun void rl_free_line_state (void) +This will free any partial state associated with the current input line +(undo information, any partial history entry, any partially-entered +keyboard macro, and any partially-entered numeric argument). This +should be called before @code{rl_cleanup_after_signal ()}. The +Readline signal handler for @code{SIGINT} calls this to abort the +current input line. +@end deftypefun + +@deftypefun void rl_reset_after_signal (void) +This will reinitialize the terminal and reinstall any Readline signal +handlers, depending on the values of @code{rl_catch_signals} and +@code{rl_catch_sigwinch}. +@end deftypefun + +If an application does not wish Readline to catch @code{SIGWINCH}, it may +call @code{rl_resize_terminal ()} to force Readline to update its idea of +the terminal size when a @code{SIGWINCH} is received. + +@deftypefun void rl_resize_terminal (void) +Update Readline's internal screen size. +@end deftypefun + +The following functions install and remove Readline's signal handlers. + +@deftypefun int rl_set_signals (void) +Install Readline's signal handler for @code{SIGINT}, @code{SIGQUIT}, +@code{SIGTERM}, @code{SIGALRM}, @code{SIGTSTP}, @code{SIGTTIN}, +@code{SIGTTOU}, and @code{SIGWINCH}, depending on the values of +@code{rl_catch_signals} and @code{rl_catch_sigwinch}. +@end deftypefun + +@deftypefun int rl_clear_signals (void) +Remove all of the Readline signal handlers installed by +@code{rl_set_signals ()}. +@end deftypefun + @node Custom Completers @section Custom Completers @@ -1108,6 +1253,20 @@ string (the current directory name) as an argument. It could be used to expand symbolic links or shell variables in pathnames. @end deftypevar +@deftypevar {VFunction *} rl_completion_display_matches_hook +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. +This function is called in lieu of Readline displaying the list. +It takes three arguments: +(@code{char **}@var{matches}, @code{int} @var{num_matches}, @code{int} @var{max_length}) +where @var{matches} is the array of matching strings, +@var{num_matches} is the number of strings in that array, and +@var{max_length} is the length of the longest string in that array. +Readline provides a convenience function, @code{rl_display_match_list}, +that takes care of doing the display to Readline's output stream. That +function may be called from this hook. +@end deftypevar + @node A Short Completion Example @subsection A Short Completion Example diff --git a/readline/doc/rluser.texinfo b/readline/doc/rluser.texinfo index b2fd060..755f7ca 100644 --- a/readline/doc/rluser.texinfo +++ b/readline/doc/rluser.texinfo @@ -97,7 +97,7 @@ regardless of the location of the cursor within the line. * Readline Killing Commands:: How to delete text, and how to get it back! * Readline Arguments:: Giving numeric arguments to commands. * Searching:: Searching through previous lines. - @end menu +@end menu @node Readline Bare Essentials @subsection Readline Bare Essentials @@ -252,8 +252,10 @@ 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 @key{ESC} character is used to terminate an incremental search. -@key{C-j} will also terminate the search. +The characters present in the value of the @var{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. @@ -396,6 +398,22 @@ horizontally on a single screen line when they are longer than the width of the screen, instead of wrapping onto a new screen line. By default, this variable is set to @samp{off}. +@item input-meta +@vindex input-meta +@vindex meta-flag +If set to @samp{on}, Readline will enable eight-bit input (it +will not strip the eighth bit from the characters it reads), +regardless of what the terminal claims it can support. The +default value is @samp{off}. The name @code{meta-flag} is a +synonym for this variable. + +@item isearch-terminators +@vindex isearch-terminators +The string of characters that should terminate an incremental search without +subsequently executing the character as a command (@pxref{Searching}). +If this variable has not been given a value, the characters @key{ESC} and +@key{C-J} will terminate an incremental search. + @item keymap @vindex keymap Sets Readline's idea of the current keymap for key binding commands. @@ -422,15 +440,6 @@ This variable, when set to @samp{on}, causes Readline to display an asterisk (@samp{*}) at the start of history lines which have been modified. This variable is @samp{off} by default. -@item input-meta -@vindex input-meta -@vindex meta-flag -If set to @samp{on}, Readline will enable eight-bit input (it -will not strip the eighth bit from the characters it reads), -regardless of what the terminal claims it can support. The -default value is @samp{off}. The name @code{meta-flag} is a -synonym for this variable. - @item output-meta @vindex output-meta If set to @samp{on}, Readline will display characters with the @@ -876,6 +885,11 @@ return @code{EOF}. Delete the character behind the cursor. A numeric argument means to kill the characters instead of deleting them. +@item forward-backward-delete-char () +Delete the character under the cursor, unless the cursor is at the +end of the line, in which case the character behind the cursor is +deleted. By default, this is not bound to a key. + @item quoted-insert (C-q, C-v) Add the next character typed to the line verbatim. This is how to insert key sequences like @key{C-q}, for example. @@ -1039,6 +1053,13 @@ through the list. This command is intended to be bound to @code{TAB}, but is unbound by default. +@item delete-char-or-list () +Deletes the character under the cursor if not at the beginning or +end of the line (like @code{delete-char}). +If at the end of the line, behaves identically to +@code{possible-completions}. +This command is unbound by default. + @ifset BashFeatures @item complete-filename (M-/) Attempt filename completion on the text before point. @@ -1141,7 +1162,12 @@ Incremental undo, separately remembered for each line. Undo all changes made to this line. This is like executing the @code{undo} command enough times to get back to the beginning. +@ifset BashFeatures +@item tilde-expand (M-&) +@end ifset +@ifclear BashFeatures @item tilde-expand (M-~) +@end ifclear Perform tilde expansion on the current word. @item set-mark (C-@@) diff --git a/readline/doc/texi2dvi b/readline/doc/texi2dvi index 00e154d..3d7134d 100755 --- a/readline/doc/texi2dvi +++ b/readline/doc/texi2dvi @@ -1,10 +1,9 @@ #! /bin/sh # texi2dvi --- smartly produce DVI files from texinfo sources - -# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - # $Id$ - +# +# Copyright (C) 1992, 93, 94, 95, 96, 97, 98 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) @@ -19,28 +18,27 @@ # along with this program; if not, you can either send email to this # program's maintainer or write to: The Free Software Foundation, # Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA. - +# # Commentary: - -# Author: Noah Friedman <friedman@prep.ai.mit.edu> - -# Please send bug reports, etc. to bug-texinfo@prep.ai.mit.edu +# +# Author: Noah Friedman <friedman@gnu.org> +# +# Please send bug reports, etc. to bug-texinfo@gnu.org. # If possible, please send a copy of the output of the script called with # the `--debug' option when making a bug report. - +# # In the interest of general portability, some common bourne shell # constructs were avoided because they weren't guaranteed to be available # in some earlier implementations. I've tried to make this program as # portable as possible. Welcome to unix, where the lowest common # denominator is rapidly diminishing. # -# Among the more interesting lossages I noticed with some bourne shells -# are: +# Among the more interesting lossages I noticed among Bourne shells: # * No shell functions. # * No `unset' builtin. # * `shift' cannot take a numeric argument, and signals an error if # there are no arguments to shift. - +# # Code: # Name by which this script was invoked. @@ -54,30 +52,39 @@ version=`set - $rcs_revision; echo $2` bq='`' eq="'" -usage="Usage: $progname {options} [file1] {file2 {...}} -(version $version) +usage="Usage: $0 [OPTION]... FILE... +Run a Texinfo document through TeX. -Options are: +Options: +-b, --batch No interaction (\nonstopmode in TeX). +-c, --clean Remove all auxiliary files. -D, --debug Turn on shell debugging ($bq${bq}set -x$eq$eq). --h, --help You're looking at it. --v, --version Print version number. +-t, --texinfo CMD Insert CMD after @setfilename before running TeX. +--verbose Report on what is done. +-h, --help Display this help and exit. +-v, --version Display version information and exit. -Arguments in brackets are required. Those in braces are optional. -" +The values of the TEX, TEXINDEX, and MAKEINFO environment variables are +used to run those commands, if they are set. + +Email bug reports to bug-texinfo@gnu.org." # Initialize variables. # Don't use `unset' since old bourne shells don't have this command. # Instead, assign them an empty value. -# Some of these, like TEX and TEXINDEX, may be inherited from the environment -backup_extension=.bak +# Some of these, like TEX and TEXINDEX, may be inherited from the environment. +backup_extension=.bak # these files get deleted if all goes well. +batch= +clean= debug= orig_pwd="`pwd`" -verbose= +textra= +verbose=false +makeinfo="${MAKEINFO-makeinfo}" texindex="${TEXINDEX-texindex}" tex="${TEX-tex}" -# Save this so we can construct a new TEXINPUTS path for each file to be -# processed. +# Save this so we can construct a new TEXINPUTS path for each file. TEXINPUTS_orig="$TEXINPUTS" export TEXINPUTS @@ -86,190 +93,270 @@ export TEXINPUTS # It's a good idea to document the full long option name in each case. # Long options which take arguments will need a `*' appended to the # canonical name to match the value appended after the `=' character. -while : ; do - case $# in 0) break ;; esac +while :; do + test $# -eq 0 && break + case "$1" in - -D | --debug | --d* ) - debug=t - shift - ;; - -h | --help | --h* ) - echo "$usage" 1>&2 - exit 0 - ;; - -v | --version | --v* ) - echo "texi2dvi version $version" 1>&2 - exit 0 - ;; + -b | --batch | --b* ) batch=t; shift ;; + -c | --clean | --c* ) clean=t; shift ;; + -D | --debug | --d* ) debug=t; shift ;; + -h | --help | --h* ) echo "$usage"; exit 0 ;; + # OK, we should do real option parsing here, but be lazy for now. + -t | --texinfo | --t*) shift; textra="$textra $1"; shift ;; + -v | --vers* ) + echo "$progname (GNU Texinfo 3.12) $version" + echo "Copyright (C) 1998 Free Software Foundation, Inc. +There is NO warranty. You may redistribute this software +under the terms of the GNU General Public License. +For more information about these matters, see the files named COPYING." + exit 0 ;; + --verb* ) verbose=echo; shift ;; -- ) # Stop option processing shift - break - ;; + break ;; -* ) case "$1" in --*=* ) arg=`echo "$1" | sed -e 's/=.*//'` ;; * ) arg="$1" ;; esac exec 1>&2 - echo "$progname: unknown or ambiguous option $bq$arg$eq" - echo "$progname: Use $bq--help$eq for a list of options." - exit 1 - ;; - * ) - break - ;; + echo "$progname: Unknown or ambiguous option $bq$arg$eq." + echo "$progname: Try $bq--help$eq for more information." + exit 1 ;; + * ) break ;; esac done # See if there are any command line args left (which will be interpreted as -# filename arguments) -case $# in - 0 ) - exec 1>&2 - echo "$progname: at least one file name is required as an argument." - echo "$progname: Use $bq--help$eq for a description of command syntax." - exit 2 - ;; -esac - -case "$debug" in t ) set -x ;; esac +# filename arguments). +if test $# -eq 0; then + exec 1>&2 + echo "$progname: At least one file name is required as an argument." + echo "$progname: Try $bq--help$eq for more information." + exit 2 +fi + +test "$debug" = t && set -x # Texify files -for command_line_filename in ${1+"$@"} ; do - # Roughly equivalent to `dirname ...`, but more portable - directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`" - filename_texi="`basename ${command_line_filename}`" - # Strip off the last extension part (probably .texinfo or .texi) - filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`" - - # If directory and file are the same, then it's probably because there's - # no pathname component. Set dirname to `.', the current directory. - if test "z${directory}" = "z${command_line_filename}" ; then - directory="." - fi - - # Source file might @include additional texinfo sources. Put `.' and - # directory where source file(s) reside in TEXINPUTS before anything - # else. `.' goes first to ensure that any old .aux, .cps, etc. files in - # ${directory} don't get used in preference to fresher files in `.'. - TEXINPUTS=".:${directory}:${TEXINPUTS_orig}" - - # "Unset" variables that might have values from previous iterations and - # which won't be completely reset later. - definite_index_files="" - - # See if file exists here. If it doesn't we're in trouble since, even - # though the user may be able to reenter a valid filename at the tex - # prompt (assuming they're attending the terminal), this script won't be - # able to find the right index files and so forth. - if test ! -r "${command_line_filename}" ; then - echo "${progname}: ${command_line_filename}: No such file or permission denied." 1>&2 - continue; - fi - - # Find all files having root filename with a two-letter extension, - # determine whether they're really index files, and save them. Foo.aux - # is actually the cross-references file, but we need to keep track of - # that too. - possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" - for this_file in ${possible_index_files} ; do +for command_line_filename in ${1+"$@"}; do + $verbose "Processing $command_line_filename ..." + + # See if file exists. If it doesn't we're in trouble since, even + # though the user may be able to reenter a valid filename at the tex + # prompt (assuming they're attending the terminal), this script won't + # be able to find the right index files and so forth. + if test ! -r "${command_line_filename}"; then + echo "$0: Could not read ${command_line_filename}." >&2 + continue + fi + + # Roughly equivalent to `dirname ...`, but more portable + directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`" + filename_texi="`basename ${command_line_filename}`" + # Strip off the last extension part (probably .texinfo or .texi) + filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`" + + # Use same basename since we want to generate aux files with the same + # basename as the manual. Use extension .texi for the temp file so + # that TeX will ignore it. Thus, we must use a subdirectory. + # + # Output the macro-expanded file to here. The vastly abbreviated + # temporary directory name is so we don't have collisions on 8.3 or + # 14-character filesystems. + tmp_dir=${TMPDIR-/tmp}/txi2d.$$ + filename_tmp=$tmp_dir/$filename_noext.texi + # Output the file with the user's extra commands to here. + tmp_dir2=${tmp_dir}.2 + filename_tmp2=$tmp_dir2/$filename_noext.texi + mkdir $tmp_dir $tmp_dir2 + # Always remove the temporary directories. + trap "rm -rf $tmp_dir $tmp_dir2" 1 2 15 + + # If directory and file are the same, then it's probably because there's + # no pathname component. Set dirname to `.', the current directory. + if test "z${directory}" = "z${command_line_filename}"; then + directory=. + fi + + # Source file might @include additional texinfo sources. Put `.' and + # directory where source file(s) reside in TEXINPUTS before anything + # else. `.' goes first to ensure that any old .aux, .cps, etc. files in + # ${directory} don't get used in preference to fresher files in `.'. + TEXINPUTS=".:${directory}:${TEXINPUTS_orig}" + + # Expand macro commands in the original source file using Makeinfo; + # the macro syntax bfox implemented is impossible to implement in TeX. + # Always use `end' footnote style, since the `separate' style + # generates different output (arguably this is a bug in -E). + # Discard main info output, the user asked to run TeX, not makeinfo. + # Redirect output to /dev/null to throw away `Making info file...' msg. + $verbose "Macro-expanding $command_line_filename to $filename_tmp ..." + $makeinfo --footnote-style=end -E $filename_tmp -o /dev/null \ + $command_line_filename >/dev/null + + # But if there were no macros, or makeinfo failed for some reason, + # just use the original file. (It shouldn't make any difference, but + # let's be safe.) + if test $? -ne 0 || cmp -s $filename_tmp $command_line_filename; then + $verbose "Reverting to $command_line_filename ..." + cp -p $command_line_filename $filename_tmp + fi + filename_input=$filename_tmp + dirname_input=$tmp_dir + + # Used most commonly for @finalout, @smallbook, etc. + if test -n "$textra"; then + $verbose "Inserting extra commands: $textra." + sed '/^@setfilename/a\ +'"$textra" $filename_input >$filename_tmp2 + filename_input=$filename_tmp2 + dirname_input=$tmp_dir2 + fi + + # If clean mode was specified, then move to the temporary directory. + if test "$clean" = t; then + $verbose "cd $dirname_input" + cd $dirname_input || exit 1 + filename_input=`basename $filename_input` + fi + + while true; do # will break out of loop below + # "Unset" variables that might have values from previous iterations and + # which won't be completely reset later. + definite_index_files= + + # Find all files having root filename with a two-letter extension, + # determine whether they're really index files, and save them. Foo.aux + # is actually the cross-references file, but we need to keep track of + # that too. + possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" + for this_file in ${possible_index_files}; do # If file is empty, forget it. - if test ! -s "${this_file}" ; then - continue; - fi + test -s "${this_file}" || continue - # Examine first character of file. If it's not a backslash or - # single quote, then it's definitely not an index or xref file. + # Examine first character of file. If it's not suitable to be an + # index or xref file, don't process it. first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`" - if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then - definite_index_files="${definite_index_files} ${this_file}" + if test "x${first_character}" = "x\\" \ + || test "x${first_character}" = "x'"; then + definite_index_files="${definite_index_files} ${this_file}" fi - done - orig_index_files="${definite_index_files}" - orig_index_files_sans_aux="`echo ${definite_index_files} \ - | sed 's/'${filename_noext}'\.aux//; - s/^[ ]*//;s/[ ]*$//;'`" - - # Now save copies of original index files so we have some means of - # comparison later. - for index_file_to_save in ${orig_index_files} ; do - cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}" - done - - # Run texindex on current index files. If they already exist, and - # after running TeX a first time the index files don't change, then - # there's no reason to run TeX again. But we won't know that if the - # index files are out of date or nonexistent. - if test "${orig_index_files_sans_aux}" ; then + done + orig_index_files="${definite_index_files}" + orig_index_files_sans_aux="`echo ${definite_index_files} \ + | sed 's/'${filename_noext}'\.aux//; + s/^[ ]*//;s/[ ]*$//;'`" + + # Now save copies of original index files so we have some means of + # comparison later. + $verbose "Backing up current index files: $orig_index_files ..." + for index_file_to_save in ${orig_index_files}; do + cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}" + done + + # Run texindex on current index files. If they already exist, and + # after running TeX a first time the index files don't change, then + # there's no reason to run TeX again. But we won't know that if the + # index files are out of date or nonexistent. + if test -n "${orig_index_files_sans_aux}"; then + $verbose "Running $texindex $orig_index_files_sans_aux ..." ${texindex} ${orig_index_files_sans_aux} - fi - - if ${tex} ${command_line_filename} ; then # TeX run first time - definite_index_files="" - # Get list of new index files - possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" - for this_file in ${possible_index_files} ; do - # If file is empty, forget it. - if test ! -s ${this_file} ; then - continue; - fi - - # Examine first character of file. If it's not a backslash or - # single quote, then it's definitely not an index or xref file. - first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`" - if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then - definite_index_files="${definite_index_files} ${this_file}" - fi + fi + + # Finally, run TeX. + if test "$batch" = t; then + tex_mode='\nonstopmode' + else + tex_mode= + fi + $verbose "Running $tex $filename_input ..." + cmd="$tex $tex_mode \\input $filename_input" + $cmd + + # Check if index files changed. + # + definite_index_files= + # Get list of new index files. + possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" + for this_file in ${possible_index_files}; do + # If file is empty, forget it. + test -s "${this_file}" || continue + + # Examine first character of file. If it's not a backslash or + # single quote, then it's definitely not an index or xref file. + # (Will have to check for @ when we switch to Texinfo syntax in + # all these files...) + first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`" + if test "x${first_character}" = "x\\" \ + || test "x${first_character}" = "x'"; then + definite_index_files="${definite_index_files} ${this_file}" + fi + done + new_index_files="${definite_index_files}" + new_index_files_sans_aux="`echo ${definite_index_files} \ + | sed 's/'${filename_noext}'\.aux//; + s/^[ ]*//;s/[ ]*$//;'`" + + # If old and new list don't at least have the same file list, then one + # file or another has definitely changed. + $verbose "Original index files =$orig_index_files" + $verbose "New index files =$new_index_files" + if test "z${orig_index_files}" != "z${new_index_files}"; then + index_files_changed_p=t + else + # File list is the same. We must compare each file until we find a + # difference. + index_files_changed_p= + for this_file in ${new_index_files}; do + $verbose "Comparing index file $this_file ..." + # cmp -s will return nonzero exit status if files differ. + cmp -s "${this_file}" "${this_file}${backup_extension}" + if test $? -ne 0; then + # We only need to keep comparing until we find *one* that + # differs, because we'll have to run texindex & tex no + # matter what. + index_files_changed_p=t + $verbose "Index file $this_file differed:" + test $verbose = echo \ + && diff -c "${this_file}${backup_extension}" "${this_file}" + break + fi done - new_index_files="${definite_index_files}" - new_index_files_sans_aux="`echo ${definite_index_files} \ - | sed 's/'${filename_noext}'\.aux//; - s/^[ ]*//;s/[ ]*$//;'`" - - # If old and new list don't at least have the same file list, then one - # file or another has definitely changed. - if test "${orig_index_files}" != "${new_index_files}" ; then - index_files_changed_p=t - else - # File list is the same. We must compare each file until we find a - # difference. - index_files_changed_p="" - for this_file in ${new_index_files} ; do - # cmp -s will return nonzero exit status if files differ. - cmp -s "${this_file}" "${this_file}${backup_extension}" - if test $? -ne 0 ; then - # We only need to keep comparing until we find *one* that - # differs, because we'll have to run texindex & tex no - # matter what. - index_files_changed_p=t - break - fi - done - fi + fi - # If index files have changed since TeX has been run, or if the aux - # file wasn't present originally, run texindex and TeX again. - if test "${index_files_changed_p}" ; then - retval=0 - if test "${new_index_files_sans_aux}" ; then - ${texindex} ${new_index_files_sans_aux} - retval=$? - fi - if test ${retval} -eq 0 ; then - ${tex} "${command_line_filename}" - fi - fi - fi - - # Generate list of files to delete, then call rm once with the entire - # list. This is significantly faster than multiple executions of rm. - file_list="" - for file in ${orig_index_files} ; do - file_list="${file_list} ${file}${backup_extension}" - done - if test "${file_list}" ; then - rm -f ${file_list} - fi + # If index files have changed since TeX has been run, or if the aux + # file wasn't present originally, run texindex and TeX again. + if test "${index_files_changed_p}"; then :; else + # Nothing changed. We're done with TeX. + break + fi + done + + # If we were in clean mode, compilation was in a tmp directory. + # Copy the DVI file into the directory where the compilation + # has been done. (The temp dir is about to get removed anyway.) + # We also return to the original directory so that + # - the next file is processed in correct conditions + # - the temporary file can be removed + if test -n "$clean"; then + $verbose "Copying DVI file from `pwd` to $orig_pwd" + cp -p $filename_noext.dvi $orig_pwd + cd $orig_pwd || exit 1 + fi + + # Generate list of files to delete, then call rm once with the entire + # list. This is significantly faster than multiple executions of rm. + file_list= + for file in ${orig_index_files}; do + file_list="${file_list} ${file}${backup_extension}" + done + if test -n "${file_list}"; then + $verbose "Removing $file_list $tmp_dir $tmp_dir2 ..." + rm -f ${file_list} + rm -rf $tmp_dir $tmp_dir2 + fi done -# texi2dvi ends here +$verbose "$0 done." +true # exit successfully. diff --git a/readline/doc/texi2html b/readline/doc/texi2html index cc75178..4beec01 100755 --- a/readline/doc/texi2html +++ b/readline/doc/texi2html @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/local/bin/perl 'di '; 'ig 00 '; #+############################################################################## @@ -9,7 +9,7 @@ # # #-############################################################################## -# @(#)texi2html 1.51 09/10/96 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch +# @(#)texi2html 1.52 01/05/98 Written (mainly) by Lionel Cons, Lionel.Cons@cern.ch # The man page for this program is included at the end of this file and can be # viewed using the command 'nroff -man texi2html'. @@ -29,7 +29,7 @@ $DEBUG_DEF = 16; $DEBUG_HTML = 32; $DEBUG_USER = 64; -$BIBRE = '\[[\w\/]+\]'; # RE for a bibliography reference +$BIBRE = '\[[\w\/-]+\]'; # RE for a bibliography reference $FILERE = '[\/\w.+-]+'; # RE for a file name $VARRE = '[^\s\{\}]+'; # RE for a variable name $NODERE = '[^@{}:\'`",]+'; # RE for a node name @@ -37,8 +37,8 @@ $NODESRE = '[^@{}:\'`"]+'; # RE for a list of node names $XREFRE = '[^@{}]+'; # RE for a xref (should use NODERE) $ERROR = "***"; # prefix for errors and warnings -$THISPROG = "texi2html 1.51"; # program name and version -$HOMEPAGE = "http://wwwcn.cern.ch/dci/texi2html/"; # program home page +$THISPROG = "texi2html 1.52"; # program name and version +$HOMEPAGE = "http://wwwinfo.cern.ch/dis/texi2html/"; # program home page $TODAY = &pretty_date; # like "20 September 1993" $SPLITTAG = "<!-- SPLIT HERE -->\n"; # tag to know where to split $PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections @@ -129,6 +129,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E "!", "!", "?", "?", ".", ".", + "-", "", ); # @@ -159,19 +160,23 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E 'cite', 'CITE', 'code', 'CODE', 'ctrl', '&do_ctrl', # special case - 'dfn', 'STRONG', # DFN tag is illegal in the standard + 'dfn', 'EM', # DFN tag is illegal in the standard 'dmn', '', # useless + 'email', '&do_email', # insert a clickable email address 'emph', 'EM', 'file', '"TT', # will put quotes, cf. &apply_style 'i', 'I', 'kbd', 'KBD', 'key', 'KBD', + 'math', 'EM', 'r', '', # unsupported 'samp', '"SAMP', # will put quotes, cf. &apply_style 'sc', '&do_sc', # special case 'strong', 'STRONG', 't', 'TT', 'titlefont', '', # useless + 'uref', '&do_uref', # insert a clickable URL + 'url', '&do_url', # insert a clickable URL 'var', 'VAR', 'w', '', # unsupported ); @@ -270,6 +275,7 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E 'smallbook', 1, 'vskip', 1, 'filbreak', 1, + 'paragraphindent', 1, # unsupported formats 'cartouche', 1, 'end cartouche', 1, @@ -283,6 +289,8 @@ $html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//E # # #---############################################################################ +%value = (); # hold texinfo variables, see also -D + $use_bibliography = 1; $use_acc = 0; $debug = 0; @@ -306,6 +314,7 @@ To convert a Texinfo file to HMTL: $0 [options] file -expandinfo : use \@ifinfo sections, not \@iftex -glossary : handle a glossary -invisible name: use 'name' as an invisible anchor + -Dname : define name like with \@set -I dir : search also for files in 'dir' -menu : handle menus -monolithic : output only one file including ToC @@ -317,7 +326,7 @@ To convert a Texinfo file to HMTL: $0 [options] file To check converted files: $0 -check [-verbose] files EOT -while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) { +while (@ARGV && $ARGV[0] =~ /^-/) { $_ = shift(@ARGV); if (/^-acc$/) { $use_acc = 1; next; } if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; } @@ -327,6 +336,7 @@ while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) { if (/^-g(lossary)?$/) { $use_glossary = 1; next; } if (/^-i(nvisible)?$/) { $invisible_mark = shift(@ARGV); next; } if (/^-iso$/) { $use_iso = 1; next; } + if (/^-D(.+)?$/) { $value{$1 || shift(@ARGV)} = 1; next; } if (/^-I(.+)?$/) { push(@include_dirs, $1 || shift(@ARGV)); next; } if (/^-m(enu)?$/) { $show_menu = 1; next; } if (/^-mono(lithic)?$/) { $monolithic = 1; next; } @@ -383,9 +393,8 @@ if ($monolithic) { # # variables # -%value = (); # hold texinfo variables $value{'html'} = 1; # predefine html (the output format) -$value{'texi2html'} = '1.51'; # predefine texi2html (the translator) +$value{'texi2html'} = '1.52'; # predefine texi2html (the translator) # _foo: internal to track @foo foreach ('_author', '_title', '_subtitle', '_settitle', '_setfilename') { @@ -453,7 +462,7 @@ $toplevel = 0; # top level seen in hierarchy $curlevel = 0; # current level in TOC $node = ''; # current node name $in_table = 0; # am I inside a table -$table_type = ''; # type of table ('', 'f', 'v') +$table_type = ''; # type of table ('', 'f', 'v', 'multi') @tables = (); # nested table support $in_bibliography = 0; # am I inside a bibliography $in_glossary = 0; # am I inside a glossary @@ -554,9 +563,11 @@ while ($_ = &next_line) { # s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/; # non-@ substitutions cf. texinfmt.el - s/``/\"/g; - s/''/\"/g; - s/([\w ])---([\w ])/$1--$2/g; + unless ($in_pre) { + s/``/\"/g; + s/''/\"/g; + s/([\w ])---([\w ])/$1--$2/g; + } # # analyze the tag # @@ -570,14 +581,9 @@ while ($_ = &next_line) { } &skip_until($tag), next if $tag eq 'tex'; # handle special tables - if ($tag eq 'table') { - $table_type = ''; - } elsif ($tag eq 'ftable') { + if ($tag =~ /^(|f|v|multi)table$/) { + $table_type = $1; $tag = 'table'; - $table_type = 'f'; - } elsif ($tag eq 'vtable') { - $tag = 'table'; - $table_type = 'v'; } # special cases if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) { @@ -647,11 +653,16 @@ while ($_ = &next_line) { push(@lines, &debug("<$format_map{$tag}>\n", __LINE__)); next; } elsif ($tag eq 'table') { - if (/^\@[fv]?table\s+\@(\w+)\s*$/) { - $in_table = $1; + if (/^\@(|f|v|multi)table\s+\@(\w+)/) { + $in_table = $2; unshift(@tables, join($;, $table_type, $in_table)); - push(@lines, &debug("<DL COMPACT>\n", __LINE__)); - &html_push_if('DL'); + if ($table_type eq "multi") { + push(@lines, &debug("<TABLE BORDER>\n", __LINE__)); + &html_push_if('TABLE'); + } else { + push(@lines, &debug("<DL COMPACT>\n", __LINE__)); + &html_push_if('DL'); + } push(@lines, &html_debug("\n", __LINE__)); } else { warn "$ERROR Bad table line: $_"; @@ -776,18 +787,29 @@ while ($_ = &next_line) { &html_pop_if(); push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__)); push(@lines, &html_debug("\n", __LINE__)); - } elsif ($end_tag eq 'table' || - $end_tag eq 'ftable' || - $end_tag eq 'vtable') { - shift(@tables); + } elsif ($end_tag =~ /^(|f|v|multi)table$/) { + unless (@tables) { + warn "$ERROR \@end $end_tag without \@*table\n"; + next; + } + ($table_type, $in_table) = split($;, shift(@tables)); + unless ($1 eq $table_type) { + warn "$ERROR \@end $end_tag without matching \@$end_tag\n"; + next; + } + if ($table_type eq "multi") { + push(@lines, "</TR></TABLE>\n"); + &html_pop_if('TR'); + } else { + push(@lines, "</DL>\n"); + &html_pop_if('DD'); + } + &html_pop_if(); if (@tables) { ($table_type, $in_table) = split($;, $tables[0]); } else { $in_table = 0; } - push(@lines, "</DL>\n"); - &html_pop_if('DD'); - &html_pop_if(); } elsif (defined($def_map{$end_tag})) { push(@lines, &debug("</DL>\n", __LINE__)); } elsif ($end_tag eq 'menu') { @@ -986,6 +1008,12 @@ EOC if ($table_type) { # add also an index unshift(@input_spool, "\@${table_type}index $what\n"); } + } elsif ($html_element eq 'TABLE') { + push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__)); + &html_push('TR'); + } elsif ($html_element eq 'TR') { + push(@lines, &debug("</TR>\n", __LINE__)); + push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__)); } else { push(@lines, &debug("<LI>$what\n", __LINE__)); &html_push('LI') unless $html_element eq 'LI'; @@ -996,6 +1024,9 @@ EOC $deferred_ref = ''; } next; + } elsif (/^\@tab\s+(.*)$/) { + push(@lines, "<TD>$1</TD>\n"); + next; } } } @@ -1088,13 +1119,25 @@ while (@lines) { print "# index $key sorted as $_\n" if $key ne $_ && $debug & $DEBUG_INDEX; } + push(@lines2, "Jump to:\n"); + $last_letter = undef; + foreach $key (sort byalpha @keys) { + $letter = substr($key2alpha{$key}, 0, 1); + $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;; + if (!defined($last_letter) || $letter ne $last_letter) { + push(@lines2, "-\n") if defined($last_letter); + push(@lines2, "<A HREF=\"#$index\_$letter\">" . &protect_html($letter) . "</A>\n"); + $last_letter = $letter; + } + } + push(@lines2, "<P>\n"); $last_letter = undef; foreach $key (sort byalpha @keys) { $letter = substr($key2alpha{$key}, 0, 1); $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;; if (!defined($last_letter) || $letter ne $last_letter) { push(@lines2, "</DIR>\n") if defined($last_letter); - push(@lines2, "<H2>" . &protect_html($letter) . "</H2>\n"); + push(@lines2, "<H2><A NAME=\"$index\_$letter\">" . &protect_html($letter) . "</A></H2>\n"); push(@lines2, "<DIR>\n"); $last_letter = $letter; } @@ -1657,8 +1700,24 @@ sub menu_entry { sub do_ctrl { "^$_[0]" } +sub do_email { + local($addr, $text) = split(/,\s*/, $_[0]); + + $text = $addr unless $text; + &anchor('', "mailto:$addr", $text); +} + sub do_sc { "\U$_[0]\E" } +sub do_uref { + local($url, $text) = split(/,\s*/, $_[0]); + + $text = $url unless $text; + &anchor('', $url, $text); +} + +sub do_url { &anchor('', $_[0], $_[0]) } + sub apply_style { local($texi_style, $text) = @_; local($style); @@ -1822,7 +1881,7 @@ sub print_toplevel_footer { print FILE <<EOT; This document was generated on $TODAY using the <A HREF=\"$HOMEPAGE\">texi2html</A> -translator version 1.51.</P> +translator version 1.52.</P> EOT &print_footer; } @@ -1879,7 +1938,7 @@ sub byalpha { .nr nl 0-1 \" fake up transition to first page again .nr % 0 \" start at page 1 '; __END__ ############# From here on it's a standard manual page ############ -.TH TEXI2HTML 1 "09/10/96" +.TH TEXI2HTML 1 "01/05/98" .AT 3 .SH NAME texi2html \- a Texinfo to HTML converter @@ -1924,8 +1983,9 @@ Use the section named 'Glossary' to build a list of terms and put links in the H document from each term toward its definition. .TP .B \-invisible \fIname\fP -Use \fIname\fP to create invisible destination anchors for index links. This is a workaround -for a known bug of many WWW browsers, including xmosaic. +Use \fIname\fP to create invisible destination anchors for index links +(you can for instance use the invisible.xbm file shipped with this program). +This is a workaround for a known bug of many WWW browsers, including netscape. .TP .B \-I \fIdir\fP Look also in \fIdir\fP to find included files. @@ -1985,21 +2045,21 @@ option, it creates only one file: predefines the following variables: \fBhtml\fP, \fBtexi2html\fP. .SH ADDITIONAL COMMANDS .I texi2html -implements the following non-Texinfo commands: +implements the following non-Texinfo commands (maybe they are in Texinfo now...): .TP 16 .B @ifhtml This indicates the start of an HTML section, this section will passed through -without any modofication. +without any modification. .TP .B @end ifhtml -This indcates the end of an HTML section. +This indicates the end of an HTML section. .SH VERSION -This is \fItexi2html\fP version 1.51, 09/10/96. +This is \fItexi2html\fP version 1.52, 01/05/98. .PP The latest version of \fItexi2html\fP can be found in WWW, cf. URL -http://wwwcn.cern.ch/dci/texi2html/ +http://wwwinfo.cern.ch/dis/texi2html/ .SH AUTHOR -The main author is Lionel Cons, CERN CN/DCI/UWS, Lionel.Cons@cern.ch. +The main author is Lionel Cons, CERN IT/DIS/OSE, Lionel.Cons@cern.ch. Many other people around the net contributed to this program. .SH COPYRIGHT This program is the intellectual property of the European diff --git a/readline/examples/Makefile.in b/readline/examples/Makefile.in index 1848673..879aa49 100644 --- a/readline/examples/Makefile.in +++ b/readline/examples/Makefile.in @@ -1,6 +1,6 @@ # This is the Makefile for the examples subdirectory of readline. -*- text -*- # -SHELL = /bin/sh +SHELL = @MAKE_SHELL@ RM = rm -f srcdir = @srcdir@ @@ -14,7 +14,7 @@ CFLAGS = @CFLAGS@ LOCAL_CFLAGS = @LOCAL_CFLAGS@ CPPFLAGS = @CPPFLAGS@ -INCLUDES = -I $(srcdir) -I $(top_srcdir) -I.. +INCLUDES = -I$(srcdir) -I$(top_srcdir) -I.. CCFLAGS = $(DEFS) $(LOCAL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(CFLAGS) LDFLAGS = -g -L.. @@ -22,10 +22,11 @@ LDFLAGS = -g -L.. TERMCAP_LIB = @TERMCAP_LIB@ .c.o: + ${RM} $@ $(CC) $(CCFLAGS) -c $< -EXECUTABLES = fileman rltest rl -OBJECTS = fileman.o rltest.o rl.o +EXECUTABLES = fileman rltest rl rlversion +OBJECTS = fileman.o rltest.o rl.o rlversion.o all: $(EXECUTABLES) @@ -38,6 +39,9 @@ fileman: fileman.o rltest: rltest.o $(CC) $(LDFLAGS) -o $@ rltest.o -lreadline $(TERMCAP_LIB) +rlversion: rlversion.o + $(CC) $(LDFLAGS) -o $@ rlversion.o -lreadline $(TERMCAP_LIB) + clean mostlyclean: $(RM) $(OBJECTS) $(RM) $(EXECUTABLES) @@ -48,3 +52,4 @@ distclean maintainer-clean: clean fileman.o: fileman.c rltest.o: rltest.c rl.o: rl.c +rlversion.o: rlversion.c diff --git a/readline/examples/rl.c b/readline/examples/rl.c index ccddd0f..17a6343 100644 --- a/readline/examples/rl.c +++ b/readline/examples/rl.c @@ -42,6 +42,7 @@ set_deftext () } } +static void usage() { fprintf (stderr, "%s: usage: %s [-p prompt] [-u unit] [-d default]\n", @@ -54,7 +55,7 @@ main (argc, argv) { char *temp, *prompt; struct stat sb; - int done, opt, fd; + int opt, fd; FILE *ifp; progname = strrchr(argv[0], '/'); diff --git a/readline/examples/rlversion.c b/readline/examples/rlversion.c new file mode 100644 index 0000000..2d73a96 --- /dev/null +++ b/readline/examples/rlversion.c @@ -0,0 +1,21 @@ +/* + * rlversion -- print out readline's version number + */ + +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include <config.h> +#endif + +#include <stdio.h> +#include <sys/types.h> +#include "posixstat.h" + +#include "readline.h" + +main() +{ + printf ("%s\n", rl_library_version ? rl_library_version : "unknown"); + exit (0); +} diff --git a/readline/funmap.c b/readline/funmap.c index 3946e0f..f6b8628 100644 --- a/readline/funmap.c +++ b/readline/funmap.c @@ -71,6 +71,7 @@ static FUNMAP default_funmap[] = { { "copy-forward-word", rl_copy_forward_word }, { "copy-region-as-kill", rl_copy_region_to_kill }, { "delete-char", rl_delete }, + { "delete-char-or-list", rl_delete_or_show_completions }, { "delete-horizontal-space", rl_delete_horizontal_space }, { "digit-argument", rl_digit_argument }, { "do-lowercase-version", rl_do_lowercase_version }, @@ -83,6 +84,7 @@ static FUNMAP default_funmap[] = { { "end-of-history", rl_end_of_history }, { "end-of-line", rl_end_of_line }, { "exchange-point-and-mark", rl_exchange_point_and_mark }, + { "forward-backward-delete-char", rl_rubout_or_delete }, { "forward-char", rl_forward }, { "forward-search-history", rl_forward_search_history }, { "forward-word", rl_forward_word }, diff --git a/readline/histexpand.c b/readline/histexpand.c index 0dc179a..392e6d3 100644 --- a/readline/histexpand.c +++ b/readline/histexpand.c @@ -365,6 +365,10 @@ hist_error(s, start, current, errtype) emsg = "unrecognized history modifier"; elen = 29; break; + case NO_PREV_SUBST: + emsg = "no previous substitution"; + elen = 24; + break; default: emsg = "unknown expansion error"; elen = 23; @@ -654,15 +658,6 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) } } - /* If there is no lhs, the substitution can't succeed. */ - if (subst_lhs_len == 0) - { - *ret_string = hist_error (string, starting_index, i, SUBST_FAILED); - free (result); - free (temp); - return -1; - } - FREE (subst_rhs); subst_rhs = get_subst_pattern (string, &i, delimiter, 1, &subst_rhs_len); @@ -674,6 +669,15 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) else i += 2; + /* If there is no lhs, the substitution can't succeed. */ + if (subst_lhs_len == 0) + { + *ret_string = hist_error (string, starting_index, i, NO_PREV_SUBST); + free (result); + free (temp); + return -1; + } + l_temp = strlen (temp); /* Ignore impossible cases. */ if (subst_lhs_len > l_temp) diff --git a/readline/histfile.c b/readline/histfile.c index 81dda57..3325b7f 100644 --- a/readline/histfile.c +++ b/readline/histfile.c @@ -155,7 +155,11 @@ 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 { error_and_exit: if (file >= 0) @@ -217,7 +221,7 @@ read_history_range (filename, from, to) int history_truncate_file (fname, lines) char *fname; - register int lines; + int lines; { register int i; int file, chars_read; @@ -276,6 +280,12 @@ history_truncate_file (fname, lines) if (i && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { write (file, buffer + i, file_size - i); + +#if defined (__BEOS__) + /* BeOS ignores O_TRUNC. */ + ftruncate (file, file_size - i); +#endif + close (file); } diff --git a/readline/histlib.h b/readline/histlib.h index 10a40d7..422cf59 100644 --- a/readline/histlib.h +++ b/readline/histlib.h @@ -69,6 +69,7 @@ extern char *strchr (); #define BAD_WORD_SPEC 1 #define SUBST_FAILED 2 #define BAD_MODIFIER 3 +#define NO_PREV_SUBST 4 /* Possible definitions for history starting point specification. */ #define ANCHORED_SEARCH 1 diff --git a/readline/history.c b/readline/history.c index 24c5a49..d56ffac 100644 --- a/readline/history.c +++ b/readline/history.c @@ -278,7 +278,7 @@ HIST_ENTRY * replace_history_entry (which, line, data) int which; char *line; - char *data; + histdata_t data; { HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY)); HIST_ENTRY *old_value; diff --git a/readline/history.h b/readline/history.h index e49a341..8ecce72 100644 --- a/readline/history.h +++ b/readline/history.h @@ -22,6 +22,16 @@ #ifndef _HISTORY_H_ #define _HISTORY_H_ +#ifdef __cplusplus +extern "C" { +#endif + +#if defined READLINE_LIBRARY +# include "rlstdc.h" +#else +# include <readline/rlstdc.h> +#endif + #if !defined (_FUNCTION_DEF) # define _FUNCTION_DEF typedef int Function (); @@ -30,10 +40,16 @@ typedef char *CPFunction (); typedef char **CPPFunction (); #endif +#ifdef __STDC__ +typedef void *histdata_t; +#else +typedef char *histdata_t; +#endif + /* The structure used to store a history entry. */ typedef struct _hist_entry { char *line; - char *data; + histdata_t data; } HIST_ENTRY; /* A structure used to pass the current state of the history stuff around. */ @@ -52,81 +68,81 @@ typedef struct _hist_state { /* Begin a session in which the history functions might be used. This just initializes the interactive variables. */ -extern void using_history (); +extern void using_history __P((void)); /* Return the current HISTORY_STATE of the history. */ -extern HISTORY_STATE *history_get_history_state (); +extern HISTORY_STATE *history_get_history_state __P((void)); /* Set the state of the current history array to STATE. */ -extern void history_set_history_state (); +extern void history_set_history_state __P((HISTORY_STATE *)); /* Manage the history list. */ /* Place STRING at the end of the history list. The associated data field (if any) is set to NULL. */ -extern void add_history (); +extern void add_history __P((char *)); /* A reasonably useless function, only here for completeness. WHICH is the magic number that tells us which element to delete. The elements are numbered from 0. */ -extern HIST_ENTRY *remove_history (); +extern HIST_ENTRY *remove_history __P((int)); /* Make the history entry at WHICH have LINE and DATA. This returns the old entry so you can dispose of the data. In the case of an invalid WHICH, a NULL pointer is returned. */ -extern HIST_ENTRY *replace_history_entry (); +extern HIST_ENTRY *replace_history_entry __P((int, char *, histdata_t)); /* Clear the history list and start over. */ -extern void clear_history (); +extern void clear_history __P((void)); /* Stifle the history list, remembering only MAX number of entries. */ -extern void stifle_history (); +extern void stifle_history __P((int)); /* Stop stifling the history. This returns the previous amount the history was stifled by. The value is positive if the history was stifled, negative if it wasn't. */ -extern int unstifle_history (); +extern int unstifle_history __P((void)); /* Return 1 if the history is stifled, 0 if it is not. */ -extern int history_is_stifled (); +extern int history_is_stifled __P((void)); /* Information about the history list. */ /* Return a NULL terminated array of HIST_ENTRY which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return NULL. */ -extern HIST_ENTRY **history_list (); +extern HIST_ENTRY **history_list __P((void)); /* Returns the number which says what history element we are now looking at. */ -extern int where_history (); +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 (); +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. */ -extern HIST_ENTRY *history_get (); +extern HIST_ENTRY *history_get __P((int)); /* Return the number of bytes that the primary history entries are using. This just adds up the lengths of the_history->lines. */ -extern int history_total_bytes (); +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 (); +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 a NULL pointer. */ -extern HIST_ENTRY *previous_history (); +extern HIST_ENTRY *previous_history __P((void)); /* Move history_offset forward to the next item in the input_history, and return the a pointer to that entry. If there is no next entry, return a NULL pointer. */ -extern HIST_ENTRY *next_history (); +extern HIST_ENTRY *next_history __P((void)); /* Searching the history list. */ @@ -136,44 +152,45 @@ extern HIST_ENTRY *next_history (); current_history () is the history entry, and the value of this function is the offset in the line of that history entry that the string was found in. Otherwise, nothing is changed, and a -1 is returned. */ -extern int history_search (); +extern int history_search __P((char *, int)); /* Search the history for STRING, starting at history_offset. - The search is anchored: matching lines must begin with string. */ -extern int history_search_prefix (); + The search is anchored: matching lines must begin with string. + DIRECTION is as in history_search(). */ +extern int history_search_prefix __P((char *, int)); /* Search for STRING in the history list, starting at POS, an absolute index into the list. DIR, if negative, says to search backwards from POS, else forwards. Returns the absolute index of the history element where STRING was found, or -1 otherwise. */ -extern int history_search_pos (); +extern int history_search_pos __P((char *, int, int)); /* Managing the history file. */ /* Add the contents of FILENAME to the history list, a line at a time. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ -extern int read_history (); +extern int read_history __P((char *)); /* Read a range of lines from FILENAME, adding them to the history list. Start reading at the FROM'th line and end at the TO'th. If FROM is zero, start at the beginning. If TO is less than FROM, read until the end of the file. If FILENAME is NULL, then read from ~/.history. Returns 0 if successful, or errno if not. */ -extern int read_history_range (); +extern int read_history_range __P((char *, int, int)); /* Write the current history to FILENAME. If FILENAME is NULL, then write the history list to ~/.history. Values returned are as in read_history (). */ -extern int write_history (); +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 (); +int append_history __P((int, char *)); /* Truncate the history file, leaving only the last NLINES lines. */ -extern int history_truncate_file (); +extern int history_truncate_file __P((char *, int)); /* History expansion. */ @@ -189,20 +206,24 @@ extern int history_truncate_file (); If an error ocurred in expansion, then OUTPUT contains a descriptive error message. */ -extern int history_expand (); +extern int history_expand __P((char *, char **)); /* Extract a string segment consisting of the FIRST through LAST arguments present in STRING. Arguments are broken up as in the shell. */ -extern char *history_arg_extract (); +extern char *history_arg_extract __P((int, int, char *)); /* Return the text of the history event beginning at the current - offset into STRING. */ -extern char *get_history_event (); + offset into STRING. Pass STRING with *INDEX equal to the + history_expansion_char that begins this specification. + DELIMITING_QUOTE is a character that is allowed to end the string + specification for what to search for in addition to the normal + characters `:', ` ', `\t', `\n', and sometimes `?'. */ +extern char *get_history_event __P((char *, int *, int)); /* Return an array of tokens, much as the shell might. The tokens are parsed out of STRING. */ -extern char **history_tokenize (); +extern char **history_tokenize __P((char *)); /* Exported history variables. */ extern int history_base; @@ -220,4 +241,8 @@ extern int history_quotes_inhibit_expansion; application and not expanded. */ extern Function *history_inhibit_expansion_function; +#ifdef __cplusplus +} +#endif + #endif /* !_HISTORY_H_ */ diff --git a/readline/input.c b/readline/input.c index 7e3c0fe..3b48483 100644 --- a/readline/input.c +++ b/readline/input.c @@ -124,38 +124,13 @@ _rl_any_typein () return any_typein; } -/* Add KEY to the buffer of characters to be read. */ -int -rl_stuff_char (key) - int key; -{ - if (key == EOF) - { - key = NEWLINE; - rl_pending_input = EOF; - } - ibuffer[push_index++] = key; - if (push_index >= ibuffer_len) - push_index = 0; - return push_index; -} - -/* Make C be the next command to be executed. */ -int -rl_execute_next (c) - int c; -{ - rl_pending_input = c; - return 0; -} - -/* Return the amount of space available in the - buffer for stuffing characters. */ +/* Return the amount of space available in the buffer for stuffing + characters. */ static int ibuffer_space () { if (pop_index > push_index) - return (pop_index - push_index); + return (pop_index - push_index - 1); else return (ibuffer_len - (push_index - pop_index)); } @@ -341,6 +316,36 @@ _rl_insert_typein (c) free (string); } +/* Add KEY to the buffer of characters to be read. Returns 1 if the + character was stuffed correctly; 0 otherwise. */ +int +rl_stuff_char (key) + int key; +{ + if (ibuffer_space () == 0) + return 0; + + if (key == EOF) + { + key = NEWLINE; + rl_pending_input = EOF; + } + ibuffer[push_index++] = key; + if (push_index >= ibuffer_len) + push_index = 0; + + return 1; +} + +/* Make C be the next command to be executed. */ +int +rl_execute_next (c) + int c; +{ + rl_pending_input = c; + return 0; +} + /* **************************************************************** */ /* */ /* Character Input */ @@ -409,6 +414,11 @@ rl_getc (stream) if (result == 0) return (EOF); +#if defined (__BEOS__) + if (errno == EINTR) + continue; +#endif + #if defined (EWOULDBLOCK) if (errno == EWOULDBLOCK) { diff --git a/readline/isearch.c b/readline/isearch.c index 7decf95..67279e1 100644 --- a/readline/isearch.c +++ b/readline/isearch.c @@ -48,6 +48,9 @@ #include "readline.h" #include "history.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; @@ -55,9 +58,6 @@ extern int rl_line_buffer_len; extern int rl_point, rl_end; extern char *rl_line_buffer; -extern void _rl_save_prompt (); -extern void _rl_restore_prompt (); - extern int rl_execute_next (); extern void rl_extend_line_buffer (); @@ -178,12 +178,20 @@ rl_search_history (direction, invoking_key) /* Non-zero if we are doing a reverse search. */ int reverse; + /* The list of characters which terminate the search, but are not + subsequently executed. If the variable isearch-terminators has + been set, we use that value, otherwise we use ESC and C-J. */ + unsigned char *isearch_terminators; + orig_point = rl_point; last_found_line = orig_line = where_history (); reverse = direction < 0; hlist = history_list (); allocated_line = (char *)NULL; + isearch_terminators = _rl_isearch_terminators ? _rl_isearch_terminators + : (unsigned char *)"\033\012"; + /* Create an arrary of pointers to the lines that we want to search. */ maybe_replace_line (); i = 0; @@ -211,7 +219,7 @@ rl_search_history (direction, invoking_key) /* The line where we start the search. */ i = orig_line; - _rl_save_prompt (); + rl_save_prompt (); /* Initialize search parameters. */ search_string = xmalloc (search_string_size = 128); @@ -246,10 +254,18 @@ rl_search_history (direction, invoking_key) c = !reverse ? -1 : -2; } +#if 0 /* Let NEWLINE (^J) terminate the search for people who don't like using ESC. ^M can still be used to terminate the search and immediately execute the command. */ if (c == ESC || c == NEWLINE) +#else + /* The characters in isearch_terminators (set from the user-settable + variable isearch-terminators) are used to terminate the search but + not subsequently execute the character as a command. The default + value is "\033\012" (ESC and C-J). */ + if (strchr (isearch_terminators, c)) +#endif { /* ESC still terminates the search, but if there is pending input or if input arrives within 0.1 seconds (on systems @@ -291,7 +307,7 @@ rl_search_history (direction, invoking_key) strcpy (rl_line_buffer, lines[orig_line]); rl_point = orig_point; rl_end = strlen (rl_line_buffer); - _rl_restore_prompt(); + rl_restore_prompt(); rl_clear_message (); if (allocated_line) free (allocated_line); @@ -409,15 +425,15 @@ rl_search_history (direction, invoking_key) /* First put back the original state. */ strcpy (rl_line_buffer, lines[orig_line]); - _rl_restore_prompt (); + rl_restore_prompt (); /* Free the search string. */ free (search_string); if (last_found_line < orig_line) - rl_get_previous_history (orig_line - last_found_line); + rl_get_previous_history (orig_line - last_found_line, 0); else - rl_get_next_history (last_found_line - orig_line); + rl_get_next_history (last_found_line - orig_line, 0); /* If the string was not found, put point at the end of the line. */ if (line_index < 0) diff --git a/readline/keymaps.c b/readline/keymaps.c index 9359749..c73666b 100644 --- a/readline/keymaps.c +++ b/readline/keymaps.c @@ -124,7 +124,7 @@ rl_make_keymap () /* Free the storage associated with MAP. */ void rl_discard_keymap (map) - Keymap (map); + Keymap map; { int i; diff --git a/readline/keymaps.h b/readline/keymaps.h index f6143f8..5dff46f 100644 --- a/readline/keymaps.h +++ b/readline/keymaps.h @@ -24,8 +24,10 @@ #define _KEYMAPS_H_ #if defined (READLINE_LIBRARY) +# include "rlstdc.h" # include "chardefs.h" #else +# include <readline/rlstdc.h> # include <readline/chardefs.h> #endif @@ -70,26 +72,29 @@ extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap; /* Return a new, empty keymap. Free it with free() when you are done. */ -extern Keymap rl_make_bare_keymap (); +extern Keymap rl_make_bare_keymap __P((void)); /* Return a new keymap which is a copy of MAP. */ -extern Keymap rl_copy_keymap (); +extern Keymap rl_copy_keymap __P((Keymap)); /* Return a new keymap with the printing characters bound to rl_insert, the lowercase Meta characters bound to run their equivalents, and the Meta digits bound to produce numeric arguments. */ -extern Keymap rl_make_keymap (); +extern Keymap rl_make_keymap __P((void)); -extern void rl_discard_keymap (); +/* Free the storage associated with a keymap. */ +extern void rl_discard_keymap __P((Keymap)); + +/* These functions actually appear in bind.c */ /* Return the keymap corresponding to a given name. Names look like - `emacs' or `emacs-meta' or `vi-insert'. */ -extern Keymap rl_get_keymap_by_name (); + `emacs' or `emacs-meta' or `vi-insert'. */ +extern Keymap rl_get_keymap_by_name __P((char *)); /* Return the current keymap. */ -extern Keymap rl_get_keymap (); +extern Keymap rl_get_keymap __P((void)); /* Set the current keymap to MAP. */ -extern void rl_set_keymap (); +extern void rl_set_keymap __P((Keymap)); #endif /* _KEYMAPS_H_ */ diff --git a/readline/kill.c b/readline/kill.c index a150e3c..0b4714f 100644 --- a/readline/kill.c +++ b/readline/kill.c @@ -572,6 +572,8 @@ rl_yank_last_arg (count, key) static int explicit_arg_p = 0; static int count_passed = 1; static int direction = 1; + static int undo_needed = 0; + int retval; if (rl_last_func != rl_yank_last_arg) { @@ -582,19 +584,22 @@ rl_yank_last_arg (count, key) } else { - rl_do_undo (); + if (undo_needed) + rl_do_undo (); if (count < 1) direction = -direction; history_skip += direction; if (history_skip < 0) history_skip = 0; - count_passed = count; } if (explicit_arg_p) - return (rl_yank_nth_arg_internal (count, key, history_skip)); + retval = rl_yank_nth_arg_internal (count_passed, key, history_skip); else - return (rl_yank_nth_arg_internal ('$', key, history_skip)); + retval = rl_yank_nth_arg_internal ('$', key, history_skip); + + undo_needed = retval == 0; + return retval; } /* A special paste command for users of Cygnus's cygwin32. */ diff --git a/readline/posixjmp.h b/readline/posixjmp.h index 8703d17..1347cc0 100644 --- a/readline/posixjmp.h +++ b/readline/posixjmp.h @@ -9,10 +9,12 @@ #if defined (HAVE_POSIX_SIGSETJMP) # define procenv_t sigjmp_buf -# undef setjmp -# define setjmp(x) sigsetjmp((x), 1) -# undef longjmp -# define longjmp(x, n) siglongjmp((x), (n)) +# if !defined (__OPENNT) +# undef setjmp +# define setjmp(x) sigsetjmp((x), 1) +# undef longjmp +# define longjmp(x, n) siglongjmp((x), (n)) +# endif /* !__OPENNT */ #else # define procenv_t jmp_buf #endif diff --git a/readline/readline.c b/readline/readline.c index 8ff6e98..622811f 100644 --- a/readline/readline.c +++ b/readline/readline.c @@ -64,7 +64,7 @@ #include "history.h" #ifndef RL_LIBRARY_VERSION -# define RL_LIBRARY_VERSION "2.2-bash" +# define RL_LIBRARY_VERSION "4.0" #endif /* Evaluates its arguments multiple times. */ @@ -83,7 +83,6 @@ extern void _rl_output_character_function (); #else extern int _rl_output_character_function (); #endif -extern void _rl_get_screen_size (); extern int _rl_enable_meta; extern int _rl_term_autowrap; @@ -100,7 +99,6 @@ extern int alphabetic (); /* Functions imported from bind.c. */ extern void _rl_bind_if_unbound (); -extern int rl_set_keymap_from_edit_mode (); /* Functions imported from input.c. */ extern int _rl_any_typein (); @@ -118,9 +116,7 @@ extern void _rl_move_vert (); extern void _rl_update_final (); extern void _rl_clear_to_eol (); extern void _rl_clear_screen (); - -extern void _rl_save_prompt (); -extern void _rl_restore_prompt (); +extern void _rl_erase_entire_line (); extern void _rl_erase_at_end_of_line (); extern void _rl_move_cursor_relative (); @@ -253,9 +249,14 @@ int rl_visible_prompt_length = 0; int rl_key_sequence_length = 0; /* If non-zero, then this is the address of a function to call just - before readline_internal () prints the first prompt. */ + before readline_internal_setup () prints the first prompt. */ Function *rl_startup_hook = (Function *)NULL; +/* If non-zero, this is the address of a function to call just before + readline_internal_setup () returns and readline_internal starts + reading input characters. */ +Function *rl_pre_input_hook = (Function *)NULL; + /* What we use internally. You should always refer to RL_LINE_BUFFER. */ static char *the_line; @@ -286,6 +287,9 @@ char *_rl_comment_begin; /* Keymap holding the function currently being executed. */ Keymap rl_executing_keymap; +/* Non-zero means to erase entire line, including prompt, on empty input lines. */ +int rl_erase_empty_line = 0; + /* Line buffer and maintenence. */ char *rl_line_buffer = (char *)NULL; int rl_line_buffer_len = 0; @@ -388,6 +392,9 @@ readline_internal_setup () rl_vi_insertion_mode (1, 0); #endif /* VI_MODE */ } + + if (rl_pre_input_hook) + (*rl_pre_input_hook) (); } STATIC_CALLBACK char * @@ -405,7 +412,7 @@ readline_internal_teardown (eof) { temp = savestring (the_line); rl_revert_line (1, 0); - entry = replace_history_entry (where_history (), the_line, (HIST_ENTRY *)NULL); + entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL); _rl_free_history_entry (entry); strcpy (the_line, temp); @@ -488,6 +495,12 @@ readline_internal_charloop () if (rl_done == 0) (*rl_redisplay_function) (); + /* If the application writer has told us to erase the entire line if + the only character typed was something bound to rl_newline, do so. */ + if (rl_erase_empty_line && rl_done && rl_last_func == rl_newline && + rl_point == 0 && rl_end == 0) + _rl_erase_entire_line (); + #if defined (READLINE_CALLBACKS) return 0; #else @@ -501,7 +514,7 @@ readline_internal_charloop () static int readline_internal_charloop () { - int eof; + int eof = 1; while (rl_done == 0) eof = readline_internal_char (); @@ -837,11 +850,19 @@ rl_digit_loop () { int key, c, sawminus, sawdigits; - _rl_save_prompt (); + rl_save_prompt (); sawminus = sawdigits = 0; while (1) { + if (rl_numeric_arg > 1000000) + { + sawdigits = rl_explicit_arg = rl_numeric_arg = 0; + ding (); + rl_restore_prompt (); + rl_clear_message (); + return 1; + } rl_message ("(arg: %d) ", rl_arg_sign * rl_numeric_arg); key = c = rl_read_key (); @@ -858,7 +879,7 @@ rl_digit_loop () else { key = rl_read_key (); - _rl_restore_prompt (); + rl_restore_prompt (); rl_clear_message (); return (_rl_dispatch (key, _rl_keymap)); } @@ -881,7 +902,7 @@ rl_digit_loop () /* Make M-- command equivalent to M--1 command. */ if (sawminus && rl_numeric_arg == 1 && rl_explicit_arg == 0) rl_explicit_arg = 1; - _rl_restore_prompt (); + rl_restore_prompt (); rl_clear_message (); return (_rl_dispatch (key, _rl_keymap)); } @@ -1231,7 +1252,8 @@ rl_backward_word (count, key) /* Clear the current line. Numeric argument to C-l does this. */ int -rl_refresh_line () +rl_refresh_line (ignore1, ignore2) + int ignore1, ignore2; { int curr_line, nleft; @@ -1278,7 +1300,7 @@ rl_clear_screen (count, key) { if (rl_explicit_arg) { - rl_refresh_line (); + rl_refresh_line (count, key); return 0; } @@ -1428,6 +1450,11 @@ rl_newline (count, key) } #endif /* VI_MODE */ + /* If we've been asked to erase empty lines, suppress the final update, + since _rl_update_final calls crlf(). */ + if (rl_erase_empty_line && rl_point == 0 && rl_end == 0) + return 0; + if (readline_echoing_p) _rl_update_final (); return 0; @@ -1507,9 +1534,22 @@ rl_delete (count, key) } else return (rl_delete_text (rl_point, rl_point + 1)); - } +/* Delete the character under the cursor, unless the insertion + point is at the end of the line, in which case the character + behind the cursor is deleted. COUNT is obeyed and may be used + to delete forward or backward that many characters. */ +int +rl_rubout_or_delete (count, key) + int count, key; +{ + if (rl_end != 0 && rl_point == rl_end) + return (rl_rubout (count, key)); + else + return (rl_delete (count, key)); +} + /* Delete all spaces and tabs around point. */ int rl_delete_horizontal_space (count, ignore) @@ -1533,6 +1573,19 @@ rl_delete_horizontal_space (count, ignore) return 0; } +/* Like the tcsh editing function delete-char-or-list. The eof character + is caught before this is invoked, so this really does the same thing as + delete-char-or-list-or-eof, as long as it's bound to the eof character. */ +int +rl_delete_or_show_completions (count, key) + int count, key; +{ + if (rl_end != 0 && rl_point == rl_end) + return (rl_possible_completions (count, key)); + else + return (rl_delete (count, key)); +} + #ifndef RL_COMMENT_BEGIN_DEFAULT #define RL_COMMENT_BEGIN_DEFAULT "#" #endif @@ -1859,7 +1912,7 @@ maybe_replace_line () /* If the current line has changed, save the changes. */ if (temp && ((UNDO_LIST *)(temp->data) != rl_undo_list)) { - temp = replace_history_entry (where_history (), the_line, rl_undo_list); + temp = replace_history_entry (where_history (), the_line, (histdata_t)rl_undo_list); free (temp->line); free (temp); } diff --git a/readline/readline.h b/readline/readline.h index 280ec32..dba1a0f 100644 --- a/readline/readline.h +++ b/readline/readline.h @@ -23,10 +23,16 @@ #if !defined (_READLINE_H_) #define _READLINE_H_ +#ifdef __cplusplus +extern "C" { +#endif + #if defined (READLINE_LIBRARY) +# include "rlstdc.h" # include "keymaps.h" # include "tilde.h" #else +# include <readline/rlstdc.h> # include <readline/keymaps.h> # include <readline/tilde.h> #endif @@ -60,78 +66,191 @@ typedef struct _funmap { extern FUNMAP **funmap; -/* Functions available to bind to key sequences. */ -extern int - rl_tilde_expand (), rl_set_mark (), rl_exchange_point_and_mark (), - rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (), - rl_forward (), ding (), rl_newline (), rl_kill_line (), - rl_copy_region_to_kill (), rl_kill_region (), rl_char_search (), - rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (), - rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars (), - rl_unix_line_discard (), rl_unix_word_rubout (), - rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (), - rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (), - rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (), - rl_complete (), rl_possible_completions (), rl_insert_completions (), - rl_menu_complete (), - rl_do_lowercase_version (), rl_kill_full_line (), - rl_digit_argument (), rl_universal_argument (), rl_abort (), - rl_undo_command (), rl_revert_line (), rl_beginning_of_history (), - rl_end_of_history (), rl_forward_search_history (), rl_insert (), - rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (), - rl_restart_output (), rl_re_read_init_file (), - rl_dump_functions (), rl_dump_variables (), rl_dump_macros (), - rl_delete_horizontal_space (), rl_history_search_forward (), - rl_history_search_backward (), rl_tty_status (), rl_yank_last_arg (), - rl_insert_comment (), rl_backward_char_search (), - rl_copy_forward_word (), rl_copy_backward_word (); - -/* Not available unless readline is compiled -DPAREN_MATCHING. */ -extern int rl_insert_close (); - -/* Not available unless READLINE_CALLBACKS is defined. */ -extern void rl_callback_handler_install (); -extern void rl_callback_read_char (); -extern void rl_callback_handler_remove (); +/* **************************************************************** */ +/* */ +/* Functions available to bind to key sequences */ +/* */ +/* **************************************************************** */ +/* Bindable commands for numeric arguments. */ +extern int rl_digit_argument __P((int, int)); +extern int rl_universal_argument __P((int, int)); + +/* Bindable commands for moving the cursor. */ +extern int rl_forward __P((int, int)); +extern int rl_backward __P((int, int)); +extern int rl_beg_of_line __P((int, int)); +extern int rl_end_of_line __P((int, int)); +extern int rl_forward_word __P((int, int)); +extern int rl_backward_word __P((int, int)); +extern int rl_refresh_line __P((int, int)); +extern int rl_clear_screen __P((int, int)); +extern int rl_arrow_keys __P((int, int)); + +/* Bindable commands for inserting and deleting text. */ +extern int rl_insert __P((int, int)); +extern int rl_quoted_insert __P((int, int)); +extern int rl_tab_insert __P((int, int)); +extern int rl_newline __P((int, int)); +extern int rl_do_lowercase_version __P((int, int)); +extern int rl_rubout __P((int, int)); +extern int rl_delete __P((int, int)); +extern int rl_rubout_or_delete __P((int, int)); +extern int rl_delete_horizontal_space __P((int, int)); +extern int rl_delete_or_show_completions __P((int, int)); +extern int rl_insert_comment __P((int, int)); + +/* Bindable commands for changing case. */ +extern int rl_upcase_word __P((int, int)); +extern int rl_downcase_word __P((int, int)); +extern int rl_capitalize_word __P((int, int)); + +/* Bindable commands for transposing characters and words. */ +extern int rl_transpose_words __P((int, int)); +extern int rl_transpose_chars __P((int, int)); + +/* Bindable commands for searching within a line. */ +extern int rl_char_search __P((int, int)); +extern int rl_backward_char_search __P((int, int)); + +/* Bindable commands for readline's interface to the command history. */ +extern int rl_beginning_of_history __P((int, int)); +extern int rl_end_of_history __P((int, int)); +extern int rl_get_next_history __P((int, int)); +extern int rl_get_previous_history __P((int, int)); + +/* Bindable commands for managing the mark and region. */ +extern int rl_set_mark __P((int, int)); +extern int rl_exchange_point_and_mark __P((int, int)); + +/* Bindable commands to set the editing mode (emacs or vi). */ +extern int rl_vi_editing_mode __P((int, int)); +extern int rl_emacs_editing_mode __P((int, int)); + +/* Bindable commands for managing key bindings. */ +extern int rl_re_read_init_file __P((int, int)); +extern int rl_dump_functions __P((int, int)); +extern int rl_dump_macros __P((int, int)); +extern int rl_dump_variables __P((int, int)); + +/* Bindable commands for word completion. */ +extern int rl_complete __P((int, int)); +extern int rl_possible_completions __P((int, int)); +extern int rl_insert_completions __P((int, int)); +extern int rl_menu_complete __P((int, int)); + +/* Bindable commands for killing and yanking text, and managing the kill ring. */ +extern int rl_kill_word __P((int, int)); +extern int rl_backward_kill_word __P((int, int)); +extern int rl_kill_line __P((int, int)); +extern int rl_backward_kill_line __P((int, int)); +extern int rl_kill_full_line __P((int, int)); +extern int rl_unix_word_rubout __P((int, int)); +extern int rl_unix_line_discard __P((int, int)); +extern int rl_copy_region_to_kill __P((int, int)); +extern int rl_kill_region __P((int, int)); +extern int rl_copy_forward_word __P((int, int)); +extern int rl_copy_backward_word __P((int, int)); +extern int rl_yank __P((int, int)); +extern int rl_yank_pop __P((int, int)); +extern int rl_yank_nth_arg __P((int, int)); +extern int rl_yank_last_arg __P((int, int)); /* Not available unless __CYGWIN32__ is defined. */ #ifdef __CYGWIN32__ -extern int rl_paste_from_clipboard (); +extern int rl_paste_from_clipboard __P((int, int)); #endif -/* These are *both* defined even when VI_MODE is not. */ -extern int rl_vi_editing_mode (), rl_emacs_editing_mode (); +/* Bindable commands for incremental searching. */ +extern int rl_reverse_search_history __P((int, int)); +extern int rl_forward_search_history __P((int, int)); + +/* Bindable keyboard macro commands. */ +extern int rl_start_kbd_macro __P((int, int)); +extern int rl_end_kbd_macro __P((int, int)); +extern int rl_call_last_kbd_macro __P((int, int)); + +/* Bindable undo commands. */ +extern int rl_revert_line __P((int, int)); +extern int rl_undo_command __P((int, int)); + +/* Bindable tilde expansion commands. */ +extern int rl_tilde_expand __P((int, int)); + +/* Bindable terminal control commands. */ +extern int rl_restart_output __P((int, int)); +extern int rl_stop_output __P((int, int)); + +/* Miscellaneous bindable commands. */ +extern int rl_abort __P((int, int)); +extern int rl_tty_status __P((int, int)); + +/* Bindable commands for incremental and non-incremental history searching. */ +extern int rl_history_search_forward __P((int, int)); +extern int rl_history_search_backward __P((int, int)); +extern int rl_noninc_forward_search __P((int, int)); +extern int rl_noninc_reverse_search __P((int, int)); +extern int rl_noninc_forward_search_again __P((int, int)); +extern int rl_noninc_reverse_search_again __P((int, int)); + +/* Not available unless readline is compiled -DPAREN_MATCHING. */ +extern int rl_insert_close __P((int, int)); -/* Non incremental history searching. */ -extern int rl_noninc_forward_search (); -extern int rl_noninc_reverse_search (); -extern int rl_noninc_forward_search_again (); -extern int rl_noninc_reverse_search_again (); +/* Not available unless READLINE_CALLBACKS is defined. */ +extern void rl_callback_handler_install __P((char *, VFunction *)); +extern void rl_callback_read_char __P((void)); +extern void rl_callback_handler_remove __P((void)); /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */ -extern int rl_vi_check (); -extern int - rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (), - rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (), - rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (), - rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (), - rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (), - rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (), - rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (), - rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (), - rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (), - rl_vi_search_again (), rl_vi_subst (), rl_vi_overstrike (), - rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (), - rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (), - rl_vi_complete (), rl_vi_fetch_history (), rl_vi_set_mark (), - rl_vi_goto_mark (), rl_vi_back_to_indent (); - -/* Keyboard macro commands. */ -extern int rl_start_kbd_macro (), rl_end_kbd_macro (); -extern int rl_call_last_kbd_macro (); -extern void rl_push_macro_input (); - -extern int rl_arrow_keys(), rl_refresh_line (); +/* VI-mode bindable commands. */ +extern int rl_vi_redo __P((int, int)); +extern int rl_vi_undo __P((int, int)); +extern int rl_vi_yank_arg __P((int, int)); +extern int rl_vi_fetch_history __P((int, int)); +extern int rl_vi_search_again __P((int, int)); +extern int rl_vi_search __P((int, int)); +extern int rl_vi_complete __P((int, int)); +extern int rl_vi_tilde_expand __P((int, int)); +extern int rl_vi_prev_word __P((int, int)); +extern int rl_vi_next_word __P((int, int)); +extern int rl_vi_end_word __P((int, int)); +extern int rl_vi_insert_beg __P((int, int)); +extern int rl_vi_append_mode __P((int, int)); +extern int rl_vi_append_eol __P((int, int)); +extern int rl_vi_eof_maybe __P((int, int)); +extern int rl_vi_insertion_mode __P((int, int)); +extern int rl_vi_movement_mode __P((int, int)); +extern int rl_vi_arg_digit __P((int, int)); +extern int rl_vi_change_case __P((int, int)); +extern int rl_vi_put __P((int, int)); +extern int rl_vi_column __P((int, int)); +extern int rl_vi_delete_to __P((int, int)); +extern int rl_vi_change_to __P((int, int)); +extern int rl_vi_yank_to __P((int, int)); +extern int rl_vi_delete __P((int, int)); +extern int rl_vi_back_to_indent __P((int, int)); +extern int rl_vi_first_print __P((int, int)); +extern int rl_vi_char_search __P((int, int)); +extern int rl_vi_match __P((int, int)); +extern int rl_vi_change_char __P((int, int)); +extern int rl_vi_subst __P((int, int)); +extern int rl_vi_overstrike __P((int, int)); +extern int rl_vi_overstrike_delete __P((int, int)); +extern int rl_vi_replace __P((int, int)); +extern int rl_vi_set_mark __P((int, int)); +extern int rl_vi_goto_mark __P((int, int)); + +/* VI-mode utility functions. */ +extern int rl_vi_check __P((void)); +extern int rl_vi_domove __P((int, int *)); +extern int rl_vi_bracktype __P((int)); + +/* VI-mode pseudo-bindable commands, used as utility functions. */ +extern int rl_vi_fWord __P((int, int)); +extern int rl_vi_bWord __P((int, int)); +extern int rl_vi_eWord __P((int, int)); +extern int rl_vi_fword __P((int, int)); +extern int rl_vi_bword __P((int, int)); +extern int rl_vi_eword __P((int, int)); /* **************************************************************** */ /* */ @@ -141,57 +260,80 @@ extern int rl_arrow_keys(), rl_refresh_line (); /* Readline functions. */ /* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */ -extern char *readline (); - -/* These functions are from bind.c. */ -/* rl_add_defun (char *name, Function *function, int key) - Add NAME to the list of named functions. Make FUNCTION - be the function that gets called. - If KEY is not -1, then bind it. */ -extern int rl_add_defun (); - -extern Keymap rl_make_bare_keymap (); -extern Keymap rl_copy_keymap (); -extern Keymap rl_make_keymap (); -extern void rl_discard_keymap (); -extern Keymap rl_get_keymap (), rl_get_keymap_by_name (); -extern void rl_set_keymap (); -extern char *rl_get_keymap_name (); - -extern int rl_bind_key (), rl_bind_key_in_map (); -extern int rl_unbind_key (), rl_unbind_key_in_map (); -extern int rl_unbind_function_in_map (), rl_unbind_command_in_map (); -extern int rl_set_key (); -extern int rl_generic_bind (); -extern int rl_parse_and_bind (); -/* Backwards compatibility, use rl_generic_bind instead. */ -extern int rl_macro_bind (), rl_variable_bind (); +extern char *readline __P((char *)); -extern int rl_read_init_file (); +extern int rl_initialize __P((void)); -extern Function *rl_named_function (), *rl_function_of_keyseq (); -extern char **rl_invoking_keyseqs (), **rl_invoking_keyseqs_in_map (); -extern void rl_function_dumper (); -extern void rl_variable_dumper (); -extern void rl_macro_dumper (); -extern void rl_list_funmap_names (); +extern int rl_discard_argument __P((void)); -/* Undocumented in the texinfo manual; not really useful to programs. */ -extern int rl_translate_keyseq (); -extern void rl_initialize_funmap (); +/* Utility functions to bind keys to readline commands. */ +extern int rl_add_defun __P((char *, Function *, int)); +extern int rl_bind_key __P((int, Function *)); +extern int rl_bind_key_in_map __P((int, Function *, Keymap)); +extern int rl_unbind_key __P((int)); +extern int rl_unbind_key_in_map __P((int, Keymap)); +extern int rl_unbind_function_in_map __P((Function *, Keymap)); +extern int rl_unbind_command_in_map __P((char *, Keymap)); +extern int rl_set_key __P((char *, Function *, Keymap)); +extern int rl_generic_bind __P((int, char *, char *, Keymap)); +extern int rl_variable_bind __P((char *, char *)); -/* Functions for undoing. */ -extern int rl_begin_undo_group (), rl_end_undo_group (); -extern void rl_add_undo (), free_undo_list (); -extern int rl_do_undo (); -extern int rl_modifying (); +/* Backwards compatibility, use rl_generic_bind instead. */ +extern int rl_macro_bind __P((char *, char *, Keymap)); + +/* Undocumented in the texinfo manual; not really useful to programs. */ +extern int rl_translate_keyseq __P((char *, char *, int *)); +extern char *rl_untranslate_keyseq __P((int)); + +extern Function *rl_named_function __P((char *)); +extern Function *rl_function_of_keyseq __P((char *, Keymap, int *)); + +extern void rl_list_funmap_names __P((void)); +extern char **rl_invoking_keyseqs_in_map __P((Function *, Keymap)); +extern char **rl_invoking_keyseqs __P((Function *)); + +extern void rl_function_dumper __P((int)); +extern void rl_macro_dumper __P((int)); +extern void rl_variable_dumper __P((int)); + +extern int rl_read_init_file __P((char *)); +extern int rl_parse_and_bind __P((char *)); + +/* Functions for manipulating keymaps. */ +extern Keymap rl_make_bare_keymap __P((void)); +extern Keymap rl_copy_keymap __P((Keymap)); +extern Keymap rl_make_keymap __P((void)); +extern void rl_discard_keymap __P((Keymap)); + +extern Keymap rl_get_keymap_by_name __P((char *)); +extern char *rl_get_keymap_name __P((Keymap)); +extern void rl_set_keymap __P((Keymap)); +extern Keymap rl_get_keymap __P((void)); +extern void rl_set_keymap_from_edit_mode __P((void)); +extern char *rl_get_keymap_name_from_edit_mode __P((void)); + +/* Functions for manipulating the funmap, which maps command names to functions. */ +extern int rl_add_funmap_entry __P((char *, Function *)); +extern void rl_initialize_funmap __P((void)); +extern char **rl_funmap_names __P((void)); + +/* Utility functions for managing keyboard macros. */ +extern void rl_push_macro_input __P((char *)); + +/* Functions for undoing, from undo.c */ +extern void rl_add_undo __P((enum undo_code, int, int, char *)); +extern void free_undo_list __P((void)); +extern int rl_do_undo __P((void)); +extern int rl_begin_undo_group __P((void)); +extern int rl_end_undo_group __P((void)); +extern int rl_modifying __P((int, int)); /* Functions for redisplay. */ -extern void rl_redisplay (); -extern int rl_forced_update_display (); -extern int rl_clear_message (); -extern int rl_reset_line_state (); -extern int rl_on_new_line (); +extern void rl_redisplay __P((void)); +extern int rl_on_new_line __P((void)); +extern int rl_forced_update_display __P((void)); +extern int rl_clear_message __P((void)); +extern int rl_reset_line_state __P((void)); #if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG) extern int rl_message (const char *, ...); @@ -200,36 +342,59 @@ extern int rl_message (); #endif /* Undocumented in texinfo manual. */ -extern int rl_character_len (); -extern int rl_show_char (); -extern int crlf (); - -/* Modifying text. */ -extern int rl_insert_text (), rl_delete_text (); -extern int rl_kill_text (); -extern char *rl_copy_text (); - -/* `Public' utility functions. */ -extern int rl_reset_terminal (); -extern int rl_stuff_char (); -extern int rl_read_key (), rl_getc (); +extern int rl_show_char __P((int)); +extern int rl_character_len __P((int, int)); +extern int crlf __P((void)); -extern int rl_initialize (); +/* Save and restore internal prompt redisplay information. */ +extern void rl_save_prompt __P((void)); +extern void rl_restore_prompt __P((void)); +/* Modifying text. */ +extern int rl_insert_text __P((char *)); +extern int rl_delete_text __P((int, int)); +extern int rl_kill_text __P((int, int)); +extern char *rl_copy_text __P((int, int)); + +/* Terminal and tty mode management. */ +extern void rl_prep_terminal __P((int)); +extern void rl_deprep_terminal __P((void)); +extern void rltty_set_default_bindings __P((Keymap)); + +extern int rl_reset_terminal __P((char *)); +extern void rl_resize_terminal __P((void)); + +/* `Public' utility functions . */ +extern void rl_extend_line_buffer __P((int)); +extern int ding __P((void)); + +/* Functions for character input. */ +extern int rl_stuff_char __P((int)); +extern int rl_execute_next __P((int)); +extern int rl_read_key __P((void)); +extern int rl_getc __P((FILE *)); + +/* Readline signal handling, from signals.c */ +extern int rl_set_signals __P((void)); +extern int rl_clear_signals __P((void)); +extern void rl_cleanup_after_signal __P((void)); +extern void rl_reset_after_signal __P((void)); +extern void rl_free_line_state __P((void)); + /* Undocumented. */ -extern int rl_expand_prompt (); -extern int rl_set_signals (), rl_clear_signals (); -extern int maybe_save_line (), maybe_unsave_line (), maybe_replace_line (); +extern int rl_expand_prompt __P((char *)); + +extern int maybe_save_line __P((void)); +extern int maybe_unsave_line __P((void)); +extern int maybe_replace_line __P((void)); /* Completion functions. */ -/* These functions are from complete.c. */ -extern int rl_complete_internal (); +extern int rl_complete_internal __P((int)); +extern void rl_display_match_list __P((char **, int, int)); -/* Return an array of strings which are the result of repeatadly calling - FUNC with TEXT. */ -extern char **completion_matches (); -extern char *username_completion_function (); -extern char *filename_completion_function (); +extern char **completion_matches __P((char *, CPFunction *)); +extern char *username_completion_function __P((char *, int)); +extern char *filename_completion_function __P((char *, int)); /* **************************************************************** */ /* */ @@ -254,10 +419,14 @@ extern char *rl_line_buffer; /* The location of point, and end. */ extern int rl_point, rl_end; +/* The mark, or saved cursor position. */ extern int rl_mark; +/* Flag to indicate that readline has finished with the current input + line and should return it. */ extern int rl_done; +/* If set to a character value, that will be the next keystroke read. */ extern int rl_pending_input; /* Non-zero if we called this function from _rl_dispatch(). It's present @@ -275,6 +444,11 @@ extern FILE *rl_instream, *rl_outstream; before readline_internal () prints the first prompt. */ extern Function *rl_startup_hook; +/* If non-zero, this is the address of a function to call just before + readline_internal_setup () returns and readline_internal starts + reading input characters. */ +extern Function *rl_pre_input_hook; + /* The address of a function to call periodically while Readline is awaiting character input, or NULL, for no event handling. */ extern Function *rl_event_hook; @@ -288,6 +462,24 @@ extern VFunction *rl_deprep_term_function; extern Keymap rl_executing_keymap; extern Keymap rl_binding_keymap; +/* Display variables. */ +/* If non-zero, readline will erase the entire line, including any prompt, + if the only thing typed on an otherwise-blank line is something bound to + rl_newline. */ +extern int rl_erase_empty_line; + +/* 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. */ +extern int rl_catch_signals; + +/* If non-zero, readline will install a signal handler for SIGWINCH + that also attempts to call any calling application's SIGWINCH signal + handler. Note that the terminal is not cleaned up before the + application's signal handler is called; use rl_cleanup_after_signal() + to do that. */ +extern int rl_catch_sigwinch; + /* Completion variables. */ /* Pointer to the generator function for completion_matches (). NULL means to use filename_entry_function (), the default filename @@ -346,6 +538,15 @@ extern Function *rl_directory_completion_hook; /* Backwards compatibility with previous versions of readline. */ #define rl_symbolic_link_hook rl_directory_completion_hook +/* 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. + This function is called instead of actually doing the display. + It takes three arguments: (char **matches, int num_matches, int max_length) + where MATCHES is the array of strings that matched, NUM_MATCHES is the + number of strings in that array, and MAX_LENGTH is the length of the + longest string in that array. */ +extern VFunction *rl_completion_display_matches_hook; + /* Non-zero means that the results of the matches are to be treated as filenames. This is ALWAYS zero on entry, and can only be changed within a completion entry finder function. */ @@ -413,4 +614,8 @@ extern int rl_inhibit_completion; extern char *savestring (); /* XXX backwards compatibility */ #endif +#ifdef __cplusplus +} +#endif + #endif /* _READLINE_H_ */ diff --git a/readline/rlconf.h b/readline/rlconf.h index 8f07db1..1356fd8 100644 --- a/readline/rlconf.h +++ b/readline/rlconf.h @@ -56,8 +56,6 @@ /* Define this if you want code that allows readline to be used in an X `callback' style. */ -#if !defined (SHELL) -# define READLINE_CALLBACKS -#endif +#define READLINE_CALLBACKS #endif /* _RLCONF_H_ */ diff --git a/readline/rlstdc.h b/readline/rlstdc.h new file mode 100644 index 0000000..08b0f89 --- /dev/null +++ b/readline/rlstdc.h @@ -0,0 +1,79 @@ +/* stdc.h -- macros to make source compile on both ANSI C and K&R C + compilers. */ + +/* Copyright (C) 1993 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#if !defined (_RL_STDC_H_) +#define _RL_STDC_H_ + +/* Adapted from BSD /usr/include/sys/cdefs.h. */ + +/* 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 (__STDC__) + +# if !defined (__P) +# define __P(protos) protos +# endif +# define __STRING(x) #x + +# if !defined (__GNUC__) +# define inline +# endif + +#else /* !__STDC__ */ + +# if !defined (__P) +# 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 /* !_RL_STDC_H_ */ diff --git a/readline/rltty.c b/readline/rltty.c index 8312963..a5ef938 100644 --- a/readline/rltty.c +++ b/readline/rltty.c @@ -37,9 +37,9 @@ #include "rldefs.h" -#if !defined (SHELL) && defined (GWINSZ_IN_SYS_IOCTL) +#if defined (GWINSZ_IN_SYS_IOCTL) # include <sys/ioctl.h> -#endif /* !SHELL && GWINSZ_IN_SYS_IOCTL */ +#endif /* GWINSZ_IN_SYS_IOCTL */ #include "rltty.h" #include "readline.h" @@ -144,7 +144,7 @@ static int terminal_prepped; static int ksrflow; #endif -#if !defined (SHELL) && defined (TIOCGWINSZ) +#if defined (TIOCGWINSZ) /* Dummy call to force a backgrounded readline to stop before it tries to get the tty settings. */ static void @@ -156,9 +156,7 @@ set_winsize (tty) if (ioctl (tty, TIOCGWINSZ, &w) == 0) (void) ioctl (tty, TIOCSWINSZ, &w); } -#else /* SHELL || !TIOCGWINSZ */ -# define set_winsize(tty) -#endif /* SHELL || !TIOCGWINSZ */ +#endif /* TIOCGWINSZ */ #if defined (NEW_TTY_DRIVER) @@ -389,6 +387,7 @@ get_tty_settings (tty, tiop) TIOTYPE *tiop; { int ioctl_ret; + set_winsize (tty); while (1) diff --git a/readline/savestring.c b/readline/savestring.c new file mode 100644 index 0000000..3f53a87 --- /dev/null +++ b/readline/savestring.c @@ -0,0 +1,33 @@ +/* savestring.c */ + +/* Copyright (C) 1998 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library, a library for + reading lines of text with interactive input and history editing. + + The GNU Readline Library is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 1, or + (at your option) any later version. + + The GNU Readline Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + The GNU General Public License is often shipped with GNU software, and + is generally kept in a file called COPYING or LICENSE. If you do not + have a copy of the license, write to the Free Software Foundation, + 675 Mass Ave, Cambridge, MA 02139, USA. */ + +extern char *strcpy (); +extern char *xmalloc (); + +/* Backwards compatibility, now that savestring has been removed from + all `public' readline header files. */ +char * +savestring (s) + char *s; +{ + return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); +} diff --git a/readline/search.c b/readline/search.c index 3024ee59..6c76e1a 100644 --- a/readline/search.c +++ b/readline/search.c @@ -61,7 +61,6 @@ 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_restore_prompt (); extern void rl_extend_line_buffer (); static char *noninc_search_string = (char *) NULL; @@ -172,7 +171,7 @@ noninc_search (dir, pchar) rl_message (p, 0, 0); free (p); -#define SEARCH_RETURN _rl_restore_prompt (); return +#define SEARCH_RETURN rl_restore_prompt (); return /* Read the search string. */ while (c = rl_read_key ()) @@ -241,7 +240,7 @@ noninc_search (dir, pchar) noninc_search_string = savestring (rl_line_buffer); } - _rl_restore_prompt (); + rl_restore_prompt (); noninc_dosearch (noninc_search_string, dir); } diff --git a/readline/shell.c b/readline/shell.c index 8bc2fe9..091ec08 100644 --- a/readline/shell.c +++ b/readline/shell.c @@ -26,10 +26,9 @@ # include <config.h> #endif +#include <sys/types.h> + #if defined (HAVE_UNISTD_H) -# ifdef _MINIX -# include <sys/types.h> -# endif # include <unistd.h> #endif /* HAVE_UNISTD_H */ @@ -45,24 +44,16 @@ # include <strings.h> #endif /* !HAVE_STRING_H */ -extern char *xmalloc (), *xrealloc (); +#include <pwd.h> -#if !defined (SHELL) +#if !defined (HAVE_GETPW_DECLS) +extern struct passwd *getpwuid (); +#endif /* !HAVE_GETPW_DECLS */ -#ifdef savestring -#undef savestring -#endif +extern char *xmalloc (); -/* Backwards compatibility, now that savestring has been removed from - all `public' readline header files. */ -#if 0 -char * -savestring (s) - char *s; -{ - return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s))); -} -#endif +/* All of these functions are resolved from bash if we are linking readline + as part of bash. */ /* Does shell-like quoting using single quotes. */ char * @@ -128,13 +119,15 @@ get_env_value (varname) return ((char *)getenv (varname)); } -#else /* SHELL */ -extern char *get_string_value (); - char * -get_env_value (varname) - char *varname; +get_home_dir () { - return get_string_value (varname); -} -#endif /* SHELL */ + char *home_dir; + struct passwd *entry; + + home_dir = (char *)NULL; + entry = getpwuid (getuid ()); + if (entry) + home_dir = entry->pw_dir; + return (home_dir); +} diff --git a/readline/shlib/Makefile.in b/readline/shlib/Makefile.in new file mode 100644 index 0000000..bff52f7 --- /dev/null +++ b/readline/shlib/Makefile.in @@ -0,0 +1,316 @@ +## -*- text -*- ## +# Makefile for the GNU readline library shared library support. +# +# Copyright (C) 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +RL_LIBRARY_VERSION = @LIBVERSION@ +RL_LIBRARY_NAME = readline + +srcdir = @srcdir@ +VPATH = .:@top_srcdir@ +topdir = @top_srcdir@ +BUILD_DIR = @BUILD_DIR@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +CC = @CC@ +RANLIB = @RANLIB@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +RM = rm -f +CP = cp +MV = mv + +SHELL = @MAKE_SHELL@ + +host_os = @host_os@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ + +CFLAGS = @CFLAGS@ +LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@ + +DEFS = @DEFS@ +LOCAL_DEFS = @LOCAL_DEFS@ + +# +# These values are generated for configure by ${topdir}/support/shobj-conf. +# If your system is not supported by that script, but includes facilities for +# dynamic loading of shared objects, please update the script and send the +# changes to bash-maintainers@gnu.org. +# +SHOBJ_CC = @SHOBJ_CC@ +SHOBJ_CFLAGS = @SHOBJ_CFLAGS@ +SHOBJ_LD = @SHOBJ_LD@ + +SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ +SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@ +SHOBJ_LIBS = @SHOBJ_LIBS@ + +SHLIB_XLDFLAGS = @SHLIB_XLDFLAGS@ +SHLIB_LIBS = @SHLIB_LIBS@ +SHLIB_LIBSUFF = @SHLIB_LIBSUFF@ + +SHLIB_LIBVERSION = @SHLIB_LIBVERSION@ + +SHLIB_STATUS = @SHLIB_STATUS@ + +# shared library versioning +SHLIB_MAJOR= 4 +# shared library systems like SVR4's do not use minor versions +SHLIB_MINOR= .0 + +# For libraries which include headers from other libraries. +INCLUDES = -I. -I.. -I$(topdir) -I$(includedir) + +CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(CPPFLAGS) $(INCLUDES) $(LOCAL_CFLAGS) $(CFLAGS) + +.SUFFIXES: .so + +.c.so: + ${RM} $@ + $(SHOBJ_CC) -c $(CCFLAGS) $(SHOBJ_CFLAGS) -o $*.o $< + $(MV) $*.o $@ + +# The name of the main library target. + +SHARED_READLINE = libreadline.$(SHLIB_LIBVERSION) +SHARED_HISTORY = libhistory.$(SHLIB_LIBVERSION) +SHARED_LIBS = $(SHARED_READLINE) $(SHARED_HISTORY) + +# The C code source files for this library. +CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \ + $(topdir)/vi_mode.c $(topdir)/parens.c $(topdir)/rltty.c \ + $(topdir)/complete.c $(topdir)/bind.c $(topdir)/isearch.c \ + $(topdir)/display.c $(topdir)/signals.c $(topdir)/emacs_keymap.c \ + $(topdir)/vi_keymap.c $(topdir)/util.c $(topdir)/kill.c \ + $(topdir)/undo.c $(topdir)/macro.c $(topdir)/input.c \ + $(topdir)/callback.c $(topdir)/terminal.c $(topdir)/xmalloc.c \ + $(topdir)/history.c $(topdir)/histsearch.c $(topdir)/histexpand.c \ + $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \ + $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.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 + +SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so +SHARED_TILDEOBJ = tilde.so +SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \ + rltty.so complete.so bind.so isearch.so display.so signals.so \ + util.so kill.so undo.so macro.so input.so callback.so terminal.so \ + nls.so xmalloc.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) + +########################################################################## + +all: $(SHLIB_STATUS) + +supported: $(SHARED_LIBS) + +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 "Please send the changes you made to bash-maintainers@gnu.org" + @echo "for inclusion in future bash and readline releases." + +$(SHARED_READLINE): $(SHARED_OBJ) + $(RM) $@ + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS) + +$(SHARED_HISTORY): $(SHARED_HISTOBJ) xmalloc.so + $(RM) $@ + $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so $(SHLIB_LIBS) + +installdirs: $(topdir)/support/mkdirs + -$(SHELL) $(topdir)/support/mkdirs $(libdir) + +install: installdirs $(SHLIB_STATUS) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -i "$(INSTALL_DATA)" $(SHARED_READLINE) + @echo install: you may need to run ldconfig + +uninstall: + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -U $(SHARED_HISTORY) + $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -d $(libdir) -U $(SHARED_READLINE) + @echo uninstall: you may need to run ldconfig + +clean mostlyclean: force + $(RM) $(SHARED_OBJ) $(SHARED_LIBS) + +distclean maintainer-clean: clean + $(RM) Makefile + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: + +# Dependencies +bind.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h +bind.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +bind.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +bind.so: $(topdir)/tilde.h $(topdir)/history.h +callback.so: $(topdir)/rlconf.h +callback.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h +callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +callback.so: $(topdir)/tilde.h +complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h +complete.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +complete.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +complete.so: $(topdir)/tilde.h +display.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h +display.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +display.so: $(topdir)/tcap.h +display.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +display.so: $(topdir)/tilde.h $(topdir)/history.h +funmap.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +funmap.so: $(topdir)/rlconf.h $(topdir)/ansi_stdlib.h +funmap.so: ${BUILD_DIR}/config.h $(topdir)/tilde.h +histexpand.so: $(topdir)/ansi_stdlib.h +histexpand.so: $(topdir)/history.h histlib.h +histexpand.so: ${BUILD_DIR}/config.h +histfile.so: $(topdir)/ansi_stdlib.h +histfile.so: $(topdir)/history.h histlib.h +histfile.so: ${BUILD_DIR}/config.h +history.so: $(topdir)/ansi_stdlib.h +history.so: $(topdir)/history.h histlib.h +history.so: ${BUILD_DIR}/config.h +histsearch.so: $(topdir)/ansi_stdlib.h +histsearch.so: $(topdir)/history.h histlib.h +histsearch.so: ${BUILD_DIR}/config.h +input.so: $(topdir)/ansi_stdlib.h +input.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +input.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +input.so: $(topdir)/tilde.h +isearch.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +isearch.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +isearch.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h +keymaps.so: emacs_keymap.c vi_keymap.c +keymaps.so: $(topdir)/keymaps.h $(topdir)/chardefs.h $(topdir)/rlconf.h +keymaps.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +keymaps.so: ${BUILD_DIR}/config.h $(topdir)/ansi_stdlib.h $(topdir)/tilde.h +kill.so: $(topdir)/ansi_stdlib.h +kill.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +kill.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +kill.so: $(topdir)/tilde.h $(topdir)/history.h +macro.so: $(topdir)/ansi_stdlib.h +macro.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +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 +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 +readline.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +readline.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +readline.so: $(topdir)/history.h $(topdir)/tilde.h +readline.so: $(topdir)/posixstat.h $(topdir)/ansi_stdlib.h $(topdir)/posixjmp.h +rltty.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +rltty.so: $(topdir)/rltty.h $(topdir)/tilde.h +rltty.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +search.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +search.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +search.so: $(topdir)/ansi_stdlib.h $(topdir)/history.h $(topdir)/tilde.h +signals.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +signals.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +signals.so: $(topdir)/history.h $(topdir)/tilde.h +terminal.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +terminal.so: $(topdir)/tcap.h +terminal.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +terminal.so: $(topdir)/tilde.h $(topdir)/history.h +tilde.so: $(topdir)/ansi_stdlib.h ${BUILD_DIR}/config.h $(topdir)/tilde.h +undo.so: $(topdir)/ansi_stdlib.h +undo.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +undo.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +undo.so: $(topdir)/tilde.h $(topdir)/history.h +util.so: $(topdir)/posixjmp.h $(topdir)/ansi_stdlib.h +util.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +util.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +util.so: $(topdir)/tilde.h +vi_mode.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h $(topdir)/rlconf.h +vi_mode.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h +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 + +readline.so: $(topdir)/readline.c +vi_mode.so: $(topdir)/vi_mode.c +funmap.so: $(topdir)/funmap.c +keymaps.so: $(topdir)/keymaps.c +parens.so: $(topdir)/parens.c +search.so: $(topdir)/search.c +rltty.so: $(topdir)/rltty.c +complete.so: $(topdir)/complete.c +bind.so: $(topdir)/bind.c +isearch.so: $(topdir)/isearch.c +display.so: $(topdir)/display.c +signals.so: $(topdir)/signals.c +util.so: $(topdir)/util.c +kill.so: $(topdir)/kill.c +undo.so: $(topdir)/undo.c +macro.so: $(topdir)/macro.c +input.so: $(topdir)/input.c +callback.so: $(topdir)/callback.c +terminal.so: $(topdir)/terminal.c +nls.so: $(topdir)/nls.c +xmalloc.so: $(topdir)/xmalloc.c +history.so: $(topdir)/history.c +histexpand.so: $(topdir)/histexpand.c +histfile.so: $(topdir)/histfile.c +histsearch.so: $(topdir)/histsearch.c +savestring.so: $(topdir)/savestring.c +shell.so: $(topdir)/shell.c +tilde.so: $(topdir)/tilde.c + +readline.so: readline.c +vi_mode.so: vi_mode.c +funmap.so: funmap.c +keymaps.so: keymaps.c +parens.so: parens.c +search.so: search.c +rltty.so: rltty.c +complete.so: complete.c +bind.so: bind.c +isearch.so: isearch.c +display.so: display.c +signals.so: signals.c +util.so: util.c +kill.so: kill.c +undo.so: undo.c +macro.so: macro.c +input.so: input.c +callback.so: callback.c +terminal.so: terminal.c +nls.so: nls.c +xmalloc.so: xmalloc.c +history.so: history.c +histexpand.so: histexpand.c +histfile.so: histfile.c +histsearch.so: histsearch.c +savestring.so: savestring.c +shell.so: shell.c +tilde.so: tilde.c diff --git a/readline/signals.c b/readline/signals.c index e19c22d..3a34432 100644 --- a/readline/signals.c +++ b/readline/signals.c @@ -49,18 +49,6 @@ #include "readline.h" #include "history.h" -extern int readline_echoing_p; -extern int rl_pending_input; -extern int _rl_meta_flag; - -extern void free_undo_list (); -extern void _rl_get_screen_size (); -extern void _rl_redisplay_after_sigwinch (); -extern void _rl_clean_up_for_exit (); -extern void _rl_kill_kbd_macro (); -extern void _rl_init_argument (); -extern void rl_deprep_terminal (), rl_prep_terminal (); - #if !defined (RETSIGTYPE) # if defined (VOID_SIGHANDLER) # define RETSIGTYPE void @@ -79,40 +67,52 @@ extern void rl_deprep_terminal (), rl_prep_terminal (); to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ typedef RETSIGTYPE SigHandler (); +extern int readline_echoing_p; +extern int rl_pending_input; +extern int _rl_meta_flag; + +extern void free_undo_list (); +extern void _rl_get_screen_size (); +extern void _rl_redisplay_after_sigwinch (); +extern void _rl_clean_up_for_exit (); +extern void _rl_kill_kbd_macro (); +extern void _rl_init_argument (); +extern void rl_deprep_terminal (), rl_prep_terminal (); + static SigHandler *rl_set_sighandler (); +/* Exported variables for use by applications. */ + +/* If non-zero, readline will install its own signal handlers for + SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */ +int rl_catch_signals = 1; + +/* If non-zero, readline will install a signal handler for SIGWINCH. */ +#ifdef SIGWINCH +int rl_catch_sigwinch = 1; +#endif + +static int signals_set_flag; +static int sigwinch_set_flag; + /* **************************************************************** */ /* */ /* Signal Handling */ /* */ /* **************************************************************** */ -/* If we're not being compiled as part of bash, initialize handlers for - and catch the job control signals (SIGTTIN, SIGTTOU, SIGTSTP) and - SIGTERM. */ -#if !defined (SHELL) -# define HANDLE_JOB_SIGNALS -# define HANDLE_SIGTERM -#endif /* !SHELL */ - #if defined (HAVE_POSIX_SIGNALS) typedef struct sigaction sighandler_cxt; # define rl_sigaction(s, nh, oh) sigaction(s, nh, oh) #else -typedef struct { SigHandler *sa_handler; } sighandler_cxt; +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_alrm; - -#if defined (HANDLE_JOB_SIGNALS) +static sighandler_cxt old_int, old_term, old_alrm, old_quit; +#if defined (SIGTSTP) static sighandler_cxt old_tstp, old_ttou, old_ttin; -#endif /* HANDLE_JOB_SIGNALS */ - -#if defined (HANDLE_SIGTERM) -static sighandler_cxt old_term; #endif - #if defined (SIGWINCH) static sighandler_cxt old_winch; #endif @@ -143,18 +143,8 @@ rl_signal_handler (sig) switch (sig) { case SIGINT: - { - register HIST_ENTRY *entry; - - free_undo_list (); - - entry = current_history (); - if (entry) - entry->data = (char *)NULL; - } - _rl_kill_kbd_macro (); - rl_clear_message (); - _rl_init_argument (); + rl_free_line_state (); + /* FALLTHROUGH */ #if defined (SIGTSTP) case SIGTSTP: @@ -163,10 +153,8 @@ rl_signal_handler (sig) #endif /* SIGTSTP */ case SIGALRM: case SIGTERM: - _rl_clean_up_for_exit (); - (*rl_deprep_term_function) (); - rl_clear_signals (); - rl_pending_input = 0; + case SIGQUIT: + rl_cleanup_after_signal (); #if defined (HAVE_POSIX_SIGNALS) sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set); @@ -188,8 +176,7 @@ rl_signal_handler (sig) # endif /* HAVE_BSD_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */ - (*rl_prep_term_function) (_rl_meta_flag); - rl_set_signals (); + rl_reset_after_signal (); } SIGHANDLER_RETURN; @@ -197,7 +184,7 @@ rl_signal_handler (sig) #if defined (SIGWINCH) static RETSIGTYPE -rl_handle_sigwinch (sig) +rl_sigwinch_handler (sig) int sig; { SigHandler *oh; @@ -209,14 +196,10 @@ rl_handle_sigwinch (sig) disposition set by the calling application. We need this state because we call the application's SIGWINCH handler after updating our own idea of the screen size. */ - rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &dummy_winch); + rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); #endif - if (readline_echoing_p) - { - _rl_get_screen_size (fileno (rl_instream), 1); - _rl_redisplay_after_sigwinch (); - } + rl_resize_terminal (); /* If another sigwinch handler has been installed, call it. */ oh = (SigHandler *)old_winch.sa_handler; @@ -263,62 +246,66 @@ rl_set_sighandler (sig, handler, ohandler) return (ohandler->sa_handler); } -int -rl_set_signals () +static void +rl_maybe_set_sighandler (sig, handler, ohandler) + int sig; + SigHandler *handler; + sighandler_cxt *ohandler; { sighandler_cxt dummy; SigHandler *oh; -#if defined (HAVE_POSIX_SIGNALS) sigemptyset (&dummy.sa_mask); -#endif - - oh = rl_set_sighandler (SIGINT, rl_signal_handler, &old_int); + oh = rl_set_sighandler (sig, handler, ohandler); if (oh == (SigHandler *)SIG_IGN) - rl_sigaction (SIGINT, &old_int, &dummy); + rl_sigaction (sig, ohandler, &dummy); +} - oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm); - if (oh == (SigHandler *)SIG_IGN) - rl_sigaction (SIGALRM, &old_alrm, &dummy); +int +rl_set_signals () +{ + sighandler_cxt dummy; + SigHandler *oh; + + if (rl_catch_signals && signals_set_flag == 0) + { + rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int); + rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term); + rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit); + + oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm); + if (oh == (SigHandler *)SIG_IGN) + rl_sigaction (SIGALRM, &old_alrm, &dummy); #if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART) - /* If the application using readline has already installed a signal - handler with SA_RESTART, SIGALRM will cause reads to be restarted - automatically, so readline should just get out of the way. Since - we tested for SIG_IGN above, we can just test for SIG_DFL here. */ - if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART)) - rl_sigaction (SIGALRM, &old_alrm, &dummy); + /* If the application using readline has already installed a signal + handler with SA_RESTART, SIGALRM will cause reads to be restarted + automatically, so readline should just get out of the way. Since + we tested for SIG_IGN above, we can just test for SIG_DFL here. */ + if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART)) + rl_sigaction (SIGALRM, &old_alrm, &dummy); #endif /* HAVE_POSIX_SIGNALS */ -#if defined (HANDLE_JOB_SIGNALS) - #if defined (SIGTSTP) - oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp); - if (oh == (SigHandler *)SIG_IGN) - rl_sigaction (SIGTSTP, &old_tstp, &dummy); -#else - oh = (SigHandler *)NULL; + rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp); #endif /* SIGTSTP */ #if defined (SIGTTOU) - rl_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou); - rl_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin); - - if (oh == (SigHandler *)SIG_IGN) - { - rl_set_sighandler (SIGTTOU, SIG_IGN, &dummy); - rl_set_sighandler (SIGTTIN, SIG_IGN, &dummy); - } + rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou); #endif /* SIGTTOU */ -#endif /* HANDLE_JOB_SIGNALS */ +#if defined (SIGTTIN) + rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin); +#endif /* SIGTTIN */ -#if defined (HANDLE_SIGTERM) - /* Handle SIGTERM if we're not being compiled as part of bash. */ - rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term); -#endif /* HANDLE_SIGTERM */ + signals_set_flag = 1; + } #if defined (SIGWINCH) - rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch); + if (rl_catch_sigwinch && sigwinch_set_flag == 0) + { + rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch); + sigwinch_set_flag = 1; + } #endif /* SIGWINCH */ return 0; @@ -329,35 +316,79 @@ rl_clear_signals () { sighandler_cxt dummy; -#if defined (HAVE_POSIX_SIGNALS) - sigemptyset (&dummy.sa_mask); -#endif - - rl_sigaction (SIGINT, &old_int, &dummy); - rl_sigaction (SIGALRM, &old_alrm, &dummy); + if (rl_catch_signals && signals_set_flag == 1) + { + sigemptyset (&dummy.sa_mask); -#if defined (HANDLE_JOB_SIGNALS) + rl_sigaction (SIGINT, &old_int, &dummy); + rl_sigaction (SIGTERM, &old_term, &dummy); + rl_sigaction (SIGQUIT, &old_quit, &dummy); + rl_sigaction (SIGALRM, &old_alrm, &dummy); #if defined (SIGTSTP) - rl_sigaction (SIGTSTP, &old_tstp, &dummy); -#endif + rl_sigaction (SIGTSTP, &old_tstp, &dummy); +#endif /* SIGTSTP */ #if defined (SIGTTOU) - rl_sigaction (SIGTTOU, &old_ttou, &dummy); - rl_sigaction (SIGTTIN, &old_ttin, &dummy); + rl_sigaction (SIGTTOU, &old_ttou, &dummy); #endif /* SIGTTOU */ -#endif /* HANDLE_JOB_SIGNALS */ +#if defined (SIGTTIN) + rl_sigaction (SIGTTIN, &old_ttin, &dummy); +#endif /* SIGTTIN */ -#if defined (HANDLE_SIGTERM) - rl_sigaction (SIGTERM, &old_term, &dummy); -#endif /* HANDLE_SIGTERM */ + signals_set_flag = 0; + } #if defined (SIGWINCH) - sigemptyset (&dummy.sa_mask); - rl_sigaction (SIGWINCH, &old_winch, &dummy); + if (rl_catch_sigwinch && sigwinch_set_flag == 1) + { + sigemptyset (&dummy.sa_mask); + rl_sigaction (SIGWINCH, &old_winch, &dummy); + sigwinch_set_flag = 0; + } #endif return 0; } + +/* Clean up the terminal and readline state after catching a signal, before + resending it to the calling application. */ +void +rl_cleanup_after_signal () +{ + _rl_clean_up_for_exit (); + (*rl_deprep_term_function) (); + rl_clear_signals (); + rl_pending_input = 0; +} + +/* Reset the terminal and readline state after a signal handler returns. */ +void +rl_reset_after_signal () +{ + (*rl_prep_term_function) (_rl_meta_flag); + rl_set_signals (); +} + +/* Free up the readline variable line state for the current line (undo list, + any partial history entry, any keyboard macros in progress, and any + numeric arguments in process) after catching a signal, before calling + rl_cleanup_after_signal(). */ +void +rl_free_line_state () +{ + register HIST_ENTRY *entry; + + free_undo_list (); + + entry = current_history (); + if (entry) + entry->data = (char *)NULL; + + _rl_kill_kbd_macro (); + rl_clear_message (); + _rl_init_argument (); +} + #endif /* HANDLE_SIGNALS */ diff --git a/readline/support/config.guess b/readline/support/config.guess index 0e11ad8..66a2428 100755 --- a/readline/support/config.guess +++ b/readline/support/config.guess @@ -151,6 +151,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:QNX:*:42*) echo i386-qssl-qnx`echo ${UNAME_VERSION}` exit 0 ;; + BeBox:BeOS:*:*) + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; # end cases added for Bash alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then @@ -213,6 +225,9 @@ EOF amiga:OpenBSD:*:*) echo m68k-cbm-openbsd${UNAME_RELEASE} exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -315,10 +330,10 @@ EOF echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; Power?Macintosh:Rhapsody:*:*) - echo powerpc-apple-nextstep${UNAME_RELEASE} + echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-unknown-nextstep${UNAME_RELEASE} + echo ${UNAME_MACHINE}-unknown-rhapsody${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} @@ -737,6 +752,11 @@ EOF i?86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 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:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -862,7 +882,7 @@ EOF PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 - exit 0 ;; + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/readline/support/config.sub b/readline/support/config.sub index 244fbde..c1ec2df 100755 --- a/readline/support/config.sub +++ b/readline/support/config.sub @@ -94,7 +94,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple ) os= basic_machine=$1 ;; @@ -102,7 +102,7 @@ case $os in os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -175,7 +175,8 @@ case $basic_machine in | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \ | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | alpha-* | we32k-* | cydra-* | ns16k-* \ + | 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-* \ @@ -183,7 +184,7 @@ case $basic_machine in | cadmus-* | ews*-nec | ibmrt-ibm* | masscomp-masscomp \ | tandem-* | symmetric-* | drs6000-icl | *-*ardent | gould-gould \ | concurrent-* | ksr1-* | esa-ibm | fxc-alliant | *370-amdahl \ - | *-convex) + | *-convex | sx4*-nec) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -208,7 +209,12 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm +# basic_machine=m68k-cbm + basic_machine=m68k-unknown + ;; + amigaos) + basic_machine=m68k-unknown + os=-amigaos ;; amigados) basic_machine=m68k-cbm @@ -404,6 +410,14 @@ case $basic_machine in miniframe) basic_machine=m68000-convergent ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux + ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -454,6 +468,14 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + osr5 | sco5) # SCO Open Server + basic_machine=i386-pc + os=-sco3.2v5 + ;; + odt | odt3 | odt4) # SCO Open Desktop + basic_machine=i386-pc + os=-sco3.2v4 + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -584,6 +606,14 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; + uw2 | unixware | unixware2) + basic_machine=i386-pc + os=-sysv4.2uw2.1 + ;; + uw7 | unixware7) + basic_machine=i386-pc + os=-sysv5uw7 + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -622,7 +652,11 @@ 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. mips) - basic_machine=mips-mips + if test "x$os" = "x-linux" ; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi ;; romp) basic_machine=romp-ibm @@ -683,9 +717,15 @@ case $os in -solaris) os=-solaris2 ;; - -unixware* | svr4*) + svr4*) os=-sysv4 ;; + -unixware | -uw | -unixware2* | -uw2*) + os=-sysv4.2uw2.1 + ;; + -unixware7* | -uw7*) + os=-sysv5uw7 + ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; @@ -696,15 +736,16 @@ 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* \ - | -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* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -linux-gnu* | -uxpv* | -qnx* | -powerux) + | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -linux-gnu* | -uxpv* | -qnx* | -powerux* | -beos* | -rhapsody* \ + | -superux* ) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) @@ -759,7 +800,10 @@ case $os in -sysvr4) os=-sysv4 ;; - # This must come after -sysvr4. + -sysvr5) + os=-sysv5 + ;; + # This must come after -sysvr[45]. -sysv*) ;; -xenix) @@ -817,6 +861,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + *-be) + os=-beos + ;; *-ibm) os=-aix ;; @@ -830,7 +877,7 @@ case $basic_machine in os=-sysv ;; *-cbm) - os=-amigados + os=-amigaos ;; *-dg) os=-dgux diff --git a/readline/support/mkdist b/readline/support/mkdist index 0d3d694..a1e4eb1 100755 --- a/readline/support/mkdist +++ b/readline/support/mkdist @@ -48,7 +48,7 @@ fi version=$1 newdir=${ROOTNAME}-$version -vmsg creating distribution for version $version in $newdir +vmsg creating distribution for $ROOTNAME version $version in $newdir if [ ! -d $newdir ]; then mkdir $newdir || { echo $0: cannot make directory $newdir 1>&2 ; exit 1; } diff --git a/readline/support/shlib-install b/readline/support/shlib-install new file mode 100755 index 0000000..e43a7c0 --- /dev/null +++ b/readline/support/shlib-install @@ -0,0 +1,105 @@ +#! /bin/sh +# +# shlib-install - install a shared library and do any necessary host-specific +# post-installation configuration (like ldconfig) +# +# usage: shlib-install [-D] -O host_os -d installation-dir -i install-prog [-U] library +# +# Chet Ramey +# chet@po.cwru.edu + +# +# defaults +# +INSTALLDIR=/usr/local/lib +LDCONFIG=ldconfig + +PROGNAME=`basename $0` +USAGE="$PROGNAME [-D] -O host_os -d installation-dir -i install-prog [-U] library" + +# process options + +while [ $# -gt 0 ]; do + case "$1" in + -O) shift; host_os="$1"; shift ;; + -d) shift; INSTALLDIR="$1"; shift ;; + -i) shift; INSTALLPROG="$1" ; shift ;; + -D) echo=echo ; shift ;; + -U) uninstall=true ; shift ;; + -*) echo "$USAGE" >&2 ; exit 2;; + *) break ;; + esac +done + +# set install target name +LIBNAME="$1" + +if [ -z "$LIBNAME" ]; then + echo "$USAGE" >&2 + exit 2 +fi + +OLDSUFF=old +MV=mv +RM="rm -f" +LN="ln -s" + +# pre-install + +if [ -z "$uninstall" ]; then + ${echo} $RM ${INSTALLDIR}/${LIBNAME}.${OLDSUFF} + if [ -f "$INSTALLDIR/$LIBNAME" ]; then + ${echo} $MV $INSTALLDIR/$LIBNAME ${INSTALLDIR}/${LIBNAME}${OLDSUFF} + fi +fi + +# install/uninstall + +if [ -z "$uninstall" ] ; then + ${echo} eval ${INSTALLPROG} $LIBNAME ${INSTALLDIR}/${LIBNAME} +else + ${echo} ${RM} ${INSTALLDIR}/${LIBNAME} +fi + +# post-install/uninstall + +case "$LIBNAME" in +*.*.[0-9].[0-9]) # libname.so.M.N + LINK2=`echo $LIBNAME | sed 's:\(.*\..*\.[0-9]\)\.[0-9]:\1:'` # libname.so.M + LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]\.[0-9]:\1:'` # libname.so + ;; +*.*.[0-9]) # libname.so.M + LINK1=`echo $LIBNAME | sed 's:\(.*\..*\)\.[0-9]:\1:'` # libname.so + ;; +esac + +# +# Create symlinks to the installed library. This section is incomplete. +# +case "$host_os" in +*linux*|bsdi4*) + # 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 + ;; + +solaris2*|aix4.[2-9]*|hpux1*) + # libname.so -> libname.so.M + ${echo} ${RM} ${INSTALLDIR}/$LINK1 + if [ -z "$uninstall" ]; then + ${echo} ln -s $INSTALLDIR/$LIBNAME ${INSTALLDIR}/$LINK1 + fi + ;; + +*) ;; +esac + +exit 0 diff --git a/readline/support/shobj-conf b/readline/support/shobj-conf new file mode 100755 index 0000000..cbd3d1b --- /dev/null +++ b/readline/support/shobj-conf @@ -0,0 +1,341 @@ +#! /bin/sh +# +# shobj-conf -- output a series of variable assignments to be substituted +# into a Makefile by configure which specify system-dependent +# information for creating shared objects that may be loaded +# into bash with `enable -f' +# +# usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor +# +# Chet Ramey +# chet@po.cwru.edu + +# +# defaults +# +SHOBJ_STATUS=supported +SHLIB_STATUS=supported + +SHOBJ_CC=cc +SHOBJ_CFLAGS= +SHOBJ_LD= +SHOBJ_LDFLAGS= +SHOBJ_XLDFLAGS= +SHOBJ_LIBS= + +SHLIB_XLDFLAGS= +SHLIB_LIBS= +SHLIB_LIBSUFF='so' + +SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)' + +PROGNAME=`basename $0` +USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor" + +while [ $# -gt 0 ]; do + case "$1" in + -C) shift; SHOBJ_CC="$1"; shift ;; + -c) shift; host_cpu="$1"; shift ;; + -o) shift; host_os="$1"; shift ;; + -v) shift; host_vendor="$1"; shift ;; + *) echo "$USAGE" >&2 ; exit 2;; + esac +done + +case "${host_os}-${SHOBJ_CC}" in +sunos4*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD=/usr/bin/ld + SHOBJ_LDFLAGS='-assert pure-text' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +sunos4*) + SHOBJ_CFLAGS=-pic + SHOBJ_LD=/usr/bin/ld + SHOBJ_LDFLAGS='-assert pure-text' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +sunos5*-gcc*|solaris2*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-i' + + SHLIB_XLDFLAGS='-R $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sunos5*|solaris2*) + SHOBJ_CFLAGS='-K pic' + SHOBJ_LD=/usr/ccs/bin/ld + SHOBJ_LDFLAGS='-G -dy -z text -i -h $@' + + SHLIB_XLDFLAGS='-R $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +freebsd2* | netbsd* | openbsd*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-x -Bshareable' + + SHLIB_XLDFLAGS='-R$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +freebsd3*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_XLDFLAGS='-R$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +linux*) + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +bsdi2*) + SHOBJ_CC=shlicc2 + SHOBJ_CFLAGS= + SHOBJ_LD=ld + SHOBJ_LDFLAGS=-r + SHOBJ_LIBS=-lc_s.2.1.0 + + # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in + # the ass -- they require changing {/usr/lib,etc}/shlib.map on + # each system, and the library creation process is byzantine + SHLIB_STATUS=unsupported + ;; + +bsdi3*) + SHOBJ_CC=shlicc2 + SHOBJ_CFLAGS= + SHOBJ_LD=ld + SHOBJ_LDFLAGS=-r + SHOBJ_LIBS=-lc_s.3.0.0 + + # BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in + # the ass -- they require changing {/usr/lib,etc}/shlib.map on + # each system, and the library creation process is byzantine + SHLIB_STATUS=unsupported + ;; + +bsdi4*) + # BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked + # shared libraries. gcc 2.x is the standard compiler, and the + # `normal' gcc options should work as they do in Linux. + + SHOBJ_CFLAGS=-fPIC + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' + ;; + +osf*) + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"' + + SHLIB_XLDFLAGS='-rpath $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +aix4.[2-9]*-gcc*) # lightly tested by jik@cisco.com + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='ld' + SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' + SHOBJ_XLDFLAGS='-G' + + SHLIB_XLDFLAGS='-bM:SRE' + SHLIB_LIBS='-lcurses -lc' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +aix4.[2-9]*) + SHOBJ_CFLAGS=-K + SHOBJ_LD='ld' + SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' + SHOBJ_XLDFLAGS='-G' + + SHLIB_XLDFLAGS='-bM:SRE' + SHLIB_LIBS='-lcurses -lc' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +# +# THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface +# +irix[56]*-gcc*) + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' + + SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +irix[56]*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@' + + SHLIB_XLDFLAGS='-rpath $(libdir)' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux9*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' + + SHLIB_XLDFLAGS='-Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux9*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +hpux10*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' + + SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux10*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +hpux11*-gcc*) + # must use gcc; the bundled cc cannot compile PIC code + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' +# SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@' + SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s -Wl,+h,$@' + + SHLIB_XLDFLAGS='-Wl,+b,$(libdir)' + SHLIB_LIBSUFF='sl' + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +hpux11*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +sysv4*-gcc*) + SHOBJ_CFLAGS=-shared + SHOBJ_LDFLAGS='-shared -h $@' + SHOBJ_LD='${CC}' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv4*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-dy -z text -G -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sco3.2v5*-gcc*) + SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sco3.2v5*) + SHOBJ_CFLAGS='-K pic -b elf' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv5uw7*-gcc*) + SHOBJ_CFLAGS='-fpic' + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +sysv5uw7*) + SHOBJ_CFLAGS='-K PIC' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -dy -z text -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +dgux*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +dgux*) + SHOBJ_CFLAGS='-K pic' + SHOBJ_LD=ld + SHOBJ_LDFLAGS='-G -dy -h $@' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; +# +# Rely on correct gcc configuration for everything else +# +*-gcc*) + SHOBJ_CFLAGS=-fpic + SHOBJ_LD='${CC}' + SHOBJ_LDFLAGS='-shared' + + SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' + ;; + +*) + SHOBJ_STATUS=unsupported + SHLIB_STATUS=unsupported + ;; + +esac + +echo SHOBJ_CC=\'"$SHOBJ_CC"\' +echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\' +echo SHOBJ_LD=\'"$SHOBJ_LD"\' +echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\' +echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\' +echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\' + +echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\' +echo SHLIB_LIBS=\'"$SHLIB_LIBS"\' +echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\' +echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\' + +echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\' +echo SHLIB_STATUS=\'"$SHLIB_STATUS"\' + +exit 0 diff --git a/readline/terminal.c b/readline/terminal.c index f532638..a1fcc25 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -236,6 +236,16 @@ _rl_set_screen_size (rows, cols) screenchars = screenwidth * screenheight; } +void +rl_resize_terminal () +{ + if (readline_echoing_p) + { + _rl_get_screen_size (fileno (rl_instream), 1); + _rl_redisplay_after_sigwinch (); + } +} + struct _tc_string { char *tc_var; char **tc_value; diff --git a/readline/tilde.c b/readline/tilde.c index 3741f97..d1853bd 100644 --- a/readline/tilde.c +++ b/readline/tilde.c @@ -47,10 +47,6 @@ #include "tilde.h" -#ifdef SHELL -#include "shell.h" -#endif - #if !defined (HAVE_GETPW_DECLS) extern struct passwd *getpwuid (), *getpwnam (); #endif /* !HAVE_GETPW_DECLS */ @@ -77,6 +73,12 @@ static char *xmalloc (), *xrealloc (); 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 (); + /* The default value of tilde_additional_prefixes. This is set to whitespace preceding a tilde so that simple programs which do not perform any word separation get desired behaviour. */ @@ -171,15 +173,6 @@ tilde_find_suffix (string) return (i); } -#if !defined (SHELL) -static char * -get_string_value (varname) - char *varname; -{ - return ((char *)getenv (varname)); -} -#endif - /* Return a new string which is the result of tilde expanding STRING. */ char * tilde_expand (string) @@ -284,27 +277,6 @@ glue_prefix_and_suffix (prefix, suffix, suffind) return ret; } -static char * -get_home_dir () -{ - char *home_dir; - -#ifdef SHELL - home_dir = (char *)NULL; - if (current_user.home_dir == 0) - get_current_user_info (); - home_dir = current_user.home_dir; -#else - struct passwd *entry; - - home_dir = (char *)NULL; - entry = getpwuid (getuid ()); - if (entry) - home_dir = entry->pw_dir; -#endif - return (home_dir); -} - /* Do the work of tilde expansion on FILENAME. FILENAME starts with a tilde. If there is no expansion, call tilde_expansion_failure_hook. This always returns a newly-allocated string, never static storage. */ @@ -328,7 +300,7 @@ tilde_expand_word (filename) if (filename[1] == '\0' || filename[1] == '/') { /* Prefix $HOME to the rest of the string. */ - expansion = get_string_value ("HOME"); + expansion = get_env_value ("HOME"); /* If there is no HOME variable, look up the directory in the password database. */ diff --git a/readline/util.c b/readline/util.c index fde012e..1dc3b66 100644 --- a/readline/util.c +++ b/readline/util.c @@ -64,6 +64,7 @@ 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 (); @@ -124,7 +125,7 @@ rl_tty_status (count, key) { #if defined (TIOCSTAT) ioctl (1, TIOCSTAT, (char *)0); - rl_refresh_line (); + rl_refresh_line (count, key); #else ding (); #endif diff --git a/readline/vi_mode.c b/readline/vi_mode.c index 2f62ec3..d4868bf 100644 --- a/readline/vi_mode.c +++ b/readline/vi_mode.c @@ -77,7 +77,7 @@ extern char *xmalloc (), *xrealloc (); /* Variables imported from readline.c */ -extern int rl_point, rl_end, rl_mark, rl_done; +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; @@ -352,9 +352,9 @@ rl_vi_prev_word (count, key) } if (_rl_uppercase_p (key)) - rl_vi_bWord (count); + rl_vi_bWord (count, key); else - rl_vi_bword (count); + rl_vi_bword (count, key); return (0); } @@ -374,9 +374,9 @@ rl_vi_next_word (count, key) } if (_rl_uppercase_p (key)) - rl_vi_fWord (count); + rl_vi_fWord (count, key); else - rl_vi_fword (count); + rl_vi_fword (count, key); return (0); } @@ -392,16 +392,16 @@ rl_vi_end_word (count, key) } if (_rl_uppercase_p (key)) - rl_vi_eWord (count); + rl_vi_eWord (count, key); else - rl_vi_eword (count); + rl_vi_eword (count, key); return (0); } /* Move forward a word the way that 'W' does. */ int -rl_vi_fWord (count) - int count; +rl_vi_fWord (count, ignore) + int count, ignore; { while (count-- && rl_point < (rl_end - 1)) { @@ -417,8 +417,8 @@ rl_vi_fWord (count) } int -rl_vi_bWord (count) - int count; +rl_vi_bWord (count, ignore) + int count, ignore; { while (count-- && rl_point > 0) { @@ -441,8 +441,8 @@ rl_vi_bWord (count) } int -rl_vi_eWord (count) - int count; +rl_vi_eWord (count, ignore) + int count, ignore; { while (count-- && rl_point < (rl_end - 1)) { @@ -471,8 +471,8 @@ rl_vi_eWord (count) } int -rl_vi_fword (count) - int count; +rl_vi_fword (count, ignore) + int count, ignore; { while (count-- && rl_point < (rl_end - 1)) { @@ -497,8 +497,8 @@ rl_vi_fword (count) } int -rl_vi_bword (count) - int count; +rl_vi_bword (count, ignore) + int count, ignore; { while (count-- && rl_point > 0) { @@ -536,8 +536,8 @@ rl_vi_bword (count) } int -rl_vi_eword (count) - int count; +rl_vi_eword (count, ignore) + int count, ignore; { while (count-- && rl_point < rl_end - 1) { @@ -729,7 +729,7 @@ rl_vi_put (count, key) if (!_rl_uppercase_p (key) && (rl_point + 1 <= rl_end)) rl_point++; - rl_yank (); + rl_yank (1, key); rl_backward (1, key); return (0); } |