diff options
author | Patrick Palka <patrick@parcs.ath.cx> | 2015-01-12 21:42:15 -0500 |
---|---|---|
committer | Patrick Palka <patrick@parcs.ath.cx> | 2015-05-18 09:51:39 -0400 |
commit | 78caf3ba9ace2cb03ad067730a2223dac4abecdc (patch) | |
tree | f5b4e290bc912935fa7a62ad12958269b6084933 | |
parent | 35d7c4317b85948f0a3e021d719811481d13fe45 (diff) | |
download | binutils-gdb-78caf3ba9ace2cb03ad067730a2223dac4abecdc.tar.gz |
[RFC] Sync readline to version 6.3 patchlevel 8
This patch syncs our upstream copy of readline to version 6.3
patchlevel 8.
I basically copied what was done when Jan updated to readline 6.2 in
2011: http://sourceware.org/ml/gdb-patches/2011-05/msg00003.html
Specifically, I:
1. Extracted the readline 6.3 tarball on top of readline/
2. Applied patches 1-8 from ftp://ftp.cwru.edu/pub/bash/readline-6.3-patches/
3. Omitted all the files in doc/ that were intentionally omitted before.
4. Regenerated readline/configure and readline/examples/rlfe/configure
using autoconf 2.64. No other configure files needed regenerating.
5. Reapplied the only local patch since the update to readline 6.2 that
has not already been applied to readline 6.3, 05942d8a1 ("Fix
executable indicator in file name completeion on Windows."). This
particular patch has been applied upstream but readline 6.3 does not
have it. Whether or not a local patch has already been applied to
readline 6.3 was determined via manual inspection. (Wasn't too bad
really.)
The new files to make it into the tree are:
colors.{c,h}
configure.ac
parse-colors.{c,h}
examples/hist_erasedups.c
examples/hist_purgecmd.c
Deleted files:
configure.in
I've been using this patch locally for a few months now and I've
experienced only a single regression which has already been preemptively
fixed by 8900d71e3 ("Explicitly call rl_resize_terminal() in TUI's
SIGWINCH handler"). Other than that, no issues in either the CLI or the
TUI, or changes in the testsuite. Though I have only been able to test
this patch on Linux.
Have I missed anything? What else should be done in order to sync our
copy of readline? Unlike the last sync from 5.1 to 6.2, this sync to
6.3 is quite minor and hopefully painless.
Because the commit is so big and so mechanical I elected to create a
branch users/ppalka/readline-6.3-update where you can view/test the
change.
readline/ChangeLog.gdb:
Import readline 6.3 and upstream patches 1-8.
* configure: Regenerate.
* examples/rlfe/configure: Regenerate.
* complete.c: Reapply previous change.
89 files changed, 6278 insertions, 3730 deletions
diff --git a/readline/CHANGELOG b/readline/CHANGELOG index 5513f121ee4..c7c3077b908 100644 --- a/readline/CHANGELOG +++ b/readline/CHANGELOG @@ -1093,3 +1093,132 @@ xfree.c ----- {examples,shlib}/Makefile.in - Cygwin-based changes from Eric Blake <eblake@redhat.com> + + 3/26/2011 + --------- +Makefile.in + - don't ignore failures when building, installing, or cleaning in + the shlib subdirectory. Sample patch from Mike Frysinger + <vapier@gentoo.org> + +shlib/Makefile.in + - split the install and uninstall targets into install-supported and + install-unsupported targets that depend on the value of + SHLIB_STATUS + + 4/2 + --- +{,shlib}/Makefile.in + - add dependency for callback.o/callback.so on xmalloc.h. From + Jan Kratochvil <jan.kratochvil@redhat.com> + +{,doc,examples,shlib}/Makefile.in + - fix typo: htm target should be html. From Jan Kratochvil + <jan.kratochvil@redhat.com> + - remove `.' from VPATH. From Jan Kratochvil + <jan.kratochvil@redhat.com> + +examples/rlfe/configure.in + - quote AC_PROGRAM_SOURCE. From Jan Kratochvil + <jan.kratochvil@redhat.com> + + 5/17 + ---- +config.h.in + - WCWIDTH_BROKEN: new define, picked up from bash, defined on systems + where wcwidth returns 1 for Unicode combining characters + + 11/28 + ----- +support/shlib-install + - make sure solaris2 systems make the installed shared library + executable. ldd warns about it otherwise. Bug and fix from + Tim Mooney <tim.mooney@ndsu.edu> + +examples/hist_erasedups.c + - new example program, shows how to erase duplicates from the history + list + +examples/hist_purgecmd.c + - new example program, shows how to remove all entries matching a + string or pattern from the history list + + 1/12/2012 + --------- +colors.[ch],parse-colors.[ch]} + - new files, part of color infrastructure support + +Makefile.in,shlib/Makefile.in + - arrange to have colors.o and parse-colors.o added to library + (static and shared versions) + +{configure,config.h}.in + - check for stdbool.h, define HAVE_STDBOOL_H if found + +rldefs.h + - COLOR_SUPPORT: if defined, compile in colors.c and parse-colors.c + for color support + + 1/18 + ---- + +{configure,config.h}.in + - new check: check for AUDIT_USER_TTY defined in <linux/audit.h>, + define HAVE_DECL_AUDIT_USER_TTY if both are found + + 8/7 + --- +configure.in + - AC_CANONICAL_BUILD: call to set the build_xxx variables + - use $build_os instead of $host_os to decide when DJGPP should run + `pwd.exe' to figure out the build directory. Report and fix from + Yao Qi <yao@codesourcery.com> + + 8/29 + ---- +configure.ac + - new name for configure.in + +MANIFEST,Makefile.in + - configure.in -> configure.ac + + 1/5/2013 + -------- +configure.ac + - move version number up to 6.3 + + 1/31 + ---- +configure.ac + - use AC_CHECK_TOOL instead of AC_CHECK_PROG to check for ar, since it + will find $host-prefixed versions of utilities. Report and fix from + Mike Frysinger <vapier@gentoo.org> + + 3/4 + --- +Makefile.in + - PACKAGE_TARNAME, docdir: new variables substituted by autoconf + - OTHER_DOCS,OTHER_INSTALLED_DOCS: new variables with auxiliary + documentation files to be installed into $(docdir) + - install: add new rule to install $(OTHER_DOCS) + - uninstall: add new rule to uninstall $(docdir)/$(OTHER_INSTALLED_DOCS) + + 4/29 + ---- +Makefile.in + - installdirs: make sure to create $(DESTDIR)$(docdir). Report from + <hiroo.hayashi@computer.org> + + 1/27/2014 + --------- +Makefile.in + - install-examples: should not depend on `shared', since the examples + themselves are not built using shared libraries. Report from + <hiroo.hayashi@computer.org> + +support/shobj-conf + - [from bash] darwin: changed the install_name embedded into the + shared library to contain only the major version number, not the + minor one. The idea is that the minor versions should all be API/ABI + compatible, and it is better to link automatically with the latest + one. Idea from Max Horn <max@quendi.de> diff --git a/readline/CHANGES b/readline/CHANGES index 9d589886286..337275dfae3 100644 --- a/readline/CHANGES +++ b/readline/CHANGES @@ -1,3 +1,142 @@ +This document details the changes between this version, readline-6.3, and the +previous version, readline-6.2. + +1. Changes to Readline + +a. Fixed a bug that did not allow the `dd', `cc', or `yy' vi editing mode + commands to work on the entire line. + +b. Fixed a bug that caused redisplay problems with prompts longer than 128 + characters and history searches. + +c. Fixed a bug that caused readline to try and run code to modify its idea + of the screen size in a signal handler context upon receiving a SIGWINCH. + +d. Fixed a bug that caused the `meta' key to be enabled beyond the duration + of an individual call top readline(). + +e. Added a workaround for a wcwidth bug in Mac OS X that caused readline's + redisplay to mishandle zero-width combining characters. + +f. Fixed a bug that caused readline to `forget' part of a key sequence when + a multiple-key sequence caused it to break out of an incremental search. + +g. Fixed bugs that caused readline to execute code in a signal handler + context if interrupted while reading from the file system during completion. + +h. Fixed a bug that caused readline to `forget' part of a key sequence when + reading an unbound multi-character key sequence. + +i. Fixed a bug that caused Readline's signal handlers to be installed beyond + the bounds of a single call to readline(). + +j. Fixed a bug that caused the `.' command to not redo the most recent `R' + command in vi mode. + +k. Fixed a bug that caused ignoring case in completion matches to result in + readline using the wrong match. + +l. Paren matching now works in vi insert mode. + +m. Fix menu-completion to make show-all-if-ambiguous and menu-complete-display-prefix + work together. + +n. Fixed a bug that didn't allow the `cc', `dd', or `yy' commands to be redone + in vi editing mode. + +o. Fixed a bug that caused the filename comparison code to not compare + multibyte characters correctly when using case-sensitive or case-mapping + comparisons. + +p. Fixed the input reading loop to call the input hook function only when there + is no terminal input available. + +q. Fixed a bug that caused binding a macro to a multi-character key sequence + where the sequence and macro value share a common prefix to not perform + the macro replacement. + +r. Fixed several redisplay errors with multibyte characters and prompts + containing invisible characters when using horizontal scrolling. + +s. Fixed a bug that caused redisplay errors when trying to overwrite + existing characters using multibyte characters. + +t. Fixed a bug in vi mode that caused the arrow keys to set the saved last + vi-mode command to the wrong value. + +u. Fixed a bug that caused double-quoted strings to be scanned incorrectly + when being used as the value of a readline variable assignment. + +v. Fixed a bug with vi mode that prevented `.' from repeating a command + entered on a previous line (command). + +w. Fixed a bug that could cause completion to core dump if it was interrupted + by a signal. + +x. Fixed a bug that could cause readline to crash and seg fault attempting to + expand an empty history entry. + +y. Fixed a bug that caused display problems with multi-line prompts containing + invisible characters on multiple lines. + +z. Fixed a bug that caused effects made by undoing changes to a history line to + be discarded. + +2. New Features in Readline + +a. Readline is now more responsive to SIGHUP and other fatal signals when + reading input from the terminal or performing word completion but no + longer attempts to run any not-allowable functions from a signal handler + context. + +b. There are new bindable commands to search the history for the string of + characters between the beginning of the line and the point + (history-substring-search-forward, history-substring-search-backward) + +c. Readline allows quoted strings as the values of variables when setting + them with `set'. As a side effect, trailing spaces and tabs are ignored + when setting a string variable's value. + +d. The history library creates a backup of the history file when writing it + and restores the backup on a write error. + +e. New application-settable variable: rl_filename_stat_hook: a function called + with a filename before using it in a call to stat(2). Bash uses it to + expand shell variables so things like $HOME/Downloads have a slash + appended. + +f. New bindable function `print-last-kbd-macro', prints the most-recently- + defined keyboard macro in a reusable format. + +g. New user-settable variable `colored-stats', enables use of colored text + to denote file types when displaying possible completions (colored analog + of visible-stats). + +h. New user-settable variable `keyseq-timout', acts as an inter-character + timeout when reading input or incremental search strings. + +i. New application-callable function: rl_clear_history. Clears the history list + and frees all readline-associated private data. + +j. New user-settable variable, show-mode-in-prompt, adds a characters to the + beginning of the prompt indicating the current editing mode. + +k. New application-settable variable: rl_input_available_hook; function to be + called when readline needs to check whether there is data available on its + input source. The default hook checks rl_instream. + +l. Readline calls an application-set event hook (rl_signal_event_hook) after + it gets a signal while reading input (read returns -1/EINTR but readline + does not handle the signal immediately) to allow the application to handle + or otherwise note it. Not currently called for SIGHUP or SIGTERM. + +m. If the user-settable variable `history-size' is set to a value less than + 0, the history list size is unlimited. + +n. When creating shared libraries on Mac OS X, the pathname written into the + library (install_name) no longer includes the minor version number. + +------------------------------------------------------------------------------- This document details the changes between this version, readline-6.2, and the previous version, readline-6.1. diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb index 43abd19e11c..e557cb12ddc 100644 --- a/readline/ChangeLog.gdb +++ b/readline/ChangeLog.gdb @@ -1,3 +1,9 @@ +2015-05-13 Patrick Palka <patrick@parcs.ath.cx> + + Import readline 6.3 and upstream patches 1-8. + * configure: Regenerate. + * examples/rlfe/configure: Regenerate. + 2014-12-30 Eli Zaretskii <eliz@gnu.org> * complete.c (stat_char) [_WIN32]: Don't use 'access' and X_OK on diff --git a/readline/INSTALL b/readline/INSTALL index a0b0976898f..7e67623d710 100644 --- a/readline/INSTALL +++ b/readline/INSTALL @@ -1,7 +1,7 @@ Basic Installation ================== -These are installation instructions for Readline-6.2. +These are installation instructions for Readline-6.3. The simplest way to compile readline is: diff --git a/readline/MANIFEST b/readline/MANIFEST index 8972bddcf09..ec98f19ac4f 100644 --- a/readline/MANIFEST +++ b/readline/MANIFEST @@ -18,13 +18,15 @@ USAGE f aclocal.m4 f config.h.in f configure f -configure.in f +configure.ac f Makefile.in f ansi_stdlib.h f chardefs.h f +colors.h f history.h f histlib.h f keymaps.h f +parse-colors.h f posixdir.h f posixjmp.h f posixselect.h f @@ -44,6 +46,7 @@ tilde.h f xmalloc.h f bind.c f callback.c f +colors.c f compat.c f complete.c f display.c f @@ -58,6 +61,7 @@ mbutil.c f misc.c f nls.c f parens.c f +parse-colors.c f readline.c f rltty.c f savestring.c f @@ -113,10 +117,13 @@ examples/rl-fgets.c f examples/rlcat.c f examples/rlevent.c f examples/rltest.c f +examples/rl-callbacktest.c f examples/rl.c f examples/rlptytest.c f examples/rlversion.c f examples/histexamp.c f +examples/hist_erasedups.c f +examples/hist_purgecmd.c f examples/Inputrc f examples/autoconf/BASH_CHECK_LIB_TERMCAP f examples/autoconf/RL_LIB_READLINE_VERSION f diff --git a/readline/Makefile.in b/readline/Makefile.in index f4ed8110a29..c0a0f1cdfbc 100644 --- a/readline/Makefile.in +++ b/readline/Makefile.in @@ -26,6 +26,8 @@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ + srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -62,6 +64,8 @@ localedir = @localedir@ infodir = @infodir@ +docdir = @docdir@ + man3dir = $(mandir)/man3 # Support an alternate destination root directory for package building @@ -112,7 +116,7 @@ CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \ $(srcdir)/histfile.c $(srcdir)/nls.c $(srcdir)/search.c \ $(srcdir)/shell.c $(srcdir)/savestring.c $(srcdir)/tilde.c \ $(srcdir)/text.c $(srcdir)/misc.c $(srcdir)/compat.c \ - $(srcdir)/mbutil.c + $(srcdir)/mbutil.c $(srcdir)/xfree.c # The header files for this library. HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \ @@ -121,14 +125,17 @@ HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \ $(srcdir)/tilde.h $(srcdir)/rlconf.h $(srcdir)/rltty.h \ $(srcdir)/ansi_stdlib.h $(srcdir)/tcap.h $(srcdir)/rlstdc.h \ $(srcdir)/xmalloc.h $(srcdir)/rlprivate.h $(srcdir)/rlshell.h \ - $(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h + $(srcdir)/rltypedefs.h $(srcdir)/rlmbutil.h \ + $(srcdir)/colors.h $(srcdir)/parse-colors.h HISTOBJ = history.o histexpand.o histfile.o histsearch.o shell.o mbutil.o TILDEOBJ = tilde.o +COLORSOBJ = colors.o parse-colors.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 \ - text.o nls.o misc.o compat.o xfree.o xmalloc.o $(HISTOBJ) $(TILDEOBJ) + text.o nls.o misc.o $(HISTOBJ) $(TILDEOBJ) $(COLORSOBJ) \ + xmalloc.o xfree.o compat.o # The texinfo files which document this library. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo @@ -144,6 +151,9 @@ CREATED_TAGS = TAGS tags INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h \ rlstdc.h rlconf.h rltypedefs.h +OTHER_DOCS = $(srcdir)/CHANGES $(srcdir)/INSTALL $(srcdir)/README +OTHER_INSTALLED_DOCS = CHANGES INSTALL README + ########################################################################## TARGETS = @STATIC_TARGET@ @SHARED_TARGET@ INSTALL_TARGETS = @STATIC_INSTALL_TARGET@ @SHARED_INSTALL_TARGET@ @@ -193,13 +203,13 @@ stamp-h: config.status $(srcdir)/config.h.in CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status echo > $@ -#$(srcdir)/configure: $(srcdir)/configure.in ## Comment-me-out in distribution +#$(srcdir)/configure: $(srcdir)/configure.ac ## 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 ) + ( cd shlib ; ${MAKE} ${MFLAGS} all ) documentation: force -test -d doc || mkdir doc @@ -211,17 +221,7 @@ examples: force force: -## GDB LOCAL -## Don't mess with people's installed readline's. -## This tries to install this version of readline over whatever -## version is already installed on the system (which could be a -## newer version). There is no real reason for us to install -## readline along with GDB. GDB links statically against readline, -## so it doesn't depend on us installing it on the system. - -install: - -#install: $(INSTALL_TARGETS) +install: $(INSTALL_TARGETS) install-headers: installdirs ${INSTALLED_HEADERS} for f in ${INSTALLED_HEADERS}; do \ @@ -245,7 +245,7 @@ install-static: installdirs $(STATIC_LIBS) install-headers install-doc install-e installdirs: $(srcdir)/support/mkinstalldirs -$(SHELL) $(srcdir)/support/mkinstalldirs $(DESTDIR)$(includedir) \ $(DESTDIR)$(includedir)/readline $(DESTDIR)$(libdir) \ - $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) + $(DESTDIR)$(infodir) $(DESTDIR)$(man3dir) $(DESTDIR)$(docdir) uninstall: uninstall-headers uninstall-doc uninstall-examples -test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \ @@ -253,24 +253,26 @@ uninstall: uninstall-headers uninstall-doc uninstall-examples -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) install-shared: installdirs install-headers shared install-doc - -( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install ) + ( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install ) uninstall-shared: maybe-uninstall-headers -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) -install-examples: installdirs install-headers shared +install-examples: installdirs install-headers -( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install ) uninstall-examples: maybe-uninstall-headers -( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) install-doc: installdirs + $(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir) -( if test -d doc ; then \ cd doc && \ ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} install; \ fi ) uninstall-doc: + -( cd $(DESTDIR)$(docdir) && ${RM} ${OTHER_INSTALLED_DOCS} ) -( if test -d doc ; then \ cd doc && \ ${MAKE} ${MFLAGS} infodir=$(infodir) DESTDIR=${DESTDIR} uninstall; \ @@ -285,17 +287,17 @@ tags: force clean: force $(RM) $(OBJECTS) $(STATIC_LIBS) $(RM) readline readline.exe - -( cd shlib && $(MAKE) $(MFLAGS) $@ ) + ( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) mostlyclean: clean - -( cd shlib && $(MAKE) $(MFLAGS) $@ ) + ( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) distclean maintainer-clean: clean - -( cd shlib && $(MAKE) $(MFLAGS) $@ ) + ( cd shlib && $(MAKE) $(MFLAGS) $@ ) -( cd doc && $(MAKE) $(MFLAGS) $@ ) -( cd examples && $(MAKE) $(MFLAGS) $@ ) $(RM) Makefile @@ -422,10 +424,18 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h vi_mode.o: history.h ansi_stdlib.h rlstdc.h xfree.o: ${BUILD_DIR}/config.h -xfree.o: ansi_stdlib.h readline.h +xfree.o: ansi_stdlib.h xmalloc.o: ${BUILD_DIR}/config.h xmalloc.o: ansi_stdlib.h +colors.o: ${BUILD_DIR}/config.h colors.h +colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h +colors.o: rlconf.h +colors.o: ansi_stdlib.h posixstat.h +parse-colors.o: ${BUILD_DIR}/config.h colors.h parse-colors.h +parse-colors.o: rldefs.h rlconf.h +parse-colors.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h rlstdc.h + bind.o: rlshell.h histfile.o: rlshell.h nls.o: rlshell.h @@ -455,6 +465,8 @@ text.o: rlprivate.h undo.o: rlprivate.h util.o: rlprivate.h vi_mode.o: rlprivate.h +colors.o: rlprivate.h +parse-colors.o: rlprivate.h bind.o: xmalloc.h callback.o: xmalloc.h @@ -483,6 +495,8 @@ util.o: xmalloc.h vi_mode.o: xmalloc.h xfree.o: xmalloc.h xmalloc.o: xmalloc.h +colors.o: xmalloc.h +parse-colors.o: xmalloc.h complete.o: rlmbutil.h display.o: rlmbutil.h @@ -526,6 +540,9 @@ vi_mode.o: $(srcdir)/vi_mode.c xfree.o: $(srcdir)/xfree.c xmalloc.o: $(srcdir)/xmalloc.c +colors.o: $(srcdir)/parse-colors.c +parse-colors.o: $(srcdir)/parse-colors.c + histexpand.o: $(srcdir)/histexpand.c histfile.o: $(srcdir)/histfile.c history.o: $(srcdir)/history.c diff --git a/readline/NEWS b/readline/NEWS index 0ec6e0913de..ba5b581ed3d 100644 --- a/readline/NEWS +++ b/readline/NEWS @@ -1,19 +1,57 @@ -This is a terse description of the new features added to readline-6.2 since -the release of readline-6.1. +This is a terse description of the new features added to readline-6.3 since +the release of readline-6.2. -a. The history library does not try to write the history filename in the - current directory if $HOME is unset. This closes a potential security - problem if the application does not specify a history filename. +New Features in Readline -b. New bindable variable `completion-display-width' to set the number of - columns used when displaying completions. +a. Readline is now more responsive to SIGHUP and other fatal signals when + reading input from the terminal or performing word completion but no + longer attempts to run any not-allowable functions from a signal handler + context. -c. New bindable variable `completion-case-map' to cause case-insensitive - completion to treat `-' and `_' as identical. +b. There are new bindable commands to search the history for the string of + characters between the beginning of the line and the point + (history-substring-search-forward, history-substring-search-backward) -d. There are new bindable vi-mode command names to avoid readline's case- - insensitive matching not allowing them to be bound separately. +c. Readline allows quoted strings as the values of variables when setting + them with `set'. As a side effect, trailing spaces and tabs are ignored + when setting a string variable's value. -e. New bindable variable `menu-complete-display-prefix' causes the menu - completion code to display the common prefix of the possible completions - before cycling through the list, instead of after. +d. The history library creates a backup of the history file when writing it + and restores the backup on a write error. + +e. New application-settable variable: rl_filename_stat_hook: a function called + with a filename before using it in a call to stat(2). Bash uses it to + expand shell variables so things like $HOME/Downloads have a slash + appended. + +f. New bindable function `print-last-kbd-macro', prints the most-recently- + defined keyboard macro in a reusable format. + +g. New user-settable variable `colored-stats', enables use of colored text + to denote file types when displaying possible completions (colored analog + of visible-stats). + +h. New user-settable variable `keyseq-timout', acts as an inter-character + timeout when reading input or incremental search strings. + +i. New application-callable function: rl_clear_history. Clears the history list + and frees all readline-associated private data. + +j. New user-settable variable, show-mode-in-prompt, adds a characters to the + beginning of the prompt indicating the current editing mode. + +k. New application-settable variable: rl_input_available_hook; function to be + called when readline detects there is data available on its input file + descriptor. + +l. Readline calls an application-set event hook (rl_event_hook) after it gets + a signal while reading input (read returns -1/EINTR but readline does not + handle the signal immediately) to allow the application to handle or + otherwise note it. + +m. If the user-settable variable `history-size' is set to a value less than + 0, the history list size is unlimited. + +n. New application-settable variable: rl_signal_event_hook; function that is + called when readline is reading terminal input and read(2) is interrupted + by a signal. Currently not called for SIGHUP or SIGTERM. diff --git a/readline/README b/readline/README index bc89f460711..8395c344b87 100644 --- a/readline/README +++ b/readline/README @@ -1,7 +1,7 @@ Introduction ============ -This is the Gnu Readline library, version 6.2. +This is the Gnu Readline library, version 6.3. The Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both @@ -159,6 +159,15 @@ Readline library. The texinfo files include both user and programmer's manuals. HTML versions of the manuals appear in the `doc' subdirectory as well. +Usage +===== + +Our position on the use of Readline through a shared-library linking +mechanism is that there is no legal difference between shared-library +linking and static linking--either kind of linking combines various +modules into a single larger work. The conditions for using Readline +in a larger work are stated in section 3 of the GNU GPL. + Reporting Bugs ============== diff --git a/readline/aclocal.m4 b/readline/aclocal.m4 index 716a0436113..a947272e2ce 100644 --- a/readline/aclocal.m4 +++ b/readline/aclocal.m4 @@ -1698,7 +1698,6 @@ AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP)) AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS)) AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS)) - AC_REPLACE_FUNCS(mbschr) AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB)) @@ -1763,6 +1762,33 @@ if test $bash_cv_type_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here]) fi +dnl check for broken wcwidth +AC_CACHE_CHECK([for wcwidth broken with unicode combining characters], +bash_cv_wcwidth_broken, +[AC_TRY_RUN([ +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> + +#include <locale.h> +#include <wchar.h> + +main(c, v) +int c; +char **v; +{ + int w; + + setlocale(LC_ALL, "en_US.UTF-8"); + w = wcwidth (0x0301); + exit (w == 0); /* exit 0 if wcwidth broken */ +} +], +bash_cv_wcwidth_broken=yes, bash_cv_wcwdith_broken=no, bash_cv_wcwidth_broken=no)]) +if test "$bash_cv_wcwidth_broken" = yes; then + AC_DEFINE(WCWIDTH_BROKEN, 1, [wcwidth is usually not broken]) +fi + if test "$am_cv_func_iconv" = yes; then OLDLIBS="$LIBS" LIBS="$LIBS $LIBICONV" @@ -3098,7 +3124,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], found_so= found_a= if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then found_dir="$additional_libdir" found_so="$additional_libdir/lib$name.$shlibext" if test -f "$additional_libdir/lib$name.la"; then @@ -3120,7 +3146,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then found_dir="$dir" found_so="$dir/lib$name.$shlibext" if test -f "$dir/lib$name.la"; then @@ -4123,7 +4149,7 @@ main() AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET, [AC_MSG_CHECKING(for offset of exit status in return status from wait) AC_CACHE_VAL(bash_cv_wexitstatus_offset, -[AC_RUN_IFELSE([ +[AC_TRY_RUN([ #include <stdlib.h> #include <unistd.h> diff --git a/readline/bind.c b/readline/bind.c index a939528862f..8acf4ac4ca0 100644 --- a/readline/bind.c +++ b/readline/bind.c @@ -1,6 +1,6 @@ /* bind.c -- key binding and startup file support for the readline library. */ -/* Copyright (C) 1987-2010 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -72,11 +72,15 @@ extern char *strchr (), *strrchr (); /* Variables exported by this file. */ Keymap rl_binding_keymap; +static int _rl_skip_to_delim PARAMS((char *, int, int)); + static char *_rl_read_file PARAMS((char *, size_t *)); static void _rl_init_file_error PARAMS((const char *)); static int _rl_read_init_file PARAMS((const char *, int)); static int glean_key_from_name PARAMS((char *)); + static int find_boolean_var PARAMS((const char *)); +static int find_string_var PARAMS((const char *)); static char *_rl_get_string_variable_value PARAMS((const char *)); static int substring_member_of_array PARAMS((const char *, const char * const *)); @@ -567,6 +571,40 @@ rl_translate_keyseq (seq, array, len) return (0); } +static int +_rl_isescape (c) + int c; +{ + switch (c) + { + case '\007': + case '\b': + case '\f': + case '\n': + case '\r': + case TAB: + case 0x0b: return (1); + default: return (0); + } +} + +static int +_rl_escchar (c) + int c; +{ + switch (c) + { + case '\007': return ('a'); + case '\b': return ('b'); + case '\f': return ('f'); + case '\n': return ('n'); + case '\r': return ('r'); + case TAB: return ('t'); + case 0x0b: return ('v'); + default: return (c); + } +} + char * rl_untranslate_keyseq (seq) int seq; @@ -618,9 +656,10 @@ rl_untranslate_keyseq (seq) return kseq; } -static char * -_rl_untranslate_macro_value (seq) +char * +_rl_untranslate_macro_value (seq, use_escapes) char *seq; + int use_escapes; { char *ret, *r, *s; int c; @@ -644,9 +683,14 @@ _rl_untranslate_macro_value (seq) else if (CTRL_CHAR (c)) { *r++ = '\\'; - *r++ = 'C'; - *r++ = '-'; - c = _rl_to_lower (UNCTRL (c)); + if (use_escapes && _rl_isescape (c)) + c = _rl_escchar (c); + else + { + *r++ = 'C'; + *r++ = '-'; + c = _rl_to_lower (UNCTRL (c)); + } } else if (c == RUBOUT) { @@ -1157,6 +1201,38 @@ handle_parser_directive (statement) return (1); } +/* Start at STRING[START] and look for DELIM. Return I where STRING[I] == + DELIM or STRING[I] == 0. DELIM is usually a double quote. */ +static int +_rl_skip_to_delim (string, start, delim) + char *string; + int start, delim; +{ + int i, c, passc; + + for (i = start,passc = 0; c = string[i]; i++) + { + if (passc) + { + passc = 0; + if (c == 0) + break; + continue; + } + + if (c == '\\') + { + passc = 1; + continue; + } + + if (c == delim) + break; + } + + return i; +} + /* Read the binding command from STRING and perform it. A key binding command looks like: Keyname: function-name\0, a variable binding command looks like: set variable value. @@ -1172,7 +1248,7 @@ rl_parse_and_bind (string) while (string && whitespace (*string)) string++; - if (!string || !*string || *string == '#') + if (string == 0 || *string == 0 || *string == '#') return 0; /* If this is a parser directive, act on it. */ @@ -1192,31 +1268,16 @@ rl_parse_and_bind (string) backslash to quote characters in the key expression. */ if (*string == '"') { - int passc = 0; + i = _rl_skip_to_delim (string, 1, '"'); - for (i = 1; c = string[i]; i++) - { - if (passc) - { - passc = 0; - continue; - } - - if (c == '\\') - { - passc++; - continue; - } - - if (c == '"') - break; - } /* If we didn't find a closing quote, abort the line. */ if (string[i] == '\0') { _rl_init_file_error ("no closing `\"' in key binding"); return 1; } + else + i++; /* skip past closing double quote */ } /* Advance to the colon (:) or whitespace which separates the two objects. */ @@ -1236,6 +1297,7 @@ rl_parse_and_bind (string) if (_rl_stricmp (string, "set") == 0) { char *var, *value, *e; + int s; var = string + i; /* Make VAR point to start of variable name. */ @@ -1243,25 +1305,37 @@ rl_parse_and_bind (string) /* Make VALUE point to start of value string. */ value = var; - while (*value && !whitespace (*value)) value++; + while (*value && whitespace (*value) == 0) value++; if (*value) *value++ = '\0'; while (*value && whitespace (*value)) value++; - /* Strip trailing whitespace from values to boolean variables. Temp - fix until I get a real quoted-string parser here. */ - i = find_boolean_var (var); - if (i >= 0) + /* Strip trailing whitespace from values of boolean variables. */ + if (find_boolean_var (var) >= 0) { /* remove trailing whitespace */ +remove_trailing: e = value + strlen (value) - 1; while (e >= value && whitespace (*e)) e--; e++; /* skip back to whitespace or EOS */ + if (*e && e >= value) *e = '\0'; } - + else if ((i = find_string_var (var)) >= 0) + { + /* Allow quoted strings in variable values */ + if (*value == '"') + { + i = _rl_skip_to_delim (value, 1, *value); + value[i] = '\0'; + value++; /* skip past the quote */ + } + else + goto remove_trailing; + } + rl_variable_bind (var, value); return 0; } @@ -1282,32 +1356,13 @@ rl_parse_and_bind (string) the quoted string delimiter, like the shell. */ if (*funname == '\'' || *funname == '"') { - int delimiter, passc; - - delimiter = string[i++]; - for (passc = 0; c = string[i]; i++) - { - if (passc) - { - passc = 0; - continue; - } - - if (c == '\\') - { - passc = 1; - continue; - } - - if (c == delimiter) - break; - } - if (c) + i = _rl_skip_to_delim (string, i+1, *funname); + if (string[i]) i++; } /* Advance to the end of the string. */ - for (; string[i] && !whitespace (string[i]); i++); + for (; string[i] && whitespace (string[i]) == 0; i++); /* No extra whitespace at the end of the string. */ string[i] = '\0'; @@ -1367,7 +1422,7 @@ rl_parse_and_bind (string) /* Get the actual character we want to deal with. */ kname = strrchr (string, '-'); - if (!kname) + if (kname == 0) kname = string; else kname++; @@ -1423,6 +1478,9 @@ static const struct { { "bind-tty-special-chars", &_rl_bind_stty_chars, 0 }, { "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL }, { "byte-oriented", &rl_byte_oriented, 0 }, +#if defined (COLOR_SUPPORT) + { "colored-stats", &_rl_colored_stats, 0 }, +#endif { "completion-ignore-case", &_rl_completion_case_fold, 0 }, { "completion-map-case", &_rl_completion_case_map, 0 }, { "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 }, @@ -1447,6 +1505,7 @@ static const struct { { "revert-all-at-newline", &_rl_revert_all_at_newline, 0 }, { "show-all-if-ambiguous", &_rl_complete_show_all, 0 }, { "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 }, + { "show-mode-in-prompt", &_rl_show_mode_in_prompt, 0 }, { "skip-completed-text", &_rl_skip_completed_text, 0 }, #if defined (VISIBLE_STATS) { "visible-stats", &rl_visible_stats, 0 }, @@ -1486,6 +1545,8 @@ hack_special_boolean_var (i) else _rl_bell_preference = AUDIBLE_BELL; } + else if (_rl_stricmp (name, "show-mode-in-prompt") == 0) + _rl_reset_prompt (); } typedef int _rl_sv_func_t PARAMS((const char *)); @@ -1511,6 +1572,7 @@ static int sv_editmode PARAMS((const char *)); static int sv_histsize PARAMS((const char *)); static int sv_isrchterm PARAMS((const char *)); static int sv_keymap PARAMS((const char *)); +static int sv_seqtimeout PARAMS((const char *)); static const struct { const char * const name; @@ -1526,6 +1588,7 @@ static const struct { { "history-size", V_INT, sv_histsize }, { "isearch-terminators", V_STRING, sv_isrchterm }, { "keymap", V_STRING, sv_keymap }, + { "keyseq-timeout", V_INT, sv_seqtimeout }, { (char *)NULL, 0, (_rl_sv_func_t *)0 } }; @@ -1683,13 +1746,17 @@ static int sv_histsize (value) const char *value; { - int nval = 500; + int nval; + nval = 500; if (value && *value) { nval = atoi (value); if (nval < 0) - return 1; + { + unstifle_history (); + return 0; + } } stifle_history (nval); return 0; @@ -1711,6 +1778,23 @@ sv_keymap (value) } static int +sv_seqtimeout (value) + const char *value; +{ + int nval; + + nval = 0; + if (value && *value) + { + nval = atoi (value); + if (nval < 0) + nval = 0; + } + _rl_keyseq_timeout = nval; + return 0; +} + +static int sv_bell_style (value) const char *value; { @@ -2167,7 +2251,8 @@ rl_function_dumper (print_readably) } } } - free (names); + + xfree (names); } /* Print all of the current functions and their bindings to @@ -2200,7 +2285,7 @@ _rl_macro_dumper_internal (print_readably, map, prefix) { case ISMACR: keyname = _rl_get_keyname (key); - out = _rl_untranslate_macro_value ((char *)map[key].function); + out = _rl_untranslate_macro_value ((char *)map[key].function, 0); if (print_readably) fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "", @@ -2312,7 +2397,7 @@ _rl_get_string_variable_value (name) { if (_rl_isearch_terminators == 0) return 0; - ret = _rl_untranslate_macro_value (_rl_isearch_terminators); + ret = _rl_untranslate_macro_value (_rl_isearch_terminators, 0); if (ret) { strncpy (numbuf, ret, sizeof (numbuf) - 1); @@ -2330,6 +2415,11 @@ _rl_get_string_variable_value (name) ret = rl_get_keymap_name_from_edit_mode (); return (ret ? ret : "none"); } + else if (_rl_stricmp (name, "keyseq-timeout") == 0) + { + sprintf (numbuf, "%d", _rl_keyseq_timeout); + return (numbuf); + } else return (0); } diff --git a/readline/callback.c b/readline/callback.c index 7682cd07b0e..6bb2c3e0dc3 100644 --- a/readline/callback.c +++ b/readline/callback.c @@ -62,8 +62,10 @@ _rl_callback_generic_arg *_rl_callback_data = 0; whenever a complete line of input is ready. The user must then call rl_callback_read_char() every time some input is available, and rl_callback_read_char() will call the user's function with the complete - text read in at each end of line. The terminal is kept prepped and - signals handled all the time, except during calls to the user's function. */ + text read in at each end of line. The terminal is kept prepped + all the time, except during calls to the user's function. Signal + handlers are only installed when the application calls back into + readline, so readline doesn't `steal' signals from the application. */ rl_vcpfunc_t *rl_linefunc; /* user callback function */ static int in_handler; /* terminal_prepped and signals set? */ @@ -80,10 +82,6 @@ _rl_callback_newline () if (rl_prep_term_function) (*rl_prep_term_function) (_rl_meta_flag); - -#if defined (HANDLE_SIGNALS) - rl_set_signals (); -#endif } readline_internal_setup (); @@ -102,6 +100,16 @@ rl_callback_handler_install (prompt, linefunc) _rl_callback_newline (); } +#if defined (HANDLE_SIGNALS) +#define CALLBACK_READ_RETURN() \ + do { \ + rl_clear_signals (); \ + return; \ + } while (0) +#else +#define CALLBACK_READ_RETURN() return +#endif + /* Read one character, and dispatch to the handler if it ends the line. */ void rl_callback_read_char () @@ -117,15 +125,24 @@ rl_callback_read_char () } memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t)); +#if defined (HAVE_POSIX_SIGSETJMP) + jcode = sigsetjmp (_rl_top_level, 0); +#else jcode = setjmp (_rl_top_level); +#endif if (jcode) { (*rl_redisplay_function) (); _rl_want_redisplay = 0; memcpy ((void *)_rl_top_level, (void *)olevel, sizeof (procenv_t)); - return; + CALLBACK_READ_RETURN (); } +#if defined (HANDLE_SIGNALS) + /* Install signal handlers only when readline has control. */ + rl_set_signals (); +#endif + do { RL_CHECK_SIGNALS (); @@ -135,12 +152,13 @@ rl_callback_read_char () if (eof == 0 && (RL_ISSTATE (RL_STATE_ISEARCH) == 0) && RL_ISSTATE (RL_STATE_INPUTPENDING)) rl_callback_read_char (); - return; + CALLBACK_READ_RETURN (); } else if (RL_ISSTATE (RL_STATE_NSEARCH)) { eof = _rl_nsearch_callback (_rl_nscxt); - return; + + CALLBACK_READ_RETURN (); } #if defined (VI_MODE) else if (RL_ISSTATE (RL_STATE_VIMOTION)) @@ -151,7 +169,7 @@ rl_callback_read_char () if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) _rl_internal_char_cleanup (); - return; + CALLBACK_READ_RETURN (); } #endif else if (RL_ISSTATE (RL_STATE_NUMERICARG)) @@ -163,7 +181,7 @@ rl_callback_read_char () else if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0) _rl_internal_char_cleanup (); - return; + CALLBACK_READ_RETURN (); } else if (RL_ISSTATE (RL_STATE_MULTIKEY)) { @@ -180,7 +198,7 @@ rl_callback_read_char () { /* This allows functions that simply need to read an additional character (like quoted-insert) to register a function to be - called when input is available. _rl_callback_data is simply a + called when input is available. _rl_callback_data is a pointer to a struct that has the argument count originally passed to the registering function and space for any additional parameters. */ @@ -230,6 +248,8 @@ rl_callback_read_char () } } while (rl_pending_input || _rl_pushed_input_available () || RL_ISSTATE (RL_STATE_MACROINPUT)); + + CALLBACK_READ_RETURN (); } /* Remove the handler, and make sure the terminal is in its normal state. */ diff --git a/readline/chardefs.h b/readline/chardefs.h index e76c34b0c67..1fa1b089d01 100644 --- a/readline/chardefs.h +++ b/readline/chardefs.h @@ -72,7 +72,7 @@ # define IN_CTYPE_DOMAIN(c) isascii(c) #endif -#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) +#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) #endif diff --git a/readline/colors.c b/readline/colors.c new file mode 100644 index 00000000000..89d9035f236 --- /dev/null +++ b/readline/colors.c @@ -0,0 +1,251 @@ +/* `dir', `vdir' and `ls' directory listing programs for GNU. + + Modified by Chet Ramey for Readline. + + Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Richard Stallman and David MacKenzie. */ + +/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis + Flaherty <dennisf@denix.elk.miles.com> based on original patches by + Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */ + +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include <config.h> +#endif + +#include "rlconf.h" + +#include <stdio.h> + +#include "posixstat.h" // stat related macros (S_ISREG, ...) +#include <fcntl.h> // S_ISUID + +// strlen() +#if defined (HAVE_STRING_H) +# include <string.h> +#else /* !HAVE_STRING_H */ +# include <strings.h> +#endif /* !HAVE_STRING_H */ + +// abort() +#if defined (HAVE_STDLIB_H) +# include <stdlib.h> +#else +# include "ansi_stdlib.h" +#endif /* HAVE_STDLIB_H */ + +#include "readline.h" +#include "rldefs.h" + +#ifdef COLOR_SUPPORT + +#include "xmalloc.h" +#include "colors.h" + +static bool is_colored (enum indicator_no type); +static void restore_default_color (void); + +COLOR_EXT_TYPE *_rl_color_ext_list = 0; + +/* Output a color indicator (which may contain nulls). */ +void +_rl_put_indicator (const struct bin_str *ind) { + fwrite (ind->string, ind->len, 1, rl_outstream); +} + +static bool +is_colored (enum indicator_no colored_filetype) +{ + size_t len = _rl_color_indicator[colored_filetype].len; + char const *s = _rl_color_indicator[colored_filetype].string; + return ! (len == 0 + || (len == 1 && strncmp (s, "0", 1) == 0) + || (len == 2 && strncmp (s, "00", 2) == 0)); +} + +static void +restore_default_color (void) +{ + _rl_put_indicator (&_rl_color_indicator[C_LEFT]); + _rl_put_indicator (&_rl_color_indicator[C_RIGHT]); +} + +void +_rl_set_normal_color (void) +{ + if (is_colored (C_NORM)) + { + _rl_put_indicator (&_rl_color_indicator[C_LEFT]); + _rl_put_indicator (&_rl_color_indicator[C_NORM]); + _rl_put_indicator (&_rl_color_indicator[C_RIGHT]); + } +} + +/* Returns whether any color sequence was printed. */ +bool +_rl_print_color_indicator (char *f) +{ + enum indicator_no colored_filetype; + COLOR_EXT_TYPE *ext; /* Color extension */ + size_t len; /* Length of name */ + + const char* name; + char *filename; + struct stat astat; + mode_t mode; + int linkok; + + int stat_ok; + + name = f; + + /* This should already have undergone tilde expansion */ + filename = 0; + if (rl_filename_stat_hook) + { + filename = savestring (f); + (*rl_filename_stat_hook) (&filename); + name = filename; + } + +#if defined (HAVE_LSTAT) + stat_ok = lstat(name, &astat); +#else + stat_ok = stat(name, &astat); +#endif + if( stat_ok == 0 ) { + mode = astat.st_mode; + linkok = 1; //f->linkok; + } + else + linkok = -1; + + /* Is this a nonexistent file? If so, linkok == -1. */ + + if (linkok == -1 && _rl_color_indicator[C_MISSING].string != NULL) + colored_filetype = C_MISSING; + else if(stat_ok != 0) + { + static enum indicator_no filetype_indicator[] = FILETYPE_INDICATORS; + colored_filetype = filetype_indicator[normal]; //f->filetype]; + } + else + { + if (S_ISREG (mode)) + { + colored_filetype = C_FILE; + + if ((mode & S_ISUID) != 0 && is_colored (C_SETUID)) + colored_filetype = C_SETUID; + else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID)) + colored_filetype = C_SETGID; + else if (is_colored (C_CAP) && 0) //f->has_capability) + colored_filetype = C_CAP; + else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC)) + colored_filetype = C_EXEC; + else if ((1 < astat.st_nlink) && is_colored (C_MULTIHARDLINK)) + colored_filetype = C_MULTIHARDLINK; + } + else if (S_ISDIR (mode)) + { + colored_filetype = C_DIR; + +#if defined (S_ISVTX) + if ((mode & S_ISVTX) && (mode & S_IWOTH) + && is_colored (C_STICKY_OTHER_WRITABLE)) + colored_filetype = C_STICKY_OTHER_WRITABLE; + else +#endif + if ((mode & S_IWOTH) != 0 && is_colored (C_OTHER_WRITABLE)) + colored_filetype = C_OTHER_WRITABLE; +#if defined (S_ISVTX) + else if ((mode & S_ISVTX) != 0 && is_colored (C_STICKY)) + colored_filetype = C_STICKY; +#endif + } + else if (S_ISLNK (mode)) + colored_filetype = ((linkok == 0 + && (!strncmp (_rl_color_indicator[C_LINK].string, "target", 6) + || _rl_color_indicator[C_ORPHAN].string)) + ? C_ORPHAN : C_LINK); + else if (S_ISFIFO (mode)) + colored_filetype = C_FIFO; + else if (S_ISSOCK (mode)) + colored_filetype = C_SOCK; + else if (S_ISBLK (mode)) + colored_filetype = C_BLK; + else if (S_ISCHR (mode)) + colored_filetype = C_CHR; + else + { + /* Classify a file of some other type as C_ORPHAN. */ + colored_filetype = C_ORPHAN; + } + } + + /* Check the file's suffix only if still classified as C_FILE. */ + ext = NULL; + if (colored_filetype == C_FILE) + { + /* Test if NAME has a recognized suffix. */ + len = strlen (name); + name += len; /* Pointer to final \0. */ + for (ext = _rl_color_ext_list; ext != NULL; ext = ext->next) + { + if (ext->ext.len <= len + && strncmp (name - ext->ext.len, ext->ext.string, + ext->ext.len) == 0) + break; + } + } + + free (filename); /* NULL or savestring return value */ + + { + const struct bin_str *const s + = ext ? &(ext->seq) : &_rl_color_indicator[colored_filetype]; + if (s->string != NULL) + { + /* Need to reset so not dealing with attribute combinations */ + if (is_colored (C_NORM)) + restore_default_color (); + _rl_put_indicator (&_rl_color_indicator[C_LEFT]); + _rl_put_indicator (s); + _rl_put_indicator (&_rl_color_indicator[C_RIGHT]); + return 0; + } + else + return 1; + } +} + +void +_rl_prep_non_filename_text (void) +{ + if (_rl_color_indicator[C_END].string != NULL) + _rl_put_indicator (&_rl_color_indicator[C_END]); + else + { + _rl_put_indicator (&_rl_color_indicator[C_LEFT]); + _rl_put_indicator (&_rl_color_indicator[C_RESET]); + _rl_put_indicator (&_rl_color_indicator[C_RIGHT]); + } +} +#endif /* COLOR_SUPPORT */ diff --git a/readline/colors.h b/readline/colors.h new file mode 100644 index 00000000000..fc926e539bf --- /dev/null +++ b/readline/colors.h @@ -0,0 +1,122 @@ +/* `dir', `vdir' and `ls' directory listing programs for GNU. + + Modified by Chet Ramey for Readline. + + Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Richard Stallman and David MacKenzie. */ + +/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis + Flaherty <dennisf@denix.elk.miles.com> based on original patches by + Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */ + +#ifndef _COLORS_H_ +#define _COLORS_H_ + +#include <stdio.h> // size_t + +#if defined(__TANDEM) && defined(HAVE_STDBOOL_H) && (__STDC_VERSION__ < 199901L) +typedef int _Bool; +#endif + +#if defined (HAVE_STDBOOL_H) +# include <stdbool.h> // bool +#else +typedef int _rl_bool_t; + +#ifdef bool +# undef bool +#endif +#define bool _rl_bool_t + +#ifndef true +# define true 1 +# define false 0 +#endif + +#endif /* !HAVE_STDBOOL_H */ + +/* Null is a valid character in a color indicator (think about Epson + printers, for example) so we have to use a length/buffer string + type. */ +struct bin_str + { + size_t len; + const char *string; + }; + +/* file type indicators (dir, sock, fifo, ...) + Default value is initialized in parse-colors.c. + It is then modified from the values of $LS_COLORS. */ +extern struct bin_str _rl_color_indicator[]; + +/* The LS_COLORS variable is in a termcap-like format. */ +typedef struct _color_ext_type + { + struct bin_str ext; /* The extension we're looking for */ + struct bin_str seq; /* The sequence to output when we do */ + struct _color_ext_type *next; /* Next in list */ + } COLOR_EXT_TYPE; + +/* file extensions indicators (.txt, .log, .jpg, ...) + Values are taken from $LS_COLORS in rl_parse_colors(). */ +extern COLOR_EXT_TYPE *_rl_color_ext_list; + +#define FILETYPE_INDICATORS \ + { \ + C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, \ + C_LINK, C_SOCK, C_FILE, C_DIR \ + } + +/* Whether we used any colors in the output so far. If so, we will + need to restore the default color later. If not, we will need to + call prep_non_filename_text before using color for the first time. */ + +enum indicator_no + { + C_LEFT, C_RIGHT, C_END, C_RESET, C_NORM, C_FILE, C_DIR, C_LINK, + C_FIFO, C_SOCK, + C_BLK, C_CHR, C_MISSING, C_ORPHAN, C_EXEC, C_DOOR, C_SETUID, C_SETGID, + C_STICKY, C_OTHER_WRITABLE, C_STICKY_OTHER_WRITABLE, C_CAP, C_MULTIHARDLINK, + C_CLR_TO_EOL + }; + + +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +enum filetype + { + unknown, + fifo, + chardev, + directory, + blockdev, + normal, + symbolic_link, + sock, + whiteout, + arg_directory + }; + +extern void _rl_put_indicator (const struct bin_str *ind); +extern void _rl_set_normal_color (void); +extern bool _rl_print_color_indicator (char *f); +extern void _rl_prep_non_filename_text (void); + +#endif /* !_COLORS_H_ */ diff --git a/readline/complete.c b/readline/complete.c index a5ce8039e50..cd9aebe8b7f 100644 --- a/readline/complete.c +++ b/readline/complete.c @@ -1,6 +1,6 @@ /* complete.c -- filename completion for readline. */ -/* Copyright (C) 1987-2011 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -31,6 +31,8 @@ # include <sys/file.h> #endif +#include <signal.h> + #if defined (HAVE_UNISTD_H) # include <unistd.h> #endif /* HAVE_UNISTD_H */ @@ -64,6 +66,10 @@ extern int errno; #include "xmalloc.h" #include "rlprivate.h" +#if defined (COLOR_SUPPORT) +# include "colors.h" +#endif + #ifdef __STDC__ typedef int QSFUNC (const void *, const void *); #else @@ -94,17 +100,27 @@ extern struct passwd *getpwent PARAMS((void)); longest string in that array. */ rl_compdisp_func_t *rl_completion_display_matches_hook = (rl_compdisp_func_t *)NULL; -#if defined (VISIBLE_STATS) +#if defined (VISIBLE_STATS) || defined (COLOR_SUPPORT) # if !defined (X_OK) # define X_OK 1 # endif +#endif + +#if defined (VISIBLE_STATS) static int stat_char PARAMS((char *)); #endif +#if defined (COLOR_SUPPORT) +static int colored_stat_start PARAMS((char *)); +static void colored_stat_end PARAMS((void)); +#endif + static int path_isdir PARAMS((const char *)); static char *rl_quote_filename PARAMS((char *, int, char *)); +static void _rl_complete_sigcleanup PARAMS((int, void *)); + static void set_completion_defaults PARAMS((int)); static int get_y_or_n PARAMS((int)); static int _rl_internal_pager PARAMS((int)); @@ -189,6 +205,12 @@ int _rl_completion_columns = -1; int rl_visible_stats = 0; #endif /* VISIBLE_STATS */ +#if defined (COLOR_SUPPORT) +/* Non-zero means to use colors to indicate file type when listing possible + completions. The colors used are taken from $LS_COLORS, if set. */ +int _rl_colored_stats = 0; +#endif + /* If non-zero, when completing in the middle of a word, don't insert characters from the match that match characters following point in the word. This means, for instance, completing when the cursor is @@ -206,6 +228,8 @@ rl_icppfunc_t *rl_directory_completion_hook = (rl_icppfunc_t *)NULL; rl_icppfunc_t *rl_directory_rewrite_hook = (rl_icppfunc_t *)NULL; +rl_icppfunc_t *rl_filename_stat_hook = (rl_icppfunc_t *)NULL; + /* If non-zero, this is the address of a function to call when reading directory entries from the filesystem for completion and comparing them to the partial word to be completed. The function should @@ -457,6 +481,15 @@ _rl_reset_completion_state () rl_completion_quote_character = 0; } +static void +_rl_complete_sigcleanup (sig, ptr) + int sig; + void *ptr; +{ + if (sig == SIGINT) /* XXX - for now */ + _rl_free_match_list ((char **)ptr); +} + /* Set default values for readline word completion. These are the variables that application completion functions can change or inspect. */ static void @@ -481,10 +514,6 @@ get_y_or_n (for_pager) { int c; -/* Disabled for GDB due to the gdb.base/readline-ask.exp regression. - [patch] testsuite: Test readline-6.2 "ask" regression - http://sourceware.org/ml/gdb-patches/2011-05/msg00002.html */ -#if 0 /* For now, disable pager in callback mode, until we later convert to state driven functions. Have to wait until next major version to add new state definition, since it will change value of RL_STATE_DONE. */ @@ -492,7 +521,6 @@ get_y_or_n (for_pager) if (RL_ISSTATE (RL_STATE_CALLBACK)) return 1; #endif -#endif for (;;) { @@ -556,6 +584,8 @@ stat_char (filename) { struct stat finfo; int character, r; + char *f; + const char *fn; /* Short-circuit a //server on cygwin, since that will always behave as a directory. */ @@ -564,10 +594,20 @@ stat_char (filename) return '/'; #endif + f = 0; + if (rl_filename_stat_hook) + { + f = savestring (filename); + (*rl_filename_stat_hook) (&f); + fn = f; + } + else + fn = filename; + #if defined (HAVE_LSTAT) && defined (S_ISLNK) - r = lstat (filename, &finfo); + r = lstat (fn, &finfo); #else - r = stat (filename, &finfo); + r = stat (fn, &finfo); #endif if (r == -1) @@ -598,26 +638,32 @@ stat_char (filename) #endif else if (S_ISREG (finfo.st_mode)) { -#if defined (_WIN32) && !defined (__CYGWIN__) - /* Windows 'access' doesn't support X_OK and on latest Windows - versions even invokes an invalid parameter exception. */ - char *ext = strrchr (filename, '.'); - - if (ext - && (_rl_stricmp (ext, ".exe") == 0 - || _rl_stricmp (ext, ".cmd") == 0 - || _rl_stricmp (ext, ".bat") == 0 - || _rl_stricmp (ext, ".com") == 0)) - character = '*'; -#else if (access (filename, X_OK) == 0) character = '*'; -#endif } + + free (f); return (character); } #endif /* VISIBLE_STATS */ +#if defined (COLOR_SUPPORT) +static int +colored_stat_start (filename) + char *filename; +{ + _rl_set_normal_color (); + return (_rl_print_color_indicator (filename)); +} + +static void +colored_stat_end () +{ + _rl_prep_non_filename_text (); + _rl_put_indicator (&_rl_color_indicator[C_CLR_TO_EOL]); +} +#endif + /* Return the portion of PATHNAME that should be output when listing possible completions. If we are hacking filename completion, we are only interested in the basename, the portion following the @@ -697,7 +743,7 @@ fnwidth (string) else { pos += clen; - w = wcwidth (wc); + w = WCWIDTH (wc); width += (w >= 0) ? w : 1; } #else @@ -784,7 +830,7 @@ fnprint (to_print, prefix_bytes) break; else { - w = wcwidth (wc); + w = WCWIDTH (wc); width = (w >= 0) ? w : 1; } fwrite (s, 1, tlen, rl_outstream); @@ -814,13 +860,20 @@ print_filename (to_print, full_pathname, prefix_bytes) char *s, c, *new_full_pathname, *dn; extension_char = 0; - printed_len = fnprint (to_print, prefix_bytes); +#if defined (COLOR_SUPPORT) + /* Defer printing if we want to prefix with a color indicator */ + if (_rl_colored_stats == 0 || rl_filename_completion_desired == 0) +#endif + printed_len = fnprint (to_print, prefix_bytes); + if (rl_filename_completion_desired && ( #if defined (VISIBLE_STATS) - if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories)) -#else - if (rl_filename_completion_desired && _rl_complete_mark_directories) + rl_visible_stats || +#endif +#if defined (COLOR_SUPPORT) + _rl_colored_stats || #endif + _rl_complete_mark_directories)) { /* If to_print != full_pathname, to_print is the basename of the path passed. In this case, we try to expand the directory @@ -866,8 +919,28 @@ print_filename (to_print, full_pathname, prefix_bytes) extension_char = stat_char (new_full_pathname); else #endif - if (path_isdir (new_full_pathname)) - extension_char = '/'; + if (_rl_complete_mark_directories) + { + dn = 0; + if (rl_directory_completion_hook == 0 && rl_filename_stat_hook) + { + dn = savestring (new_full_pathname); + (*rl_filename_stat_hook) (&dn); + free (new_full_pathname); + new_full_pathname = dn; + } + if (path_isdir (new_full_pathname)) + extension_char = '/'; + } + +#if defined (COLOR_SUPPORT) + if (_rl_colored_stats) + { + colored_stat_start (new_full_pathname); + printed_len = fnprint (to_print, prefix_bytes); + colored_stat_end (); + } +#endif xfree (new_full_pathname); to_print[-1] = c; @@ -880,8 +953,18 @@ print_filename (to_print, full_pathname, prefix_bytes) extension_char = stat_char (s); else #endif - if (path_isdir (s)) + if (_rl_complete_mark_directories && path_isdir (s)) extension_char = '/'; + +#if defined (COLOR_SUPPORT) + if (_rl_colored_stats) + { + colored_stat_start (s); + printed_len = fnprint (to_print, prefix_bytes); + colored_stat_end (); + } +#endif + } xfree (s); @@ -1076,10 +1159,13 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) variable rl_attempted_completion_function. */ if (rl_attempted_completion_function) { - _rl_interrupt_immediately++; matches = (*rl_attempted_completion_function) (text, start, end); - if (_rl_interrupt_immediately > 0) - _rl_interrupt_immediately--; + if (RL_SIG_RECEIVED()) + { + _rl_free_match_list (matches); + matches = 0; + RL_CHECK_SIGNALS (); + } if (matches || rl_attempted_completion_over) { @@ -1090,7 +1176,15 @@ gen_completion_matches (text, start, end, our_func, found_quote, quote_char) /* XXX -- filename dequoting moved into rl_filename_completion_function */ + /* rl_completion_matches will check for signals as well to avoid a long + delay while reading a directory. */ matches = rl_completion_matches (text, our_func); + if (RL_SIG_RECEIVED()) + { + _rl_free_match_list (matches); + matches = 0; + RL_CHECK_SIGNALS (); + } return matches; } @@ -1165,9 +1259,11 @@ compute_lcd_of_matches (match_list, matches, text) { register int i, c1, c2, si; int low; /* Count of max-matched characters. */ + int lx; char *dtext; /* dequoted TEXT, if needed */ #if defined (HANDLE_MULTIBYTE) int v; + size_t v1, v2; mbstate_t ps1, ps2; wchar_t wc1, wc2; #endif @@ -1200,14 +1296,20 @@ compute_lcd_of_matches (match_list, matches, text) #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - v = mbrtowc (&wc1, match_list[i]+si, strlen (match_list[i]+si), &ps1); - mbrtowc (&wc2, match_list[i+1]+si, strlen (match_list[i+1]+si), &ps2); + v1 = mbrtowc(&wc1, match_list[i]+si, strlen (match_list[i]+si), &ps1); + v2 = mbrtowc (&wc2, match_list[i+1]+si, strlen (match_list[i+1]+si), &ps2); + if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2)) + { + if (c1 != c2) /* do byte comparison */ + break; + continue; + } wc1 = towlower (wc1); wc2 = towlower (wc2); if (wc1 != wc2) break; - else if (v > 1) - si += v - 1; + else if (v1 > 1) + si += v1 - 1; } else #endif @@ -1282,21 +1384,20 @@ compute_lcd_of_matches (match_list, matches, text) qsort (match_list+1, matches, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare); si = strlen (text); - if (si <= low) - { - for (i = 1; i <= matches; i++) - if (strncmp (match_list[i], text, si) == 0) - { - strncpy (match_list[0], match_list[i], low); - break; - } - /* no casematch, use first entry */ - if (i > matches) - strncpy (match_list[0], match_list[1], low); - } - else - /* otherwise, just use the text the user typed. */ - strncpy (match_list[0], text, low); + lx = (si <= low) ? si : low; /* check shorter of text and matches */ + /* Try to preserve the case of what the user typed in the presence of + multiple matches: check each match for something that matches + what the user typed taking case into account; use it up to common + length of matches if one is found. If not, just use first match. */ + for (i = 1; i <= matches; i++) + if (strncmp (match_list[i], text, lx) == 0) + { + strncpy (match_list[0], match_list[i], low); + break; + } + /* no casematch, use first entry */ + if (i > matches) + strncpy (match_list[0], match_list[1], low); FREE (dtext); } @@ -1323,7 +1424,7 @@ postprocess_matches (matchesp, matching_filenames) return 0; /* It seems to me that in all the cases we handle we would like - to ignore duplicate possiblilities. Scan for the text to + to ignore duplicate possibilities. Scan for the text to insert being identical to the other completions. */ if (rl_ignore_completion_duplicates) { @@ -1481,7 +1582,7 @@ rl_display_match_list (matches, len, max) /* Have we reached the end of this line? */ if (matches[i+1]) { - if (i && (limit > 1) && (i % limit) == 0) + if (limit == 1 || (i && (limit > 1) && (i % limit) == 0)) { rl_crlf (); lines++; @@ -1690,7 +1791,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match) char *text; int delimiter, quote_char, nontrivial_match; { - char temp_string[4], *filename; + char temp_string[4], *filename, *fn; int temp_string_index, s; struct stat finfo; @@ -1709,6 +1810,13 @@ append_to_match (text, delimiter, quote_char, nontrivial_match) if (rl_filename_completion_desired) { filename = tilde_expand (text); + if (rl_filename_stat_hook) + { + fn = savestring (filename); + (*rl_filename_stat_hook) (&fn); + xfree (filename); + filename = fn; + } s = (nontrivial_match && rl_completion_mark_symlink_dirs == 0) ? LSTAT (filename, &finfo) : stat (filename, &finfo); @@ -1728,8 +1836,7 @@ append_to_match (text, delimiter, quote_char, nontrivial_match) #ifdef S_ISLNK /* Don't add anything if the filename is a symlink and resolves to a directory. */ - else if (s == 0 && S_ISLNK (finfo.st_mode) && - stat (filename, &finfo) == 0 && S_ISDIR (finfo.st_mode)) + else if (s == 0 && S_ISLNK (finfo.st_mode) && path_isdir (filename)) ; #endif else @@ -1849,10 +1956,8 @@ rl_complete_internal (what_to_do) /* nontrivial_lcd is set if the common prefix adds something to the word being completed. */ nontrivial_lcd = matches && strcmp (text, matches[0]) != 0; -#if 1 if (what_to_do == '!' || what_to_do == '@') tlen = strlen (text); -#endif xfree (text); if (matches == 0) @@ -1886,10 +1991,6 @@ rl_complete_internal (what_to_do) case '!': case '@': /* Insert the first match with proper quoting. */ -#if 0 - if (*matches[0]) - insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char); -#else if (what_to_do == TAB) { if (*matches[0]) @@ -1904,7 +2005,6 @@ rl_complete_internal (what_to_do) if (mlen >= tlen) insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, "e_char); } -#endif /* If there are more matches, ring the bell to indicate. If we are in vi mode, Posix.2 says to not ring the bell. @@ -1940,7 +2040,14 @@ rl_complete_internal (what_to_do) break; case '?': + if (rl_completion_display_matches_hook == 0) + { + _rl_sigcleanup = _rl_complete_sigcleanup; + _rl_sigcleanarg = matches; + } display_matches (matches); + _rl_sigcleanup = 0; + _rl_sigcleanarg = 0; break; default: @@ -1948,6 +2055,7 @@ rl_complete_internal (what_to_do) rl_ding (); FREE (saved_line_buffer); RL_UNSETSTATE(RL_STATE_COMPLETING); + _rl_free_match_list (matches); _rl_reset_completion_state (); return 1; } @@ -1989,6 +2097,8 @@ rl_completion_matches (text, entry_function) const char *text; rl_compentry_func_t *entry_function; { + register int i; + /* Number of slots in match_list. */ int match_list_size; @@ -2006,18 +2116,36 @@ rl_completion_matches (text, entry_function) match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *)); match_list[1] = (char *)NULL; - _rl_interrupt_immediately++; while (string = (*entry_function) (text, matches)) { - if (matches + 1 == match_list_size) + if (RL_SIG_RECEIVED ()) + { + /* Start at 1 because we don't set matches[0] in this function. + Only free the list members if we're building match list from + rl_filename_completion_function, since we know that doesn't + free the strings it returns. */ + if (entry_function == rl_filename_completion_function) + { + for (i = 1; match_list[i]; i++) + xfree (match_list[i]); + } + xfree (match_list); + match_list = 0; + match_list_size = 0; + matches = 0; + RL_CHECK_SIGNALS (); + } + + if (matches + 1 >= match_list_size) match_list = (char **)xrealloc (match_list, ((match_list_size += 10) + 1) * sizeof (char *)); + if (match_list == 0) + return (match_list); + match_list[++matches] = string; match_list[matches + 1] = (char *)NULL; } - if (_rl_interrupt_immediately > 0) - _rl_interrupt_immediately--; /* If there were any matches, then look through them finding out the lowest common denominator. That then becomes match_list[0]. */ @@ -2056,7 +2184,9 @@ rl_username_completion_function (text, state) username = savestring (&text[first_char_loc]); namelen = strlen (username); +#if defined (HAVE_GETPWENT) setpwent (); +#endif } #if defined (HAVE_GETPWENT) @@ -2093,8 +2223,9 @@ rl_username_completion_function (text, state) /* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME (FILENAME_LEN). If _rl_completion_case_fold is set, compare without - regard to the alphabetic case of characters. CONVFN is the possibly- - converted directory entry; FILENAME is what the user typed. */ + regard to the alphabetic case of characters. If + _rl_completion_case_map is set, make `-' and `_' equivalent. CONVFN is + the possibly-converted directory entry; FILENAME is what the user typed. */ static int complete_fncmp (convfn, convlen, filename, filename_len) const char *convfn; @@ -2104,34 +2235,110 @@ complete_fncmp (convfn, convlen, filename, filename_len) { register char *s1, *s2; int d, len; +#if defined (HANDLE_MULTIBYTE) + size_t v1, v2; + mbstate_t ps1, ps2; + wchar_t wc1, wc2; +#endif + +#if defined (HANDLE_MULTIBYTE) + memset (&ps1, 0, sizeof (mbstate_t)); + memset (&ps2, 0, sizeof (mbstate_t)); +#endif + + if (filename_len == 0) + return 1; + if (convlen < filename_len) + return 0; + + len = filename_len; + s1 = (char *)convfn; + s2 = (char *)filename; /* Otherwise, if these match up to the length of filename, then it is a match. */ if (_rl_completion_case_fold && _rl_completion_case_map) { /* Case-insensitive comparison treating _ and - as equivalent */ - if (filename_len == 0) - return 1; - if (convlen < filename_len) - return 0; - s1 = (char *)convfn; - s2 = (char *)filename; - len = filename_len; - do +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + do + { + v1 = mbrtowc (&wc1, s1, convlen, &ps1); + v2 = mbrtowc (&wc2, s2, filename_len, &ps2); + if (v1 == 0 && v2 == 0) + return 1; + else if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2)) + { + if (*s1 != *s2) /* do byte comparison */ + return 0; + else if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_')) + return 0; + s1++; s2++; len--; + continue; + } + wc1 = towlower (wc1); + wc2 = towlower (wc2); + s1 += v1; + s2 += v1; + len -= v1; + if ((wc1 == L'-' || wc1 == L'_') && (wc2 == L'-' || wc2 == L'_')) + continue; + if (wc1 != wc2) + return 0; + } + while (len != 0); + } + else +#endif { - d = _rl_to_lower (*s1) - _rl_to_lower (*s2); - /* *s1 == [-_] && *s2 == [-_] */ - if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_')) - d = 0; - if (d != 0) - return 0; - s1++; s2++; /* already checked convlen >= filename_len */ + do + { + d = _rl_to_lower (*s1) - _rl_to_lower (*s2); + /* *s1 == [-_] && *s2 == [-_] */ + if ((*s1 == '-' || *s1 == '_') && (*s2 == '-' || *s2 == '_')) + d = 0; + if (d != 0) + return 0; + s1++; s2++; /* already checked convlen >= filename_len */ + } + while (--len != 0); } - while (--len != 0); + return 1; } else if (_rl_completion_case_fold) { +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + do + { + v1 = mbrtowc (&wc1, s1, convlen, &ps1); + v2 = mbrtowc (&wc2, s2, filename_len, &ps2); + if (v1 == 0 && v2 == 0) + return 1; + else if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2)) + { + if (*s1 != *s2) /* do byte comparison */ + return 0; + s1++; s2++; len--; + continue; + } + wc1 = towlower (wc1); + wc2 = towlower (wc2); + if (wc1 != wc2) + return 0; + s1 += v1; + s2 += v1; + len -= v1; + } + while (len != 0); + return 1; + } + else +#endif if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) && (convlen >= filename_len) && (_rl_strnicmp (filename, convfn, filename_len) == 0)) @@ -2251,8 +2458,9 @@ rl_filename_completion_function (text, state) } directory = opendir (dirname); - /* Now dequote a non-null filename. */ - if (filename && *filename && rl_completion_found_quote && rl_filename_dequoting_function) + /* Now dequote a non-null filename. FILENAME will not be NULL, but may + be empty. */ + if (*filename && rl_completion_found_quote && rl_filename_dequoting_function) { /* delete single and double quotes */ temp = (*rl_filename_dequoting_function) (filename, rl_completion_quote_character); @@ -2616,6 +2824,11 @@ rl_menu_complete (count, ignore) full_completion = 1; return (0); } + else if (_rl_menu_complete_prefix_first) + { + rl_ding (); + return (0); + } } else if (match_list_size <= 1) { diff --git a/readline/config.h.in b/readline/config.h.in index 8560c4be9f3..a67e43e1526 100644 --- a/readline/config.h.in +++ b/readline/config.h.in @@ -124,6 +124,9 @@ /* Define if you have the wcwidth function. */ #undef HAVE_WCWIDTH +/* and whether it works */ +#undef WCWIDTH_BROKEN + #undef STDC_HEADERS /* Define if you have the <dirent.h> header file. */ @@ -153,6 +156,9 @@ /* Define if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H +/* Define if you have the <stdbool.h> header file. */ +#undef HAVE_STDBOOL_H + /* Define if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H @@ -218,6 +224,9 @@ /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET +/* Define if you have <linux/audit.h> and it defines AUDIT_USER_TTY */ +#undef HAVE_DECL_AUDIT_USER_TTY + /* Definitions pulled in from aclocal.m4. */ #undef VOID_SIGHANDLER @@ -259,12 +268,4 @@ # define TERMIOS_MISSING #endif -#if defined (__STDC__) && defined (HAVE_STDARG_H) -# define PREFER_STDARG -# define USE_VARARGS -#else -# if defined (HAVE_VARARGS_H) -# define PREFER_VARARGS -# define USE_VARARGS -# endif -#endif +/* VARARGS defines moved to rlstdc.h */ diff --git a/readline/configure b/readline/configure index 09de45df5e4..f5f4acdfa43 100755 --- a/readline/configure +++ b/readline/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in for Readline 6.2, version 2.67. +# From configure.ac for Readline 6.3, version 2.73. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for readline 6.2. +# Generated by GNU Autoconf 2.64 for readline 6.3. # # Report bugs to <bug-readline@gnu.org>. # @@ -550,8 +550,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='readline' PACKAGE_TARNAME='readline' -PACKAGE_VERSION='6.2' -PACKAGE_STRING='readline 6.2' +PACKAGE_VERSION='6.3' +PACKAGE_STRING='readline 6.3' PACKAGE_BUGREPORT='bug-readline@gnu.org' PACKAGE_URL='' @@ -693,6 +693,7 @@ enable_option_checking with_curses with_purify enable_multibyte +enable_shared enable_static enable_largefile ' @@ -1246,7 +1247,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures readline 6.2 to adapt to many kinds of systems. +\`configure' configures readline 6.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1311,7 +1312,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of readline 6.2:";; + short | recursive ) echo "Configuration of readline 6.3:";; esac cat <<\_ACEOF @@ -1320,6 +1321,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-multibyte enable multibyte characters if OS supports them + --enable-shared build shared libraries [default=YES] --enable-static build static libraries [default=YES] --disable-largefile omit support for large files @@ -1406,7 +1408,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -readline configure 6.2 +readline configure 6.3 generated by GNU Autoconf 2.64 Copyright (C) 2009 Free Software Foundation, Inc. @@ -1827,11 +1829,50 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR +# ------------------------------------ +# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 +$as_echo_n "checking whether $2 is declared... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $2 + (void) $2; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by readline $as_me 6.2, which was +It was created by readline $as_me 6.3, which was generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -2182,11 +2223,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_aux_dir= -for ac_dir in `cd $srcdir;pwd`/.. "$srcdir"/`cd $srcdir;pwd`/..; do +for ac_dir in ./support "$srcdir"/./support; do for ac_t in install-sh install.sh shtool; do if test -f "$ac_dir/$ac_t"; then ac_aux_dir=$ac_dir @@ -2196,7 +2234,7 @@ for ac_dir in `cd $srcdir;pwd`/.. "$srcdir"/`cd $srcdir;pwd`/..; do done done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \`cd $srcdir;pwd\`/.. \"$srcdir\"/\`cd $srcdir;pwd\`/.." "$LINENO" 5 + as_fn_error "cannot find install-sh, install.sh, or shtool in ./support \"$srcdir\"/./support" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -2211,7 +2249,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. ac_config_headers="$ac_config_headers config.h" -LIBVERSION=6.2 +LIBVERSION=6.3 # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || @@ -2314,13 +2352,18 @@ fi opt_multibyte=yes opt_static_libs=yes -opt_shared_libs=no +opt_shared_libs=yes # Check whether --enable-multibyte was given. if test "${enable_multibyte+set}" = set; then : enableval=$enable_multibyte; opt_multibyte=$enableval fi +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; opt_shared_libs=$enableval +fi + # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; opt_static_libs=$enableval @@ -2726,10 +2769,12 @@ done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include <stdio.h> int main () { +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; @@ -3761,8 +3806,9 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -# Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AR+set}" = set; then : @@ -3778,7 +3824,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="" + ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -3786,7 +3832,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" fi fi AR=$ac_cv_prog_AR @@ -3799,6 +3844,60 @@ $as_echo "no" >&6; } fi +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + test -n "$ARFLAGS" || ARFLAGS="cr" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. @@ -4525,7 +4624,8 @@ $as_echo "#define HAVE_STRCOLL 1" >>confdefs.h fi -for ac_header in fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \ +for ac_header in fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \ + string.h strings.h \ limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -5623,6 +5723,19 @@ $as_echo "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h fi +ac_fn_c_check_decl "$LINENO" "AUDIT_USER_TTY" "ac_cv_have_decl_AUDIT_USER_TTY" "#include <linux/audit.h> +" +if test "x$ac_cv_have_decl_AUDIT_USER_TTY" = x""yes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_AUDIT_USER_TTY $ac_have_decl +_ACEOF + + case "$host_os" in aix*) prefer_curses=yes ;; esac @@ -5914,7 +6027,6 @@ if test "x$ac_cv_func_mbsrtowcs" = x""yes; then : fi - for ac_func in mbschr do : ac_fn_c_check_func "$LINENO" "mbschr" "ac_cv_func_mbschr" @@ -6176,6 +6288,54 @@ $as_echo "#define HAVE_WINT_T 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wcwidth broken with unicode combining characters" >&5 +$as_echo_n "checking for wcwidth broken with unicode combining characters... " >&6; } +if test "${bash_cv_wcwidth_broken+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + bash_cv_wcwidth_broken=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> + +#include <locale.h> +#include <wchar.h> + +main(c, v) +int c; +char **v; +{ + int w; + + setlocale(LC_ALL, "en_US.UTF-8"); + w = wcwidth (0x0301); + exit (w == 0); /* exit 0 if wcwidth broken */ +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + bash_cv_wcwidth_broken=yes +else + bash_cv_wcwdith_broken=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bash_cv_wcwidth_broken" >&5 +$as_echo "$bash_cv_wcwidth_broken" >&6; } +if test "$bash_cv_wcwidth_broken" = yes; then + +$as_echo "#define WCWIDTH_BROKEN 1" >>confdefs.h + +fi + if test "$am_cv_func_iconv" = yes; then OLDLIBS="$LIBS" LIBS="$LIBS $LIBICONV" @@ -6802,7 +6962,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by readline $as_me 6.2, which was +This file was extended by readline $as_me 6.3, which was generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6866,7 +7026,7 @@ Report bugs to <bug-readline@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -readline config.status 6.2 +readline config.status 6.3 configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/readline/configure.in b/readline/configure.ac index b395af458f4..cea8f91ef9f 100644 --- a/readline/configure.in +++ b/readline/configure.ac @@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 1987-2009 Free Software Foundation, Inc. +# Copyright (C) 1987-2014 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 @@ -20,23 +20,19 @@ dnl Process this file with autoconf to produce a configure script. # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -AC_REVISION([for Readline 6.2, version 2.67]) +AC_REVISION([for Readline 6.3, version 2.73]) -m4_include([../config/override.m4]) - -AC_INIT(readline, 6.2, bug-readline@gnu.org) +AC_INIT(readline, 6.3, bug-readline@gnu.org) dnl make sure we are using a recent autoconf version AC_PREREQ(2.50) AC_CONFIG_SRCDIR(readline.h) -dnl GDB LOCAL -dnl AC_CONFIG_AUX_DIR(./support) -AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) +AC_CONFIG_AUX_DIR(./support) AC_CONFIG_HEADERS(config.h) dnl update the value of RL_READLINE_VERSION in readline.h when this changes -LIBVERSION=6.2 +LIBVERSION=6.3 AC_CANONICAL_HOST AC_CANONICAL_BUILD @@ -62,10 +58,10 @@ fi dnl option parsing for optional features opt_multibyte=yes opt_static_libs=yes -opt_shared_libs=no +opt_shared_libs=yes AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval) -dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval) +AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval) AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval) if test $opt_multibyte = no; then @@ -119,7 +115,7 @@ test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL -AC_CHECK_PROG(AR, ar, , ar) +AC_CHECK_TOOL(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" @@ -151,7 +147,8 @@ AC_CHECK_FUNCS(getpwent getpwnam getpwuid) AC_FUNC_STRCOLL -AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h string.h strings.h \ +AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h varargs.h stdarg.h stdbool.h \ + string.h strings.h \ limits.h locale.h pwd.h memory.h termcap.h termios.h termio.h) AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h) @@ -186,6 +183,8 @@ BASH_STRUCT_WINSIZE BASH_STRUCT_DIRENT_D_INO BASH_STRUCT_DIRENT_D_FILENO +AC_CHECK_DECLS([AUDIT_USER_TTY],,, [[#include <linux/audit.h>]]) + dnl yuck case "$host_os" in aix*) prefer_curses=yes ;; diff --git a/readline/display.c b/readline/display.c index 7653d873197..4df1f734bec 100644 --- a/readline/display.c +++ b/readline/display.c @@ -1,6 +1,6 @@ /* display.c -- readline redisplay facility. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2013 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -42,7 +42,7 @@ #include <stdio.h> #ifdef __MSDOS__ -# include <pc.h> +# include <pc.h> #endif /* System-specific feature definitions and include files. */ @@ -67,6 +67,7 @@ static void update_line PARAMS((char *, char *, int, int, int, int)); static void space_to_eol PARAMS((int)); static void delete_chars PARAMS((int)); static void insert_some_chars PARAMS((char *, int, int)); +static void open_some_spaces PARAMS((int)); static void cr PARAMS((void)); /* State of visible and invisible lines. */ @@ -169,6 +170,7 @@ int _rl_last_v_pos = 0; static int cpos_adjusted; static int cpos_buffer_position; +static int displaying_prompt_first_line; static int prompt_multibyte_chars; /* Number of lines currently on screen minus 1. */ @@ -180,7 +182,8 @@ int _rl_vis_botlin = 0; static int last_lmargin; /* A buffer for `modeline' messages. */ -static char msg_buf[128]; +static char *msg_buf = 0; +static int msg_bufsiz = 0; /* Non-zero forces the redisplay even if we thought it was unnecessary. */ static int forced_display; @@ -236,6 +239,18 @@ static int saved_local_length; static int saved_invis_chars_first_line; static int saved_physical_chars; +/* Return a character indicating the editing mode, for use in the prompt. */ +static int +prompt_modechar () +{ + if (rl_editing_mode == emacs_mode) + return '@'; + else if (_rl_keymap == vi_insertion_keymap) + return '+'; /* vi insert mode */ + else + return ':'; /* vi command mode */ +} + /* Expand the prompt string S and return the number of visible characters in *LP, if LP is not null. This is currently more-or-less a placeholder for expansion. LIP, if non-null is a place to store the @@ -262,7 +277,16 @@ expand_prompt (pmt, lp, lip, niflp, vlp) /* Short-circuit if we can. */ if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0) { - r = savestring (pmt); + if (pmt == rl_prompt && _rl_show_mode_in_prompt) + { + l = strlen (pmt); + r = (char *)xmalloc (l + 2); + r[0] = prompt_modechar (); + strcpy (r + 1, pmt); + } + else + r = savestring (pmt); + if (lp) *lp = strlen (r); if (lip) @@ -275,13 +299,20 @@ expand_prompt (pmt, lp, lip, niflp, vlp) } l = strlen (pmt); - r = ret = (char *)xmalloc (l + 1); + r = ret = (char *)xmalloc (l + 2); + + rl = physchars = 0; /* move up here so mode show can set them */ + if (pmt == rl_prompt && _rl_show_mode_in_prompt) + { + *r++ = prompt_modechar (); + rl = physchars = 1; + } invfl = 0; /* invisible chars in first line of prompt */ invflset = 0; /* we only want to set invfl once */ igstart = 0; - for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++) + for (ignoring = last = ninvis = 0, p = pmt; p && *p; p++) { /* This code strips the invisible character string markers RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */ @@ -370,6 +401,12 @@ _rl_strip_prompt (pmt) return ret; } +void +_rl_reset_prompt () +{ + rl_visible_prompt_length = rl_expand_prompt (rl_prompt); +} + /* * Expand the prompt string into the various display components, if * necessary. @@ -711,10 +748,9 @@ rl_redisplay () /* Now account for invisible characters in the current line. */ /* XXX - this assumes that the invisible characters may be split, but only between the first and the last lines. */ - temp += ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line - : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line)) - : ((newlines == 0) ? wrap_offset : 0)); - + temp += (newlines == 0) ? prompt_invis_chars_first_line + : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line); + inv_lbreaks[++newlines] = temp; #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0) @@ -765,7 +801,7 @@ rl_redisplay () break; /* Found '\0' */ else { - temp = wcwidth (wc); + temp = WCWIDTH (wc); wc_width = (temp >= 0) ? temp : 1; } } @@ -929,7 +965,7 @@ rl_redisplay () /* If we can move the cursor up and down, then use multiple lines, otherwise, let long lines display in a single terminal line, and horizontally scroll it. */ - + displaying_prompt_first_line = 1; if (_rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up) { int nleft, pos, changed_screen_line, tx; @@ -1183,6 +1219,8 @@ rl_redisplay () else lmargin = last_lmargin; + displaying_prompt_first_line = lmargin < nleft; + /* If the first character on the screen isn't the first character in the display line, indicate this with a special character. */ if (lmargin > 0) @@ -1208,7 +1246,8 @@ rl_redisplay () _rl_screenwidth + (lmargin ? 0 : wrap_offset), 0); - if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && OLD_CPOS_IN_PROMPT()) + if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && + displaying_prompt_first_line && OLD_CPOS_IN_PROMPT()) _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */ /* If the visible new line is shorter than the old, but the number @@ -1216,7 +1255,7 @@ rl_redisplay () the new line, we need to clear to eol. */ t = _rl_last_c_pos - M_OFFSET (lmargin, wrap_offset); if ((M_OFFSET (lmargin, wrap_offset) > visible_wrap_offset) && - (_rl_last_c_pos == out) && + (_rl_last_c_pos == out) && displaying_prompt_first_line && t < visible_first_line_len) { nleft = _rl_screenwidth - t; @@ -1278,6 +1317,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) int temp, lendiff, wsatend, od, nd, twidth, o_cpos; int current_invis_chars; int col_lendiff, col_temp; + int bytes_to_insert; #if defined (HANDLE_MULTIBYTE) mbstate_t ps_new, ps_old; int new_offset, old_offset; @@ -1304,7 +1344,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) size_t ret; /* This fixes only double-column characters, but if the wrapped - character comsumes more than three columns, spaces will be + character consumes more than three columns, spaces will be inserted in the string buffer. */ if (current_line < line_state_visible->wbsize && line_state_visible->wrapped_line[current_line] > 0) _rl_clear_to_eol (line_state_visible->wrapped_line[current_line]); @@ -1319,7 +1359,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) else if (MB_NULLWCH (ret)) tempwidth = 0; else - tempwidth = wcwidth (wc); + tempwidth = WCWIDTH (wc); if (tempwidth > 0) { @@ -1339,7 +1379,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) memcpy (old, new, bytes); /* Fix up indices if we copy data from one line to another */ omax += bytes - ret; - for (i = current_line+1; i < inv_botlin+1; i++) + for (i = current_line+1; i <= inv_botlin+1; i++) vis_lbreaks[i] += bytes - ret; } } @@ -1376,6 +1416,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) temp = (omax < nmax) ? omax : nmax; if (memcmp (old, new, temp) == 0) /* adding at the end */ { + new_offset = old_offset = temp; ofd = old + temp; nfd = new + temp; } @@ -1386,6 +1427,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) if (omax == nmax && STREQN (new, old, omax)) { + old_offset = omax; + new_offset = nmax; ofd = old + omax; nfd = new + nmax; } @@ -1398,6 +1441,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) { old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY); new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY); + ofd = old + old_offset; nfd = new + new_offset; } @@ -1421,6 +1465,27 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) if (ofd == oe && nfd == ne) return; +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_utf8locale) + { + wchar_t wc; + mbstate_t ps = { 0 }; + int t; + + /* If the first character in the difference is a zero-width character, + assume it's a combining character and back one up so the two base + characters no longer compare equivalently. */ + t = mbrtowc (&wc, ofd, MB_CUR_MAX, &ps); + if (t > 0 && UNICODE_COMBINING_CHAR (wc) && WCWIDTH (wc) == 0) + { + old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY); + new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY); + ofd = old + old_offset; /* equal by definition */ + nfd = new + new_offset; + } + } +#endif + wsatend = 1; /* flag for trailing whitespace */ #if defined (HANDLE_MULTIBYTE) @@ -1428,6 +1493,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) { ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY); nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY); + while ((ols > ofd) && (nls > nfd)) { memset (&ps_old, 0, sizeof (mbstate_t)); @@ -1544,10 +1610,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) o_cpos = _rl_last_c_pos; /* When this function returns, _rl_last_c_pos is correct, and an absolute - cursor postion in multibyte mode, but a buffer index when not in a + cursor position in multibyte mode, but a buffer index when not in a multibyte locale. */ _rl_move_cursor_relative (od, old); -#if 1 + #if defined (HANDLE_MULTIBYTE) /* We need to indicate that the cursor position is correct in the presence of invisible characters in the prompt string. Let's see if setting this when @@ -1557,11 +1623,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) _rl_last_c_pos == prompt_physical_chars) cpos_adjusted = 1; #endif -#endif /* if (len (new) > len (old)) - lendiff == difference in buffer - col_lendiff == difference on screen + lendiff == difference in buffer (bytes) + col_lendiff == difference on screen (columns) When not using multibyte characters, these are equal */ lendiff = (nls - nfd) - (ols - ofd); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@ -1572,7 +1637,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) /* If we are changing the number of invisible characters in a line, and the spot of first difference is before the end of the invisible chars, lendiff needs to be adjusted. */ - if (current_line == 0 && !_rl_horizontal_scroll_mode && + if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */ current_invis_chars != visible_wrap_offset) { if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@ -1587,6 +1652,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) } } + /* We use temp as a count of the number of bytes from the first difference + to the end of the new line. col_temp is the corresponding number of + screen columns. A `dumb' update moves to the spot of first difference + and writes TEMP bytes. */ /* Insert (diff (len (old), len (new)) ch. */ temp = ne - nfd; if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@ -1594,6 +1663,10 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) else col_temp = temp; + /* how many bytes from the new line buffer to write to the display */ + bytes_to_insert = nls - nfd; + + /* col_lendiff > 0 if we are adding characters to the line */ if (col_lendiff > 0) /* XXX - was lendiff */ { /* Non-zero if we're increasing the number of lines. */ @@ -1607,11 +1680,11 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) if (lendiff < 0) { _rl_output_some_chars (nfd, temp); - _rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1); + _rl_last_c_pos += col_temp; /* XXX - was _rl_col_width (nfd, 0, temp, 1); */ /* If nfd begins before any invisible characters in the prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ - if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + if (current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) { _rl_last_c_pos -= wrap_offset; cpos_adjusted = 1; @@ -1642,57 +1715,42 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) (col_lendiff < prompt_visible_length)) == 0) && (visible_wrap_offset >= current_invis_chars)) { - insert_some_chars (nfd, lendiff, col_lendiff); - _rl_last_c_pos += col_lendiff; - } -#if 0 /* XXX - for now */ - else if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && _rl_last_c_pos == 0 && wrap_offset && (nfd-new) <= prompt_last_invisible && col_lendiff < prompt_visible_length && visible_wrap_offset >= current_invis_chars) - { - _rl_output_some_chars (nfd, lendiff); - _rl_last_c_pos += col_lendiff; + open_some_spaces (col_lendiff); + _rl_output_some_chars (nfd, bytes_to_insert); + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + _rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1); + else + _rl_last_c_pos += bytes_to_insert; } -#endif else if ((MB_CUR_MAX == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0) { /* 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. */ - _rl_output_some_chars (nfd, lendiff); - _rl_last_c_pos += col_lendiff; + _rl_output_some_chars (nfd, temp); + _rl_last_c_pos += col_temp; + return; } - else + else /* just write from first difference to end of new line */ { _rl_output_some_chars (nfd, temp); _rl_last_c_pos += col_temp; /* If nfd begins before the last invisible character in the prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ - if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) { _rl_last_c_pos -= wrap_offset; cpos_adjusted = 1; } return; } - /* Copy (new) chars to screen from first diff to last match. */ - temp = nls - nfd; - if ((temp - lendiff) > 0) + + if (bytes_to_insert > lendiff) { - _rl_output_some_chars (nfd + lendiff, temp - lendiff); - /* XXX -- this bears closer inspection. Fixes a redisplay bug - reported against bash-3.0-alpha by Andreas Schwab involving - multibyte characters and prompt strings with invisible - characters, but was previously disabled. */ - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff, 1); - else - twidth = temp - lendiff; - _rl_last_c_pos += twidth; /* If nfd begins before the last invisible character in the prompt, adjust _rl_last_c_pos to account for wrap_offset and set cpos_adjusted to let the caller know. */ - if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible)) { _rl_last_c_pos -= wrap_offset; cpos_adjusted = 1; @@ -1710,6 +1768,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) a physical character position. */ if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == prompt_last_screen_line && wrap_offset && + displaying_prompt_first_line && wrap_offset != prompt_invis_chars_first_line && ((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth)))) { @@ -1727,32 +1786,52 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) prompt string, don't bother. It screws up the assumptions about what's on the screen. */ if (_rl_horizontal_scroll_mode && _rl_last_c_pos == 0 && + displaying_prompt_first_line && -lendiff == visible_wrap_offset) col_lendiff = 0; + /* If we have moved lmargin and we're shrinking the line, we've + already moved the cursor to the first character of the new line, + so deleting -col_lendiff characters will mess up the cursor + position calculation */ + if (_rl_horizontal_scroll_mode && displaying_prompt_first_line == 0 && + col_lendiff && _rl_last_c_pos < -col_lendiff) + col_lendiff = 0; + if (col_lendiff) delete_chars (-col_lendiff); /* delete (diff) characters */ - /* Copy (new) chars to screen from first diff to last match */ - temp = nls - nfd; - if (temp > 0) + /* Copy (new) chars to screen from first diff to last match, + overwriting what is there. */ + if (bytes_to_insert > 0) { /* If nfd begins at the prompt, or before the invisible characters in the prompt, we need to adjust _rl_last_c_pos in a multibyte locale to account for the wrap offset and set cpos_adjusted accordingly. */ - _rl_output_some_chars (nfd, temp); + _rl_output_some_chars (nfd, bytes_to_insert); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - _rl_last_c_pos += _rl_col_width (nfd, 0, temp, 1); - if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + _rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1); + if (current_line == 0 && wrap_offset && + displaying_prompt_first_line && + _rl_last_c_pos > wrap_offset && + ((nfd - new) <= prompt_last_invisible)) { _rl_last_c_pos -= wrap_offset; cpos_adjusted = 1; } } else - _rl_last_c_pos += temp; + _rl_last_c_pos += bytes_to_insert; + + /* XXX - we only want to do this if we are at the end of the line + so we move there with _rl_move_cursor_relative */ + if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new))) + { + _rl_move_cursor_relative (ne-new, new); + goto clear_rest_of_line; + } } } /* Otherwise, print over the existing material. */ @@ -1768,29 +1847,29 @@ update_line (old, new, current_line, omax, nmax, inv_botlin) _rl_last_c_pos += col_temp; /* XXX */ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible)) + if (current_line == 0 && wrap_offset && + displaying_prompt_first_line && + _rl_last_c_pos > wrap_offset && + ((nfd - new) <= prompt_last_invisible)) { _rl_last_c_pos -= wrap_offset; cpos_adjusted = 1; } } } +clear_rest_of_line: lendiff = (oe - old) - (ne - new); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) col_lendiff = _rl_col_width (old, 0, oe - old, 1) - _rl_col_width (new, 0, ne - new, 1); else col_lendiff = lendiff; -#if 0 - if (col_lendiff) -#else /* If we've already printed over the entire width of the screen, including the old material, then col_lendiff doesn't matter and space_to_eol will insert too many spaces. XXX - maybe we should adjust col_lendiff based on the difference between _rl_last_c_pos and _rl_screenwidth */ if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth))) -#endif { if (_rl_term_autowrap && current_line < inv_botlin) space_to_eol (col_lendiff); @@ -1942,6 +2021,9 @@ _rl_move_cursor_relative (new, data) else dpos = _rl_col_width (data, 0, new, 1); + if (displaying_prompt_first_line == 0) + adjust = 0; + /* Use NEW when comparing against the last invisible character in the prompt string, since they're both buffer indices and DPOS is a desired display position. */ @@ -2060,18 +2142,18 @@ _rl_move_vert (to) } else { /* delta < 0 */ -#ifdef __MSDOS__ +#ifdef __DJGPP__ int row, col; - fflush (rl_outstream); /* make sure the cursor pos is current! */ + fflush (rl_outstream); ScreenGetCursor (&row, &col); ScreenSetCursor (row + delta, col); - i = -delta; /* in case someone wants to use it after the loop */ -#else /* !__MSDOS__ */ + i = -delta; +#else if (_rl_term_up && *_rl_term_up) for (i = 0; i < -delta; i++) tputs (_rl_term_up, 1, _rl_output_character_function); -#endif /* !__MSDOS__ */ +#endif /* !__DJGPP__ */ } _rl_last_v_pos = to; /* Now TO is here */ @@ -2149,6 +2231,9 @@ rl_message (va_alist) #if defined (PREFER_VARARGS) char *format; #endif +#if defined (HAVE_VSNPRINTF) + int bneed; +#endif #if defined (PREFER_STDARG) va_start (args, format); @@ -2157,11 +2242,28 @@ rl_message (va_alist) format = va_arg (args, char *); #endif + if (msg_buf == 0) + msg_buf = xmalloc (msg_bufsiz = 128); + #if defined (HAVE_VSNPRINTF) - vsnprintf (msg_buf, sizeof (msg_buf) - 1, format, args); + bneed = vsnprintf (msg_buf, msg_bufsiz - 1, format, args); + if (bneed >= msg_bufsiz - 1) + { + msg_bufsiz = bneed + 1; + msg_buf = xrealloc (msg_buf, msg_bufsiz); + va_end (args); + +#if defined (PREFER_STDARG) + va_start (args, format); +#else + va_start (args); + format = va_arg (args, char *); +#endif + vsnprintf (msg_buf, msg_bufsiz - 1, format, args); + } #else vsprintf (msg_buf, format, args); - msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */ + msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */ #endif va_end (args); @@ -2170,6 +2272,12 @@ rl_message (va_alist) rl_save_prompt (); msg_saved_prompt = 1; } + else if (local_prompt != saved_local_prompt) + { + FREE (local_prompt); + FREE (local_prompt_prefix); + local_prompt = (char *)NULL; + } rl_display_prompt = msg_buf; local_prompt = expand_prompt (msg_buf, &prompt_visible_length, &prompt_last_invisible, @@ -2186,8 +2294,11 @@ int rl_message (format, arg1, arg2) char *format; { + if (msg_buf == 0) + msg_buf = xmalloc (msg_bufsiz = 128); + sprintf (msg_buf, format, arg1, arg2); - msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */ + msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */ rl_display_prompt = msg_buf; if (saved_local_prompt == 0) @@ -2195,6 +2306,12 @@ rl_message (format, arg1, arg2) rl_save_prompt (); msg_saved_prompt = 1; } + else if (local_prompt != saved_local_prompt) + { + FREE (local_prompt); + FREE (local_prompt_prefix); + local_prompt = (char *)NULL; + } local_prompt = expand_prompt (msg_buf, &prompt_visible_length, &prompt_last_invisible, &prompt_invis_chars_first_line, @@ -2336,8 +2453,8 @@ _rl_clear_to_eol (count) tputs (_rl_term_clreol, 1, _rl_output_character_function); else #endif - if (count) - space_to_eol (count); + if (count) + space_to_eol (count); } /* Clear to the end of the line using spaces. COUNT is the minimum @@ -2357,15 +2474,15 @@ space_to_eol (count) void _rl_clear_screen () { -#if defined (__GO32__) - ScreenClear (); /* FIXME: only works in text modes */ - ScreenSetCursor (0, 0); /* term_clrpag is "cl" which homes the cursor */ -#else +#ifndef __DJGPP__ if (_rl_term_clrpag) tputs (_rl_term_clrpag, 1, _rl_output_character_function); else rl_crlf (); -#endif +#else + ScreenClear (); + ScreenSetCursor (0, 0); +#endif /* __DJGPP__ */ } /* Insert COUNT characters from STRING to the output stream at column COL. */ @@ -2374,48 +2491,47 @@ insert_some_chars (string, count, col) char *string; int count, col; { -#if defined (__MSDOS__) || defined (__MINGW32__) + open_some_spaces (col); _rl_output_some_chars (string, count); -#else - /* DEBUGGING */ - if (MB_CUR_MAX == 1 || rl_byte_oriented) - if (count != col) - _rl_ttymsg ("debug: insert_some_chars: count (%d) != col (%d)", count, col); +} + +/* Insert COL spaces, keeping the cursor at the same position. We follow the + ncurses documentation and use either im/ei with explicit spaces, or IC/ic + by itself. We assume there will either be ei or we don't need to use it. */ +static void +open_some_spaces (col) + int col; +{ +#if !defined (__MSDOS__) && !defined (__MINGW32__) + char *buffer; + register int i; /* If IC is defined, then we do not have to "enter" insert mode. */ if (_rl_term_IC) { - char *buffer; - buffer = tgoto (_rl_term_IC, 0, col); tputs (buffer, 1, _rl_output_character_function); - _rl_output_some_chars (string, count); } - else + else if (_rl_term_im && *_rl_term_im) { - register int i; - - /* If we have to turn on insert-mode, then do so. */ - if (_rl_term_im && *_rl_term_im) - tputs (_rl_term_im, 1, _rl_output_character_function); - - /* If there is a special command for inserting characters, then - use that first to open up the space. */ - if (_rl_term_ic && *_rl_term_ic) - { - for (i = col; i--; ) - tputs (_rl_term_ic, 1, _rl_output_character_function); - } - - /* Print the text. */ - _rl_output_some_chars (string, count); - - /* If there is a string to turn off insert mode, we had best use - it now. */ + tputs (_rl_term_im, 1, _rl_output_character_function); + /* just output the desired number of spaces */ + for (i = col; i--; ) + _rl_output_character_function (' '); + /* If there is a string to turn off insert mode, use it now. */ if (_rl_term_ei && *_rl_term_ei) tputs (_rl_term_ei, 1, _rl_output_character_function); + /* and move back the right number of spaces */ + _rl_backspace (col); + } + else if (_rl_term_ic && *_rl_term_ic) + { + /* If there is a special command for inserting characters, then + use that first to open up the space. */ + for (i = col; i--; ) + tputs (_rl_term_ic, 1, _rl_output_character_function); } -#endif /* __MSDOS__ || __MINGW32__ */ +#endif /* !__MSDOS__ && !__MINGW32__ */ } /* Delete COUNT characters from the display line. */ @@ -2566,7 +2682,8 @@ _rl_clean_up_for_exit () { if (_rl_echoing_p) { - _rl_move_vert (_rl_vis_botlin); + if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */ + _rl_move_vert (_rl_vis_botlin); _rl_vis_botlin = 0; fflush (rl_outstream); rl_restart_output (1, 0); @@ -2620,10 +2737,8 @@ _rl_col_width (str, start, end, flags) if (end <= start) return 0; if (MB_CUR_MAX == 1 || rl_byte_oriented) -{ -_rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1"); + /* this can happen in some cases where it's inconvenient to check */ return (end - start); -} memset (&ps, 0, sizeof (mbstate_t)); @@ -2697,7 +2812,7 @@ _rl_ttymsg ("_rl_col_width: called with MB_CUR_MAX == 1"); { point += tmp; max -= tmp; - tmp = wcwidth(wc); + tmp = WCWIDTH(wc); width += (tmp >= 0) ? tmp : 1; } } diff --git a/readline/doc/Makefile.in b/readline/doc/Makefile.in index 89d8b47be5e..72b79857f6f 100644 --- a/readline/doc/Makefile.in +++ b/readline/doc/Makefile.in @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +PACKAGE_TARNAME = @PACKAGE_TARNAME@ + topdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ @@ -24,6 +26,7 @@ prefix = @prefix@ datarootdir = @datarootdir@ +docdir = @docdir@ infodir = @infodir@ mandir = @mandir@ diff --git a/readline/doc/history.3 b/readline/doc/history.3 index 4eb159c9d11..ada9a38ec44 100644 --- a/readline/doc/history.3 +++ b/readline/doc/history.3 @@ -4,11 +4,11 @@ .\" Chet Ramey .\" Information Network Services .\" Case Western Reserve University -.\" chet@ins.CWRU.Edu +.\" chet.ramey@case.edu .\" -.\" Last Change: Thu Aug 12 22:24:41 EDT 2010 +.\" Last Change: Thu Thu Jun 27 10:34:44 EDT 2013 .\" -.TH HISTORY 3 "2010 August 12" "GNU History 6.2" +.TH HISTORY 3 "2013 June 27" "GNU History 6.3" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -112,7 +112,7 @@ starting with .TP .B !?\fIstring\fR\fB[?]\fR Refer to the most recent command -preceding the current postition in the history list +preceding the current position in the history list containing .IR string . The trailing \fB?\fP may be omitted if @@ -161,7 +161,8 @@ The \fIn\fRth word. The first argument. That is, word 1. .TP .B $ -The last argument. +The last word. This is usually the last argument, but will expand to the +zeroth word if there is only one word in the line. .TP .B % The word matched by the most recent `?\fIstring\fR?' search. @@ -649,7 +650,7 @@ bfox@gnu.org .PP Chet Ramey, Case Western Reserve University .br -chet@ins.CWRU.Edu +chet.ramey@case.edu .SH BUG REPORTS If you find a bug in the .B history @@ -669,4 +670,4 @@ newsgroup .PP Comments and bug reports concerning this manual page should be directed to -.IR chet@ins.CWRU.Edu . +.IR chet.ramey@case.edu . diff --git a/readline/doc/history.texi b/readline/doc/history.texi index 64945d86e4d..a991fe5ba47 100644 --- a/readline/doc/history.texi +++ b/readline/doc/history.texi @@ -2,33 +2,25 @@ @c %**start of header (This is for running Texinfo on a region.) @setfilename history.info @settitle GNU History Library -@c %**end of header (This is for running Texinfo on a region.) - @include version.texi +@c %**end of header (This is for running Texinfo on a region.) + @copying This document describes the GNU History library (version @value{VERSION}, @value{UPDATED}), a programming tool that provides a consistent user interface for recalling lines of previously typed input. -Copyright @copyright{} 1988--2011 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. +Copyright @copyright{} 1988--2014 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no -Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', -and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License''. - -(a) The FSF's Back-Cover Text is: You are free to copy and modify -this GNU manual. Buying copies from GNU Press supports the FSF in -developing GNU and promoting software freedom.'' +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +A copy of the license is included in the section entitled +``GNU Free Documentation License''. @end quotation @end copying @@ -50,12 +42,6 @@ developing GNU and promoting software freedom.'' @vskip 0pt plus 1filll @insertcopying -@sp 1 -Published by the Free Software Foundation @* -59 Temple Place, Suite 330, @* -Boston, MA 02111-1307 @* -USA @* - @end titlepage @contents diff --git a/readline/doc/hstech.texi b/readline/doc/hstech.texi index 4fc9e8ef1b7..6487f20b60a 100644 --- a/readline/doc/hstech.texi +++ b/readline/doc/hstech.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988-2011 Free Software Foundation, Inc. +Copyright (C) 1988-2014 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual @@ -377,7 +377,7 @@ if the returned line should be displayed, but not executed, as with the @code{:p} modifier (@pxref{Modifiers}). @end table -If an error ocurred in expansion, then @var{output} contains a descriptive +If an error occurred in expansion, then @var{output} contains a descriptive error message. @end deftypefun diff --git a/readline/doc/hsuser.texi b/readline/doc/hsuser.texi index 9aa6c358dbe..69a5016342f 100644 --- a/readline/doc/hsuser.texi +++ b/readline/doc/hsuser.texi @@ -1,7 +1,7 @@ @ignore This file documents the user interface to the GNU History library. -Copyright (C) 1988--2011 Free Software Foundation, Inc. +Copyright (C) 1988--2014 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. Permission is granted to make and distribute verbatim copies of this manual @@ -26,10 +26,9 @@ into another language, under the above conditions for modified versions. @node Using History Interactively @chapter Using History Interactively -@c GDB bundling modification: -@c @ifclear BashFeatures -@c @defcodeindex bt -@c @end ifclear +@ifclear BashFeatures +@defcodeindex bt +@end ifclear @ifset BashFeatures This chapter describes how to use the @sc{gnu} History Library @@ -42,8 +41,7 @@ see the @sc{gnu} Readline Library Manual. This chapter describes how to use the @sc{gnu} History Library interactively, from a user's standpoint. It should be considered a user's guide. For information on using the @sc{gnu} History Library in your own programs, -@c GDB bundling modification: -@pxref{Programming with GNU History, , , history, GNU History Library}. +@pxref{Programming with GNU History}. @end ifclear @ifset BashFeatures @@ -86,17 +84,18 @@ file named by the @env{HISTFILE} variable (default @file{~/.bash_history}). The file named by the value of @env{HISTFILE} is truncated, if necessary, to contain no more than the number of lines specified by the value of the @env{HISTFILESIZE} variable. -When an interactive shell exits, the last +When a shell with history enabled exits, the last @env{$HISTSIZE} lines are copied from the history list to the file named by @env{$HISTFILE}. If the @code{histappend} shell option is set (@pxref{Bash Builtins}), the lines are appended to the history file, otherwise the history file is overwritten. If @env{HISTFILE} -is unset, or if the history file is unwritable, the history is -not saved. After saving the history, the history file is truncated -to contain no more than @env{$HISTFILESIZE} -lines. If @env{HISTFILESIZE} is not set, no truncation is performed. +is unset, or if the history file is unwritable, the history is not saved. +After saving the history, the history file is truncated +to contain no more than @env{$HISTFILESIZE} lines. +If @env{HISTFILESIZE} is unset, or set to null, a non-numeric value, or +a numeric value less than zero, the history file is not truncated. If the @env{HISTTIMEFORMAT} is set, the time stamp information associated with each history entry is written to the history file, @@ -143,8 +142,10 @@ history list and history file. @code{fc -s [@var{pat}=@var{rep}] [@var{command}]} @end example -Fix Command. In the first form, a range of commands from @var{first} to -@var{last} is selected from the history list. Both @var{first} and +The first form selects a range of commands from @var{first} to +@var{last} from the history list and displays or edits and re-executes +them. +Both @var{first} and @var{last} may be specified as a string (to locate the most recent command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the @@ -163,6 +164,7 @@ When editing is complete, the edited commands are echoed and executed. In the second form, @var{command} is re-executed after each instance of @var{pat} in the selected command is replaced by @var{rep}. +@var{command} is intepreted the same as @var{first} above. A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so that typing @samp{r cc} runs the last command beginning with @code{cc} @@ -210,11 +212,11 @@ to the current history list. These are lines appended to the history file since the beginning of the current Bash session. @item -r -Read the current history file and append its contents to +Read the history file and append its contents to the history list. @item -w -Write out the current history to the history file. +Write out the current history list to the history file. @item -p Perform history substitution on the @var{arg}s and display the result diff --git a/readline/doc/readline.3 b/readline/doc/readline.3 index f79f4bbef21..5ac7b109a45 100644 --- a/readline/doc/readline.3 +++ b/readline/doc/readline.3 @@ -4,11 +4,11 @@ .\" Chet Ramey .\" Information Network Services .\" Case Western Reserve University -.\" chet@ins.CWRU.Edu +.\" chet.ramey@case.edu .\" -.\" Last Change: Sat Aug 28 18:56:32 EDT 2010 +.\" Last Change: Mon Jan 6 16:34:55 EST 2014 .\" -.TH READLINE 3 "2010 August 28" "GNU Readline 6.2" +.TH READLINE 3 "2014 January 6" "GNU Readline 6.3" .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -351,6 +351,12 @@ If set to \fBOn\fP, readline attempts to bind the control characters treated specially by the kernel's terminal driver to their readline equivalents. .TP +.B colored\-stats (Off) +If set to \fBOn\fP, readline displays possible completions using different +colors to indicate their file type. +The color definitions are taken from the value of the \fBLS_COLORS\fP +environment variable. +.TP .B comment\-begin (``#'') The string that is inserted in \fBvi\fP mode when the .B insert\-comment @@ -439,8 +445,12 @@ same location on each history line retrieved with \fBprevious-history\fP or \fBnext-history\fP. .TP .B history\-size (0) -Set the maximum number of history entries saved in the history list. If -set to zero, the number of entries in the history list is not limited. +Set the maximum number of history entries saved in the history list. +If set to zero, any existing history entries are deleted and no new entries +are saved. +If set to a value less than zero, the number of history entries is not +limited. +By default, the number of history entries is not limited. .TP .B horizontal\-scroll\-mode (Off) When set to \fBOn\fP, makes readline use a single line for display, @@ -472,6 +482,19 @@ The value of .B editing\-mode also affects the default keymap. .TP +.B keyseq\-timeout (500) +Specifies the duration \fIreadline\fP will wait for a character when reading an +ambiguous key sequence (one that can form a complete key sequence using +the input read so far, or can take additional input to complete a longer +key sequence). +If no input is received within the timeout, \fIreadline\fP will use the shorter +but complete key sequence. +The value is specified in milliseconds, so a value of 1000 means that +\fIreadline\fP will wait one second for additional input. +If this variable is set to a value less than or equal to zero, or to a +non-numeric value, \fIreadline\fP will wait until another key is pressed to +decide which key sequence to complete. +.TP .B mark\-directories (On) If set to \fBOn\fP, completed directory names have a slash appended. @@ -533,6 +556,11 @@ possible partial completion (the possible completions don't share a common prefix) cause the matches to be listed immediately instead of ringing the bell. .TP +.B show\-mode\-in\-prompt (Off) +If set to \fBOn\fP, add a character to the beginning of the prompt +indicating the editing mode: emacs (@), vi command (:) or vi +insertion (+). +.TP .B skip\-completed\-text (Off) If set to \fBOn\fP, this alters the default completion behavior when inserting a single match into the line. It's only active when @@ -738,15 +766,30 @@ using a non-incremental search for a string supplied by the user. Search forward through the history using a non-incremental search for a string supplied by the user. .TP +.B history\-search\-backward +Search backward through the history for the string of characters +between the start of the current line and the current cursor +position (the \fIpoint\fP). +The search string must match at the beginning of a history line. +This is a non-incremental search. +.TP .B history\-search\-forward Search forward through the history for the string of characters +between the start of the current line and the point. +The search string must match at the beginning of a history line. +This is a non-incremental search. +.TP +.B history\-substring\-search\-backward +Search backward through the history for the string of characters between the start of the current line and the current cursor position (the \fIpoint\fP). +The search string may match anywhere in a history line. This is a non-incremental search. .TP -.B history\-search\-backward -Search backward through the history for the string of characters +.B history\-substring\-search\-forward +Search forward through the history for the string of characters between the start of the current line and the point. +The search string may match anywhere in a history line. This is a non-incremental search. .TP .B yank\-nth\-arg (M\-C\-y) @@ -778,13 +821,22 @@ as if the "!$" history expansion had been specified. .PP .PD 0 .TP -.B delete\-char (C\-d) -Delete the character at point. If point is at the -beginning of the line, there are no characters in the line, and -the last character typed was not bound to \fBdelete\-char\fP, then return +.B \fIend\-of\-file\fP (usually C\-d) +The character indicating end-of-file as set, for example, by +.if t \f(CWstty\fP. +.if n ``stty''. +If this character is read when there are no characters +on the line, and point is at the beginning of the line, Readline +interprets it as the end of input and returns .SM .BR EOF . .TP +.B delete\-char (C\-d) +Delete the character at point. +If this function is bound to the +same character as the tty \fBEOF\fP character, as \fBC\-d\fP +commonly is, see above for the effects. +.TP .B backward\-delete\-char (Rubout) Delete the character behind the cursor. When given a numeric argument, save the deleted text on the kill ring. @@ -996,6 +1048,9 @@ and store the definition. .B call\-last\-kbd\-macro (C\-x e) Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. +.B print\-last\-kbd\-macro () +Print the last keyboard macro defined in a format suitable for the +\fIinputrc\fP file. .PD .SS Miscellaneous .PP @@ -1355,7 +1410,7 @@ bfox@gnu.org .PP Chet Ramey, Case Western Reserve University .br -chet@ins.CWRU.Edu +chet.ramey@case.edu .SH BUG REPORTS If you find a bug in .B readline, @@ -1375,7 +1430,7 @@ newsgroup .PP Comments and bug reports concerning this manual page should be directed to -.IR chet@ins.CWRU.Edu . +.IR chet.ramey@case.edu . .SH BUGS .PP It's too big and too slow. diff --git a/readline/doc/rlman.texi b/readline/doc/rlman.texi index 1c9ac13338b..17a8292b6a4 100644 --- a/readline/doc/rlman.texi +++ b/readline/doc/rlman.texi @@ -2,34 +2,26 @@ @comment %**start of header (This is for running Texinfo on a region.) @setfilename readline.info @settitle GNU Readline Library +@include version.texi + @comment %**end of header (This is for running Texinfo on a region.) @synindex vr fn -@include version.texi - @copying This manual describes the GNU Readline Library (version @value{VERSION}, @value{UPDATED}), a library which aids in the consistency of user interface across discrete programs which provide a command line interface. -Copyright @copyright{} 1988--2011 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. +Copyright @copyright{} 1988--2014 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no -Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', -and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License''. - -(a) The FSF's Back-Cover Text is: You are free to copy and modify -this GNU manual. Buying copies from GNU Press supports the FSF in -developing GNU and promoting software freedom.'' +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +A copy of the license is included in the section entitled +``GNU Free Documentation License''. @end quotation @end copying @@ -50,12 +42,6 @@ developing GNU and promoting software freedom.'' @vskip 0pt plus 1filll @insertcopying -@sp 1 -Published by the Free Software Foundation @* -59 Temple Place, Suite 330, @* -Boston, MA 02111-1307 @* -USA @* - @end titlepage @contents @@ -67,6 +53,7 @@ USA @* This document describes the GNU Readline Library, a utility which aids in the consistency of user interface across discrete programs which provide a command line interface. +The Readline home page is @url{http://www.gnu.org/software/readline/}. @menu * Command Line Editing:: GNU Readline User's Manual. diff --git a/readline/doc/rltech.texi b/readline/doc/rltech.texi index dc272a2190c..40de49c4db6 100644 --- a/readline/doc/rltech.texi +++ b/readline/doc/rltech.texi @@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding in the consistency of user interface across discrete programs that need to provide a command line interface. -Copyright (C) 1988--2011 Free Software Foundation, Inc. +Copyright (C) 1988--2014 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -195,7 +195,7 @@ For Readline 4.2, for example, the value of @node Readline Typedefs @subsection Readline Typedefs -For readabilty, we declare a number of new object types, all pointers +For readability, we declare a number of new object types, all pointers to functions. The reason for declaring these new types is to make it easier to write @@ -440,6 +440,35 @@ If non-zero, Readline will call indirectly through this pointer to get a character from the input stream. By default, it is set to @code{rl_getc}, the default Readline character input function (@pxref{Character Input}). +In general, an application that sets @var{rl_getc_function} should consider +setting @var{rl_input_available_hook} as well. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_signal_event_hook +If non-zero, this is the address of a function to call if a read system +call is interrupted when Readline is reading terminal input. +@end deftypevar + +@deftypevar {rl_hook_func_t *} rl_input_available_hook +If non-zero, Readline will use this function's return value when it needs +to determine whether or not there is available input on the current input +source. +The default hook checks @code{rl_instream}; if an application is using a +different input source, it should set the hook appropriately. +Readline queries for available input when implementing intra-key-sequence +timeouts during input and incremental searches. +This may use an application-specific timeout before returning a value; +Readline uses the value passed to @code{rl_set_keyboard_input_timeout()} +or the value of the user-settable @var{keyseq-timeout} variable. +This is designed for use by applications using Readline's callback interface +(@pxref{Alternate Interface}), which may not use the traditional +@code{read(2)} and file descriptor interface, or other applications using +a different input mechanism. +If an application uses an input mechanism or hook that can potentially exceed +the value of @var{keyseq-timeout}, it should increase the timeout or set +this hook appropriately even when not using the callback interface. +In general, an application that sets @var{rl_getc_function} should consider +setting @var{rl_input_available_hook} as well. @end deftypevar @deftypevar {rl_voidfunc_t *} rl_redisplay_function @@ -479,6 +508,19 @@ last key binding occurred. This variable is set to the text of any currently-executing macro. @end deftypevar +@deftypevar int rl_executing_key +The key that caused the dispatch to the currently-executing Readline function. +@end deftypevar + +@deftypevar {char *} rl_executing_keyseq +The full key sequence that caused the dispatch to the currently-executing +Readline function. +@end deftypevar + +@deftypevar int rl_key_sequence_length +The number of characters in @var{rl_executing_keyseq}. +@end deftypevar + @deftypevar {int} rl_readline_state A variable with bit values that encapsulate the current Readline state. A bit is set with the @code{RL_SETSTATE} macro, and unset with the @@ -487,7 +529,7 @@ whether a particular state bit is set. Current state bits include: @table @code @item RL_STATE_NONE -Readline has not yet been called, nor has it begun to intialize. +Readline has not yet been called, nor has it begun to initialize. @item RL_STATE_INITIALIZING Readline is initializing its internal data structures. @item RL_STATE_INITIALIZED @@ -580,6 +622,7 @@ means that vi mode is active. * Miscellaneous Functions:: Functions that don't fall into any category. * Alternate Interface:: Using Readline in a `callback' fashion. * A Readline Example:: An example Readline function. +* Alternate Interface Example:: An example program using the alternate interface. @end menu @node Function Naming @@ -908,7 +951,7 @@ Readline thinks the screen display is correct. @deftypefun int rl_on_new_line (void) Tell the update functions that we have moved onto a new (empty) line, -usually after ouputting a newline. +usually after outputting a newline. @end deftypefun @deftypefun int rl_on_new_line_with_prompt (void) @@ -1241,21 +1284,29 @@ use all of a terminal's capabilities, and this function will return values for only those capabilities Readline uses. @end deftypefun +@deftypefun {void} rl_clear_history (void) +Clear the history list by deleting all of the entries, in the same manner +as the History library's @code{clear_history()} function. +This differs from @code{clear_history} because it frees private data +Readline saves in the history list. +@end deftypefun + @node Alternate Interface @subsection Alternate Interface An alternate interface is available to plain @code{readline()}. Some applications need to interleave keyboard I/O with file, device, or window system I/O, typically by using a main loop to @code{select()} -on various file descriptors. To accomodate this need, readline can +on various file descriptors. To accommodate this need, readline can also be invoked as a `callback' function from an event loop. There are functions available to make this easy. @deftypefun void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler) Set up the terminal for readline I/O and display the initial expanded value of @var{prompt}. Save the value of @var{lhandler} to -use as a function to call when a complete line of input has been entered. -The function takes the text of the line as an argument. +use as a handler function to call when a complete line of input has been +entered. +The handler function receives the text of the line as an argument. @end deftypefun @deftypefun void rl_callback_read_char (void) @@ -1263,14 +1314,15 @@ Whenever an application determines that keyboard input is available, it should call @code{rl_callback_read_char()}, which will read the next character from the current input source. If that character completes the line, @code{rl_callback_read_char} will -invoke the @var{lhandler} function saved by @code{rl_callback_handler_install} -to process the line. +invoke the @var{lhandler} function installed by +@code{rl_callback_handler_install} to process the line. Before calling the @var{lhandler} function, the terminal settings are reset to the values they had before calling @code{rl_callback_handler_install}. If the @var{lhandler} function returns, +and the line handler remains installed, the terminal settings are modified for Readline's use again. -@code{EOF} is indicated by calling @var{lhandler} with a +@code{EOF} is indicated by calling @var{lhandler} with a @code{NULL} line. @end deftypefun @@ -1350,6 +1402,98 @@ invert_case_line (count, key) @} @end example +@node Alternate Interface Example +@subsection Alternate Interface Example + +Here is a complete program that illustrates Readline's alternate interface. +It reads lines from the terminal and displays them, providing the +standard history and TAB completion functions. +It understands the EOF character or "exit" to exit the program. + +@example +/* Standard include files. stdio.h is required. */ +#include <stdlib.h> +#include <unistd.h> + +/* Used for select(2) */ +#include <sys/types.h> +#include <sys/select.h> + +#include <stdio.h> + +/* Standard readline include files. */ +#include <readline/readline.h> +#include <readline/history.h> + +static void cb_linehandler (char *); + +int running; +const char *prompt = "rltest$ "; + +/* Callback function called for each line when accept-line executed, EOF + seen, or EOF character read. This sets a flag and returns; it could + also call exit(3). */ +static void +cb_linehandler (char *line) +@{ + /* Can use ^D (stty eof) or `exit' to exit. */ + if (line == NULL || strcmp (line, "exit") == 0) + @{ + if (line == 0) + printf ("\n"); + printf ("exit\n"); + /* This function needs to be called to reset the terminal settings, + and calling it from the line handler keeps one extra prompt from + being displayed. */ + rl_callback_handler_remove (); + + running = 0; + @} + else + @{ + if (*line) + add_history (line); + printf ("input line: %s\n", line); + free (line); + @} +@} + +int +main (int c, char **v) +@{ + fd_set fds; + int r; + + /* Install the line handler. */ + rl_callback_handler_install (prompt, cb_linehandler); + + /* Enter a simple event loop. This waits until something is available + to read on readline's input stream (defaults to standard input) and + calls the builtin character read callback to read it. It does not + have to modify the user's terminal settings. */ + running = 1; + while (running) + @{ + FD_ZERO (&fds); + FD_SET (fileno (rl_instream), &fds); + + r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); + if (r < 0) + @{ + perror ("rltest: select"); + rl_callback_handler_remove (); + break; + @} + + if (FD_ISSET (fileno (rl_instream), &fds)) + rl_callback_read_char (); + @} + + printf ("rltest: Event loop has exited\n"); + return 0; +@} +@end example + @node Readline Signal Handling @section Readline Signal Handling @@ -1365,6 +1509,7 @@ 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{SIGHUP}, @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 @@ -1397,19 +1542,28 @@ 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{SIGINT}, @code{SIGQUIT}, @code{SIGTERM}, @code{SIGHUP}, @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}. +If this variable is set to a non-zero value, +Readline will install a signal handler for @code{SIGWINCH}. The default value of @code{rl_catch_sigwinch} is 1. @end deftypevar +@deftypevar int rl_change_environment +If this variable is set to a non-zero value, +and Readline is handling @code{SIGWINCH}, Readline will modify the +@var{LINES} and @var{COLUMNS} environment variables upon receipt of a +@code{SIGWINCH} + +The default value of @code{rl_change_environment} 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), @@ -1477,7 +1631,7 @@ 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{SIGTERM}, @code{SIGHUP}, @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 @@ -1611,7 +1765,7 @@ This calls @code{rl_complete_internal()} with an argument of @samp{*}. @end deftypefun @deftypefun int rl_completion_mode (rl_command_func_t *cfunc) -Returns the apppriate value to pass to @code{rl_complete_internal()} +Returns the appropriate value to pass to @code{rl_complete_internal()} depending on whether @var{cfunc} was called twice in succession and the values of the @code{show-all-if-ambiguous} and @code{show-all-if-unmodified} variables. @@ -1728,29 +1882,45 @@ the directory portion of the pathname the user typed. At the least, even if no other expansion is performed, this function should remove any quote characters from the directory name, because its result will be passed directly to @code{opendir()}. + The directory completion hook returns an integer that should be non-zero if the function modifies its directory argument. The function should not modify the directory argument if it returns 0. @end deftypevar -@ignore -@deftypevar extern rl_icppfunc_t *rl_directory_rewrite_hook; +@deftypevar {rl_icppfunc_t *} rl_directory_rewrite_hook; If non-zero, this is the address of a function to call when completing a directory name. This function takes the address of the directory name to be modified as an argument. Unlike @code{rl_directory_completion_hook}, it only modifies the directory name used in @code{opendir}, not what is displayed when the possible completions are printed or inserted. It is called before rl_directory_completion_hook. +At the least, even if no other expansion is performed, this function should +remove any quote characters from the directory name, because its result will +be passed directly to @code{opendir()}. -I'm not happy with how this works yet, so it's undocumented. +The directory rewrite hook returns an integer that should be non-zero if +the function modfies its directory argument. +The function should not modify the directory argument if it returns 0. +@end deftypevar + +@deftypevar {rl_icppfunc_t *} rl_filename_stat_hook +If non-zero, this is the address of a function for the completer to +call before deciding which character to append to a completed name. +This function modifies its filename name argument, and the modified value +is passed to @code{stat()} to determine the file's type and characteristics. +This function does not need to remove quote characters from the filename. + +The stat hook returns an integer that should be non-zero if +the function modfies its directory argument. +The function should not modify the directory argument if it returns 0. @end deftypevar -@end ignore @deftypevar {rl_dequote_func_t *} rl_filename_rewrite_hook If non-zero, this is the address of a function called when reading directory entries from the filesystem for completion and comparing them to the partial word to be completed. The function should -perform any necesary application or system-specific conversion on +perform any necessary application or system-specific conversion on the filename, such as converting between character sets or converting from a filesystem format to a character input format. The function takes two arguments: @var{fname}, the filename to be converted, diff --git a/readline/doc/rluser.texi b/readline/doc/rluser.texi index 8a69c99313a..0af6c02e135 100644 --- a/readline/doc/rluser.texi +++ b/readline/doc/rluser.texi @@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo" which contains both end-user and programmer documentation for the GNU Readline Library. -Copyright (C) 1988--2011 Free Software Foundation, Inc. +Copyright (C) 1988--2014 Free Software Foundation, Inc. Authored by Brian Fox and Chet Ramey. @@ -72,6 +72,8 @@ Line editing can be enabled at any time using the @option{-o emacs} or a specific command. * Programmable Completion Builtins:: Builtin commands to specify how to complete arguments for a particular command. +* A Programmable Completion Example:: An example shell function for + generating possible completions. @end ifset @end menu @@ -425,6 +427,14 @@ If set to @samp{on}, Readline attempts to bind the control characters treated specially by the kernel's terminal driver to their Readline equivalents. +@item colored-stats +@vindex colored-stats +If set to @samp{on}, Readline displays possible completions using different +colors to indicate their file type. +The color definitions are taken from the value of the @env{LS_COLORS} +environment variable. +The default is @samp{off}. + @item comment-begin @vindex comment-begin The string to insert at the beginning of the line when the @@ -521,8 +531,12 @@ or @code{next-history}. The default is @samp{off}. @item history-size @vindex history-size -Set the maximum number of history entries saved in the history list. If -set to zero, the number of entries in the history list is not limited. +Set the maximum number of history entries saved in the history list. +If set to zero, any existing history entries are deleted and no new entries +are saved. +If set to a value less than zero, the number of history entries is not +limited. +By default, the number of history entries is not limited. @item horizontal-scroll-mode @vindex horizontal-scroll-mode @@ -565,6 +579,22 @@ equivalent to @code{emacs-standard}. The default value is @code{emacs}. The value of the @code{editing-mode} variable also affects the default keymap. +@item keyseq-timeout +Specifies the duration Readline will wait for a character when reading an +ambiguous key sequence (one that can form a complete key sequence using +the input read so far, or can take additional input to complete a longer +key sequence). +If no input is received within the timeout, Readline will use the shorter +but complete key sequence. +Readline uses this value to determine whether or not input is +available on the current input source (@code{rl_instream} by default). +The value is specified in milliseconds, so a value of 1000 means that +Readline will wait one second for additional input. +If this variable is set to a value less than or equal to zero, or to a +non-numeric value, Readline will wait until another key is pressed to +decide which key sequence to complete. +The default value is @code{500}. + @item mark-directories If set to @samp{on}, completed directory names have a slash appended. The default is @samp{on}. @@ -640,6 +670,13 @@ a common prefix) cause the matches to be listed immediately instead of ringing the bell. The default value is @samp{off}. +@item show-mode-in-prompt +@vindex show-mode-in-prompt +If set to @samp{on}, add a character to the beginning of the prompt +indicating the editing mode: emacs (@samp{@@}), vi command (@samp{:}), +or vi insertion (@samp{+}). +The default value is @samp{off}. + @item skip-completed-text @vindex skip-completed-text If set to @samp{on}, this alters the default completion behavior when @@ -880,7 +917,7 @@ binding, variable assignment, and conditional syntax. # You can re-read the inputrc file with C-x C-r. # Lines beginning with '#' are comments. # -# First, include any systemwide bindings and variable +# First, include any system-wide bindings and variable # assignments from /etc/Inputrc $include /etc/Inputrc @@ -1100,13 +1137,30 @@ for a string supplied by the user. @item history-search-forward () Search forward through the history for the string of characters between the start of the current line and the point. +The search string must match at the beginning of a history line. This is a non-incremental search. By default, this command is unbound. @item history-search-backward () Search backward through the history for the string of characters -between the start of the current line and the point. This -is a non-incremental search. By default, this command is unbound. +between the start of the current line and the point. +The search string must match at the beginning of a history line. +This is a non-incremental search. +By default, this command is unbound. + +@item history-substr-search-forward () +Search forward through the history for the string of characters +between the start of the current line and the point. +The search string may match anywhere in a history line. +This is a non-incremental search. +By default, this command is unbound. + +@item history-substr-search-backward () +Search backward through the history for the string of characters +between the start of the current line and the point. +The search string may match anywhere in a history line. +This is a non-incremental search. +By default, this command is unbound. @item yank-nth-arg (M-C-y) Insert the first argument to the previous command (usually @@ -1137,11 +1191,17 @@ as if the @samp{!$} history expansion had been specified. @subsection Commands For Changing Text @ftable @code + +@item @i{end-of-file} (usually C-d) +The character indicating end-of-file as set, for example, by +@code{stty}. If this character is read when there are no characters +on the line, and point is at the beginning of the line, Readline +interprets it as the end of input and returns @sc{eof}. + @item delete-char (C-d) -Delete the character at point. If point is at the -beginning of the line, there are no characters in the line, and -the last character typed was not bound to @code{delete-char}, then -return @sc{eof}. +Delete the character at point. If this function is bound to the +same character as the tty @sc{eof} character, as @kbd{C-d} +commonly is, see above for the effects. @item backward-delete-char (Rubout) Delete the character behind the cursor. A numeric argument means @@ -1435,6 +1495,10 @@ and save the definition. Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. +@item print-last-kbd-macro () +Print the last keboard macro defined in a format suitable for the +@var{inputrc} file. + @end ftable @node Miscellaneous Commands @@ -1693,10 +1757,11 @@ When the command or function is invoked, the @env{COMP_LINE}, assigned values as described above (@pxref{Bash Variables}). If a shell function is being invoked, the @env{COMP_WORDS} and @env{COMP_CWORD} variables are also set. -When the function or command is invoked, the first argument is the +When the function or command is invoked, the first argument ($1) is the name of the command whose arguments are being completed, the -second argument is the word being completed, and the third argument -is the word preceding the word being completed on the current command line. +second argument ($2) is the word being completed, and the third argument +($3) is the word preceding the word being completed on the current command +line. No filtering of the generated completions against the word being completed is performed; the function or command has complete freedom in generating the matches. @@ -1706,7 +1771,7 @@ The function may use any of the shell facilities, including the @code{compgen} and @code{compopt} builtins described below (@pxref{Programmable Completion Builtins}), to generate the matches. It must put the possible completions in the @env{COMPREPLY} array -variable. +variable, one per array element. Next, any command specified with the @option{-C} option is invoked in an environment equivalent to command substitution. @@ -1774,17 +1839,18 @@ completion function would load completions dynamically: @example _completion_loader() @{ - . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124 + . "/etc/bash_completion.d/$1.sh" >/dev/null 2>&1 && return 124 @} -complete -D -F _completion_loader +complete -D -F _completion_loader -o bashdefault -o default @end example @node Programmable Completion Builtins @section Programmable Completion Builtins @cindex completion builtins -Two builtin commands are available to manipulate the programmable completion -facilities. +Three builtin commands are available to manipulate the programmable completion +facilities: one to specify how the arguments to a particular command are to +be completed, and two to modify the completion as it is happening. @table @code @item compgen @@ -1871,6 +1937,10 @@ quoting special characters, or suppressing trailing spaces). This option is intended to be used with shell functions specified with @option{-F}. +@item noquote +Tell Readline not to quote the completed words if they are filenames +(quoting filenames is the default). + @item nospace Tell Readline not to append a space (the default) to words completed at the end of the line. @@ -1970,6 +2040,10 @@ used as the possible completions. @item -F @var{function} The shell function @var{function} is executed in the current shell environment. +When it is executed, $1 is the name of the command whose arguments are +being completed, $2 is the word being completed, and $3 is the word +preceding the word being completed, as described above +(@pxref{Programmable Completion}). When it finishes, the possible completions are retrieved from the value of the @env{COMPREPLY} array variable. @@ -2034,4 +2108,122 @@ specification exists, or an output error occurs. @end table +@node A Programmable Completion Example +@section A Programmable Completion Example + +The most common way to obtain additional completion functionality beyond +the default actions @code{complete} and @code{compgen} provide is to use +a shell function and bind it to a particular command using @code{complete -F}. + +The following function provides completions for the @code{cd} builtin. +It is a reasonably good example of what shell functions must do when +used for completion. This function uses the word passsed as @code{$2} +to determine the directory name to complete. You can also use the +@code{COMP_WORDS} array variable; the current word is indexed by the +@code{COMP_CWORD} variable. + +The function relies on the @code{complete} and @code{compgen} builtins +to do much of the work, adding only the things that the Bash @code{cd} +does beyond accepting basic directory names: +tilde expansion (@pxref{Tilde Expansion}), +searching directories in @var{$CDPATH}, which is described above +(@pxref{Bourne Shell Builtins}), +and basic support for the @code{cdable_vars} shell option +(@pxref{The Shopt Builtin}). +@code{_comp_cd} modifies the value of @var{IFS} so that it contains only +a newline to accommodate file names containing spaces and tabs -- +@code{compgen} prints the possible completions it generates one per line. + +Possible completions go into the @var{COMPREPLY} array variable, one +completion per array element. The programmable completion system retrieves +the completions from there when the function returns. + +@example +# A completion function for the cd builtin +# based on the cd completion function from the bash_completion package +_comp_cd() +@{ + local IFS=$' \t\n' # normalize IFS + local cur _skipdot _cdpath + local i j k + + # Tilde expansion, with side effect of expanding tilde to full pathname + case "$2" in + \~*) eval cur="$2" ;; + *) cur=$2 ;; + esac + + # no cdpath or absolute pathname -- straight directory completion + if [[ -z "$@{CDPATH:-@}" ]] || [[ "$cur" == @@(./*|../*|/*) ]]; then + # compgen prints paths one per line; could also use while loop + IFS=$'\n' + COMPREPLY=( $(compgen -d -- "$cur") ) + IFS=$' \t\n' + # CDPATH+directories in the current directory if not in CDPATH + else + IFS=$'\n' + _skipdot=false + # preprocess CDPATH to convert null directory names to . + _cdpath=$@{CDPATH/#:/.:@} + _cdpath=$@{_cdpath//::/:.:@} + _cdpath=$@{_cdpath/%:/:.@} + for i in $@{_cdpath//:/$'\n'@}; do + if [[ $i -ef . ]]; then _skipdot=true; fi + k="$@{#COMPREPLY[@@]@}" + for j in $( compgen -d -- "$i/$cur" ); do + COMPREPLY[k++]=$@{j#$i/@} # cut off directory + done + done + $_skipdot || COMPREPLY+=( $(compgen -d -- "$cur") ) + IFS=$' \t\n' + fi + + # variable names if appropriate shell option set and no completions + if shopt -q cdable_vars && [[ $@{#COMPREPLY[@@]@} -eq 0 ]]; then + COMPREPLY=( $(compgen -v -- "$cur") ) + fi + + return 0 +@} +@end example + +We install the completion function using the @option{-F} option to +@code{complete}: + +@example +# Tell readline to quote appropriate and append slashes to directories; +# use the bash default completion for other arguments +complete -o filenames -o nospace -o bashdefault -F _comp_cd cd +@end example + +@noindent +Since we'd like Bash and Readline to take care of some +of the other details for us, we use several other options to tell Bash +and Readline what to do. The @option{-o filenames} option tells Readline +that the possible completions should be treated as filenames, and quoted +appropriately. That option will also cause Readline to append a slash to +filenames it can determine are directories (which is why we might want to +extend @code{_comp_cd} to append a slash if we're using directories found +via @var{CDPATH}: Readline can't tell those completions are directories). +The @option{-o nospace} option tells Readline to not append a space +character to the directory name, in case we want to append to it. +The @option{-o bashdefault} option brings in the rest of the "Bash default" +completions -- possible completion that Bash adds to the default Readline +set. These include things like command name completion, variable completion +for words beginning with @samp{@{}, completions containing pathname +expansion patterns (@pxref{Filename Expansion}), and so on. + +Once installed using @code{complete}, @code{_comp_cd} will be called every +time we attempt word completion for a @code{cd} command. + +Many more examples -- an extensive collection of completions for most of +the common GNU, Unix, and Linux commands -- are available as part of the +bash_completion project. This is installed by default on many GNU/Linux +distributions. Originally written by Ian Macdonald, the project now lives +at @url{http://bash-completion.alioth.debian.org/}. There are ports for +other systems such as Solaris and Mac OS X. + +An older version of the bash_completion package is distributed with bash +in the @file{examples/complete} subdirectory. + @end ifset diff --git a/readline/doc/rluserman.texi b/readline/doc/rluserman.texi index 3d545204535..ba6b0ad8f14 100644 --- a/readline/doc/rluserman.texi +++ b/readline/doc/rluserman.texi @@ -2,33 +2,25 @@ @comment %**start of header (This is for running Texinfo on a region.) @setfilename rluserman.info @settitle GNU Readline Library -@comment %**end of header (This is for running Texinfo on a region.) - @include version.texi +@comment %**end of header (This is for running Texinfo on a region.) + @copying This manual describes the end user interface of the GNU Readline Library (version @value{VERSION}, @value{UPDATED}), a library which aids in the consistency of user interface across discrete programs which provide a command line interface. -Copyright @copyright{} 1988--2011 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. +Copyright @copyright{} 1988--2014 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no -Invariant Sections, with the Front-Cover texts being ``A GNU Manual'', -and with the Back-Cover Texts as in (a) below. A copy of the license is -included in the section entitled ``GNU Free Documentation License''. - -(a) The FSF's Back-Cover Text is: You are free to copy and modify -this GNU manual. Buying copies from GNU Press supports the FSF in -developing GNU and promoting software freedom.'' +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. +A copy of the license is included in the section entitled +``GNU Free Documentation License''. @end quotation @end copying @@ -49,12 +41,6 @@ developing GNU and promoting software freedom.'' @vskip 0pt plus 1filll @insertcopying -@sp 1 -Published by the Free Software Foundation @* -59 Temple Place, Suite 330, @* -Boston, MA 02111-1307 @* -USA @* - @end titlepage @contents @@ -66,6 +52,7 @@ USA @* This document describes the end user interface of the GNU Readline Library, a utility which aids in the consistency of user interface across discrete programs which provide a command line interface. +The Readline home page is @url{http://www.gnu.org/software/readline/}. @menu * Command Line Editing:: GNU Readline User's Manual. diff --git a/readline/doc/texi2dvi b/readline/doc/texi2dvi index a9165a58bd0..83c08425da4 100755 --- a/readline/doc/texi2dvi +++ b/readline/doc/texi2dvi @@ -1,6 +1,6 @@ #! /bin/sh # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources. -# $Id$ +# $Id: texi2dvi,v 1.14 2003/02/05 00:42:33 karl Exp $ # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, # 2002, 2003 Free Software Foundation, Inc. @@ -25,7 +25,7 @@ # the `--debug' option when making a bug report. # This string is expanded by rcs automatically when this file is checked out. -rcs_revision='$Revision$' +rcs_revision='$Revision: 1.14 $' rcs_version=`set - $rcs_revision; echo $2` program=`echo $0 | sed -e 's!.*/!!'` version="texi2dvi (GNU Texinfo 4.5) $rcs_version diff --git a/readline/doc/texi2html b/readline/doc/texi2html index 9f9c2eb172e..13b55884c34 100755 --- a/readline/doc/texi2html +++ b/readline/doc/texi2html @@ -35,7 +35,7 @@ require 5.0; #--############################################################################## # CVS version: -# $Id$ +# $Id: texi2html.pl,v 1.55 2000/07/27 14:39:41 obachman Exp $ # Homepage: $T2H_HOMEPAGE = <<EOT; @@ -91,7 +91,7 @@ eval { ($T2H_USER = (getpwuid ($<))[6]) =~ s/,.*//;}; # Who am i # Copy this file and make changes to it, if you like. # Afterwards, either, load it with command-line option -init_file <your_init_file> # -# $Id$ +# $Id: texi2html.init,v 1.34 2000/07/27 14:09:02 obachman Exp $ ###################################################################### # stuff which can also be set by command-line options @@ -1509,7 +1509,7 @@ package Getopt::MySimple; # -------------------------------------------------------------------------- # Locally modified by obachman (Display type instead of env, order by cmp) -# $Id$ +# $Id: MySimple.pm,v 1.1 2000/07/03 08:44:13 obachman Exp $ # use strict; # no strict 'refs'; diff --git a/readline/doc/version.texi b/readline/doc/version.texi index 3ee1c10e8a2..70b66582035 100644 --- a/readline/doc/version.texi +++ b/readline/doc/version.texi @@ -1,10 +1,10 @@ @ignore -Copyright (C) 1988-2011 Free Software Foundation, Inc. +Copyright (C) 1988-2014 Free Software Foundation, Inc. @end ignore -@set EDITION 6.2 -@set VERSION 6.2 -@set UPDATED September 6 2010 -@set UPDATED-MONTH September 2010 +@set EDITION 6.3 +@set VERSION 6.3 +@set UPDATED 6 January 2014 +@set UPDATED-MONTH January 2014 -@set LASTCHANGE Mon Sep 6 22:07:10 EDT 2010 +@set LASTCHANGE Mon Jan 6 16:26:51 EST 2014 diff --git a/readline/emacs_keymap.c b/readline/emacs_keymap.c index 9f816581efa..cb6e140a217 100644 --- a/readline/emacs_keymap.c +++ b/readline/emacs_keymap.c @@ -277,13 +277,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = { { ISFUNC, rl_insert }, /* Latin capital letter Y with acute */ { ISFUNC, rl_insert }, /* Latin capital letter thorn (Icelandic) */ { ISFUNC, rl_insert }, /* Latin small letter sharp s (German) */ -#ifndef __MINGW32__ { ISFUNC, rl_insert }, /* Latin small letter a with grave */ -#else - /* Temporary - this is a bug in readline 5.1 that should be fixed in - readline 5.2. */ - { ISFUNC, 0 }, /* Must leave this unbound for the arrow keys to work. */ -#endif { ISFUNC, rl_insert }, /* Latin small letter a with acute */ { ISFUNC, rl_insert }, /* Latin small letter a with circumflex */ { ISFUNC, rl_insert }, /* Latin small letter a with tilde */ diff --git a/readline/examples/Makefile.in b/readline/examples/Makefile.in index c8d937ad0b7..04399ce934e 100644 --- a/readline/examples/Makefile.in +++ b/readline/examples/Makefile.in @@ -68,11 +68,19 @@ TERMCAP_LIB = @TERMCAP_LIB@ $(CC) $(CCFLAGS) -c $< SOURCES = excallback.c fileman.c histexamp.c manexamp.c rl-fgets.c rl.c \ - rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c + rlcat.c rlevent.c rlptytest.c rltest.c rlversion.c \ + rl-callbacktest.c hist_erasedups.c hist_purgecmd.c EXECUTABLES = fileman$(EXEEXT) rltest$(EXEEXT) rl$(EXEEXT) rlcat$(EXEEXT) \ - rlevent$(EXEEXT) rlversion$(EXEEXT) histexamp$(EXEEXT) -OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o + rlevent$(EXEEXT) rlversion$(EXEEXT) histexamp$(EXEEXT) \ + rl-callbacktest$(EXEEXT) \ + hist_erasedups$(EXEEXT) hist_purgecmd$(EXEEXT) + +OBJECTS = fileman.o rltest.o rl.o rlevent.o rlcat.o rlversion.o histexamp.o \ + rl-callbacktest.o hist_erasedups.o hist_purgecmd.o + +OTHEREXE = rlptytest$(EXEEXT) +OTHEROBJ = rlptytest.o all: $(EXECUTABLES) everything: all @@ -110,6 +118,9 @@ fileman$(EXEEXT): fileman.o $(READLINE_LIB) rltest$(EXEEXT): rltest.o $(READLINE_LIB) $(PURIFY) $(CC) $(LDFLAGS) -o $@ rltest.o $(READLINE_LIB) $(TERMCAP_LIB) +rl-callbacktest$(EXEEXT): rl-callbacktest.o $(READLINE_LIB) + $(PURIFY) $(CC) $(LDFLAGS) -o $@ rl-callbacktest.o $(READLINE_LIB) $(TERMCAP_LIB) + rlptytest$(EXEEXT): rlptytest.o $(READLINE_LIB) $(PURIFY) $(CC) $(LDFLAGS) -o $@ rlptytest.o $(READLINE_LIB) $(TERMCAP_LIB) @@ -119,9 +130,15 @@ rlversion$(EXEEXT): rlversion.o $(READLINE_LIB) histexamp$(EXEEXT): histexamp.o $(HISTORY_LIB) $(PURIFY) $(CC) $(LDFLAGS) -o $@ histexamp.o -lhistory $(TERMCAP_LIB) +hist_erasedups$(EXEEXT): hist_erasedups.o $(HISTORY_LIB) + $(PURIFY) $(CC) $(LDFLAGS) -o $@ hist_erasedups.o -lhistory $(TERMCAP_LIB) + +hist_purgecmd$(EXEEXT): hist_purgecmd.o $(HISTORY_LIB) + $(PURIFY) $(CC) $(LDFLAGS) -o $@ hist_purgecmd.o -lhistory $(TERMCAP_LIB) + clean mostlyclean: - $(RM) $(OBJECTS) - $(RM) $(EXECUTABLES) *.exe + $(RM) $(OBJECTS) $(OTHEROBJ) + $(RM) $(EXECUTABLES) $(OTHEREXE) *.exe distclean maintainer-clean: clean $(RM) Makefile @@ -131,13 +148,19 @@ rltest.o: rltest.c rl.o: rl.c rlversion.o: rlversion.c histexamp.o: histexamp.c +hist_erasedups.o: hist_erasedups.c +hist_purgecmd.o: hist_purgecmd.c rlcat.o: rlcat.c rlptytest.o: rlptytest.c +rl-callbacktest.o: rl-callbacktest.c fileman.o: $(top_srcdir)/readline.h rltest.o: $(top_srcdir)/readline.h rl.o: $(top_srcdir)/readline.h rlversion.o: $(top_srcdir)/readline.h histexamp.o: $(top_srcdir)/history.h +hist_erasedups.o: $(top_srcdir)/history.h +hist_purgecmd.o: $(top_srcdir)/history.h rlcat.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h rlptytest.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h +rl-callbacktest.o: $(top_srcdir)/readline.h $(top_srcdir)/history.h diff --git a/readline/examples/excallback.c b/readline/examples/excallback.c index 385492b1b70..4206acfca4a 100644 --- a/readline/examples/excallback.c +++ b/readline/examples/excallback.c @@ -40,13 +40,14 @@ Copyright (C) 1999 Jeff Solomon #include <config.h> #endif -#include <stdio.h> #include <sys/types.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#include <stdlib.h> +#include <stdio.h> #include <termios.h> /* xxx - should make this more general */ #ifdef READLINE_LIBRARY @@ -55,6 +56,10 @@ Copyright (C) 1999 Jeff Solomon # include <readline/readline.h> #endif +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif + /* This little examples demonstrates the alternate interface to using readline. * In the alternate interface, the user maintains control over program flow and * only calls readline when STDIN is readable. Using the alternate interface, diff --git a/readline/examples/hist_erasedups.c b/readline/examples/hist_erasedups.c new file mode 100644 index 00000000000..02d617e3c6e --- /dev/null +++ b/readline/examples/hist_erasedups.c @@ -0,0 +1,121 @@ +/* hist_erasedups -- remove all duplicate entries from history file */ + +/* Copyright (C) 2011 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library for + reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef READLINE_LIBRARY +#define READLINE_LIBRARY 1 +#endif + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> + +#ifdef READLINE_LIBRARY +# include "history.h" +#else +# include <readline/history.h> +#endif + +#include <string.h> + +#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) +#define STREQN(a, b, n) ((n == 0) ? (1) \ + : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) + +extern int history_offset; + +static void +usage() +{ + fprintf (stderr, "hist_erasedups: usage: hist_erasedups [-t] [filename]\n"); + exit (2); +} + +int +main (argc, argv) + int argc; + char **argv; +{ + char *fn; + int r; + + while ((r = getopt (argc, argv, "t")) != -1) + { + switch (r) + { + case 't': + history_write_timestamps = 1; + break; + default: + usage (); + } + } + argv += optind; + argc -= optind; + + fn = argc ? argv[0] : getenv ("HISTFILE"); + if (fn == 0) + { + fprintf (stderr, "hist_erasedups: no history file\n"); + usage (); + } + + if ((r = read_history (fn)) != 0) + { + fprintf (stderr, "hist_erasedups: read_history: %s: %s\n", fn, strerror (r)); + exit (1); + } + + hist_erasedups (); + + if ((r = write_history (fn)) != 0) + { + fprintf (stderr, "hist_erasedups: write_history: %s: %s\n", fn, strerror (r)); + exit (1); + } + + exit (0); +} + +int +hist_erasedups () +{ + int r, n; + HIST_ENTRY *h, *temp; + + using_history (); + while (h = previous_history ()) + { + r = where_history (); + for (n = 0; n < r; n++) + { + temp = history_get (n+history_base); + if (STREQ (h->line, temp->line)) + { + remove_history (n); + r--; /* have to get one fewer now */ + n--; /* compensate for above increment */ + history_offset--; /* moving backwards in history list */ + } + } + } + using_history (); + + return r; +} diff --git a/readline/examples/hist_purgecmd.c b/readline/examples/hist_purgecmd.c new file mode 100644 index 00000000000..94becd8a5e1 --- /dev/null +++ b/readline/examples/hist_purgecmd.c @@ -0,0 +1,151 @@ +/* hist_purgecmd -- remove all instances of command or pattern from history + file */ + +/* Copyright (C) 2011 Free Software Foundation, Inc. + + This file is part of the GNU Readline Library (Readline), a library for + reading lines of text with interactive input and history editing. + + Readline is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Readline 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 Readline. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef READLINE_LIBRARY +#define READLINE_LIBRARY 1 +#endif + +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> + +#include <regex.h> + +#ifdef READLINE_LIBRARY +# include "history.h" +#else +# include <readline/history.h> +#endif + +#include <string.h> + +#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) +#define STREQN(a, b, n) ((n == 0) ? (1) \ + : ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)) + +extern int history_offset; + +#define PURGE_REGEXP 0x01 + +static void +usage() +{ + fprintf (stderr, "hist_purgecmd: usage: hist_purgecmd [-r] [-t] [-f filename] command-spec\n"); + exit (2); +} + +int +main (argc, argv) + int argc; + char **argv; +{ + char *fn; + int r, flags; + + flags = 0; + fn = 0; + while ((r = getopt (argc, argv, "f:rt")) != -1) + { + switch (r) + { + case 'f': + fn = optarg; + break; + case 'r': + flags |= PURGE_REGEXP; + break; + case 't': + history_write_timestamps = 1; + break; + default: + usage (); + } + } + argv += optind; + argc -= optind; + + if (fn == 0) + fn = getenv ("HISTFILE"); + if (fn == 0) + { + fprintf (stderr, "hist_purgecmd: no history file\n"); + usage (); + } + + if ((r = read_history (fn)) != 0) + { + fprintf (stderr, "hist_purgecmd: read_history: %s: %s\n", fn, strerror (r)); + exit (1); + } + + for (r = 0; r < argc; r++) + hist_purgecmd (argv[r], flags); + + if ((r = write_history (fn)) != 0) + { + fprintf (stderr, "hist_purgecmd: write_history: %s: %s\n", fn, strerror (r)); + exit (1); + } + + exit (0); +} + +int +hist_purgecmd (cmd, flags) + char *cmd; + int flags; +{ + int r, n, rflags; + HIST_ENTRY *temp; + regex_t regex = { 0 }; + + if (flags & PURGE_REGEXP) + { + rflags = REG_EXTENDED|REG_NOSUB; + if (regcomp (®ex, cmd, rflags)) + { + fprintf (stderr, "hist_purgecmd: %s: invalid regular expression\n", cmd); + return -1; + } + } + + r = 0; + using_history (); + r = where_history (); + for (n = 0; n < r; n++) + { + temp = history_get (n+history_base); + if (((flags & PURGE_REGEXP) && (regexec (®ex, temp->line, 0, 0, 0) == 0)) || + ((flags & PURGE_REGEXP) == 0 && STREQ (temp->line, cmd))) + { + remove_history (n); + r--; /* have to get one fewer now */ + n--; /* compensate for above increment */ + history_offset--; /* moving backwards in history list */ + } + } + using_history (); + + if (flags & PURGE_REGEXP) + regfree (®ex); + + return r; +} diff --git a/readline/examples/readlinebuf.h b/readline/examples/readlinebuf.h index b9189fbbec3..c8f3a7b41e2 100644 --- a/readline/examples/readlinebuf.h +++ b/readline/examples/readlinebuf.h @@ -1,7 +1,7 @@ /******************************************************************************* - * $Revision$ - * $Date$ - * $Author$ + * $Revision: 1.2 $ + * $Date: 2001/09/11 06:19:36 $ + * $Author: vyzo $ * * Contents: A streambuf which uses the GNU readline library for line I/O * (c) 2001 by Dimitris Vyzovitis [vyzo@media.mit.edu] diff --git a/readline/examples/rl-callbacktest.c b/readline/examples/rl-callbacktest.c new file mode 100644 index 00000000000..87a781dccab --- /dev/null +++ b/readline/examples/rl-callbacktest.c @@ -0,0 +1,87 @@ +/* Standard include files. stdio.h is required. */ +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +/* Used for select(2) */ +#include <sys/types.h> +#include <sys/select.h> + +#include <stdio.h> + +/* Standard readline include files. */ +#if defined (READLINE_LIBRARY) +# include "readline.h" +# include "history.h" +#else +# include <readline/readline.h> +# include <readline/history.h> +#endif + +static void cb_linehandler (char *); + +int running; +const char *prompt = "rltest$ "; + +/* Callback function called for each line when accept-line executed, EOF + seen, or EOF character read. This sets a flag and returns; it could + also call exit(3). */ +static void +cb_linehandler (char *line) +{ + /* Can use ^D (stty eof) or `exit' to exit. */ + if (line == NULL || strcmp (line, "exit") == 0) + { + if (line == 0) + printf ("\n"); + printf ("exit\n"); + /* This function needs to be called to reset the terminal settings, + and calling it from the line handler keeps one extra prompt from + being displayed. */ + rl_callback_handler_remove (); + + running = 0; + } + else + { + if (*line) + add_history (line); + printf ("input line: %s\n", line); + free (line); + } +} + +int +main (int c, char **v) +{ + fd_set fds; + int r; + + /* Install the line handler. */ + rl_callback_handler_install (prompt, cb_linehandler); + + /* Enter a simple event loop. This waits until something is available + to read on readline's input stream (defaults to standard input) and + calls the builtin character read callback to read it. It does not + have to modify the user's terminal settings. */ + running = 1; + while (running) + { + FD_ZERO (&fds); + FD_SET (fileno (rl_instream), &fds); + + r = select (FD_SETSIZE, &fds, NULL, NULL, NULL); + if (r < 0) + { + perror ("rltest: select"); + rl_callback_handler_remove (); + break; + } + + if (FD_ISSET (fileno (rl_instream), &fds)) + rl_callback_read_char (); + } + + printf ("rltest: Event loop has exited\n"); + return 0; +} diff --git a/readline/examples/rlfe/config.h.in b/readline/examples/rlfe/config.h.in index dbfc369663c..a843fecc4ac 100644 --- a/readline/examples/rlfe/config.h.in +++ b/readline/examples/rlfe/config.h.in @@ -21,7 +21,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * **************************************************************** - * $Id$ FAU + * $Id: config.h.in,v 1.12 1994/05/31 12:31:36 mlschroe Exp $ FAU */ @@ -377,3 +377,7 @@ #undef HAVE_SYS_STROPTS_H #undef HAVE_SYS_WAIT_H + +#undef HAVE_SGTTY_H + +#undef HAVE_SYS_SELECT_H diff --git a/readline/examples/rlfe/configure b/readline/examples/rlfe/configure index 17e902c2e94..e26bc281821 100755 --- a/readline/examples/rlfe/configure +++ b/readline/examples/rlfe/configure @@ -1,18 +1,20 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63. +# Generated by GNU Autoconf 2.64. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# Foundation, Inc. +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -20,23 +22,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_nl=' ' export as_nl @@ -44,7 +38,13 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -55,7 +55,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -78,13 +78,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -94,15 +87,15 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -114,12 +107,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' @@ -131,330 +128,299 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - # CDPATH. -$as_unset CDPATH - +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST else - as_have_required=no + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes else - exitcode=1 - echo positional parameters were not saved. + as_have_required=no fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - case $as_dir in + as_found=: + case $as_dir in #( /*) for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi done;; esac + as_found=false done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } IFS=$as_save_IFS - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 fi - - fi - fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ -exitcode=0 -if as_func_success; then - : + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' else - exitcode=1 - echo as_func_success failed. -fi + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi -if as_func_ret_success; then - : +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr else - exitcode=1 - echo as_func_ret_success failed. + as_expr=false fi -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname else - exitcode=1 - echo positional parameters were not saved. + as_dirname=false fi -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -471,8 +437,7 @@ test \$exitcode = 0") || { s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the @@ -482,29 +447,18 @@ test \$exitcode = 0") || { exit } - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -534,7 +488,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -553,10 +507,10 @@ else if test -d "$1"; then test -d "$1/."; else - case $1 in + case $1 in #( -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -570,7 +524,6 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - exec 7<&0 </dev/null 6>&1 # Name of the host. @@ -589,7 +542,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= @@ -597,6 +549,7 @@ PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="rlfe.c" # Factoring default headers for most tests. @@ -681,6 +634,7 @@ bindir program_transform_name prefix exec_prefix +PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -811,8 +765,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -838,8 +791,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1043,8 +995,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1060,8 +1011,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1091,17 +1041,17 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error "invalid variable name: \`$ac_envvar'" ;; + esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1118,15 +1068,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1149,8 +1097,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1180,11 +1127,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1223,13 +1168,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1337,6 +1280,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1400,21 +1344,372 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.64 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 2009 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case <limits.h> declares $2. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.64. Invocation command line was $ $0 $@ @@ -1450,8 +1745,8 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" -done + $as_echo "PATH: $as_dir" + done IFS=$as_save_IFS } >&5 @@ -1488,9 +1783,9 @@ do ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1506,13 +1801,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1537,13 +1832,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1615,39 +1910,41 @@ _ASBOX exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h + # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. @@ -1666,7 +1963,7 @@ for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" @@ -1677,7 +1974,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; @@ -1685,7 +1982,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1700,11 +1997,11 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; @@ -1714,17 +2011,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -1736,35 +2033,20 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi - - - - - - - - - - - - - - - - +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1788,9 +2070,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -1801,24 +2083,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -1828,9 +2110,9 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -1841,24 +2123,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -1867,7 +2149,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -1881,9 +2163,9 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -1894,24 +2176,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -1921,9 +2203,9 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -1935,18 +2217,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -1965,10 +2247,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -1980,9 +2262,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -1993,24 +2275,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2024,9 +2306,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2037,24 +2319,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2067,7 +2349,7 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2078,73 +2360,55 @@ fi fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include <stdio.h> int main () { +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` @@ -2161,17 +2425,17 @@ do done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2188,7 +2452,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2207,84 +2471,75 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then +if test -z "$ac_file"; then : $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } +{ as_fn_set_status 77 +as_fn_error "C compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } fi - ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (case "(($ac_try" in + { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. +as_fn_error "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +See \`config.log' for more details." "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } -if { (ac_try="$ac_link" +if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2299,32 +2554,24 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } fi - rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then +if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2336,17 +2583,17 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -2359,31 +2606,23 @@ else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then +if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2397,37 +2636,16 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes @@ -2436,20 +2654,16 @@ else fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then +if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2460,35 +2674,11 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2499,36 +2689,12 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - ac_c_werror_flag=$ac_save_c_werror_flag +else + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2539,42 +2705,17 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -2591,18 +2732,14 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then +if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> @@ -2659,32 +2796,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -2695,17 +2809,19 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2718,14 +2834,14 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then + if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -2740,11 +2856,7 @@ do # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include <limits.h> @@ -2753,78 +2865,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +if $ac_preproc_ok; then : break fi @@ -2836,7 +2904,7 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -2847,11 +2915,7 @@ do # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include <limits.h> @@ -2860,87 +2924,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +if $ac_preproc_ok; then : + else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } fi ac_ext=c @@ -2951,9 +2968,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then +if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -2964,7 +2981,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue @@ -2984,7 +3001,7 @@ case `"$ac_path_GREP" --version 2>&1` in $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -2999,26 +3016,24 @@ esac $ac_path_GREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then +if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3032,7 +3047,7 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue @@ -3052,7 +3067,7 @@ case `"$ac_path_EGREP" --version 2>&1` in $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3067,12 +3082,10 @@ esac $ac_path_EGREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -3080,29 +3093,25 @@ fi fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" if test $ac_cv_c_compiler_gnu = yes; then - { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } -if test "${ac_cv_prog_gcc_traditional+set}" = set; then +if test "${ac_cv_prog_gcc_traditional+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sgtty.h> Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no @@ -3111,41 +3120,33 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <termio.h> Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -{ $as_echo "$as_me:$LINENO: checking for library containing strerror" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } -if test "${ac_cv_search_strerror+set}" = set; then +if test "${ac_cv_search_strerror+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3170,105 +3171,45 @@ for ac_lib in '' cposix; do ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi - rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext - if test "${ac_cv_search_strerror+set}" = set; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_strerror+set}" = set; then : break fi done -if test "${ac_cv_search_strerror+set}" = set; then - : +if test "${ac_cv_search_strerror+set}" = set; then : + else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror -if test "$ac_res" != no; then +if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main(){exit(0);} _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) +else if test $CC != cc ; then echo "Your $CC failed - restarting with CC=cc" 1>&6 @@ -3281,88 +3222,44 @@ exec $0 $configure_args fi fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main(){exit(0);} _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -exec 5>&2 +else + exec 5>&2 eval $ac_link echo "CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;" 1>&6 echo "$ac_compile" 1>&6 -{ { $as_echo "$as_me:$LINENO: error: Can't run the compiler - sorry" >&5 -$as_echo "$as_me: error: Can't run the compiler - sorry" >&2;} - { (exit 1); exit 1; }; } +as_fn_error "Can't run the compiler - sorry" "$LINENO" 5 fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main() @@ -3372,50 +3269,21 @@ main() } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - { { $as_echo "$as_me:$LINENO: error: Your compiler does not set the exit status - sorry" >&5 -$as_echo "$as_me: error: Your compiler does not set the exit status - sorry" >&2;} - { (exit 1); exit 1; }; } -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +if ac_fn_c_try_run "$LINENO"; then : + as_fn_error "Your compiler does not set the exit status - sorry" "$LINENO" 5 fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then +if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -3426,24 +3294,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -3453,19 +3321,15 @@ done if test -f etc/toolcheck; then -{ $as_echo "$as_me:$LINENO: checking for buggy tools..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for buggy tools..." >&5 $as_echo "$as_me: checking for buggy tools..." >&6;} sh etc/toolcheck 1>&6 fi -{ $as_echo "$as_me:$LINENO: checking for System V..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for System V..." >&5 $as_echo "$as_me: checking for System V..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <signal.h> @@ -3478,44 +3342,17 @@ int x = SIGCHLD | FNDELAY; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - cat >>confdefs.h <<\_ACEOF -#define SYSV 1 -_ACEOF +else + $as_echo "#define SYSV 1" >>confdefs.h fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for Solaris 2.x..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris 2.x..." >&5 $as_echo "$as_me: checking for Solaris 2.x..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(SVR4) && defined(sun) yes @@ -3523,20 +3360,16 @@ cat >>conftest.$ac_ext <<_ACEOF _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then + $EGREP "yes" >/dev/null 2>&1; then : LIBS="$LIBS -lsocket -lnsl -lkstat" fi rm -f conftest* -{ $as_echo "$as_me:$LINENO: checking select..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking select..." >&5 $as_echo "$as_me: checking select..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3547,40 +3380,13 @@ select(0, 0, 0, 0, 0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - LIBS="$LIBS -lnet -lnsl" -{ $as_echo "$as_me:$LINENO: checking select with $LIBS..." >&5 +else + LIBS="$LIBS -lnet -lnsl" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking select with $LIBS..." >&5 $as_echo "$as_me: checking select with $LIBS..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3591,63 +3397,27 @@ select(0, 0, 0, 0, 0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - { { $as_echo "$as_me:$LINENO: error: !!! no select - no screen" >&5 -$as_echo "$as_me: error: !!! no select - no screen" >&2;} - { (exit 1); exit 1; }; } +else + as_fn_error "!!! no select - no screen" "$LINENO" 5 fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:$LINENO: checking select return value..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking select return value..." >&5 $as_echo "$as_me: checking select return value..." >&6;} -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> @@ -3749,55 +3519,22 @@ main() } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : echo "- select is ok" 1>&6 else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- select can't count" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define SELECT_BROKEN 1 -_ACEOF + echo "- select can't count" 1>&6 + $as_echo "#define SELECT_BROKEN 1" >>confdefs.h fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - -{ $as_echo "$as_me:$LINENO: checking for tgetent..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent..." >&5 $as_echo "$as_me: checking for tgetent..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3808,41 +3545,14 @@ tgetent((char *)0, (char *)0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - olibs="$LIBS" +else + olibs="$LIBS" LIBS="-lcurses $olibs" -{ $as_echo "$as_me:$LINENO: checking libcurses..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libcurses..." >&5 $as_echo "$as_me: checking libcurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3859,40 +3569,13 @@ tgetent((char *)0, (char *)0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - LIBS="-ltermcap $olibs" -{ $as_echo "$as_me:$LINENO: checking libtermcap..." >&5 +else + LIBS="-ltermcap $olibs" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libtermcap..." >&5 $as_echo "$as_me: checking libtermcap..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3903,40 +3586,13 @@ tgetent((char *)0, (char *)0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - LIBS="-ltermlib $olibs" -{ $as_echo "$as_me:$LINENO: checking libtermlib..." >&5 +else + LIBS="-ltermlib $olibs" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libtermlib..." >&5 $as_echo "$as_me: checking libtermlib..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3947,40 +3603,13 @@ tgetent((char *)0, (char *)0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - LIBS="-lncurses $olibs" -{ $as_echo "$as_me:$LINENO: checking libncurses..." >&5 +else + LIBS="-lncurses $olibs" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking libncurses..." >&5 $as_echo "$as_me: checking libncurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3991,130 +3620,56 @@ tgetent((char *)0, (char *)0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - { { $as_echo "$as_me:$LINENO: error: !!! no tgetent - no screen" >&5 -$as_echo "$as_me: error: !!! no tgetent - no screen" >&2;} - { (exit 1); exit 1; }; } +else + as_fn_error "!!! no tgetent - no screen" "$LINENO" 5 fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +extern char *tgoto(); main() { exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : echo "- you use the termcap database" 1>&6 else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- you use the terminfo database" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define TERMINFO 1 -_ACEOF + echo "- you use the terminfo database" 1>&6 + $as_echo "#define TERMINFO 1" >>confdefs.h fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - -{ $as_echo "$as_me:$LINENO: checking ospeed..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ospeed..." >&5 $as_echo "$as_me: checking ospeed..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern short ospeed; int @@ -4125,60 +3680,27 @@ ospeed=5; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_link "$LINENO"; then : - cat >>confdefs.h <<\_ACEOF -#define NEED_OSPEED 1 -_ACEOF +else + $as_echo "#define NEED_OSPEED 1" >>confdefs.h fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:$LINENO: checking for /dev/ptc..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc..." >&5 $as_echo "$as_me: checking for /dev/ptc..." >&6;} if test -r /dev/ptc; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_DEV_PTC 1 -_ACEOF +$as_echo "#define HAVE_DEV_PTC 1" >>confdefs.h fi -{ $as_echo "$as_me:$LINENO: checking for SVR4 ptys..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVR4 ptys..." >&5 $as_echo "$as_me: checking for SVR4 ptys..." >&6;} sysvr4ptys= if test -c /dev/ptmx ; then -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4189,140 +3711,21 @@ ptsname(0);grantpt(0);unlockpt(0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SVR4_PTYS 1 -_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + $as_echo "#define HAVE_SVR4_PTYS 1" >>confdefs.h sysvr4ptys=1 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - for ac_func in getpt -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt" +if test "x$ac_cv_func_getpt" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_GETPT 1 _ACEOF fi @@ -4330,117 +3733,23 @@ done if test -z "$sysvr4ptys"; then - for ac_func in openpty -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" +if test "x$ac_cv_func_openpty" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_OPENPTY 1 _ACEOF else - { $as_echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if test "${ac_cv_lib_util_openpty+set}" = set; then +if test "${ac_cv_lib_util_openpty+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4458,46 +3767,19 @@ return openpty (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_util_openpty=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_util_openpty=no + ac_cv_lib_util_openpty=no fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = x""yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_OPENPTY 1 -_ACEOF +if test "x$ac_cv_lib_util_openpty" = x""yes; then : + $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" fi @@ -4506,18 +3788,14 @@ done fi -{ $as_echo "$as_me:$LINENO: checking for ptyranges..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ptyranges..." >&5 $as_echo "$as_me: checking for ptyranges..." >&6;} if test -d /dev/ptym ; then pdir='/dev/ptym' else pdir='/dev' fi -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef M_UNIX yes; @@ -4525,7 +3803,7 @@ cat >>conftest.$ac_ext <<_ACEOF _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then + $EGREP "yes" >/dev/null 2>&1; then : ptys=`echo /dev/ptyp??` else ptys=`echo $pdir/pty??` @@ -4547,13 +3825,13 @@ fi # Check whether --with-pty-mode was given. -if test "${with_pty_mode+set}" = set; then +if test "${with_pty_mode+set}" = set; then : withval=$with_pty_mode; ptymode="${withval}" fi # Check whether --with-pty-group was given. -if test "${with_pty_group+set}" = set; then +if test "${with_pty_group+set}" = set; then : withval=$with_pty_group; ptygrp="${withval}" fi @@ -4569,23 +3847,16 @@ _ACEOF else -{ $as_echo "$as_me:$LINENO: checking default tty permissions/group..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking default tty permissions/group..." >&5 $as_echo "$as_me: checking default tty permissions/group..." >&6;} rm -f conftest_grp -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> @@ -4617,28 +3888,7 @@ main() } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : if test -f conftest_grp; then ptygrp=`cat conftest_grp` @@ -4658,19 +3908,14 @@ _ACEOF fi else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) WRITEPATH='' XTERMPATH='' # Extract the first word of "write", so it can be a program name with args. set dummy write; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_WRITEPATH+set}" = set; then +if test "${ac_cv_path_WRITEPATH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $WRITEPATH in @@ -4683,14 +3928,14 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_WRITEPATH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS ;; @@ -4698,19 +3943,19 @@ esac fi WRITEPATH=$ac_cv_path_WRITEPATH if test -n "$WRITEPATH"; then - { $as_echo "$as_me:$LINENO: result: $WRITEPATH" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WRITEPATH" >&5 $as_echo "$WRITEPATH" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "xterm", so it can be a program name with args. set dummy xterm; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_XTERMPATH+set}" = set; then +if test "${ac_cv_path_XTERMPATH+set}" = set; then : $as_echo_n "(cached) " >&6 else case $XTERMPATH in @@ -4723,14 +3968,14 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_XTERMPATH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS ;; @@ -4738,10 +3983,10 @@ esac fi XTERMPATH=$ac_cv_path_XTERMPATH if test -n "$XTERMPATH"; then - { $as_echo "$as_me:$LINENO: result: $XTERMPATH" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XTERMPATH" >&5 $as_echo "$XTERMPATH" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -4787,11 +4032,10 @@ _ACEOF fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest_grp fi @@ -4799,20 +4043,14 @@ if test -n "$posix" ; then echo "assuming posix signal definition" 1>&6 -cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF +$as_echo "#define SIGVOID 1" >>confdefs.h else -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers..." >&5 $as_echo "$as_me: checking return type of signal handlers..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> #include <signal.h> @@ -4828,43 +4066,14 @@ int i; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +if ac_fn_c_try_compile "$LINENO"; then : + $as_echo "#define SIGVOID 1" >>confdefs.h fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking sigset..." >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sigset..." >&5 $as_echo "$as_me: checking sigset..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> @@ -4884,57 +4093,21 @@ sigset(0, (int (*)())0); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - cat >>confdefs.h <<\_ACEOF -#define USESIGSET 1 -_ACEOF - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +if ac_fn_c_try_link "$LINENO"; then : + $as_echo "#define USESIGSET 1" >>confdefs.h fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking signal implementation..." >&5 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking signal implementation..." >&5 $as_echo "$as_me: checking signal implementation..." >&6;} -if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/types.h> @@ -4971,58 +4144,25 @@ main() } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -cat >>confdefs.h <<\_ACEOF -#define SYSVSIGS 1 -_ACEOF +else + $as_echo "#define SYSVSIGS 1" >>confdefs.h fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then +if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> @@ -5037,48 +4177,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + ac_cv_header_stdc=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -5088,18 +4203,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -5109,14 +4220,10 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ctype.h> #include <stdlib.h> @@ -5143,118 +4250,34 @@ main () return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -5264,147 +4287,26 @@ fi done - - -for ac_header in sys/stropts.h sys/wait.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> +for ac_header in sys/stropts.h sys/wait.h sgtty.h sys/select.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +done -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +for ac_header in term.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "term.h" "ac_cv_header_term_h" "$ac_includes_default" +if test "x$ac_cv_header_term_h" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_TERM_H 1 _ACEOF fi @@ -5441,13 +4343,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -5455,8 +4357,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -5479,11 +4381,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi @@ -5503,8 +4405,8 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -5516,9 +4418,10 @@ LTLIBOBJS=$ac_ltlibobjs ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -5528,17 +4431,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -5546,23 +4450,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_nl=' ' export as_nl @@ -5570,7 +4466,13 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -5581,7 +4483,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -5604,13 +4506,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -5620,15 +4515,15 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -5640,12 +4535,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' @@ -5657,7 +4556,89 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -5671,8 +4652,12 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -5692,76 +4677,25 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -5790,8 +4724,56 @@ fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -5810,10 +4792,10 @@ else if test -d "$1"; then test -d "$1/."; else - case $1 in + case $1 in #( -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -5828,13 +4810,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Save the log message, to keep $[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.64. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5865,10 +4853,11 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTION]... [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit @@ -5887,16 +4876,16 @@ $config_files Configuration headers: $config_headers -Report bugs to <bug-autoconf@gnu.org>." +Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.63, +configured by $0, generated by GNU Autoconf 2.64, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2009 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -5937,20 +4926,19 @@ do case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; + as_fn_error "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -5958,11 +4946,10 @@ Try \`$0 --help' for more information." >&2 ac_cs_silent=: ;; # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -6011,9 +4998,7 @@ do "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -6039,7 +5024,7 @@ $debug || trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. @@ -6050,11 +5035,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6062,10 +5043,16 @@ $debug || if test -n "$CONFIG_FILES"; then -ac_cr='
' +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' + ac_cs_awk_cr='\r' else ac_cs_awk_cr=$ac_cr fi @@ -6079,24 +5066,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6185,9 +5166,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), @@ -6228,9 +5207,7 @@ for ac_last_try in false false :; do if test -z "$ac_t"; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6315,9 +5292,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -6330,9 +5305,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6360,12 +5333,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -6376,7 +5347,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. @@ -6389,9 +5360,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -6419,47 +5388,7 @@ $as_echo X"$ac_file" | q } s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in @@ -6507,7 +5436,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - ac_sed_dataroot=' /datarootdir/ { p @@ -6517,12 +5445,11 @@ ac_sed_dataroot=' /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' +/@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -6532,7 +5459,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -6559,14 +5486,12 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} @@ -6576,9 +5501,7 @@ which seems to be undefined. Please make sure it is defined." >&2;} -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -6589,25 +5512,19 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;} $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error "could not create -" "$LINENO" 5 fi ;; @@ -6617,15 +5534,12 @@ $as_echo "$as_me: error: could not create -" >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -6646,10 +5560,10 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit $? fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/readline/examples/rlfe/configure.in b/readline/examples/rlfe/configure.in index 108cd3f50e3..ad7ce65fc06 100644 --- a/readline/examples/rlfe/configure.in +++ b/readline/examples/rlfe/configure.in @@ -1,7 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -m4_include([../../../config/override.m4]) - AC_INIT(rlfe.c) AC_CONFIG_HEADER(config.h) VERSION=0.4 @@ -225,6 +223,7 @@ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, AC_MSG_ERROR(!!! no tgetent - no screen)))))) AC_TRY_RUN([ +extern char *tgoto(); main() { exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); @@ -437,6 +436,7 @@ main() fi -AC_CHECK_HEADERS(sys/stropts.h sys/wait.h) +AC_CHECK_HEADERS(sys/stropts.h sys/wait.h sgtty.h sys/select.h) +AC_CHECK_HEADERS(term.h) AC_OUTPUT(Makefile) diff --git a/readline/examples/rlfe/extern.h b/readline/examples/rlfe/extern.h index e9a5d01566b..2fe50250cc4 100644 --- a/readline/examples/rlfe/extern.h +++ b/readline/examples/rlfe/extern.h @@ -19,7 +19,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * **************************************************************** - * $Id$ FAU + * $Id: extern.h,v 1.18 1994/05/31 12:31:57 mlschroe Exp $ FAU */ #if !defined(__GNUC__) || __GNUC__ < 2 diff --git a/readline/examples/rlfe/os.h b/readline/examples/rlfe/os.h index 734bc8c4308..df06c758099 100644 --- a/readline/examples/rlfe/os.h +++ b/readline/examples/rlfe/os.h @@ -19,7 +19,7 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * **************************************************************** - * $Id$ FAU + * $Id: os.h,v 1.10 1994/05/31 12:32:22 mlschroe Exp $ FAU */ #include <stdio.h> @@ -208,7 +208,9 @@ extern int errno; # include <cytermio.h> # endif # else /* TERMIO */ -# include <sgtty.h> +# if defined (HAVE_SGTTY_H) +# include <sgtty.h> +# endif # endif /* TERMIO */ #endif /* POSIX */ @@ -490,7 +492,7 @@ extern int errno; * select stuff */ -#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) +#if defined(M_XENIX) || defined(M_UNIX) || defined(_SEQUENT_) || defined (__INTERIX) #include <sys/select.h> /* for timeval + FD... */ #endif diff --git a/readline/examples/rlfe/rlfe.c b/readline/examples/rlfe/rlfe.c index eacd5abbb7b..f40b2ddaf00 100644 --- a/readline/examples/rlfe/rlfe.c +++ b/readline/examples/rlfe/rlfe.c @@ -547,7 +547,14 @@ main(int argc, char** argv) #endif t.c_lflag &= ~(ICANON | ISIG | ECHO | ECHOCTL | ECHOE | \ - ECHOK | ECHOKE | ECHONL | ECHOPRT ); + ECHOK | ECHONL +#if defined (ECHOKE) + | ECHOKE +#endif +#if defined (ECHOPRT) + | ECHOPRT +#endif + ); t.c_iflag &= ~ICRNL; t.c_iflag |= IGNBRK; t.c_cc[VMIN] = 1; diff --git a/readline/examples/rlptytest.c b/readline/examples/rlptytest.c index 79257db4005..0699e86153b 100644 --- a/readline/examples/rlptytest.c +++ b/readline/examples/rlptytest.c @@ -19,7 +19,7 @@ #include <signal.h> -#if 0 /* LINUX */ +#if 1 /* LINUX */ #include <pty.h> #else #include <util.h> @@ -316,6 +316,8 @@ main() if (val == -1) return -1; + signal (SIGINT, sigint); + val = init_readline (slavefd, slavefd); if (val == -1) return -1; @@ -324,8 +326,6 @@ main() if (val == -1) return -1; - signal (SIGINT, sigint); - val = main_loop (); tty_reset (STDIN_FILENO); diff --git a/readline/funmap.c b/readline/funmap.c index 86e375f60d0..363507b8677 100644 --- a/readline/funmap.c +++ b/readline/funmap.c @@ -98,6 +98,8 @@ static const FUNMAP default_funmap[] = { { "forward-word", rl_forward_word }, { "history-search-backward", rl_history_search_backward }, { "history-search-forward", rl_history_search_forward }, + { "history-substring-search-backward", rl_history_substr_search_backward }, + { "history-substring-search-forward", rl_history_substr_search_forward }, { "insert-comment", rl_insert_comment }, { "insert-completions", rl_insert_completions }, { "kill-whole-line", rl_kill_full_line }, @@ -118,6 +120,7 @@ static const FUNMAP default_funmap[] = { #endif { "possible-completions", rl_possible_completions }, { "previous-history", rl_get_previous_history }, + { "print-last-kbd-macro", rl_print_last_kbd_macro }, { "quoted-insert", rl_quoted_insert }, { "re-read-init-file", rl_re_read_init_file }, { "redraw-current-line", rl_refresh_line}, @@ -236,7 +239,7 @@ rl_initialize_funmap () /* Produce a NULL terminated array of known function names. The array is sorted. The array itself is allocated, but not the strings inside. - You should free () the array when you done, but not the pointrs. */ + You should free () the array when you done, but not the pointers. */ const char ** rl_funmap_names () { diff --git a/readline/histexpand.c b/readline/histexpand.c index 8fb3798b7ca..4899b9d3a0e 100644 --- a/readline/histexpand.c +++ b/readline/histexpand.c @@ -1,6 +1,6 @@ /* histexpand.c -- history expansion. */ -/* Copyright (C) 1989-2010 Free Software Foundation, Inc. +/* Copyright (C) 1989-2012 Free Software Foundation, Inc. This file contains the GNU History Library (History), a set of routines for managing the text of previously typed lines. @@ -272,6 +272,8 @@ get_history_event (string, caller_index, delimiting_quote) if (local_index == 0 || substring_okay) { entry = current_history (); + if (entry == 0) + FAIL_SEARCH (); history_offset = history_length; /* If this was a substring search, then remember the @@ -519,9 +521,9 @@ postproc_subst_rhs () the returned string. Returns the new index into string in *END_INDEX_PTR, and the expanded specifier in *RET_STRING. */ static int -history_expand_internal (string, start, end_index_ptr, ret_string, current_line) +history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_line) char *string; - int start, *end_index_ptr; + int start, qc, *end_index_ptr; char **ret_string; char *current_line; /* for !# */ { @@ -557,30 +559,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) event = current_line; } else - { - int quoted_search_delimiter = 0; - - /* If the character before this `!' is a double or single - quote, then this expansion takes place inside of the - quoted string. If we have to search for some text ("!foo"), - allow the delimiter to end the search string. */ -#if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) - { - int ch, l; - l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY); - ch = string[l]; - /* XXX - original patch had i - 1 ??? If i == 0 it would fail. */ - if (i && (ch == '\'' || ch == '"')) - quoted_search_delimiter = ch; - } - else -#endif /* HANDLE_MULTIBYTE */ - if (i && (string[i - 1] == '\'' || string[i - 1] == '"')) - quoted_search_delimiter = string[i - 1]; - - event = get_history_event (string, &i, quoted_search_delimiter); - } + event = get_history_event (string, &i, qc); if (event == 0) { @@ -854,7 +833,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line) } i += 2; } - /* Done with modfiers. */ + /* Done with modifiers. */ /* Believe it or not, we have to back the pointer up by one. */ --i; @@ -928,7 +907,7 @@ history_expand (hstring, output) char **output; { register int j; - int i, r, l, passc, cc, modified, eindex, only_printing, dquote, flag; + int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag; char *string; /* The output string, and its length. */ @@ -991,7 +970,7 @@ history_expand (hstring, output) /* `!' followed by one of the characters in history_no_expand_chars is NOT an expansion. */ - for (i = dquote = 0; string[i]; i++) + for (i = dquote = squote = 0; string[i]; i++) { #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) @@ -1022,6 +1001,13 @@ history_expand (hstring, output) { if (cc == 0 || member (cc, history_no_expand_chars)) continue; + /* DQUOTE won't be set unless history_quotes_inhibit_expansion + is set. The idea here is to treat double-quoted strings the + same as the word outside double quotes; in effect making the + double quote part of history_no_expand_chars when DQUOTE is + set. */ + else if (dquote && cc == '"') + continue; /* If the calling application has set history_inhibit_expansion_function to a function that checks for special cases that should not be history expanded, @@ -1071,9 +1057,9 @@ history_expand (hstring, output) } /* Extract and perform the substitution. */ - for (passc = dquote = i = j = 0; i < l; i++) + for (passc = dquote = squote = i = j = 0; i < l; i++) { - int tchar = string[i]; + int qc, tchar = string[i]; if (passc) { @@ -1130,8 +1116,14 @@ history_expand (hstring, output) case '\'': { /* If history_quotes_inhibit_expansion is set, single quotes - inhibit history expansion. */ - if (dquote == 0 && history_quotes_inhibit_expansion) + inhibit history expansion, otherwise they are treated like + double quotes. */ + if (squote) + { + squote = 0; + ADD_CHAR (tchar); + } + else if (dquote == 0 && history_quotes_inhibit_expansion) { int quote, slen; @@ -1146,6 +1138,11 @@ history_expand (hstring, output) ADD_STRING (temp); xfree (temp); } + else if (dquote == 0 && squote == 0 && history_quotes_inhibit_expansion == 0) + { + squote = 1; + ADD_CHAR (string[i]); + } else ADD_CHAR (string[i]); break; @@ -1171,6 +1168,7 @@ history_expand (hstring, output) characters in history_no_expand_chars, then it is not a candidate for expansion of any kind. */ if (cc == 0 || member (cc, history_no_expand_chars) || + (dquote && cc == '"') || (history_inhibit_expansion_function && (*history_inhibit_expansion_function) (string, i))) { ADD_CHAR (string[i]); @@ -1196,8 +1194,8 @@ history_expand (hstring, output) break; } #endif - - r = history_expand_internal (string, i, &eindex, &temp, result); + qc = squote ? '\'' : (dquote ? '"' : 0); + r = history_expand_internal (string, i, qc, &eindex, &temp, result); if (r < 0) { *output = temp; diff --git a/readline/histfile.c b/readline/histfile.c index 30a618247f1..bb7431567ec 100644 --- a/readline/histfile.c +++ b/readline/histfile.c @@ -125,14 +125,7 @@ history_filename (filename) home = sh_get_env_value ("HOME"); if (home == 0) - { -#if 0 - home = "."; - home_len = 1; -#else - return (NULL); -#endif - } + return (NULL); else home_len = strlen (home); @@ -148,6 +141,21 @@ history_filename (filename) return (return_val); } +static char * +history_backupfile (filename) + const char *filename; +{ + char *ret; + size_t len; + + len = strlen (filename); + ret = xmalloc (len + 2); + strcpy (ret, filename); + ret[len] = '-'; + ret[len+1] = '\0'; + return ret; +} + /* 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. */ @@ -403,14 +411,16 @@ history_truncate_file (fname, lines) truncate to. */ if (bp > buffer && ((file = open (filename, O_WRONLY|O_TRUNC|O_BINARY, 0600)) != -1)) { - write (file, bp, chars_read - (bp - buffer)); + if (write (file, bp, chars_read - (bp - buffer)) < 0) + rv = errno; #if defined (__BEOS__) /* BeOS ignores O_TRUNC. */ ftruncate (file, chars_read - (bp - buffer)); #endif - close (file); + if (close (file) < 0 && rv == 0) + rv = errno; } truncate_exit: @@ -430,7 +440,7 @@ history_do_write (filename, nelements, overwrite) int nelements, overwrite; { register int i; - char *output; + char *output, *bakname; int file, mode, rv; #ifdef HISTORY_USE_MMAP size_t cursize; @@ -440,13 +450,22 @@ history_do_write (filename, nelements, overwrite) mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY; #endif output = history_filename (filename); + bakname = (overwrite && output) ? history_backupfile (output) : 0; + + if (output && bakname) + rename (output, bakname); + file = output ? open (output, mode, 0600) : -1; rv = 0; if (file == -1) { + rv = errno; + if (output && bakname) + rename (bakname, output); FREE (output); - return (errno); + FREE (bakname); + return (rv); } #ifdef HISTORY_USE_MMAP @@ -486,8 +505,11 @@ history_do_write (filename, nelements, overwrite) { mmap_error: rv = errno; - FREE (output); close (file); + if (output && bakname) + rename (bakname, output); + FREE (output); + FREE (bakname); return rv; } #else @@ -495,8 +517,11 @@ mmap_error: if (buffer == 0) { rv = errno; - FREE (output); close (file); + if (output && bakname) + rename (bakname, output); + FREE (output); + FREE (bakname); return rv; } #endif @@ -524,9 +549,16 @@ mmap_error: #endif } - close (file); + if (close (file) < 0 && rv == 0) + rv = errno; + + if (rv != 0 && output && bakname) + rename (bakname, output); + else if (rv == 0 && bakname) + unlink (bakname); FREE (output); + FREE (bakname); return (rv); } diff --git a/readline/history.c b/readline/history.c index d7894cfd0a4..1181e7ccf83 100644 --- a/readline/history.c +++ b/readline/history.c @@ -1,6 +1,6 @@ /* history.c -- standalone history library */ -/* Copyright (C) 1989-2009 Free Software Foundation, Inc. +/* Copyright (C) 1989-2011 Free Software Foundation, Inc. This file contains the GNU History Library (History), a set of routines for managing the text of previously typed lines. @@ -236,7 +236,7 @@ history_get_time (hist) ts = hist->timestamp; if (ts[0] != history_comment_char) return 0; - t = (time_t) atol (ts + 1); /* XXX - should use strtol() here */ + t = (time_t) strtol (ts + 1, (char **)NULL, 10); /* XXX - should use strtol() here */ return t; } @@ -318,7 +318,7 @@ add_history_time (string) { HIST_ENTRY *hs; - if (string == 0) + if (string == 0 || history_length < 1) return; hs = the_history[history_length - 1]; FREE (hs->timestamp); @@ -394,7 +394,7 @@ replace_history_entry (which, line, data) WHICH >= 0 means to replace that particular history entry's data, as long as it matches OLD. */ void -replace_history_data (which,old, new) +replace_history_data (which, old, new) int which; histdata_t *old, *new; { diff --git a/readline/history.h b/readline/history.h index 1257e66c3e5..c8af47e5ad7 100644 --- a/readline/history.h +++ b/readline/history.h @@ -216,7 +216,7 @@ extern int history_truncate_file PARAMS((const char *, int)); -1) If there was an error in expansion. 2) If the returned line should just be printed. - If an error ocurred in expansion, then OUTPUT contains a descriptive + If an error occurred in expansion, then OUTPUT contains a descriptive error message. */ extern int history_expand PARAMS((char *, char **)); diff --git a/readline/input.c b/readline/input.c index 7c74c995089..f3f6d593c59 100644 --- a/readline/input.c +++ b/readline/input.c @@ -1,6 +1,6 @@ /* input.c -- character input functions for readline. */ -/* Copyright (C) 1994-2010 Free Software Foundation, Inc. +/* Copyright (C) 1994-2013 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -45,6 +45,8 @@ # include "ansi_stdlib.h" #endif /* HAVE_STDLIB_H */ +#include <signal.h> + #include "posixselect.h" #if defined (FIONREAD_IN_SYS_IOCTL) @@ -78,6 +80,13 @@ extern int errno; character input. */ rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL; +/* A function to call if a read(2) is interrupted by a signal. */ +rl_hook_func_t *rl_signal_event_hook = (rl_hook_func_t *)NULL; + +/* A function to replace _rl_input_available for applications using the + callback interface. */ +rl_hook_func_t *rl_input_available_hook = (rl_hook_func_t *)NULL; + rl_getc_func_t *rl_getc_function = rl_getc; static int _keyboard_input_timeout = 100000; /* 0.1 seconds; it's in usec */ @@ -104,6 +113,12 @@ _rl_any_typein () return any_typein; } +int +_rl_pushed_input_available () +{ + return (push_index != pop_index); +} + /* Return the amount of space available in the buffer for stuffing characters. */ static int @@ -117,7 +132,7 @@ ibuffer_space () /* Get a key from the buffer of characters to be read. Return the key in KEY. - Result is KEY if there was a key, or 0 if there wasn't. */ + Result is non-zero if there was a key, or 0 if there wasn't. */ static int rl_get_char (key) int *key; @@ -154,12 +169,6 @@ _rl_unget_char (key) return (0); } -int -_rl_pushed_input_available () -{ - return (push_index != pop_index); -} - /* If a character is available to be read, then read it and stuff it into IBUFFER. Otherwise, just return. Returns number of characters read (0 if none available) and -1 on error (EIO). */ @@ -291,6 +300,9 @@ _rl_input_available () #endif int tty; + if (rl_input_available_hook) + return (*rl_input_available_hook) (); + tty = fileno (rl_instream); #if defined (HAVE_SELECT) @@ -409,9 +421,7 @@ rl_clear_pending_input () int rl_read_key () { - int c; - - rl_key_sequence_length++; + int c, r; if (rl_pending_input) { @@ -429,14 +439,18 @@ rl_read_key () { while (rl_event_hook) { - if (rl_gather_tyi () < 0) /* XXX - EIO */ + if (rl_get_char (&c) != 0) + break; + + if ((r = rl_gather_tyi ()) < 0) /* XXX - EIO */ { rl_done = 1; return ('\n'); } + else if (r > 0) /* read something */ + continue; + RL_CHECK_SIGNALS (); - if (rl_get_char (&c) != 0) - break; if (rl_done) /* XXX - experimental */ return ('\n'); (*rl_event_hook) (); @@ -446,6 +460,7 @@ rl_read_key () { if (rl_get_char (&c) == 0) c = (*rl_getc_function) (rl_instream); +/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d", _rl_caught_signal); */ RL_CHECK_SIGNALS (); } } @@ -464,6 +479,8 @@ rl_getc (stream) { RL_CHECK_SIGNALS (); + /* We know at this point that _rl_caught_signal == 0 */ + #if defined (__MINGW32__) if (isatty (fileno (stream))) return (getch ()); @@ -505,11 +522,31 @@ rl_getc (stream) #undef X_EWOULDBLOCK #undef X_EAGAIN - /* If the error that we received was SIGINT, then try again, - this is simply an interrupted system call to read (). - Otherwise, some error ocurred, also signifying EOF. */ +/* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */ + + /* If the error that we received was EINTR, then try again, + this is simply an interrupted system call to read (). We allow + the read to be interrupted if we caught SIGHUP or SIGTERM (but + not SIGINT; let the signal handler deal with that), but if the + application sets an event hook, call it for other signals. + Otherwise (not EINTR), some error occurred, also signifying EOF. */ if (errno != EINTR) return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); + else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM) + return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF); + /* keyboard-generated signals of interest */ + else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT) + RL_CHECK_SIGNALS (); + /* non-keyboard-generated signals of interest */ + else if (_rl_caught_signal == SIGALRM +#if defined (SIGVTALRM) + || _rl_caught_signal == SIGVTALRM +#endif + ) + RL_CHECK_SIGNALS (); + + if (rl_signal_event_hook) + (*rl_signal_event_hook) (); } } diff --git a/readline/isearch.c b/readline/isearch.c index 712b9ea8ece..6f6a7a65839 100644 --- a/readline/isearch.c +++ b/readline/isearch.c @@ -6,7 +6,7 @@ /* */ /* **************************************************************** */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -110,7 +110,7 @@ _rl_scxt_alloc (type, flags) cxt->history_pos = 0; cxt->direction = 0; - cxt->lastc = 0; + cxt->prevc = cxt->lastc = 0; cxt->sline = 0; cxt->sline_len = cxt->sline_index = 0; @@ -156,16 +156,16 @@ rl_forward_search_history (sign, key) WHERE is the history list number of the current line. If it is -1, then this line is the starting one. */ static void -rl_display_search (search_string, reverse_p, where) +rl_display_search (search_string, flags, where) char *search_string; - int reverse_p, where; + int flags, where; { char *message; int msglen, searchlen; searchlen = (search_string && *search_string) ? strlen (search_string) : 0; - message = (char *)xmalloc (searchlen + 33); + message = (char *)xmalloc (searchlen + 64); msglen = 0; #if defined (NOTDEF) @@ -178,7 +178,13 @@ rl_display_search (search_string, reverse_p, where) message[msglen++] = '('; - if (reverse_p) + if (flags & SF_FAILED) + { + strcpy (message + msglen, "failed "); + msglen += 7; + } + + if (flags & SF_REVERSE) { strcpy (message + msglen, "reverse-"); msglen += 8; @@ -215,7 +221,7 @@ _rl_isearch_init (direction) cxt->search_terminators = _rl_isearch_terminators ? _rl_isearch_terminators : default_isearch_terminators; - /* Create an arrary of pointers to the lines that we want to search. */ + /* Create an array of pointers to the lines that we want to search. */ hlist = history_list (); rl_maybe_replace_line (); i = 0; @@ -312,13 +318,19 @@ _rl_search_getchar (cxt) RL_UNSETSTATE(RL_STATE_MOREINPUT); #if defined (HANDLE_MULTIBYTE) + /* This ends up with C (and LASTC) being set to the last byte of the + multibyte character. In most cases c == lastc == mb[0] */ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) c = cxt->lastc = _rl_read_mbstring (cxt->lastc, cxt->mb, MB_LEN_MAX); #endif + RL_CHECK_SIGNALS (); return c; } +#define ENDSRCH_CHAR(c) \ + ((CTRL_CHAR (c) || META_CHAR (c) || (c) == RUBOUT) && ((c) != CTRL ('G'))) + /* Process just-read character C according to isearch context CXT. Return -1 if the caller should just free the context and return, 0 if we should break out of the loop, and 1 if we should continue to read characters. */ @@ -344,13 +356,43 @@ _rl_isearch_dispatch (cxt, c) incremental search, so we check */ if (c >= 0 && cxt->keymap[c].type == ISKMAP && strchr (cxt->search_terminators, cxt->lastc) == 0) { + /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued + takes microseconds, so multiply by 1000. If we don't get any + additional input and this keymap shadows another function, process + that key as if it was all we read. */ + if (_rl_keyseq_timeout > 0 && + RL_ISSTATE (RL_STATE_CALLBACK) == 0 && + RL_ISSTATE (RL_STATE_INPUTPENDING) == 0 && + _rl_pushed_input_available () == 0 && + ((Keymap)(cxt->keymap[c].function))[ANYOTHERKEY].function && + _rl_input_queued (_rl_keyseq_timeout*1000) == 0) + goto add_character; + + cxt->okeymap = cxt->keymap; cxt->keymap = FUNCTION_TO_KEYMAP (cxt->keymap, c); cxt->sflags |= SF_CHGKMAP; /* XXX - we should probably save this sequence, so we can do - something useful if this doesn't end up mapping to a command. */ + something useful if this doesn't end up mapping to a command we + interpret here. Right now we just save the most recent character + that caused the index into a new keymap. */ + cxt->prevc = c; +#if defined (HANDLE_MULTIBYTE) + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + if (cxt->mb[1] == 0) + { + cxt->pmb[0] = c; /* XXX should be == cxt->mb[0] */ + cxt->pmb[1] = '\0'; + } + else + memcpy (cxt->pmb, cxt->mb, sizeof (cxt->pmb)); + } +#endif return 1; } +add_character: + /* Translate the keys we do something with to opcodes. */ if (c >= 0 && cxt->keymap[c].type == ISFUNC) { @@ -376,6 +418,54 @@ _rl_isearch_dispatch (cxt, c) { cxt->keymap = cxt->okeymap; cxt->sflags &= ~SF_CHGKMAP; + /* If we indexed into a new keymap, but didn't map to a command that + affects the search (lastc > 0), and the character that mapped to a + new keymap would have ended the search (ENDSRCH_CHAR(cxt->prevc)), + handle that now as if the previous char would have ended the search + and we would have read the current character. */ + /* XXX - should we check cxt->mb? */ + if (cxt->lastc > 0 && ENDSRCH_CHAR (cxt->prevc)) + { + rl_stuff_char (cxt->lastc); + rl_execute_next (cxt->prevc); + /* XXX - do we insert everything in cxt->pmb? */ + return (0); + } + /* Otherwise, if the current character is mapped to self-insert or + nothing (i.e., not an editing command), and the previous character + was a keymap index, then we need to insert both the previous + character and the current character into the search string. */ + else if (cxt->lastc > 0 && cxt->prevc > 0 && + cxt->keymap[cxt->prevc].type == ISKMAP && + (f == 0 || f == rl_insert)) + { + /* Make lastc be the next character read */ + /* XXX - do we insert everything in cxt->mb? */ + rl_execute_next (cxt->lastc); + /* Dispatch on the previous character (insert into search string) */ + cxt->lastc = cxt->prevc; +#if defined (HANDLE_MULTIBYTE) + /* Have to overwrite cxt->mb here because dispatch uses it below */ + if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) + { + if (cxt->pmb[1] == 0) + { + cxt->mb[0] = cxt->lastc; /* == cxt->prevc */ + cxt->mb[1] = '\0'; + } + else + memcpy (cxt->mb, cxt->pmb, sizeof (cxt->mb)); + } +#endif + cxt->prevc = 0; + } + else if (cxt->lastc > 0 && cxt->prevc > 0 && f && f != rl_insert) + { + rl_stuff_char (cxt->lastc); + rl_execute_next (cxt->prevc); + /* XXX - do we insert everything in cxt->pmb? */ + return (0); + } } /* The characters in isearch_terminators (set from the user-settable @@ -393,14 +483,11 @@ _rl_isearch_dispatch (cxt, c) XXX - since _rl_input_available depends on the application- settable keyboard timeout value, this could alternatively use _rl_input_queued(100000) */ - if (cxt->lastc == ESC && _rl_input_available ()) + if (cxt->lastc == ESC && (_rl_pushed_input_available () || _rl_input_available ())) rl_execute_next (ESC); return (0); } -#define ENDSRCH_CHAR(c) \ - ((CTRL_CHAR (c) || META_CHAR (c) || (c) == RUBOUT) && ((c) != CTRL ('G'))) - #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { @@ -436,7 +523,7 @@ _rl_isearch_dispatch (cxt, c) cxt->search_string = (char *)xrealloc (cxt->search_string, cxt->search_string_size); strcpy (cxt->search_string, last_isearch_string); cxt->search_string_index = last_isearch_string_len; - rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), -1); + rl_display_search (cxt->search_string, cxt->sflags, -1); break; } return (1); @@ -544,12 +631,16 @@ _rl_isearch_dispatch (cxt, c) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { int j, l; - for (j = 0, l = strlen (cxt->mb); j < l; ) - cxt->search_string[cxt->search_string_index++] = cxt->mb[j++]; + + if (cxt->mb[0] == 0 || cxt->mb[1] == 0) + cxt->search_string[cxt->search_string_index++] = cxt->mb[0]; + else + for (j = 0, l = RL_STRLEN (cxt->mb); j < l; ) + cxt->search_string[cxt->search_string_index++] = cxt->mb[j++]; } else #endif - cxt->search_string[cxt->search_string_index++] = c; + cxt->search_string[cxt->search_string_index++] = cxt->lastc; /* XXX - was c instead of lastc */ cxt->search_string[cxt->search_string_index] = '\0'; break; } @@ -606,6 +697,7 @@ _rl_isearch_dispatch (cxt, c) /* We cannot find the search string. Ding the bell. */ rl_ding (); cxt->history_pos = cxt->last_found_line; + rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos); return 1; } @@ -618,7 +710,7 @@ _rl_isearch_dispatch (cxt, c) rl_replace_line (cxt->lines[cxt->history_pos], 0); rl_point = cxt->sline_index; cxt->last_found_line = cxt->history_pos; - rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos); + rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos); } return 1; @@ -653,7 +745,7 @@ rl_search_history (direction, invoking_key) RL_SETSTATE(RL_STATE_ISEARCH); cxt = _rl_isearch_init (direction); - rl_display_search (cxt->search_string, (cxt->sflags & SF_REVERSE), -1); + rl_display_search (cxt->search_string, cxt->sflags, -1); /* If we are using the callback interface, all we do is set up here and return. The key is that we leave RL_STATE_ISEARCH set. */ diff --git a/readline/macro.c b/readline/macro.c index c2fac8addbe..b99a1a69fe6 100644 --- a/readline/macro.c +++ b/readline/macro.c @@ -121,6 +121,19 @@ _rl_next_macro_key () #endif } +int +_rl_prev_macro_key () +{ + if (rl_executing_macro == 0) + return (0); + + if (executing_macro_index == 0) + return (0); + + executing_macro_index--; + return (rl_executing_macro[executing_macro_index]); +} + /* Save the currently executing macro on a stack of saved macros. */ void _rl_push_executing_macro () @@ -234,7 +247,7 @@ rl_end_kbd_macro (count, ignore) return -1; } - current_macro_index -= rl_key_sequence_length - 1; + current_macro_index -= rl_key_sequence_length; current_macro[current_macro_index] = '\0'; RL_UNSETSTATE(RL_STATE_MACRODEF); @@ -263,6 +276,29 @@ rl_call_last_kbd_macro (count, ignore) return 0; } +int +rl_print_last_kbd_macro (count, ignore) + int count, ignore; +{ + char *m; + + if (current_macro == 0) + { + rl_ding (); + return 0; + } + m = _rl_untranslate_macro_value (current_macro, 1); + rl_crlf (); + printf ("%s", m); + fflush (stdout); + rl_crlf (); + FREE (m); + rl_forced_update_display (); + rl_display_fixed = 1; + + return 0; +} + void rl_push_macro_input (macro) char *macro; diff --git a/readline/mbutil.c b/readline/mbutil.c index eeb7e557f64..b036e0c3264 100644 --- a/readline/mbutil.c +++ b/readline/mbutil.c @@ -64,6 +64,9 @@ int rl_byte_oriented = 0; int rl_byte_oriented = 1; #endif +/* Ditto */ +int _rl_utf8locale = 0; + /* **************************************************************** */ /* */ /* Multibyte Character Utility Functions */ @@ -119,7 +122,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) point += tmp; if (find_non_zero) { - if (wcwidth (wc) == 0) + if (WCWIDTH (wc) == 0) continue; else count--; @@ -132,7 +135,7 @@ _rl_find_next_mbchar_internal (string, seed, count, find_non_zero) if (find_non_zero) { tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); - while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && wcwidth (wc) == 0) + while (MB_NULLWCH (tmp) == 0 && MB_INVALIDCH (tmp) == 0 && WCWIDTH (wc) == 0) { point += tmp; tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); @@ -184,7 +187,7 @@ _rl_find_prev_mbchar_internal (string, seed, find_non_zero) { if (find_non_zero) { - if (wcwidth (wc) != 0) + if (WCWIDTH (wc) != 0) prev = point; } else @@ -263,7 +266,7 @@ _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2) if point is invalied (point < 0 || more than string length), it returns -1 */ int -_rl_adjust_point(string, point, ps) +_rl_adjust_point (string, point, ps) char *string; int point; mbstate_t *ps; diff --git a/readline/misc.c b/readline/misc.c index 9f457736dac..a890cdadf9a 100644 --- a/readline/misc.c +++ b/readline/misc.c @@ -1,6 +1,6 @@ /* misc.c -- miscellaneous bindable readline functions. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -56,6 +56,8 @@ static int rl_digit_loop PARAMS((void)); static void _rl_history_set_point PARAMS((void)); +extern int history_offset; + /* Forward declarations used in this file */ void _rl_free_history_entry PARAMS((HIST_ENTRY *)); @@ -459,6 +461,7 @@ _rl_revert_all_lines () saved_undo_list = 0; /* Set up rl_line_buffer and other variables from history entry */ rl_replace_from_history (entry, 0); /* entry->line is now current */ + entry->data = 0; /* entry->data is now current undo list */ /* Undo all changes to this history entry */ while (rl_undo_list) rl_do_undo (); @@ -466,7 +469,6 @@ _rl_revert_all_lines () the timestamp. */ FREE (entry->line); entry->line = savestring (rl_line_buffer); - entry->data = 0; } entry = previous_history (); } @@ -483,6 +485,37 @@ _rl_revert_all_lines () xfree (lbuf); } +/* Free the history list, including private readline data and take care + of pointer aliases to history data. Resets rl_undo_list if it points + to an UNDO_LIST * saved as some history entry's data member. This + should not be called while editing is active. */ +void +rl_clear_history () +{ + HIST_ENTRY **hlist, *hent; + register int i; + UNDO_LIST *ul, *saved_undo_list; + + saved_undo_list = rl_undo_list; + hlist = history_list (); /* direct pointer, not copy */ + + for (i = 0; i < history_length; i++) + { + hent = hlist[i]; + if (ul = (UNDO_LIST *)hent->data) + { + if (ul == saved_undo_list) + saved_undo_list = 0; + _rl_free_undo_list (ul); + hent->data = 0; + } + _rl_free_history_entry (hent); + } + + history_offset = history_length = 0; + rl_undo_list = saved_undo_list; /* should be NULL */ +} + /* **************************************************************** */ /* */ /* History Commands */ @@ -623,6 +656,10 @@ rl_emacs_editing_mode (count, key) rl_editing_mode = emacs_mode; _rl_set_insert_mode (RL_IM_INSERT, 1); /* emacs mode default is insert mode */ _rl_keymap = emacs_standard_keymap; + + if (_rl_show_mode_in_prompt) + _rl_reset_prompt (); + return 0; } diff --git a/readline/nls.c b/readline/nls.c index e3599eb76f4..d3b36344f10 100644 --- a/readline/nls.c +++ b/readline/nls.c @@ -43,6 +43,10 @@ # include <locale.h> #endif +#if defined (HAVE_LANGINFO_CODESET) +# include <langinfo.h> +#endif + #include <ctype.h> #include "rldefs.h" @@ -50,6 +54,8 @@ #include "rlshell.h" #include "rlprivate.h" +static int utf8locale PARAMS((char *)); + #if !defined (HAVE_SETLOCALE) /* A list of legal values for the LANG or LC_CTYPE environment variables. If a locale name in this list is the value for the LC_ALL, LC_CTYPE, @@ -72,9 +78,10 @@ static char *legal_lang_values[] = }; static char *normalize_codeset PARAMS((char *)); -static char *find_codeset PARAMS((char *, size_t *)); #endif /* !HAVE_SETLOCALE */ +static char *find_codeset PARAMS((char *, size_t *)); + static char *_rl_get_locale_var PARAMS((const char *)); static char * @@ -91,7 +98,26 @@ _rl_get_locale_var (v) return lspec; } - + +static int +utf8locale (lspec) + char *lspec; +{ + char *cp; + size_t len; + +#if HAVE_LANGINFO_CODESET + cp = nl_langinfo (CODESET); + return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8")); +#else + cp = find_codeset (lspec, &len); + + if (cp == 0 || len < 4 || len > 5) + return 0; + return ((len == 5) ? strncmp (cp, "UTF-8", len) == 0 : strncmp (cp, "utf8", 4) == 0); +#endif +} + /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value to decide the defaults for 8-bit character input and output. Returns 1 if we set eight-bit mode. */ @@ -116,6 +142,9 @@ _rl_init_eightbit () lspec = ""; t = setlocale (LC_CTYPE, lspec); + if (t && *t) + _rl_utf8locale = utf8locale (t); + if (t && *t && (t[0] != 'C' || t[1]) && (STREQ (t, "POSIX") == 0)) { _rl_meta_flag = 1; @@ -197,6 +226,7 @@ normalize_codeset (codeset) return retval; } +#endif /* !HAVE_SETLOCALE */ /* Isolate codeset portion of locale specification. */ static char * @@ -249,4 +279,3 @@ find_codeset (name, lenp) return result; } -#endif /* !HAVE_SETLOCALE */ diff --git a/readline/parse-colors.c b/readline/parse-colors.c new file mode 100644 index 00000000000..98b2e9d10a1 --- /dev/null +++ b/readline/parse-colors.c @@ -0,0 +1,440 @@ +/* `dir', `vdir' and `ls' directory listing programs for GNU. + + Modified by Chet Ramey for Readline. + + Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Richard Stallman and David MacKenzie. */ + +/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis + Flaherty <dennisf@denix.elk.miles.com> based on original patches by + Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */ + +#define READLINE_LIBRARY + +#if defined (HAVE_CONFIG_H) +# include <config.h> +#endif + +#include <stdio.h> + +// strdup() / strcpy() +#if defined (HAVE_STRING_H) +# include <string.h> +#else /* !HAVE_STRING_H */ +# include <strings.h> +#endif /* !HAVE_STRING_H */ + +// abort() +#if defined (HAVE_STDLIB_H) +# include <stdlib.h> +#else +# include "ansi_stdlib.h" +#endif /* HAVE_STDLIB_H */ + +#include "rldefs.h" // STREQ, savestring +#include "readline.h" +#include "rlprivate.h" +#include "rlshell.h" +#include "xmalloc.h" + +#include "colors.h" +#include "parse-colors.h" + +#if defined (COLOR_SUPPORT) + +static bool get_funky_string (char **dest, const char **src, bool equals_end, size_t *output_count); + +struct bin_str _rl_color_indicator[] = + { + { LEN_STR_PAIR ("\033[") }, // lc: Left of color sequence + { LEN_STR_PAIR ("m") }, // rc: Right of color sequence + { 0, NULL }, // ec: End color (replaces lc+no+rc) + { LEN_STR_PAIR ("0") }, // rs: Reset to ordinary colors + { 0, NULL }, // no: Normal + { 0, NULL }, // fi: File: default + { LEN_STR_PAIR ("01;34") }, // di: Directory: bright blue + { LEN_STR_PAIR ("01;36") }, // ln: Symlink: bright cyan + { LEN_STR_PAIR ("33") }, // pi: Pipe: yellow/brown + { LEN_STR_PAIR ("01;35") }, // so: Socket: bright magenta + { LEN_STR_PAIR ("01;33") }, // bd: Block device: bright yellow + { LEN_STR_PAIR ("01;33") }, // cd: Char device: bright yellow + { 0, NULL }, // mi: Missing file: undefined + { 0, NULL }, // or: Orphaned symlink: undefined + { LEN_STR_PAIR ("01;32") }, // ex: Executable: bright green + { LEN_STR_PAIR ("01;35") }, // do: Door: bright magenta + { LEN_STR_PAIR ("37;41") }, // su: setuid: white on red + { LEN_STR_PAIR ("30;43") }, // sg: setgid: black on yellow + { LEN_STR_PAIR ("37;44") }, // st: sticky: black on blue + { LEN_STR_PAIR ("34;42") }, // ow: other-writable: blue on green + { LEN_STR_PAIR ("30;42") }, // tw: ow w/ sticky: black on green + { LEN_STR_PAIR ("30;41") }, // ca: black on red + { 0, NULL }, // mh: disabled by default + { LEN_STR_PAIR ("\033[K") }, // cl: clear to end of line + }; + +/* Parse a string as part of the LS_COLORS variable; this may involve + decoding all kinds of escape characters. If equals_end is set an + unescaped equal sign ends the string, otherwise only a : or \0 + does. Set *OUTPUT_COUNT to the number of bytes output. Return + true if successful. + + The resulting string is *not* null-terminated, but may contain + embedded nulls. + + Note that both dest and src are char **; on return they point to + the first free byte after the array and the character that ended + the input string, respectively. */ + +static bool +get_funky_string (char **dest, const char **src, bool equals_end, size_t *output_count) { + char num; /* For numerical codes */ + size_t count; /* Something to count with */ + enum { + ST_GND, ST_BACKSLASH, ST_OCTAL, ST_HEX, ST_CARET, ST_END, ST_ERROR + } state; + const char *p; + char *q; + + p = *src; /* We don't want to double-indirect */ + q = *dest; /* the whole darn time. */ + + count = 0; /* No characters counted in yet. */ + num = 0; + + state = ST_GND; /* Start in ground state. */ + while (state < ST_END) + { + switch (state) + { + case ST_GND: /* Ground state (no escapes) */ + switch (*p) + { + case ':': + case '\0': + state = ST_END; /* End of string */ + break; + case '\\': + state = ST_BACKSLASH; /* Backslash scape sequence */ + ++p; + break; + case '^': + state = ST_CARET; /* Caret escape */ + ++p; + break; + case '=': + if (equals_end) + { + state = ST_END; /* End */ + break; + } + /* else fall through */ + default: + *(q++) = *(p++); + ++count; + break; + } + break; + + case ST_BACKSLASH: /* Backslash escaped character */ + switch (*p) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + state = ST_OCTAL; /* Octal sequence */ + num = *p - '0'; + break; + case 'x': + case 'X': + state = ST_HEX; /* Hex sequence */ + num = 0; + break; + case 'a': /* Bell */ + num = '\a'; + break; + case 'b': /* Backspace */ + num = '\b'; + break; + case 'e': /* Escape */ + num = 27; + break; + case 'f': /* Form feed */ + num = '\f'; + break; + case 'n': /* Newline */ + num = '\n'; + break; + case 'r': /* Carriage return */ + num = '\r'; + break; + case 't': /* Tab */ + num = '\t'; + break; + case 'v': /* Vtab */ + num = '\v'; + break; + case '?': /* Delete */ + num = 127; + break; + case '_': /* Space */ + num = ' '; + break; + case '\0': /* End of string */ + state = ST_ERROR; /* Error! */ + break; + default: /* Escaped character like \ ^ : = */ + num = *p; + break; + } + if (state == ST_BACKSLASH) + { + *(q++) = num; + ++count; + state = ST_GND; + } + ++p; + break; + + case ST_OCTAL: /* Octal sequence */ + if (*p < '0' || *p > '7') + { + *(q++) = num; + ++count; + state = ST_GND; + } + else + num = (num << 3) + (*(p++) - '0'); + break; + + case ST_HEX: /* Hex sequence */ + switch (*p) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + num = (num << 4) + (*(p++) - '0'); + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + num = (num << 4) + (*(p++) - 'a') + 10; + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + num = (num << 4) + (*(p++) - 'A') + 10; + break; + default: + *(q++) = num; + ++count; + state = ST_GND; + break; + } + break; + + case ST_CARET: /* Caret escape */ + state = ST_GND; /* Should be the next state... */ + if (*p >= '@' && *p <= '~') + { + *(q++) = *(p++) & 037; + ++count; + } + else if (*p == '?') + { + *(q++) = 127; + ++count; + } + else + state = ST_ERROR; + break; + + default: + /* should we ? */ + /* abort (); no, we should not */ + state = ST_ERROR; + break; + } + } + + *dest = q; + *src = p; + *output_count = count; + + return state != ST_ERROR; +} +#endif /* COLOR_SUPPORT */ + +void _rl_parse_colors() +{ +#if defined (COLOR_SUPPORT) + const char *p; /* Pointer to character being parsed */ + char *buf; /* color_buf buffer pointer */ + int state; /* State of parser */ + int ind_no; /* Indicator number */ + char label[3]; /* Indicator label */ + COLOR_EXT_TYPE *ext; /* Extension we are working on */ + + p = sh_get_env_value ("LS_COLORS"); + if (p == 0 || *p == '\0') + { + _rl_color_ext_list = NULL; + return; + } + + ext = NULL; + strcpy (label, "??"); + + /* This is an overly conservative estimate, but any possible + LS_COLORS string will *not* generate a color_buf longer than + itself, so it is a safe way of allocating a buffer in + advance. */ + buf = color_buf = savestring (p); + + state = 1; + while (state > 0) + { + switch (state) + { + case 1: /* First label character */ + switch (*p) + { + case ':': + ++p; + break; + + case '*': + /* Allocate new extension block and add to head of + linked list (this way a later definition will + override an earlier one, which can be useful for + having terminal-specific defs override global). */ + + ext = (COLOR_EXT_TYPE *)xmalloc (sizeof *ext); + ext->next = _rl_color_ext_list; + _rl_color_ext_list = ext; + + ++p; + ext->ext.string = buf; + + state = (get_funky_string (&buf, &p, true, &ext->ext.len) + ? 4 : -1); + break; + + case '\0': + state = 0; /* Done! */ + break; + + default: /* Assume it is file type label */ + label[0] = *(p++); + state = 2; + break; + } + break; + + case 2: /* Second label character */ + if (*p) + { + label[1] = *(p++); + state = 3; + } + else + state = -1; /* Error */ + break; + + case 3: /* Equal sign after indicator label */ + state = -1; /* Assume failure... */ + if (*(p++) == '=')/* It *should* be... */ + { + for (ind_no = 0; indicator_name[ind_no] != NULL; ++ind_no) + { + if (STREQ (label, indicator_name[ind_no])) + { + _rl_color_indicator[ind_no].string = buf; + state = (get_funky_string (&buf, &p, false, + &_rl_color_indicator[ind_no].len) + ? 1 : -1); + break; + } + } + if (state == -1) + { + _rl_errmsg ("LS_COLORS: unrecognized prefix: %s", label); + /* recover from an unrecognized prefix */ + while (p && *p && *p != ':') + p++; + if (p && *p == ':') + state = 1; + else if (p && *p == 0) + state = 0; + } + } + break; + + case 4: /* Equal sign after *.ext */ + if (*(p++) == '=') + { + ext->seq.string = buf; + state = (get_funky_string (&buf, &p, false, &ext->seq.len) + ? 1 : -1); + } + else + state = -1; + /* XXX - recover here as with an unrecognized prefix? */ + if (state == -1 && ext->ext.string) + _rl_errmsg ("LS_COLORS: syntax error: %s", ext->ext.string); + break; + } + } + + if (state < 0) + { + COLOR_EXT_TYPE *e; + COLOR_EXT_TYPE *e2; + + _rl_errmsg ("unparsable value for LS_COLORS environment variable"); + free (color_buf); + for (e = _rl_color_ext_list; e != NULL; /* empty */) + { + e2 = e; + e = e->next; + free (e2); + } + _rl_color_ext_list = NULL; + _rl_colored_stats = 0; /* can't have colored stats without colors */ + } +#else /* !COLOR_SUPPORT */ + ; +#endif /* !COLOR_SUPPORT */ +} diff --git a/readline/parse-colors.h b/readline/parse-colors.h new file mode 100644 index 00000000000..aef86f784d4 --- /dev/null +++ b/readline/parse-colors.h @@ -0,0 +1,46 @@ +/* `dir', `vdir' and `ls' directory listing programs for GNU. + + Modified by Chet Ramey for Readline. + + Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012 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 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* Written by Richard Stallman and David MacKenzie. */ + +/* Color support by Peter Anvin <Peter.Anvin@linux.org> and Dennis + Flaherty <dennisf@denix.elk.miles.com> based on original patches by + Greg Lee <lee@uhunix.uhcc.hawaii.edu>. */ + +#ifndef _PARSE_COLORS_H_ +#define _PARSE_COLORS_H_ + +#include "readline.h" + +#define LEN_STR_PAIR(s) sizeof (s) - 1, s + +void _rl_parse_colors (void); + +static const char *const indicator_name[]= + { + "lc", "rc", "ec", "rs", "no", "fi", "di", "ln", "pi", "so", + "bd", "cd", "mi", "or", "ex", "do", "su", "sg", "st", + "ow", "tw", "ca", "mh", "cl", NULL + }; + +/* Buffer for color sequences */ +static char *color_buf; + +#endif /* !_PARSE_COLORS_H_ */ diff --git a/readline/patchlevel b/readline/patchlevel index fdf474049fc..6c10f126a3e 100644 --- a/readline/patchlevel +++ b/readline/patchlevel @@ -1,3 +1,3 @@ # Do not edit -- exists only for use by patch -1 +8 diff --git a/readline/posixdir.h b/readline/posixdir.h index bd33694dbbd..0921c5d752b 100644 --- a/readline/posixdir.h +++ b/readline/posixdir.h @@ -1,6 +1,6 @@ /* posixdir.h -- Posix directory reading includes and defines. */ -/* Copyright (C) 1987,1991 Free Software Foundation, Inc. +/* Copyright (C) 1987,1991,2012 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -46,16 +46,26 @@ # define D_NAMLEN(d) ((d)->d_namlen) #endif /* !HAVE_DIRENT_H */ +/* The bash code fairly consistenly uses d_fileno; make sure it's available */ #if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO) # define d_fileno d_ino #endif -#if defined (_POSIX_SOURCE) && (!defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO)) /* Posix does not require that the d_ino field be present, and some systems do not provide it. */ +#if !defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO) # define REAL_DIR_ENTRY(dp) 1 #else # define REAL_DIR_ENTRY(dp) (dp->d_ino != 0) #endif /* _POSIX_SOURCE */ +#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (BROKEN_DIRENT_D_INO) +# define D_INO_AVAILABLE +#endif + +/* Signal the rest of the code that it can safely use dirent.d_fileno */ +#if defined (D_INO_AVAILABLE) || defined (HAVE_STRUCT_DIRENT_D_FILENO) +# define D_FILENO_AVAILABLE 1 +#endif + #endif /* !_POSIXDIR_H_ */ diff --git a/readline/posixjmp.h b/readline/posixjmp.h index 49bfecf3389..98cf7185ea1 100644 --- a/readline/posixjmp.h +++ b/readline/posixjmp.h @@ -30,11 +30,13 @@ # if !defined (__OPENNT) # undef setjmp # define setjmp(x) sigsetjmp((x), 1) +# define setjmp_nosigs(x) sigsetjmp((x), 0) # undef longjmp # define longjmp(x, n) siglongjmp((x), (n)) # endif /* !__OPENNT */ #else # define procenv_t jmp_buf +# define setjmp_nosigs setjmp #endif #endif /* _POSIXJMP_H_ */ diff --git a/readline/readline.c b/readline/readline.c index 071e1aa082e..abb29a02843 100644 --- a/readline/readline.c +++ b/readline/readline.c @@ -1,7 +1,7 @@ /* readline.c -- a general facility for reading lines of input with emacs style editing and completion. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2013 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -82,6 +82,11 @@ extern int errno; extern void _rl_free_history_entry PARAMS((HIST_ENTRY *)); +#if defined (COLOR_SUPPORT) +extern void _rl_parse_colors PARAMS((void)); /* XXX */ +#endif + + /* Forward declarations used in this file. */ static char *readline_internal PARAMS((void)); static void readline_initialize_everything PARAMS((void)); @@ -112,7 +117,6 @@ int rl_gnu_readline_p = 1; By default, it is the standard emacs keymap. */ Keymap _rl_keymap = emacs_standard_keymap; - /* The current style of editing. */ int rl_editing_mode = emacs_mode; @@ -238,13 +242,32 @@ int rl_erase_empty_line = 0; character bound to accept-line. */ int rl_num_chars_to_read; -/* Line buffer and maintenence. */ +/* Line buffer and maintenance. */ char *rl_line_buffer = (char *)NULL; int rl_line_buffer_len = 0; /* Key sequence `contexts' */ _rl_keyseq_cxt *_rl_kscxt = 0; +int rl_executing_key; +char *rl_executing_keyseq = 0; +int _rl_executing_keyseq_size = 0; + +/* Timeout (specified in milliseconds) when reading characters making up an + ambiguous multiple-key sequence */ +int _rl_keyseq_timeout = 500; + +#define RESIZE_KEYSEQ_BUFFER() \ + do \ + { \ + if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) \ + { \ + _rl_executing_keyseq_size += 16; \ + rl_executing_keyseq = xrealloc (rl_executing_keyseq, _rl_executing_keyseq_size); \ + } \ + } \ + while (0); + /* Forward declarations used by the display, termcap, and history code. */ /* **************************************************************** */ @@ -279,6 +302,10 @@ int _rl_revert_all_at_newline = 0; characters corresponding to keyboard-generated signals. */ int _rl_echo_control_chars = 1; +/* Non-zero means to prefix the displayed prompt with a character indicating + the editing mode: @ for emacs, : for vi-command, + for vi-insert. */ +int _rl_show_mode_in_prompt = 0; + /* **************************************************************** */ /* */ /* Top Level Functions */ @@ -352,6 +379,11 @@ readline (prompt) RL_SETSTATE (RL_STATE_CALLBACK); #endif +#if HAVE_DECL_AUDIT_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) + if (value) + _rl_audit_tty (value); +#endif + return (value); } @@ -369,9 +401,19 @@ readline_internal_setup () _rl_in_stream = rl_instream; _rl_out_stream = rl_outstream; + /* Enable the meta key only for the duration of readline(), if this + terminal has one and the terminal has been initialized */ + if (_rl_enable_meta & RL_ISSTATE (RL_STATE_TERMPREPPED)) + _rl_enable_meta_key (); + if (rl_startup_hook) (*rl_startup_hook) (); +#if defined (VI_MODE) + if (rl_editing_mode == vi_mode) + rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */ +#endif /* VI_MODE */ + /* If we're not echoing, we still want to at least print a prompt, because rl_redisplay will not do it for us. If the calling application has a custom redisplay function, though, let that function handle it. */ @@ -394,11 +436,6 @@ readline_internal_setup () (*rl_redisplay_function) (); } -#if defined (VI_MODE) - if (rl_editing_mode == vi_mode) - rl_vi_insert_mode (1, 'i'); -#endif /* VI_MODE */ - if (rl_pre_input_hook) (*rl_pre_input_hook) (); @@ -437,6 +474,11 @@ readline_internal_teardown (eof) if (rl_undo_list) rl_free_undo_list (); + /* Disable the meta key, if this terminal has one and we were told to use it. + The check whether or not we sent the enable string is in + _rl_disable_meta_key(); the flag is set in _rl_enable_meta_key */ + _rl_disable_meta_key (); + /* Restore normal cursor, if available. */ _rl_set_insert_mode (RL_IM_INSERT, 0); @@ -492,7 +534,11 @@ readline_internal_charloop () #endif lk = _rl_last_command_was_kill; +#if defined (HAVE_POSIX_SIGSETJMP) + code = sigsetjmp (_rl_top_level, 0); +#else code = setjmp (_rl_top_level); +#endif if (code) { @@ -511,6 +557,7 @@ readline_internal_charloop () /* Then initialize the argument and number of keys read. */ _rl_reset_argument (); rl_key_sequence_length = 0; + rl_executing_keyseq[0] = 0; } RL_SETSTATE(RL_STATE_READCMD); @@ -519,7 +566,8 @@ readline_internal_charloop () /* look at input.c:rl_getc() for the circumstances under which this will be returned; punt immediately on read error without converting it to - a newline. */ + a newline; assume that rl_read_key has already called the signal + handler. */ if (c == READERR) { #if defined (READLINE_CALLBACKS) @@ -531,7 +579,9 @@ readline_internal_charloop () #endif } - /* EOF typed to a non-blank line is a <NL>. */ + /* EOF typed to a non-blank line is a <NL>. If we want to change this, + to force any existing line to be ignored when read(2) reads EOF, + for example, this is the place to change. */ if (c == EOF && rl_end) c = NEWLINE; @@ -694,7 +744,8 @@ _rl_dispatch_callback (cxt) r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ)); RL_CHECK_SIGNALS (); - if (r == 0) /* success! */ + /* We only treat values < 0 specially to simulate recursion. */ + if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */ { _rl_keyseq_chain_dispose (); RL_UNSETSTATE (RL_STATE_MULTIKEY); @@ -743,9 +794,10 @@ _rl_dispatch_subseq (key, map, got_subseq) { if (RL_ISSTATE (RL_STATE_MACRODEF)) _rl_add_macro_char (ESC); + RESIZE_KEYSEQ_BUFFER (); + rl_executing_keyseq[rl_key_sequence_length++] = ESC; map = FUNCTION_TO_KEYMAP (map, ESC); key = UNMETA (key); - rl_key_sequence_length += 2; return (_rl_dispatch (key, map)); } else @@ -765,13 +817,19 @@ _rl_dispatch_subseq (key, map, got_subseq) { /* Special case rl_do_lowercase_version (). */ if (func == rl_do_lowercase_version) + /* Should we do anything special if key == ANYOTHERKEY? */ return (_rl_dispatch (_rl_to_lower (key), map)); rl_executing_keymap = map; + rl_executing_key = key; + + RESIZE_KEYSEQ_BUFFER(); + rl_executing_keyseq[rl_key_sequence_length++] = key; + rl_executing_keyseq[rl_key_sequence_length] = '\0'; rl_dispatching = 1; RL_SETSTATE(RL_STATE_DISPATCHING); - (*map[key].function)(rl_numeric_arg * rl_arg_sign, key); + r = (*func) (rl_numeric_arg * rl_arg_sign, key); RL_UNSETSTATE(RL_STATE_DISPATCHING); rl_dispatching = 0; @@ -788,7 +846,10 @@ _rl_dispatch_subseq (key, map, got_subseq) /* OK, there's no function bound in this map, but there is a shadow function that was overridden when the current keymap was created. Return -2 to note that. */ - _rl_unget_char (key); + if (RL_ISSTATE (RL_STATE_MACROINPUT)) + _rl_prev_macro_key (); + else + _rl_unget_char (key); return -2; } else if (got_subseq) @@ -797,7 +858,10 @@ _rl_dispatch_subseq (key, map, got_subseq) have a matching key, nor was one overridden. This means we need to back up the recursion chain and find the last subsequence that is bound to a function. */ - _rl_unget_char (key); + if (RL_ISSTATE (RL_STATE_MACROINPUT)) + _rl_prev_macro_key (); + else + _rl_unget_char (key); return -1; } else @@ -820,13 +884,17 @@ _rl_dispatch_subseq (key, map, got_subseq) check whether there's input in the queue, which there generally will be if an arrow key has been pressed, and, if there's not, just dispatch to (what we assume is) rl_vi_movement_mode right - away. This is essentially an input test with a zero timeout. */ + away. This is essentially an input test with a zero timeout (by + default) or a timeout determined by the value of `keyseq-timeout' */ + /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued + takes microseconds, so multiply by 1000 */ if (rl_editing_mode == vi_mode && key == ESC && map == vi_insertion_keymap - && _rl_input_queued (0) == 0) + && _rl_input_queued ((_rl_keyseq_timeout > 0) ? _rl_keyseq_timeout*1000 : 0) == 0) return (_rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key))); #endif - rl_key_sequence_length++; + RESIZE_KEYSEQ_BUFFER (); + rl_executing_keyseq[rl_key_sequence_length++] = key; _rl_dispatching_keymap = FUNCTION_TO_KEYMAP (map, key); /* Allocate new context here. Use linked contexts (linked through @@ -855,6 +923,18 @@ _rl_dispatch_subseq (key, map, got_subseq) } #endif + /* Tentative inter-character timeout for potential multi-key + sequences? If no input within timeout, abort sequence and + act as if we got non-matching input. */ + /* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued + takes microseconds, so multiply by 1000 */ + if (_rl_keyseq_timeout > 0 && + (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) && + _rl_pushed_input_available () == 0 && + _rl_dispatching_keymap[ANYOTHERKEY].function && + _rl_input_queued (_rl_keyseq_timeout*1000) == 0) + return (_rl_subseq_result (-2, map, key, got_subseq)); + newkey = _rl_subseq_getchar (key); if (newkey < 0) { @@ -875,6 +955,7 @@ _rl_dispatch_subseq (key, map, got_subseq) case ISMACR: if (map[key].function != 0) { + rl_executing_keyseq[rl_key_sequence_length] = '\0'; macro = savestring ((char *)map[key].function); _rl_with_macro_input (macro); return 0; @@ -884,6 +965,7 @@ _rl_dispatch_subseq (key, map, got_subseq) #if defined (VI_MODE) if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && key != ANYOTHERKEY && + _rl_dispatching_keymap == vi_movement_keymap && _rl_vi_textmod_command (key)) _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); #endif @@ -935,14 +1017,20 @@ _rl_subseq_result (r, map, key, got_subseq) /* We didn't match (r is probably -1), so return something to tell the caller that it should try ANYOTHERKEY for an overridden function. */ - _rl_unget_char (key); + if (RL_ISSTATE (RL_STATE_MACROINPUT)) + _rl_prev_macro_key (); + else + _rl_unget_char (key); _rl_dispatching_keymap = map; return -2; } else if (r && got_subseq) { /* OK, back up the chain. */ - _rl_unget_char (key); + if (RL_ISSTATE (RL_STATE_MACROINPUT)) + _rl_prev_macro_key (); + else + _rl_unget_char (key); _rl_dispatching_keymap = map; return -1; } @@ -971,7 +1059,7 @@ rl_initialize () RL_SETSTATE(RL_STATE_INITIALIZED); } - /* Initalize the current line information. */ + /* Initialize the current line information. */ _rl_init_line_state (); /* We aren't done yet. We haven't even gotten started yet! */ @@ -1091,14 +1179,19 @@ readline_initialize_everything () /* Try to bind a common arrow key prefix, if not already bound. */ bind_arrow_keys (); - /* Enable the meta key, if this terminal has one. */ - if (_rl_enable_meta) - _rl_enable_meta_key (); - /* If the completion parser's default word break characters haven't been set yet, then do so now. */ if (rl_completer_word_break_characters == (char *)NULL) rl_completer_word_break_characters = (char *)rl_basic_word_break_characters; + +#if defined (COLOR_SUPPORT) + if (_rl_colored_stats) + _rl_parse_colors (); +#endif + + rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16); + if (rl_executing_keyseq) + rl_executing_keyseq[0] = '\0'; } /* If this system allows us to look at the values of the regular @@ -1163,6 +1256,16 @@ bind_arrow_keys_internal (map) rl_bind_keyseq_if_unbound ("\340O", rl_end_of_line); rl_bind_keyseq_if_unbound ("\340S", rl_delete); rl_bind_keyseq_if_unbound ("\340R", rl_overwrite_mode); + + /* These may or may not work because of the embedded NUL. */ + rl_bind_keyseq_if_unbound ("\\000H", rl_get_previous_history); + rl_bind_keyseq_if_unbound ("\\000P", rl_get_next_history); + rl_bind_keyseq_if_unbound ("\\000M", rl_forward_char); + rl_bind_keyseq_if_unbound ("\\000K", rl_backward_char); + rl_bind_keyseq_if_unbound ("\\000G", rl_beg_of_line); + rl_bind_keyseq_if_unbound ("\\000O", rl_end_of_line); + rl_bind_keyseq_if_unbound ("\\000S", rl_delete); + rl_bind_keyseq_if_unbound ("\\000R", rl_overwrite_mode); #endif _rl_keymap = xkeymap; diff --git a/readline/readline.h b/readline/readline.h index 0de168cdd6c..08dcd2bec57 100644 --- a/readline/readline.h +++ b/readline/readline.h @@ -1,6 +1,6 @@ /* Readline.h -- the names of functions callable from within readline. */ -/* Copyright (C) 1987-2011 Free Software Foundation, Inc. +/* Copyright (C) 1987-2013 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -39,9 +39,9 @@ extern "C" { #endif /* Hex-encoded Readline version number. */ -#define RL_READLINE_VERSION 0x0602 /* Readline 6.2 */ +#define RL_READLINE_VERSION 0x0603 /* Readline 6.3 */ #define RL_VERSION_MAJOR 6 -#define RL_VERSION_MINOR 2 +#define RL_VERSION_MINOR 3 /* Readline data structures. */ @@ -185,6 +185,7 @@ extern int rl_forward_search_history PARAMS((int, int)); extern int rl_start_kbd_macro PARAMS((int, int)); extern int rl_end_kbd_macro PARAMS((int, int)); extern int rl_call_last_kbd_macro PARAMS((int, int)); +extern int rl_print_last_kbd_macro PARAMS((int, int)); /* Bindable undo commands. */ extern int rl_revert_line PARAMS((int, int)); @@ -204,6 +205,8 @@ extern int rl_tty_status PARAMS((int, int)); /* Bindable commands for incremental and non-incremental history searching. */ extern int rl_history_search_forward PARAMS((int, int)); extern int rl_history_search_backward PARAMS((int, int)); +extern int rl_history_substr_search_forward PARAMS((int, int)); +extern int rl_history_substr_search_backward PARAMS((int, int)); extern int rl_noninc_forward_search PARAMS((int, int)); extern int rl_noninc_reverse_search PARAMS((int, int)); extern int rl_noninc_forward_search_again PARAMS((int, int)); @@ -339,6 +342,7 @@ extern Keymap rl_make_bare_keymap PARAMS((void)); extern Keymap rl_copy_keymap PARAMS((Keymap)); extern Keymap rl_make_keymap PARAMS((void)); extern void rl_discard_keymap PARAMS((Keymap)); +extern void rl_free_keymap PARAMS((Keymap)); extern Keymap rl_get_keymap_by_name PARAMS((const char *)); extern char *rl_get_keymap_name PARAMS((Keymap)); @@ -436,6 +440,10 @@ extern void rl_echo_signal_char PARAMS((int)); extern int rl_set_paren_blink_timeout PARAMS((int)); +/* History management functions. */ + +extern void rl_clear_history PARAMS((void)); + /* Undocumented. */ extern int rl_maybe_save_line PARAMS((void)); extern int rl_maybe_unsave_line PARAMS((void)); @@ -560,6 +568,13 @@ extern rl_hook_func_t *rl_pre_input_hook; awaiting character input, or NULL, for no event handling. */ extern rl_hook_func_t *rl_event_hook; +/* The address of a function to call if a read is interrupted by a signal. */ +extern rl_hook_func_t *rl_signal_event_hook; + +/* The address of a function to call if Readline needs to know whether or not + there is data available from the current input source. */ +extern rl_hook_func_t *rl_input_available_hook; + /* The address of the function to call to fetch a character from the current Readline input stream */ extern rl_getc_func_t *rl_getc_function; @@ -573,6 +588,10 @@ extern rl_voidfunc_t *rl_deprep_term_function; extern Keymap rl_executing_keymap; extern Keymap rl_binding_keymap; +extern int rl_executing_key; +extern char *rl_executing_keyseq; +extern int rl_key_sequence_length; + /* 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 @@ -603,6 +622,10 @@ extern int rl_catch_signals; to do that. */ extern int rl_catch_sigwinch; +/* If non-zero, the readline SIGWINCH handler will modify LINES and + COLUMNS in the environment. */ +extern int rl_change_environment; + /* Completion variables. */ /* Pointer to the generator function for completion_matches (). NULL means to use rl_filename_completion_function (), the default @@ -686,6 +709,13 @@ extern rl_icppfunc_t *rl_directory_completion_hook; it in bash to see how well it goes. */ extern rl_icppfunc_t *rl_directory_rewrite_hook; +/* If non-zero, this is the address of a function for the completer to call + before deciding which character to append to a completed name. It should + modify the directory name passed as an argument if appropriate, and return + non-zero if it modifies the name. This should not worry about dequoting + the filename; that has already happened by the time it gets here. */ +extern rl_icppfunc_t *rl_filename_stat_hook; + /* If non-zero, this is the address of a function to call when reading directory entries from the filesystem for completion and comparing them to the partial word to be completed. The function should diff --git a/readline/rlconf.h b/readline/rlconf.h index 39f94dbc0a6..1a40afce029 100644 --- a/readline/rlconf.h +++ b/readline/rlconf.h @@ -1,6 +1,6 @@ /* rlconf.h -- readline configuration definitions */ -/* Copyright (C) 1992-2009 Free Software Foundation, Inc. +/* Copyright (C) 1992-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -28,8 +28,12 @@ /* Define this to get an indication of file type when listing completions. */ #define VISIBLE_STATS +/* Define this to get support for colors when listing completions and in + other places. */ +#define COLOR_SUPPORT + /* This definition is needed by readline.c, rltty.c, and signals.c. */ -/* If on, then readline handles signals in a way that doesn't screw. */ +/* If on, then readline handles signals in a way that doesn't suck. */ #define HANDLE_SIGNALS /* Ugly but working hack for binding prefix meta. */ @@ -58,4 +62,8 @@ /* Define this if you want the cursor to indicate insert or overwrite mode. */ /* #define CURSOR_MODE */ +/* Define this if you want to enable code that talks to the Linux kernel + tty auditing system. */ +#define ENABLE_TTY_AUDIT_SUPPORT + #endif /* _RLCONF_H_ */ diff --git a/readline/rldefs.h b/readline/rldefs.h index 0257754665e..dab1beba1d7 100644 --- a/readline/rldefs.h +++ b/readline/rldefs.h @@ -2,7 +2,7 @@ for readline. This should be included after any files that define system-specific constants like _POSIX_VERSION or USG. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2011 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -79,8 +79,8 @@ extern char *strchr (), *strrchr (); #define _rl_stricmp strcasecmp #define _rl_strnicmp strncasecmp #else -extern int _rl_stricmp PARAMS((char *, char *)); -extern int _rl_strnicmp PARAMS((char *, char *, int)); +extern int _rl_stricmp PARAMS((const char *, const char *)); +extern int _rl_strnicmp PARAMS((const char *, const char *, int)); #endif #if defined (HAVE_STRPBRK) && !defined (HAVE_MULTIBYTE) @@ -148,6 +148,10 @@ extern char *_rl_strpbrk PARAMS((const char *, const char *)); : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0)) #endif +#if !defined (RL_STRLEN) +# define RL_STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0) +#endif + #if !defined (FREE) # define FREE(x) if (x) free (x) #endif diff --git a/readline/rlmbutil.h b/readline/rlmbutil.h index 7716a70cca1..06d85ab372f 100644 --- a/readline/rlmbutil.h +++ b/readline/rlmbutil.h @@ -123,6 +123,15 @@ extern int _rl_walphabetic PARAMS((wchar_t)); #define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2) #define MB_NULLWCH(x) ((x) == 0) +/* Unicode combining characters range from U+0300 to U+036F */ +#define UNICODE_COMBINING_CHAR(x) ((x) >= 768 && (x) <= 879) + +#if defined (WCWIDTH_BROKEN) +# define WCWIDTH(wc) ((_rl_utf8locale && UNICODE_COMBINING_CHAR(wc)) ? 0 : wcwidth(wc)) +#else +# define WCWIDTH(wc) wcwidth(wc) +#endif + #else /* !HANDLE_MULTIBYTE */ #undef MB_LEN_MAX diff --git a/readline/rlprivate.h b/readline/rlprivate.h index 384ff67cb3b..14a370d20e2 100644 --- a/readline/rlprivate.h +++ b/readline/rlprivate.h @@ -1,7 +1,7 @@ /* rlprivate.h -- functions and variables global to the readline library, but not intended for use by applications. */ -/* Copyright (C) 1999-2010 Free Software Foundation, Inc. +/* Copyright (C) 1999-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -42,6 +42,12 @@ if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \ } while (0) +#define RL_SIG_RECEIVED() (_rl_caught_signal != 0) +#define RL_SIGINT_RECEIVED() (_rl_caught_signal == SIGINT) + +#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay) +#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc) + /************************************************************************* * * * Global structs undocumented in texinfo manual and not in readline.h * @@ -86,9 +92,11 @@ typedef struct __rl_search_context int history_pos; int direction; + int prevc; int lastc; #if defined (HANDLE_MULTIBYTE) char mb[MB_LEN_MAX]; + char pmb[MB_LEN_MAX]; #endif char *sline; @@ -156,6 +164,8 @@ typedef struct __rl_callback_generic_arg typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *)); +typedef void _rl_sigcleanup_func_t PARAMS((int, void *)); + /************************************************************************* * * * Global functions undocumented in texinfo manual and not in readline.h * @@ -173,12 +183,14 @@ extern int rl_complete_with_tilde_expansion; #if defined (VISIBLE_STATS) extern int rl_visible_stats; #endif /* VISIBLE_STATS */ +#if defined (COLOR_SUPPORT) +extern int _rl_colored_stats; +#endif /* readline.c */ extern int rl_line_buffer_len; extern int rl_arg_sign; extern int rl_visible_prompt_length; -extern int rl_key_sequence_length; extern int rl_byte_oriented; /* display.c */ @@ -189,7 +201,7 @@ extern int rl_blink_matching_paren; /************************************************************************* * * - * Global functions and variables unsed and undocumented * + * Global functions and variables unused and undocumented * * * *************************************************************************/ @@ -240,6 +252,7 @@ extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *)); #endif /* READLINE_CALLBACKS */ /* bind.c */ +extern char *_rl_untranslate_macro_value PARAMS((char *, int)); /* complete.c */ extern void _rl_reset_completion_state PARAMS((void)); @@ -248,6 +261,7 @@ extern void _rl_free_match_list PARAMS((char **)); /* display.c */ extern char *_rl_strip_prompt PARAMS((char *)); +extern void _rl_reset_prompt PARAMS((void)); extern void _rl_move_cursor_relative PARAMS((int, const char *)); extern void _rl_move_vert PARAMS((int)); extern void _rl_save_prompt PARAMS((void)); @@ -282,6 +296,7 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *)); /* macro.c */ extern void _rl_with_macro_input PARAMS((char *)); extern int _rl_next_macro_key PARAMS((void)); +extern int _rl_prev_macro_key PARAMS((void)); extern void _rl_push_executing_macro PARAMS((void)); extern void _rl_pop_executing_macro PARAMS((void)); extern void _rl_add_macro_char PARAMS((int)); @@ -330,6 +345,7 @@ extern void _rl_release_sigwinch PARAMS((void)); /* terminal.c */ extern void _rl_get_screen_size PARAMS((int, int)); +extern void _rl_sigwinch_resize_terminal PARAMS((void)); extern int _rl_init_terminal_io PARAMS((const char *)); #ifdef _MINIX extern void _rl_output_character_function PARAMS((int)); @@ -339,6 +355,7 @@ extern int _rl_output_character_function PARAMS((int)); extern void _rl_output_some_chars PARAMS((const char *, int)); extern int _rl_backspace PARAMS((int)); extern void _rl_enable_meta_key PARAMS((void)); +extern void _rl_disable_meta_key PARAMS((void)); extern void _rl_control_keypad PARAMS((int)); extern void _rl_set_cursor PARAMS((int, int)); @@ -360,6 +377,7 @@ extern int _rl_set_mark_at_pos PARAMS((int)); /* undo.c */ extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *)); extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *)); +extern void _rl_free_undo_list PARAMS((UNDO_LIST *)); /* util.c */ #if defined (USE_VARARGS) && defined (PREFER_STDARG) @@ -371,6 +389,7 @@ extern void _rl_ttymsg (); extern void _rl_errmsg (); extern void _rl_trace (); #endif +extern void _rl_audit_tty PARAMS((char *)); extern int _rl_tropen PARAMS((void)); @@ -441,6 +460,9 @@ extern int _rl_history_saved_point; extern _rl_arg_cxt _rl_argcxt; +/* nls.c */ +extern int _rl_utf8locale; + /* readline.c */ extern int _rl_echoing_p; extern int _rl_horizontal_scroll_mode; @@ -452,6 +474,7 @@ extern int _rl_output_meta_chars; extern int _rl_bind_stty_chars; extern int _rl_revert_all_at_newline; extern int _rl_echo_control_chars; +extern int _rl_show_mode_in_prompt; extern char *_rl_comment_begin; extern unsigned char _rl_parsing_conditionalized_out; extern Keymap _rl_keymap; @@ -461,6 +484,9 @@ extern int _rl_last_command_was_kill; extern int _rl_eof_char; extern procenv_t _rl_top_level; extern _rl_keyseq_cxt *_rl_kscxt; +extern int _rl_keyseq_timeout; + +extern int _rl_executing_keyseq_size; /* search.c */ extern _rl_search_cxt *_rl_nscxt; @@ -469,6 +495,9 @@ extern _rl_search_cxt *_rl_nscxt; extern int _rl_interrupt_immediately; extern int volatile _rl_caught_signal; +extern _rl_sigcleanup_func_t *_rl_sigcleanup; +extern void *_rl_sigcleanarg; + extern int _rl_echoctl; extern int _rl_intr_char; diff --git a/readline/rlstdc.h b/readline/rlstdc.h index a6d23942af2..2aaa30babfb 100644 --- a/readline/rlstdc.h +++ b/readline/rlstdc.h @@ -42,4 +42,16 @@ # endif #endif +/* Moved from config.h.in because readline.h:rl_message depends on these + defines. */ +#if defined (__STDC__) && defined (HAVE_STDARG_H) +# define PREFER_STDARG +# define USE_VARARGS +#else +# if defined (HAVE_VARARGS_H) +# define PREFER_VARARGS +# define USE_VARARGS +# endif +#endif + #endif /* !_RL_STDC_H_ */ diff --git a/readline/rltty.c b/readline/rltty.c index d237b1c0048..908bae18c24 100644 --- a/readline/rltty.c +++ b/readline/rltty.c @@ -121,7 +121,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *)); static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *)); -static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t)); +static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *)); static void save_tty_chars (tiop) @@ -341,7 +341,7 @@ static int set_tty_settings PARAMS((int, TIOTYPE *)); static void prepare_terminal_settings PARAMS((int, TIOTYPE, TIOTYPE *)); -static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t)); +static void set_special_char PARAMS((Keymap, TIOTYPE *, int, rl_command_func_t *)); static void _rl_bind_tty_special_chars PARAMS((Keymap, TIOTYPE)); #if defined (FLUSHO) @@ -528,10 +528,10 @@ prepare_terminal_settings (meta_flag, oldtio, tiop) #if defined (USE_XON_XOFF) #if defined (IXANY) - tiop->c_iflag &= ~(IXON | IXOFF | IXANY); + tiop->c_iflag &= ~(IXON | IXANY); #else /* `strict' Posix systems do not define IXANY. */ - tiop->c_iflag &= ~(IXON | IXOFF); + tiop->c_iflag &= ~IXON; #endif /* IXANY */ #endif /* USE_XON_XOFF */ @@ -678,7 +678,7 @@ rl_deprep_terminal () /* Try to keep this function from being interrupted. */ _rl_block_sigint (); - tty = rl_instream ? fileno (rl_instream) : fileno (stdout); + tty = rl_instream ? fileno (rl_instream) : fileno (stdin); if (_rl_enable_keypad) _rl_control_keypad (0); diff --git a/readline/rltypedefs.h b/readline/rltypedefs.h index 60f29a18b56..f9f5cd3a5b6 100644 --- a/readline/rltypedefs.h +++ b/readline/rltypedefs.h @@ -1,6 +1,6 @@ /* rltypedefs.h -- Type declarations for readline functions. */ -/* Copyright (C) 2000-2009 Free Software Foundation, Inc. +/* Copyright (C) 2000-2011 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -26,15 +26,22 @@ extern "C" { #endif -/* Old-style */ +/* Old-style, attempt to mark as deprecated in some way people will notice. */ #if !defined (_FUNCTION_DEF) # define _FUNCTION_DEF +#if defined(__GNUC__) || defined(__clang__) +typedef int Function () __attribute__ ((deprecated)); +typedef void VFunction () __attribute__ ((deprecated)); +typedef char *CPFunction () __attribute__ ((deprecated)); +typedef char **CPPFunction () __attribute__ ((deprecated)); +#else typedef int Function (); typedef void VFunction (); typedef char *CPFunction (); typedef char **CPPFunction (); +#endif #endif /* _FUNCTION_DEF */ diff --git a/readline/search.c b/readline/search.c index bf525e6d3ce..028c2505261 100644 --- a/readline/search.c +++ b/readline/search.c @@ -1,6 +1,6 @@ /* search.c - code for non-incremental searching in emacs and vi modes. */ -/* Copyright (C) 1992-2009 Free Software Foundation, Inc. +/* Copyright (C) 1992-2013 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -43,6 +43,7 @@ #include "readline.h" #include "history.h" +#include "histlib.h" #include "rlprivate.h" #include "xmalloc.h" @@ -66,6 +67,8 @@ static char *prev_line_found = (char *) NULL; static int rl_history_search_len; static int rl_history_search_pos; +static int rl_history_search_flags; + static char *history_search_string; static int history_string_size; @@ -74,7 +77,7 @@ static int noninc_search_from_pos PARAMS((char *, int, int)); static int noninc_dosearch PARAMS((char *, int)); static int noninc_search PARAMS((int, int)); static int rl_history_search_internal PARAMS((int, int)); -static void rl_history_search_reinit PARAMS((void)); +static void rl_history_search_reinit PARAMS((int)); static _rl_search_cxt *_rl_nsearch_init PARAMS((int, int)); static int _rl_nsearch_cleanup PARAMS((_rl_search_cxt *, int)); @@ -169,7 +172,8 @@ noninc_dosearch (string, dir) oldpos = where_history (); history_set_pos (noninc_history_pos); - entry = current_history (); + entry = current_history (); /* will never be NULL after successful search */ + #if defined (VI_MODE) if (rl_editing_mode != vi_mode) #endif @@ -453,15 +457,19 @@ rl_history_search_internal (count, dir) { HIST_ENTRY *temp; int ret, oldpos; + char *t; rl_maybe_save_line (); temp = (HIST_ENTRY *)NULL; - /* Search COUNT times through the history for a line whose prefix - matches history_search_string. When this loop finishes, TEMP, - if non-null, is the history line to copy into the line buffer. */ + /* Search COUNT times through the history for a line matching + history_search_string. If history_search_string[0] == '^', the + line must match from the start; otherwise any substring can match. + When this loop finishes, TEMP, if non-null, is the history line to + copy into the line buffer. */ while (count) { + RL_CHECK_SIGNALS (); ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir); if (ret == -1) break; @@ -470,7 +478,7 @@ rl_history_search_internal (count, dir) rl_history_search_pos = ret; oldpos = where_history (); history_set_pos (rl_history_search_pos); - temp = current_history (); + temp = current_history (); /* will never be NULL after successful search */ history_set_pos (oldpos); /* Don't find multiple instances of the same line. */ @@ -505,35 +513,49 @@ rl_history_search_internal (count, dir) /* Copy the line we found into the current line buffer. */ make_history_line_current (temp); - rl_point = rl_history_search_len; + if (rl_history_search_flags & ANCHORED_SEARCH) + rl_point = rl_history_search_len; /* easy case */ + else + { + t = strstr (rl_line_buffer, history_search_string); + rl_point = t ? (int)(t - rl_line_buffer) + rl_history_search_len : rl_end; + } rl_mark = rl_end; return 0; } static void -rl_history_search_reinit () +rl_history_search_reinit (flags) + int flags; { + int sind; + rl_history_search_pos = where_history (); rl_history_search_len = rl_point; + rl_history_search_flags = flags; + prev_line_found = (char *)NULL; if (rl_point) { + /* Allocate enough space for anchored and non-anchored searches */ if (rl_history_search_len >= history_string_size - 2) { history_string_size = rl_history_search_len + 2; history_search_string = (char *)xrealloc (history_search_string, history_string_size); } - history_search_string[0] = '^'; - strncpy (history_search_string + 1, rl_line_buffer, rl_point); - history_search_string[rl_point + 1] = '\0'; + sind = 0; + if (flags & ANCHORED_SEARCH) + history_search_string[sind++] = '^'; + strncpy (history_search_string + sind, rl_line_buffer, rl_point); + history_search_string[rl_point + sind] = '\0'; } _rl_free_saved_history_line (); } /* Search forward in the history for the string of characters from the start of the line to rl_point. This is a non-incremental - search. */ + search. The search is anchored to the beginning of the history line. */ int rl_history_search_forward (count, ignore) int count, ignore; @@ -543,7 +565,7 @@ rl_history_search_forward (count, ignore) if (rl_last_func != rl_history_search_forward && rl_last_func != rl_history_search_backward) - rl_history_search_reinit (); + rl_history_search_reinit (ANCHORED_SEARCH); if (rl_history_search_len == 0) return (rl_get_next_history (count, ignore)); @@ -562,7 +584,46 @@ rl_history_search_backward (count, ignore) if (rl_last_func != rl_history_search_forward && rl_last_func != rl_history_search_backward) - rl_history_search_reinit (); + rl_history_search_reinit (ANCHORED_SEARCH); + + if (rl_history_search_len == 0) + return (rl_get_previous_history (count, ignore)); + return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1)); +} + +/* Search forward in the history for the string of characters + from the start of the line to rl_point. This is a non-incremental + search. The search succeeds if the search string is present anywhere + in the history line. */ +int +rl_history_substr_search_forward (count, ignore) + int count, ignore; +{ + if (count == 0) + return (0); + + if (rl_last_func != rl_history_substr_search_forward && + rl_last_func != rl_history_substr_search_backward) + rl_history_search_reinit (NON_ANCHORED_SEARCH); + + if (rl_history_search_len == 0) + return (rl_get_next_history (count, ignore)); + return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1)); +} + +/* Search backward through the history for the string of characters + from the start of the line to rl_point. This is a non-incremental + search. */ +int +rl_history_substr_search_backward (count, ignore) + int count, ignore; +{ + if (count == 0) + return (0); + + if (rl_last_func != rl_history_substr_search_forward && + rl_last_func != rl_history_substr_search_backward) + rl_history_search_reinit (NON_ANCHORED_SEARCH); if (rl_history_search_len == 0) return (rl_get_previous_history (count, ignore)); diff --git a/readline/shell.c b/readline/shell.c index ac0fb3604b8..6947295e50e 100644 --- a/readline/shell.c +++ b/readline/shell.c @@ -59,6 +59,8 @@ #include "rlstdc.h" #include "rlshell.h" +#include "rldefs.h" + #include "xmalloc.h" #if defined (HAVE_GETPWUID) && !defined (HAVE_GETPW_DECLS) @@ -120,31 +122,27 @@ sh_single_quote (string) /* Set the environment variables LINES and COLUMNS to lines and cols, respectively. */ +static char setenv_buf[INT_STRLEN_BOUND (int) + 1]; +static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1]; /* sizeof("LINES=") == 6 */ +static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1]; /* sizeof("COLUMNS=") == 8 */ + void sh_set_lines_and_columns (lines, cols) int lines, cols; { - char *b; - #if defined (HAVE_SETENV) - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1); - sprintf (b, "%d", lines); - setenv ("LINES", b, 1); - xfree (b); - - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + 1); - sprintf (b, "%d", cols); - setenv ("COLUMNS", b, 1); - xfree (b); + sprintf (setenv_buf, "%d", lines); + setenv ("LINES", setenv_buf, 1); + + sprintf (setenv_buf, "%d", cols); + setenv ("COLUMNS", setenv_buf, 1); #else /* !HAVE_SETENV */ # if defined (HAVE_PUTENV) - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("LINES=") + 1); - sprintf (b, "LINES=%d", lines); - putenv (b); + sprintf (putenv_buf1, "LINES=%d", lines); + putenv (putenv_buf1); - b = (char *)xmalloc (INT_STRLEN_BOUND (int) + sizeof ("COLUMNS=") + 1); - sprintf (b, "COLUMNS=%d", cols); - putenv (b); + sprintf (putenv_buf2, "COLUMNS=%d", cols); + putenv (putenv_buf2); # endif /* HAVE_PUTENV */ #endif /* !HAVE_SETENV */ } @@ -159,15 +157,27 @@ sh_get_env_value (varname) char * sh_get_home_dir () { - char *home_dir; + static char *home_dir = (char *)NULL; struct passwd *entry; + if (home_dir) + return (home_dir); + home_dir = (char *)NULL; #if defined (HAVE_GETPWUID) +# if defined (__TANDEM) + entry = getpwnam (getlogin ()); +# else entry = getpwuid (getuid ()); +# endif if (entry) - home_dir = entry->pw_dir; + home_dir = savestring (entry->pw_dir); +#endif + +#if defined (HAVE_GETPWENT) + endpwent (); /* some systems need this */ #endif + return (home_dir); } diff --git a/readline/shlib/Makefile.in b/readline/shlib/Makefile.in index a71de7a2d0f..eb16211de0f 100644 --- a/readline/shlib/Makefile.in +++ b/readline/shlib/Makefile.in @@ -134,21 +134,29 @@ CSOURCES = $(topdir)/readline.c $(topdir)/funmap.c $(topdir)/keymaps.c \ $(topdir)/histfile.c $(topdir)/nls.c $(topdir)/search.c \ $(topdir)/shell.c $(topdir)/savestring.c $(topdir)/tilde.c \ $(topdir)/text.c $(topdir)/misc.c $(topdir)/compat.c \ - $(topdir)/mbutil.c + $(topdir)/colors.c $(topdir)/parse-colors.c \ + $(topdir)/mbutil.c $(topdir)/xfree.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 xmalloc.h rlprivate.h rlshell.h rlmbutil.h +HSOURCES = $(topdir)/readline.h $(topdir)/rldefs.h $(topdir)/chardefs.h \ + $(topdir)/keymaps.h $(topdir)/history.h $(topdir)/histlib.h \ + $(topdir)/posixstat.h $(topdir)/posixdir.h $(topdir)/posixjmp.h \ + $(topdir)/tilde.h $(topdir)/rlconf.h $(topdir)/rltty.h \ + $(topdir)/ansi_stdlib.h $(topdir)/tcap.h $(topdir)/rlstdc.h \ + $(topdir)/xmalloc.h $(topdir)/rlprivate.h $(topdir)/rlshell.h \ + $(topdir)/rltypedefs.h $(topdir)/rlmbutil.h \ + $(topdir)/colors.h $(topdir)/parse-colors.h SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so \ mbutil.so SHARED_TILDEOBJ = tilde.so +SHARED_COLORSOBJ = colors.so parse-colors.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 \ - text.so nls.so misc.so xmalloc.so xfree.so $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) \ - compat.so + text.so nls.so misc.so \ + $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) $(SHARED_COLORSOBJ) \ + xmalloc.so xfree.so compat.so ########################################################################## @@ -183,16 +191,26 @@ installdirs: $(topdir)/support/mkdirs -$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(libdir) -$(SHELL) $(topdir)/support/mkdirs $(DESTDIR)$(bindir) -install: installdirs $(SHLIB_STATUS) +install-supported: installdirs $(SHLIB_STATUS) $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_HISTORY) $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -i "$(INSTALL_DATA)" $(SHARED_READLINE) @echo install: you may need to run ldconfig -uninstall: +install-unsupported: + @echo install: shared libraries not supported + +install: install-$(SHLIB_STATUS) + +uninstall-supported: $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_HISTORY) $(SHELL) $(topdir)/support/shlib-install -O $(host_os) -V $(host_vendor) -d $(DESTDIR)$(libdir) -b $(DESTDIR)$(bindir) -U $(SHARED_READLINE) @echo uninstall: you may need to run ldconfig +uninstall-unsupported: + @echo uninstall: shared libraries not supported + +uninstall: uninstall-$(SHLIB_STATUS) + clean mostlyclean: force $(RM) $(SHARED_OBJ) $(SHARED_LIBS) @@ -217,7 +235,7 @@ callback.so: $(topdir)/rldefs.h ${BUILD_DIR}/config.h callback.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/chardefs.h callback.so: $(topdir)/rltypedefs.h callback.so: $(topdir)/tilde.h -complete.so: $(topdir)/ansi_stdlib.h posixdir.h $(topdir)/posixstat.h +complete.so: $(topdir)/ansi_stdlib.h $(topdir)/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)/rltypedefs.h @@ -253,7 +271,6 @@ 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)/rltypedefs.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: $(topdir)/rltypedefs.h @@ -330,6 +347,16 @@ shell.so: $(topdir)/rlshell.h terminal.so: $(topdir)/rlshell.h histexpand.so: $(topdir)/rlshell.h +colors.so: $(BUILD_DIR)/config.h $(topdir)/colors.h +colors.so: $(topdir)/rlconf.h +colors.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/rltypedefs.h +colors.so: $(topdir)/chardefs.h $(topdir)/tilde.h $(topdir)/rlstdc.h +colors.so: $(topdir)/ansi_stdlib.h $(topdir)/posixstat.h +parse-colors.so: $(BUILD_DIR)/config.h $(topdir)/colors.h $(topdir)/parse-colors.h +parse-colors.so: $(topdir)/rldefs.h $(topdir)/rlconf.h +parse-colors.so: $(topdir)/readline.h $(topdir)/keymaps.h $(topdir)/rltypedefs.h +parse-colors.so: $(topdir)/chardefs.h $(topdir)/tilde.h $(topdir)/rlstdc.h + bind.so: $(topdir)/rlprivate.h callback.so: $(topdir)/rlprivate.h complete.so: $(topdir)/rlprivate.h @@ -350,9 +377,12 @@ terminal.so: $(topdir)/rlprivate.h text.so: $(topdir)/rlprivate.h undo.so: $(topdir)/rlprivate.h util.so: $(topdir)/rlprivate.h -vi_mode.so: $(topdir)/rlprivate.h +vi_mode.so: $(topdir)/ +colors.so: $(topdir)/rlprivate.h +parse-colors.so: $(topdir)/rlprivate.h bind.so: $(topdir)/xmalloc.h +callback.so: $(topdir)/xmalloc.h complete.so: $(topdir)/xmalloc.h display.so: $(topdir)/xmalloc.h funmap.so: $(topdir)/xmalloc.h @@ -378,18 +408,22 @@ util.so: $(topdir)/xmalloc.h vi_mode.so: $(topdir)/xmalloc.h xfree.so: $(topdir)/xmalloc.h xmalloc.so: $(topdir)/xmalloc.h - -complete.o: $(topdir)/rlmbutil.h -display.o: $(topdir)/rlmbutil.h -histexpand.o: $(topdir)/rlmbutil.h -input.o: $(topdir)/rlmbutil.h -isearch.o: $(topdir)/rlmbutil.h -mbutil.o: $(topdir)/rlmbutil.h -misc.o: $(topdir)/rlmbutil.h -readline.o: $(topdir)/rlmbutil.h -search.o: $(topdir)/rlmbutil.h -text.o: $(topdir)/rlmbutil.h -vi_mode.o: $(topdir)/rlmbutil.h +colors.so: $(topdir)/xmalloc.h +parse-colors.so: $(topdir)/xmalloc.h + +complete.so: $(topdir)/rlmbutil.h +display.so: $(topdir)/rlmbutil.h +histexpand.so: $(topdir)/rlmbutil.h +input.so: $(topdir)/rlmbutil.h +isearch.so: $(topdir)/rlmbutil.h +mbutil.so: $(topdir)/rlmbutil.h +misc.so: $(topdir)/rlmbutil.h +readline.so: $(topdir)/rlmbutil.h +search.so: $(topdir)/rlmbutil.h +text.so: $(topdir)/rlmbutil.h +vi_mode.so: $(topdir)/rlmbutil.h +colors.so: $(topdir)/rlmbutil.h +parse-colors.so: $(topdir)/rlmbutil.h bind.so: $(topdir)/bind.c callback.so: $(topdir)/callback.c @@ -456,6 +490,9 @@ vi_mode.so: vi_mode.c xfree.so: xfree.c xmalloc.so: xmalloc.c +colors.so: colors.c +parse-colors.so: parse-colors.c + histexpand.so: histexpand.c histfile.so: histfile.c history.so: history.c diff --git a/readline/signals.c b/readline/signals.c index f1196918539..61f02f9f776 100644 --- a/readline/signals.c +++ b/readline/signals.c @@ -1,6 +1,6 @@ /* signals.c -- signal handling support for readline. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2011 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -80,6 +80,7 @@ typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); +static void rl_maybe_restore_sighandler PARAMS((int, sighandler_cxt *)); static RETSIGTYPE rl_signal_handler PARAMS((int)); static RETSIGTYPE _rl_handle_signal PARAMS((int)); @@ -87,7 +88,7 @@ static RETSIGTYPE _rl_handle_signal PARAMS((int)); /* 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. */ + SIGINT, SIGTERM, SIGHUP, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */ int rl_catch_signals = 1; /* If non-zero, readline will install a signal handler for SIGWINCH. */ @@ -118,7 +119,7 @@ static int sigwinch_set_flag; /* */ /* **************************************************************** */ -static sighandler_cxt old_int, old_term, old_alrm, old_quit; +static sighandler_cxt old_int, old_term, old_hup, old_alrm, old_quit; #if defined (SIGTSTP) static sighandler_cxt old_tstp, old_ttou, old_ttin; #endif @@ -126,6 +127,9 @@ static sighandler_cxt old_tstp, old_ttou, old_ttin; static sighandler_cxt old_winch; #endif +_rl_sigcleanup_func_t *_rl_sigcleanup; +void *_rl_sigcleanarg; + /* Readline signal handler functions. */ /* Called from RL_CHECK_SIGNALS() macro */ @@ -135,7 +139,21 @@ _rl_signal_handler (sig) { _rl_caught_signal = 0; /* XXX */ - _rl_handle_signal (sig); +#if defined (SIGWINCH) + if (sig == SIGWINCH) + { + rl_resize_terminal (); + /* XXX - experimental for now */ + /* Call a signal hook because though we called the original signal handler + in rl_sigwinch_handler below, we will not resend the signal to + ourselves. */ + if (rl_signal_event_hook) + (*rl_signal_event_hook) (); + } + else +#endif + _rl_handle_signal (sig); + SIGHANDLER_RETURN; } @@ -143,7 +161,7 @@ static RETSIGTYPE rl_signal_handler (sig) int sig; { - if (_rl_interrupt_immediately || RL_ISSTATE(RL_STATE_CALLBACK)) + if (_rl_interrupt_immediately) { _rl_interrupt_immediately = 0; _rl_handle_signal (sig); @@ -181,6 +199,15 @@ _rl_handle_signal (sig) rl_set_sighandler (sig, SIG_IGN, &dummy_cxt); #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */ + /* If there's a sig cleanup function registered, call it and `deregister' + the cleanup function to avoid multiple calls */ + if (_rl_sigcleanup) + { + (*_rl_sigcleanup) (sig, _rl_sigcleanarg); + _rl_sigcleanup = 0; + _rl_sigcleanarg = 0; + } + switch (sig) { case SIGINT: @@ -189,6 +216,7 @@ _rl_handle_signal (sig) /* FALLTHROUGH */ case SIGTERM: + case SIGHUP: #if defined (SIGTSTP) case SIGTSTP: case SIGTTOU: @@ -232,7 +260,7 @@ _rl_handle_signal (sig) # endif /* HAVE_BSD_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */ - rl_reset_after_signal (); + rl_reset_after_signal (); } RL_UNSETSTATE(RL_STATE_SIGHANDLER); @@ -257,7 +285,7 @@ rl_sigwinch_handler (sig) #endif RL_SETSTATE(RL_STATE_SIGHANDLER); - rl_resize_terminal (); + _rl_caught_signal = sig; /* If another sigwinch handler has been installed, call it. */ oh = (SigHandler *)old_winch.sa_handler; @@ -317,6 +345,8 @@ rl_set_sighandler (sig, handler, ohandler) return (ohandler->sa_handler); } +/* Set disposition of SIG to HANDLER, returning old state in OHANDLER. Don't + change disposition if OHANDLER indicates the signal was ignored. */ static void rl_maybe_set_sighandler (sig, handler, ohandler) int sig; @@ -327,11 +357,29 @@ rl_maybe_set_sighandler (sig, handler, ohandler) SigHandler *oh; sigemptyset (&dummy.sa_mask); + dummy.sa_flags = 0; oh = rl_set_sighandler (sig, handler, ohandler); if (oh == (SigHandler *)SIG_IGN) rl_sigaction (sig, ohandler, &dummy); } +/* Set the disposition of SIG to HANDLER, if HANDLER->sa_handler indicates the + signal was not being ignored. MUST only be called for signals whose + disposition was changed using rl_maybe_set_sighandler or for which the + SIG_IGN check was performed inline (e.g., SIGALRM below). */ +static void +rl_maybe_restore_sighandler (sig, handler) + int sig; + sighandler_cxt *handler; +{ + sighandler_cxt dummy; + + sigemptyset (&dummy.sa_mask); + dummy.sa_flags = 0; + if (handler->sa_handler != SIG_IGN) + rl_sigaction (sig, handler, &dummy); +} + int rl_set_signals () { @@ -349,6 +397,7 @@ rl_set_signals () sigaddset (&bset, SIGINT); sigaddset (&bset, SIGTERM); + sigaddset (&bset, SIGHUP); #if defined (SIGQUIT) sigaddset (&bset, SIGQUIT); #endif @@ -377,6 +426,7 @@ rl_set_signals () rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int); rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term); + rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup); #if defined (SIGQUIT) rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit); #endif @@ -434,25 +484,31 @@ rl_clear_signals () { sigemptyset (&dummy.sa_mask); - rl_sigaction (SIGINT, &old_int, &dummy); - rl_sigaction (SIGTERM, &old_term, &dummy); + /* Since rl_maybe_set_sighandler doesn't override a SIG_IGN handler, + we should in theory not have to restore a handler where + old_xxx.sa_handler == SIG_IGN. That's what rl_maybe_restore_sighandler + does. Fewer system calls should reduce readline's per-line + overhead */ + rl_maybe_restore_sighandler (SIGINT, &old_int); + rl_maybe_restore_sighandler (SIGTERM, &old_term); + rl_maybe_restore_sighandler (SIGHUP, &old_hup); #if defined (SIGQUIT) - rl_sigaction (SIGQUIT, &old_quit, &dummy); + rl_maybe_restore_sighandler (SIGQUIT, &old_quit); #endif #if defined (SIGALRM) - rl_sigaction (SIGALRM, &old_alrm, &dummy); + rl_maybe_restore_sighandler (SIGALRM, &old_alrm); #endif #if defined (SIGTSTP) - rl_sigaction (SIGTSTP, &old_tstp, &dummy); + rl_maybe_restore_sighandler (SIGTSTP, &old_tstp); #endif /* SIGTSTP */ #if defined (SIGTTOU) - rl_sigaction (SIGTTOU, &old_ttou, &dummy); + rl_maybe_restore_sighandler (SIGTTOU, &old_ttou); #endif /* SIGTTOU */ #if defined (SIGTTIN) - rl_sigaction (SIGTTIN, &old_ttin, &dummy); + rl_maybe_restore_sighandler (SIGTTIN, &old_ttin); #endif /* SIGTTIN */ signals_set_flag = 0; @@ -540,21 +596,6 @@ _rl_block_sigint () if (sigint_blocked) return; -#if defined (HAVE_POSIX_SIGNALS) - sigemptyset (&sigint_set); - sigemptyset (&sigint_oset); - sigaddset (&sigint_set, SIGINT); - sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset); -#else /* !HAVE_POSIX_SIGNALS */ -# if defined (HAVE_BSD_SIGNALS) - sigint_oldmask = sigblock (sigmask (SIGINT)); -# else /* !HAVE_BSD_SIGNALS */ -# if defined (HAVE_USG_SIGHOLD) - sighold (SIGINT); -# endif /* HAVE_USG_SIGHOLD */ -# endif /* !HAVE_BSD_SIGNALS */ -#endif /* !HAVE_POSIX_SIGNALS */ - sigint_blocked = 1; } @@ -565,22 +606,10 @@ _rl_release_sigint () if (sigint_blocked == 0) return; -#if defined (HAVE_POSIX_SIGNALS) - sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL); -#else -# if defined (HAVE_BSD_SIGNALS) - sigsetmask (sigint_oldmask); -# else /* !HAVE_BSD_SIGNALS */ -# if defined (HAVE_USG_SIGHOLD) - sigrelse (SIGINT); -# endif /* HAVE_USG_SIGHOLD */ -# endif /* !HAVE_BSD_SIGNALS */ -#endif /* !HAVE_POSIX_SIGNALS */ - sigint_blocked = 0; + RL_CHECK_SIGNALS (); } -#ifdef SIGWINCH /* Cause SIGWINCH to not be delivered until the corresponding call to release_sigwinch(). */ void @@ -589,6 +618,8 @@ _rl_block_sigwinch () if (sigwinch_blocked) return; +#if defined (SIGWINCH) + #if defined (HAVE_POSIX_SIGNALS) sigemptyset (&sigwinch_set); sigemptyset (&sigwinch_oset); @@ -604,6 +635,8 @@ _rl_block_sigwinch () # endif /* !HAVE_BSD_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */ +#endif /* SIGWINCH */ + sigwinch_blocked = 1; } @@ -614,6 +647,8 @@ _rl_release_sigwinch () if (sigwinch_blocked == 0) return; +#if defined (SIGWINCH) + #if defined (HAVE_POSIX_SIGNALS) sigprocmask (SIG_SETMASK, &sigwinch_oset, (sigset_t *)NULL); #else @@ -626,9 +661,10 @@ _rl_release_sigwinch () # endif /* !HAVE_BSD_SIGNALS */ #endif /* !HAVE_POSIX_SIGNALS */ +#endif /* SIGWINCH */ + sigwinch_blocked = 0; } -#endif /* SIGWINCH */ /* **************************************************************** */ /* */ diff --git a/readline/support/config.guess b/readline/support/config.guess index 994d98a4666..9afd6762064 100755..100644 --- a/readline/support/config.guess +++ b/readline/support/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2008-03-12' +timestamp='2013-11-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ timestamp='2008-03-12' # 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner. # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -170,7 +184,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -180,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -201,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -223,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -324,14 +345,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -375,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -461,8 +501,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -475,7 +515,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -532,7 +572,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -575,52 +615,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -640,7 +680,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null + grep -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -711,22 +751,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -750,14 +790,14 @@ EOF exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -769,34 +809,39 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in + *:Interix*:*) + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -806,6 +851,9 @@ EOF [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -826,210 +874,157 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - mips:Linux:*:*) + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips - #undef mipsel + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips + CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1037,11 +1032,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1058,7 +1053,7 @@ EOF i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1073,7 +1068,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1101,10 +1096,13 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1139,8 +1137,18 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; @@ -1153,7 +1161,7 @@ EOF rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) @@ -1173,10 +1181,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -1202,11 +1210,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1219,6 +1227,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1245,9 +1256,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1261,7 +1294,10 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1306,13 +1342,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1327,11 +1363,14 @@ EOF i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ @@ -1349,11 +1388,11 @@ main () #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/readline/support/config.rpath b/readline/support/config.rpath index b6c4d8ffc0a..b6c4d8ffc0a 100755..100644 --- a/readline/support/config.rpath +++ b/readline/support/config.rpath diff --git a/readline/support/config.sub b/readline/support/config.sub index d07267e1ee1..61cb4bc22db 100755..100644 --- a/readline/support/config.sub +++ b/readline/support/config.sub @@ -1,44 +1,40 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20098 -# Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2008-03-26' +timestamp='2013-10-01' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# 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., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see <http://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -72,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008,2009 Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -120,12 +115,18 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -148,10 +149,13 @@ 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 | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -166,10 +170,10 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -214,6 +218,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -238,19 +248,28 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -268,31 +287,45 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ | mt \ | msp430 \ - | nios | nios2 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -302,6 +335,21 @@ case $basic_machine in basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -316,24 +364,31 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -351,31 +406,37 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ - | nios-* | nios2-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) @@ -397,7 +458,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -443,6 +504,10 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; aux) basic_machine=m68k-apple os=-aux @@ -459,10 +524,27 @@ case $basic_machine in basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -491,7 +573,7 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -530,6 +612,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp @@ -645,7 +731,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -703,8 +788,15 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -739,10 +831,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -807,6 +907,9 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; nse-tandem) basic_machine=nse-tandem ;; @@ -892,9 +995,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -919,7 +1023,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -988,6 +1096,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1044,20 +1155,8 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1127,6 +1226,9 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1135,6 +1237,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1173,7 +1279,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) @@ -1220,9 +1326,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1243,21 +1352,23 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1265,7 +1376,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1304,7 +1415,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1353,7 +1464,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1389,12 +1500,14 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1417,10 +1530,10 @@ else # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1432,8 +1545,23 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1453,14 +1581,11 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1469,6 +1594,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1487,7 +1615,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) @@ -1592,7 +1720,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) diff --git a/readline/support/mkdist b/readline/support/mkdist index ff38764343f..282431d4ad3 100755 --- a/readline/support/mkdist +++ b/readline/support/mkdist @@ -2,7 +2,7 @@ # # mkdist - make a distribution directory from a master manifest file # -# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version +# usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version # # SRCDIR defaults to src # MANIFEST defaults to $SRCDIR/MANIFEST @@ -31,7 +31,7 @@ ROOTNAME=bash usage() { - echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-v] version 1>&2 + echo usage: mkdist [-m manifest] [-s srcdir] [-r rootname] [-t] [-v] version 1>&2 exit 2 } @@ -42,12 +42,13 @@ vmsg() fi } -while getopts m:s:r:v name +while getopts m:s:r:tv name do case $name in m) MANIFEST=$OPTARG ;; s) SRCDIR=$OPTARG ;; r) ROOTNAME=$OPTARG ;; + t) maketar=yes ;; v) verbose=yes ;; ?) usage ;; esac @@ -66,6 +67,8 @@ fi version=$1 newdir=${ROOTNAME}-$version +tarfile=${newdir}.tar + vmsg creating distribution for $ROOTNAME version $version in $newdir if [ ! -d $newdir ]; then @@ -117,4 +120,10 @@ done < $MANIFEST vmsg $newdir created +if [ -n "$maketar" ]; then + tar cf ${tarfile} $newdir + gzip $tarfile + vmsg ${tarfile}.gz created +fi + exit 0 diff --git a/readline/support/shlib-install b/readline/support/shlib-install index 3d0fb3c9c13..cfec3bd1e62 100755 --- a/readline/support/shlib-install +++ b/readline/support/shlib-install @@ -66,11 +66,12 @@ fi # post-install/uninstall # HP-UX and Darwin/MacOS X require that a shared library have execute permission -# Linux does, too, and ldd warns about it +# Linux does, too, and ldd warns about it. Solaris doesn't seem to mind, +# but ldd still warns about it. # Cygwin installs both a dll (which must go in $BINDIR) and an implicit # link library (in $libdir) case "$host_os" in -hpux*|darwin*|macosx*|linux*) +hpux*|darwin*|macosx*|linux*|solaris2*) if [ -z "$uninstall" ]; then chmod 555 ${INSTALLDIR}/${LIBNAME} fi ;; @@ -131,7 +132,7 @@ case "$host_os-$host_vendor" in fi ;; -bsdi4*|*gnu*|darwin*|macosx*|netbsd*) +bsdi4*|*gnu*|darwin*|macosx*|netbsd*|mirbsd*) # libname.so.M -> libname.so.M.N ${echo} ${RM} ${INSTALLDIR}/$LINK2 if [ -z "$uninstall" ]; then @@ -177,7 +178,7 @@ freebsd3*|freebsdaout*) fi ;; -freebsd[4-9]*|freebsdelf*|dragonfly*) +freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*) # libname.so -> libname.so.M ${echo} ${RM} ${INSTALLDIR}/$LINK1 if [ -z "$uninstall" ]; then diff --git a/readline/support/shobj-conf b/readline/support/shobj-conf index 5a63e80aa9f..1f64433dea8 100755..100644 --- a/readline/support/shobj-conf +++ b/readline/support/shobj-conf @@ -10,7 +10,7 @@ # Chet Ramey # chet@po.cwru.edu -# Copyright (C) 1996-2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is part of GNU Bash, the Bourne Again SHell. # @@ -65,6 +65,20 @@ while [ $# -gt 0 ]; do done case "${host_os}-${SHOBJ_CC}-${host_vendor}" in +nsk-cc-tandem) + SHOBJ_CFLAGS=-Wglobalized + case `uname -m` in + NSR*) + SHOBJ_CFLAGS="${SHOBJ_CFLAGS} -Wcall_shared" # default on TNS/E, needed on TNS/R + SHOBJ_LD=/usr/bin/ld # for TNS/R + ;; + NSE*|NEO*) + SHOBJ_LD=/usr/bin/eld + ;; + esac + SHOBJ_LDFLAGS='-shared -bglobalized -unres_symbols ignore' + ;; + sunos4*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD=/usr/bin/ld @@ -146,7 +160,7 @@ freebsd3*|freebsdaout*) ;; # FreeBSD-4.x and later have only ELF -freebsd[4-9]*|freebsdelf*|dragonfly*) +freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' @@ -157,27 +171,8 @@ freebsd[4-9]*|freebsdelf*|dragonfly*) ;; # Darwin/MacOS X -darwin[89]*|darwin10*) - SHOBJ_STATUS=supported - SHLIB_STATUS=supported - - SHOBJ_CFLAGS='-fno-common' - - SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}' - - SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)' - SHLIB_LIBSUFF='dylib' - - SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`' - SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' - - SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 - ;; - -darwin*|macosx*) - SHOBJ_STATUS=unsupported - SHLIB_STATUS=supported - +darwin*) + # Common definitions for all darwin/mac os x versions SHOBJ_CFLAGS='-fno-common' SHOBJ_LD='${CC}' @@ -185,19 +180,39 @@ darwin*|macosx*) SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)' SHLIB_LIBSUFF='dylib' + # unused at this time + SHLIB_SONAME='$(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF)' + case "${host_os}" in - darwin[789]*|darwin10*) SHOBJ_LDFLAGS='' - SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + # Darwin versions 1, 5, 6, 7 correspond to Mac OS X 10.0, 10.1, 10.2, + # and 10.3, respectively. + darwin[1-7].*) + SHOBJ_STATUS=unsupported + SHOBJ_LDFLAGS='-dynamic' + SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + ;; + # Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4 + *) + case "${host_os}" in + darwin[89]*|darwin1[012]*) + SHOBJ_ARCHFLAGS='-arch_only `/usr/bin/arch`' ;; - *) SHOBJ_LDFLAGS='-dynamic' - SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + *) # Mac OS X 10.9 (Mavericks) and later + SHOBJ_ARCHFLAGS= + # for 32 and 64bit universal library + #SHOBJ_ARCHFLAGS='-arch i386 -arch x86_64' + #SHOBJ_CFLAGS=${SHOBJ_CFLAGS}' -arch i386 -arch x86_64' ;; + esac + SHOBJ_LDFLAGS="-dynamiclib -dynamic -undefined dynamic_lookup ${SHOBJ_ARCHFLAGS}" + SHLIB_XLDFLAGS="-dynamiclib ${SHOBJ_ARCHFLAGS}"' -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' + ;; esac SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 ;; -openbsd*|netbsd*) +openbsd*|netbsd*|mirbsd*) SHOBJ_CFLAGS=-fPIC SHOBJ_LD='${CC}' SHOBJ_LDFLAGS='-shared' diff --git a/readline/terminal.c b/readline/terminal.c index 8094186bba2..1212ec469a5 100644 --- a/readline/terminal.c +++ b/readline/terminal.c @@ -56,7 +56,7 @@ #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */ #ifdef __MSDOS__ -# include <pc.h> +# include <pc.h> #endif #include "rltty.h" @@ -81,14 +81,15 @@ static void _win_get_screensize PARAMS((int *, int *)); static void _emx_get_screensize PARAMS((int *, int *)); #endif -#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay) -#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc) - -/* If the calling application sets this to a non-zero value, readline will - use the $LINES and $COLUMNS environment variables to set its idea of the - window size before interrogating the kernel. */ +/* If the calling application sets this to a non-zero value, readline will + use the $LINES and $COLUMNS environment variables to set its idea of the + window size before interrogating the kernel. */ int rl_prefer_env_winsize = 0; +/* If this is non-zero, readline will set LINES and COLUMNS in the + environment when it handles SIGWINCH. */ +int rl_change_environment = 1; + /* **************************************************************** */ /* */ /* Terminal and Termcap */ @@ -98,7 +99,7 @@ int rl_prefer_env_winsize = 0; #ifndef __MSDOS__ static char *term_buffer = (char *)NULL; static char *term_string_buffer = (char *)NULL; -#endif /* !__MSDOS__ */ +#endif static int tcap_initialized; @@ -308,7 +309,8 @@ _rl_get_screen_size (tty, ignore_env) /* If we're being compiled as part of bash, set the environment variables $LINES and $COLUMNS to new values. Otherwise, just do a pair of putenv () or setenv () calls. */ - sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth); + if (rl_change_environment) + sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth); if (_rl_term_autowrap == 0) _rl_screenwidth--; @@ -358,7 +360,13 @@ rl_reset_screen_size () { _rl_get_screen_size (fileno (rl_instream), 0); } - + +void +_rl_sigwinch_resize_terminal () +{ + _rl_get_screen_size (fileno (rl_instream), 1); +} + void rl_resize_terminal () { @@ -560,7 +568,6 @@ _rl_init_terminal_io (terminal_name) term_has_meta = tgetflag ("km") != 0; if (term_has_meta == 0) _rl_term_mm = _rl_term_mo = (char *)NULL; - #endif /* !__MSDOS__ */ /* Attempt to find and bind the arrow keys. Do not override already @@ -694,17 +701,16 @@ rl_ding () default: break; case VISIBLE_BELL: -#ifdef __MSDOS__ - ScreenVisualBell (); - break; -#else if (_rl_visible_bell) { +#ifdef __DJGPP__ + ScreenVisualBell (); +#else tputs (_rl_visible_bell, 1, _rl_output_character_function); +#endif break; } /* FALLTHROUGH */ -#endif case AUDIBLE_BELL: fprintf (stderr, "\007"); fflush (stderr); @@ -721,12 +727,29 @@ rl_ding () /* */ /* **************************************************************** */ +static int enabled_meta = 0; /* flag indicating we enabled meta mode */ + void _rl_enable_meta_key () { #if !defined (__DJGPP__) if (term_has_meta && _rl_term_mm) - tputs (_rl_term_mm, 1, _rl_output_character_function); + { + tputs (_rl_term_mm, 1, _rl_output_character_function); + enabled_meta = 1; + } +#endif +} + +void +_rl_disable_meta_key () +{ +#if !defined (__DJGPP__) + if (term_has_meta && _rl_term_mo && enabled_meta) + { + tputs (_rl_term_mo, 1, _rl_output_character_function); + enabled_meta = 0; + } #endif } diff --git a/readline/text.c b/readline/text.c index 536e31af602..f29adf8101c 100644 --- a/readline/text.c +++ b/readline/text.c @@ -240,7 +240,7 @@ rl_replace_line (text, clear_undo) this is the same as rl_end. Any command that is called interactively receives two arguments. - The first is a count: the numeric arg pased to this command. + The first is a count: the numeric arg passed to this command. The second is the key which invoked this command. */ @@ -826,7 +826,7 @@ _rl_insert_char (count, c) pending characters that are bound to rl_insert, and insert them all. Don't do this if we're current reading input from a macro. */ - if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_any_typein ()) + if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_pushed_input_available ()) _rl_insert_typein (c); else { @@ -908,6 +908,9 @@ _rl_insert_next (count) if (c < 0) return -1; + if (RL_ISSTATE (RL_STATE_MACRODEF)) + _rl_add_macro_char (c); + #if defined (HANDLE_SIGNALS) if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) _rl_restore_tty_signals (); diff --git a/readline/undo.c b/readline/undo.c index eb042b29fd9..e9369b1a19c 100644 --- a/readline/undo.c +++ b/readline/undo.c @@ -1,7 +1,7 @@ /* readline.c -- a general facility for reading lines of input with emacs style editing and completion. */ -/* Copyright (C) 1987-2009 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -101,23 +101,33 @@ rl_add_undo (what, start, end, text) rl_undo_list = temp; } -/* Free the existing undo list. */ +/* Free an UNDO_LIST */ void -rl_free_undo_list () +_rl_free_undo_list (ul) + UNDO_LIST *ul; { - UNDO_LIST *release, *orig_list; + UNDO_LIST *release; - orig_list = rl_undo_list; - while (rl_undo_list) + while (ul) { - release = rl_undo_list; - rl_undo_list = rl_undo_list->next; + release = ul; + ul = ul->next; if (release->what == UNDO_DELETE) xfree (release->text); xfree (release); } +} + +/* Free the existing undo list. */ +void +rl_free_undo_list () +{ + UNDO_LIST *release, *orig_list; + + orig_list = rl_undo_list; + _rl_free_undo_list (rl_undo_list); rl_undo_list = (UNDO_LIST *)NULL; replace_history_data (-1, (histdata_t *)orig_list, (histdata_t *)NULL); } @@ -168,6 +178,7 @@ rl_do_undo () { UNDO_LIST *release; int waiting_for_begin, start, end; + HIST_ENTRY *cur, *temp; #define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i))) @@ -222,6 +233,18 @@ rl_do_undo () release = rl_undo_list; rl_undo_list = rl_undo_list->next; + + /* If we are editing a history entry, make sure the change is replicated + in the history entry's line */ + cur = current_history (); + if (cur && cur->data && (UNDO_LIST *)cur->data == release) + { + temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list); + xfree (temp->line); + FREE (temp->timestamp); + xfree (temp); + } + replace_history_data (-1, (histdata_t *)release, (histdata_t *)rl_undo_list); xfree (release); diff --git a/readline/util.c b/readline/util.c index 321dee23560..58b55e276d8 100644 --- a/readline/util.c +++ b/readline/util.c @@ -1,6 +1,6 @@ /* util.c -- readline utility functions */ -/* Copyright (C) 1987-2010 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -108,7 +108,11 @@ _rl_abort_internal () _rl_pop_executing_macro (); rl_last_func = (rl_command_func_t *)NULL; +#if defined (HAVE_POSIX_SIGSETJMP) + siglongjmp (_rl_top_level, 1); +#else longjmp (_rl_top_level, 1); +#endif return (0); } @@ -369,11 +373,13 @@ _rl_strpbrk (string1, string2) doesn't matter (strncasecmp). */ int _rl_strnicmp (string1, string2, count) - char *string1, *string2; + const char *string1; + const char *string2; int count; { - register char *s1, *s2; - int d; + register const char *s1; + register const char *s2; + register int d; if (count <= 0 || (string1 == string2)) return 0; @@ -397,10 +403,12 @@ _rl_strnicmp (string1, string2, count) /* strcmp (), but caseless (strcasecmp). */ int _rl_stricmp (string1, string2) - char *string1, *string2; + const char *string1; + const char *string2; { - register char *s1, *s2; - int d; + register const char *s1; + register const char *s2; + register int d; s1 = string1; s2 = string2; @@ -468,6 +476,7 @@ _rl_savestring (s) return (strcpy ((char *)xmalloc (1 + (int)strlen (s)), (s))); } +#if defined (DEBUG) #if defined (USE_VARARGS) static FILE *_rl_tracefp; @@ -507,7 +516,7 @@ _rl_tropen () if (_rl_tracefp) fclose (_rl_tracefp); - sprintf (fnbuf, "/var/tmp/rltrace.%ld", getpid()); + sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long)getpid()); unlink(fnbuf); _rl_tracefp = fopen (fnbuf, "w+"); return _rl_tracefp != 0; @@ -523,4 +532,62 @@ _rl_trclose () return r; } +void +_rl_settracefp (fp) + FILE *fp; +{ + _rl_tracefp = fp; +} +#endif +#endif /* DEBUG */ + + +#if HAVE_DECL_AUDIT_USER_TTY && defined (ENABLE_TTY_AUDIT_SUPPORT) +#include <sys/socket.h> +#include <linux/audit.h> +#include <linux/netlink.h> + +/* Report STRING to the audit system. */ +void +_rl_audit_tty (string) + char *string; +{ + struct sockaddr_nl addr; + struct msghdr msg; + struct nlmsghdr nlm; + struct iovec iov[2]; + size_t size; + int fd; + + fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_AUDIT); + if (fd < 0) + return; + size = strlen (string) + 1; + + nlm.nlmsg_len = NLMSG_LENGTH (size); + nlm.nlmsg_type = AUDIT_USER_TTY; + nlm.nlmsg_flags = NLM_F_REQUEST; + nlm.nlmsg_seq = 0; + nlm.nlmsg_pid = 0; + + iov[0].iov_base = &nlm; + iov[0].iov_len = sizeof (nlm); + iov[1].iov_base = string; + iov[1].iov_len = size; + + addr.nl_family = AF_NETLINK; + addr.nl_pid = 0; + addr.nl_groups = 0; + + msg.msg_name = &addr; + msg.msg_namelen = sizeof (addr); + msg.msg_iov = iov; + msg.msg_iovlen = 2; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + + (void)sendmsg (fd, &msg, 0); + close (fd); +} #endif diff --git a/readline/vi_keymap.c b/readline/vi_keymap.c index ba5a27ba6df..60c925d9370 100644 --- a/readline/vi_keymap.c +++ b/readline/vi_keymap.c @@ -309,7 +309,6 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = { #endif /* KEYMAP_SIZE > 128 */ }; - KEYMAP_ENTRY_ARRAY vi_insertion_keymap = { /* The regular control keys come first. */ { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-@ */ diff --git a/readline/vi_mode.c b/readline/vi_mode.c index a3c35786c36..0864192e3f4 100644 --- a/readline/vi_mode.c +++ b/readline/vi_mode.c @@ -1,7 +1,7 @@ /* vi_mode.c -- A vi emulation mode for Bash. Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */ -/* Copyright (C) 1987-2010 Free Software Foundation, Inc. +/* Copyright (C) 1987-2012 Free Software Foundation, Inc. This file is part of the GNU Readline Library (Readline), a library for reading lines of text with interactive input and history editing. @@ -108,9 +108,13 @@ static const char * const vi_textmod = "_*\\AaIiCcDdPpYyRrSsXx~"; /* Arrays for the saved marks. */ static int vi_mark_chars['z' - 'a' + 1]; +static void _rl_vi_replace_insert PARAMS((int)); +static void _rl_vi_save_replace PARAMS((void)); static void _rl_vi_stuff_insert PARAMS((int)); static void _rl_vi_save_insert PARAMS((UNDO_LIST *)); +static void vi_save_insert_buffer PARAMS ((int, int)); + static void _rl_vi_backup PARAMS((void)); static int _rl_vi_arg_dispatch PARAMS((int)); @@ -189,6 +193,22 @@ _rl_vi_textmod_command (c) } static void +_rl_vi_replace_insert (count) + int count; +{ + int nchars; + + nchars = strlen (vi_insert_buffer); + + rl_begin_undo_group (); + while (count--) + /* nchars-1 to compensate for _rl_replace_text using `end+1' in call + to rl_delete_text */ + _rl_replace_text (vi_insert_buffer, rl_point, rl_point+nchars-1); + rl_end_undo_group (); +} + +static void _rl_vi_stuff_insert (count) int count; { @@ -207,7 +227,7 @@ rl_vi_redo (count, c) { int r; - if (!rl_explicit_arg) + if (rl_explicit_arg == 0) { rl_numeric_arg = _rl_vi_last_repeat; rl_arg_sign = _rl_vi_last_arg_sign; @@ -224,6 +244,13 @@ rl_vi_redo (count, c) if (rl_point > 0) _rl_vi_backup (); } + else if (_rl_vi_last_command == 'R' && vi_insert_buffer && *vi_insert_buffer) + { + _rl_vi_replace_insert (count); + /* And back up point over the last character inserted. */ + if (rl_point > 0) + _rl_vi_backup (); + } /* Ditto for redoing an insert with `I', but move to the beginning of the line like the `I' command does. */ else if (_rl_vi_last_command == 'I' && vi_insert_buffer && *vi_insert_buffer) @@ -679,6 +706,8 @@ rl_vi_insertion_mode (count, key) { _rl_keymap = vi_insertion_keymap; _rl_vi_last_key_before_insert = key; + if (_rl_show_mode_in_prompt) + _rl_reset_prompt (); return (0); } @@ -691,6 +720,43 @@ rl_vi_insert_mode (count, key) } static void +vi_save_insert_buffer (start, len) + int start, len; +{ + /* Same code as _rl_vi_save_insert below */ + if (len >= vi_insert_buffer_size) + { + vi_insert_buffer_size += (len + 32) - (len % 32); + vi_insert_buffer = (char *)xrealloc (vi_insert_buffer, vi_insert_buffer_size); + } + strncpy (vi_insert_buffer, rl_line_buffer + start, len - 1); + vi_insert_buffer[len-1] = '\0'; +} + +static void +_rl_vi_save_replace () +{ + int len, start, end; + UNDO_LIST *up; + + up = rl_undo_list; + if (up == 0 || up->what != UNDO_END || vi_replace_count <= 0) + { + if (vi_insert_buffer_size >= 1) + vi_insert_buffer[0] = '\0'; + return; + } + /* Let's try it the quick and easy way for now. This should essentially + accommodate every UNDO_INSERT and save the inserted text to + vi_insert_buffer */ + end = rl_point; + start = end - vi_replace_count + 1; + len = vi_replace_count + 1; + + vi_save_insert_buffer (start, len); +} + +static void _rl_vi_save_insert (up) UNDO_LIST *up; { @@ -706,13 +772,8 @@ _rl_vi_save_insert (up) start = up->start; end = up->end; len = end - start + 1; - if (len >= vi_insert_buffer_size) - { - vi_insert_buffer_size += (len + 32) - (len % 32); - vi_insert_buffer = (char *)xrealloc (vi_insert_buffer, vi_insert_buffer_size); - } - strncpy (vi_insert_buffer, rl_line_buffer + start, len - 1); - vi_insert_buffer[len-1] = '\0'; + + vi_save_insert_buffer (start, len); } void @@ -728,7 +789,10 @@ _rl_vi_done_inserting () on absolute indices into the line which may change (though they probably will not). */ _rl_vi_doing_insert = 0; - _rl_vi_save_insert (rl_undo_list->next); + if (_rl_vi_last_key_before_insert == 'R') + _rl_vi_save_replace (); /* Half the battle */ + else + _rl_vi_save_insert (rl_undo_list->next); vi_continued_command = 1; } else @@ -762,6 +826,9 @@ rl_vi_movement_mode (count, key) if (RL_ISSTATE (RL_STATE_VICMDONCE) == 0) rl_free_undo_list (); + if (_rl_show_mode_in_prompt) + _rl_reset_prompt (); + RL_SETSTATE (RL_STATE_VICMDONCE); return (0); } @@ -1234,11 +1301,19 @@ rl_vi_delete_to (count, key) _rl_vimvcxt->motion = '$'; r = rl_domove_motion_callback (_rl_vimvcxt); } - else if (vi_redoing) + else if (vi_redoing && _rl_vi_last_motion != 'd') /* `dd' is special */ { _rl_vimvcxt->motion = _rl_vi_last_motion; r = rl_domove_motion_callback (_rl_vimvcxt); } + else if (vi_redoing) /* handle redoing `dd' here */ + { + _rl_vimvcxt->motion = _rl_vi_last_motion; + rl_mark = rl_end; + rl_beg_of_line (1, key); + RL_UNSETSTATE (RL_STATE_VIMOTION); + r = vidomove_dispatch (_rl_vimvcxt); + } #if defined (READLINE_CALLBACKS) else if (RL_ISSTATE (RL_STATE_CALLBACK)) { @@ -1316,11 +1391,19 @@ rl_vi_change_to (count, key) _rl_vimvcxt->motion = '$'; r = rl_domove_motion_callback (_rl_vimvcxt); } - else if (vi_redoing) + else if (vi_redoing && _rl_vi_last_motion != 'c') /* `cc' is special */ { _rl_vimvcxt->motion = _rl_vi_last_motion; r = rl_domove_motion_callback (_rl_vimvcxt); } + else if (vi_redoing) /* handle redoing `cc' here */ + { + _rl_vimvcxt->motion = _rl_vi_last_motion; + rl_mark = rl_end; + rl_beg_of_line (1, key); + RL_UNSETSTATE (RL_STATE_VIMOTION); + r = vidomove_dispatch (_rl_vimvcxt); + } #if defined (READLINE_CALLBACKS) else if (RL_ISSTATE (RL_STATE_CALLBACK)) { @@ -1377,6 +1460,19 @@ rl_vi_yank_to (count, key) _rl_vimvcxt->motion = '$'; r = rl_domove_motion_callback (_rl_vimvcxt); } + else if (vi_redoing && _rl_vi_last_motion != 'y') /* `yy' is special */ + { + _rl_vimvcxt->motion = _rl_vi_last_motion; + r = rl_domove_motion_callback (_rl_vimvcxt); + } + else if (vi_redoing) /* handle redoing `yy' here */ + { + _rl_vimvcxt->motion = _rl_vi_last_motion; + rl_mark = rl_end; + rl_beg_of_line (1, key); + RL_UNSETSTATE (RL_STATE_VIMOTION); + r = vidomove_dispatch (_rl_vimvcxt); + } #if defined (READLINE_CALLBACKS) else if (RL_ISSTATE (RL_STATE_CALLBACK)) { @@ -1911,14 +2007,20 @@ rl_vi_replace (count, key) vi_replace_count = 0; - if (!vi_replace_map) + if (vi_replace_map == 0) { vi_replace_map = rl_make_bare_keymap (); + for (i = 0; i < ' '; i++) + if (vi_insertion_keymap[i].type == ISFUNC) + vi_replace_map[i].function = vi_insertion_keymap[i].function; + for (i = ' '; i < KEYMAP_SIZE; i++) vi_replace_map[i].function = rl_vi_overstrike; vi_replace_map[RUBOUT].function = rl_vi_overstrike_delete; + + /* Make sure these are what we want. */ vi_replace_map[ESC].function = rl_vi_movement_mode; vi_replace_map[RETURN].function = rl_newline; vi_replace_map[NEWLINE].function = rl_newline; @@ -1931,7 +2033,12 @@ rl_vi_replace (count, key) vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete; } + + rl_vi_start_inserting (key, 1, rl_arg_sign); + + _rl_vi_last_key_before_insert = key; _rl_keymap = vi_replace_map; + return (0); } diff --git a/readline/xfree.c b/readline/xfree.c index d3af7d9aef0..37a81e6c236 100644 --- a/readline/xfree.c +++ b/readline/xfree.c @@ -31,10 +31,7 @@ # include "ansi_stdlib.h" #endif /* HAVE_STDLIB_H */ -#include <stdio.h> - #include "xmalloc.h" -#include "readline.h" /* **************************************************************** */ /* */ @@ -48,10 +45,6 @@ void xfree (string) PTR_T string; { - /* Leak a bit. */ - if (RL_ISSTATE(RL_STATE_SIGHANDLER)) - return; - if (string) free (string); } diff --git a/readline/xmalloc.h b/readline/xmalloc.h index 0fb6a1960e1..f40d7a596a2 100644 --- a/readline/xmalloc.h +++ b/readline/xmalloc.h @@ -38,9 +38,6 @@ #endif /* !PTR_T */ -/* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER. */ -#define xfree xfree_readline - extern PTR_T xmalloc PARAMS((size_t)); extern PTR_T xrealloc PARAMS((void *, size_t)); extern void xfree PARAMS((void *)); |