From 447b8290b3e2e2d117dc8e9cdb83b0dc6448a638 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 3 Jul 2025 16:22:52 -0400 Subject: [PATCH] Readline-8.3 distribution sources and documentation --- CHANGELOG | 44 + CHANGES | 171 + INSTALL | 49 +- MANIFEST | 27 +- Makefile.in | 67 +- NEWS | 51 + README | 7 +- aclocal.m4 | 238 +- ansi_stdlib.h | 8 +- bind.c | 422 +- callback.c | 20 +- chardefs.h | 2 +- colors.c | 4 +- complete.c | 443 +- config.h.in | 41 + configure | 2716 +++-- configure.ac | 25 +- display.c | 389 +- doc/Makefile.in | 107 +- doc/history.0 | 678 +- doc/history.3 | 496 +- doc/history.dvi | Bin 72280 -> 75304 bytes doc/history.html | 1286 +- doc/history.info | 515 +- doc/history.pdf | Bin 204504 -> 206905 bytes doc/history.ps | 4709 ++++---- doc/history.texi | 4 +- doc/history_3.pdf | Bin 0 -> 50218 bytes doc/history_3.ps | 1246 +- doc/hstech.texi | 244 +- doc/hsuser.texi | 378 +- doc/readline.0 | 1604 +-- doc/readline.3 | 1194 +- doc/readline.dvi | Bin 333112 -> 348216 bytes doc/readline.html | 6084 +++++----- doc/readline.info | 3254 ++--- doc/readline.pdf | Bin 406480 -> 417335 bytes doc/readline.ps | 10578 +++++++++-------- doc/readline_3.pdf | Bin 0 -> 91438 bytes doc/readline_3.ps | 3127 ++--- doc/rlman.texi | 2 +- doc/rltech.texi | 1239 +- doc/rluser.texi | 1360 ++- doc/rluserman.dvi | Bin 118796 -> 125460 bytes doc/rluserman.html | 2021 ++-- doc/rluserman.info | 1382 ++- doc/rluserman.pdf | Bin 237019 -> 417335 bytes doc/rluserman.ps | 5449 +++++---- doc/rluserman.texi | 4 +- doc/texi2dvi | 0 doc/texi2html | 6 +- doc/version.texi | 12 +- emacs_keymap.c | 2 +- examples/Makefile.in | 29 +- examples/autoconf/BASH_CHECK_LIB_TERMCAP | 12 +- examples/excallback.c | 31 +- examples/fileman.c | 170 +- examples/hist_erasedups.c | 10 +- examples/hist_purgecmd.c | 12 +- examples/histexamp.c | 12 +- examples/manexamp.c | 65 +- examples/rl-callbacktest.c | 11 +- examples/rl-callbacktest2.c | 148 + examples/rl-callbacktest3.c | 145 + examples/rl-timeout.c | 12 +- examples/rl.c | 14 +- examples/rlcat.c | 18 +- examples/rlevent.c | 10 +- examples/rlfe/Makefile.in | 22 +- examples/rlfe/config.h.in | 10 + examples/rlfe/configure | 4131 ++++--- examples/rlfe/{configure.in => configure.ac} | 172 +- examples/rlfe/os.h | 5 +- examples/rlfe/pty.c | 35 +- examples/rlfe/rlfe.c | 14 +- examples/rlptytest.c | 29 +- examples/rltest.c | 6 +- examples/rlwrap-0.46.1.tar.gz | Bin 0 -> 185122 bytes funmap.c | 15 +- gettimeofday.c | 131 + histexpand.c | 84 +- histfile.c | 192 +- histlib.h | 15 +- history.c | 168 +- history.h | 14 +- histsearch.c | 158 +- input.c | 92 +- isearch.c | 95 +- kill.c | 41 +- m4/codeset.m4 | 3 +- macro.c | 2 +- mbutil.c | 176 +- misc.c | 198 +- nls.c | 3 +- parens.c | 5 +- parse-colors.c | 45 +- patchlevel | 2 +- posixselect.h | 4 +- posixtime.h | 21 +- readline.c | 48 +- readline.h | 106 +- rlconf.h | 5 + rldefs.h | 16 +- rlmbutil.h | 172 +- rlprivate.h | 81 +- rlstdc.h | 14 +- rltty.c | 52 +- rltypedefs.h | 16 +- rlwinsize.h | 5 +- search.c | 231 +- shell.c | 8 +- shlib/Makefile.in | 8 +- signals.c | 32 +- support/config.guess | 111 +- support/config.rpath | 93 +- support/config.sub | 942 +- support/install-sh | 541 + support/install.sh | 247 - support/mkdirs | 0 support/mkinstalldirs | 0 support/shlib-install | 0 support/shobj-conf | 20 +- support/wcwidth.c | 277 +- tcap.h | 14 +- terminal.c | 140 +- text.c | 484 +- tilde.c | 21 +- undo.c | 4 +- util.c | 130 +- vi_mode.c | 84 +- xmalloc.c | 2 +- xmalloc.h | 10 +- 132 files changed, 35047 insertions(+), 27159 deletions(-) create mode 100644 doc/history_3.pdf create mode 100644 doc/readline_3.pdf mode change 100644 => 100755 doc/texi2dvi mode change 100644 => 100755 doc/texi2html create mode 100644 examples/rl-callbacktest2.c create mode 100644 examples/rl-callbacktest3.c rename examples/rlfe/{configure.in => configure.ac} (74%) create mode 100644 examples/rlwrap-0.46.1.tar.gz create mode 100644 gettimeofday.c mode change 100644 => 100755 support/config.rpath create mode 100755 support/install-sh delete mode 100644 support/install.sh mode change 100644 => 100755 support/mkdirs mode change 100644 => 100755 support/mkinstalldirs mode change 100644 => 100755 support/shlib-install diff --git a/CHANGELOG b/CHANGELOG index b2fcb53..783a097 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1448,3 +1448,47 @@ configure.ac readline library to be linked against a shared termcap/curses library that configure finds. If the argument begins with `-l', use that library instead; updated INSTALL accordingly + + 11/25/2022 + ---------- +gettimeofday.c + - add file from bash's lib/sh/gettimeofday.c, only compiled in if + HAVE_GETTIMEOFDAY is not defined + +Makefile.in + - gettimeofday.o: link in, it will not define any symbols if + HAVE_GETTIMEOFDAY is defined. This is for systems like _WIN32 that + don't have gettimeofday() + + 3/6/2024 + -------- +config.h.in + - added more defines that bash aclocal.m4 BASH_CHECK_MULTIBYTE checks + for + + 5/10 + ---- +examples/rlfe + - lots of updates to configure.ac to make it build on modern systems + and more-or-less work with autoconf-2.72 (still warnings about + obsolete macros) + - add prototypes and declarations to pty.c + + 5/11 + ---- +configure.ac + - AC_PROG_GCC_TRADITIONAL: remove + - need to note in CHANGES that configure now supports --enable-year2038. + THIS IS AN ABI CHANGE IF YOU ENABLE IT + + 7/7 + --- +configure.ac + - add ncursesw as a possible value for TERMCAP_PKG_CONFIG_LIB, with + corresponding changes to aclocal.m4, which is shared with bash + + 7/24 + ---- +configure.ac,Makefile.in + - STYLE_CFLAGS: set like bash if we're using gcc or clang; add to + CCFLAGS so we can compile -Wno-parentheses by default diff --git a/CHANGES b/CHANGES index eb54caa..8c89f1e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,174 @@ +This document details the changes between this version, readline-8.3, and +the previous version, readline-8.2. + +1. Changes to Readline + +a. Fixed a bug in clearing the visible line structure before redisplay. + +b. Fix a bug where setlocale(3) returning NULL caused a crash. + +c. Fixed signal checking in callback mode to handle signals that arrive before + readline restore's the application's signal handlers. + +d. Fixed a bug with word completion where the directory name needs to be + dequoted and tilde-expanded. + +e. Fixed a bug that caused compilation to fail on systems with select but not + pselect. + +f. System-specific changes for: WIN32, z/OS, Cygwin, MSYS + +g. Fixed a bug that caused word completion mismatches if the quoted text the + user typed was longer than the unquoted match. + +h. Fixes for freeing undo lists that might appear in history list entries + after non-incremental searches. + +i. Fixes for some errors revealed by address sanitizer. + +j. In vi mode, if an `f' or `F' move command associated with a `c' or `C' + command fails, don't enter insert mode. + +k. Fixed bug with truncating a history file containing timestamps that caused + the timestamp associated with the first history entry not to be written. + +l. Fix vi-mode so that a motion command attached to d/D, y/Y, or t/T must + consume or delete at least one character. + +m. Fix a redisplay error when displaying meta characters as octal sequences + and other C locale issues. + +n. Fix error that caused characters composing an incomplete multibyte + character not to be inserted into the line. + +o. In callback mode, let the application echo the signal characters (e.g., ^C) + when the application's signal handlers are installed. + +p. Added some support for lines that consume more than the physical number of + screen lines. + +q. Make sure dump-variables returns the string values for active-region-start-color + and active-region-end-color if they're set. + +r. Fixes to how characters between 128 and 159 are printed when displaying + macro values (use symbolic notation instead of directly printing the + character). + +s. Don't convert meta characters that contain NULL (\M-\C-@) to actual NULs, + which prematurely terminates the macro value. + +t. Fix typo in the readline color prefix extension that it uses for coloring + filename prefixes when displaying possible completions. + +u. Call the filename rewrite hook on the word being completed before comparing + it against possible completions from the file system to get consistent + strings. + +v. Fix infinite recursion that can happen if someone binds a key that doesn't + have a different upper and lower case represenation to do-lowercase-version. + +w. Check for non-ANSI (dumb) terminals a little more thoroughly. + +x. Don't attempt to history-expand the `quick substitution' character at the + beginning of a line if the application has set the quoting state to single + quotes. + +y. Fix small memory leak if non-incremental or incremental search is + interrupted by a signal. + +z. Loading very large history files should be much faster. + +aa. Retry opening startup files if the open is interrupted by a signal + and is not automatically restarted. + +bb. Make sure the bracketed-paste input buffer is null-terminated when read + returns an error. + +cc. Fixed a small memory leak in execute-named-command if the command doesn't + exist or the function doesn't return. + +dd. Fix for attempting to change case of invalid multibyte characters. + +ee. Fix for possible completions that compare identically when using case- + insensitive completion but have different byte lengths. + +ff. Fix to make non-incremental searches use undo lists and set the history + position the same way as incremental searches. + +gg. Don't check for signals when handling a received signal. + +hh. Fix off-by-one error when tokenizing words like $((expr)) while performing + history expansion. + +ii. Fixes for incremental searches and redisplay in the C locale. + +jj. Fixes for some use-after-free of the undo list errors when stacking multiple + commands that use rl_maybe_replace_line to save changes to a history entry. + +kk. Fixes to ensure that completion-prefix-display-length and + colored-completion-prefix are mutually exclusive. + +ll. Fixed a bug that allowed a history search to change the current history + list position. + +mm. Fixed a bug that allowed ^G to retain a saved command to execute. + +nn. Updates to new export-completions command to allow filename suffixes. + +oo. Fixed a redisplay bug with prompts containing multiple sequences of + invisible characters that are longer than the screen width. + +pp. The history library no longer skips blank lines while it is reading a + multiline history entry from a history file. + +2. New Features in Readline + +a. Output a newline if there is no prompt and readline reads an empty line. + +b. The history library falls back to stdio when writing the history list if + mmap fails. + +c. New bindable variable `search-ignore-case', causes readline to perform + case-insensitive incremental and non-incremental history searches. + +d. rl_full_quoting_desired: new application-settable variable, causes all + completions to be quoted as if they were filenames. + +e. rl_macro_display_hook: new application-settable function pointer, used if + the application wants to print macro values itself instead of letting + readline do it + +f. rl_reparse_colors: new application-callable function, reparses $LS_COLORS + (presumably after the user changes it) + +g. rl_completion_rewrite_hook: new application-settable function pointer, + called to modify the word being completed before comparing it against + pathnames from the file system. + +h. execute-named-command: a new bindable command that reads the name of a + readline command from the standard input and executes it. Bound to M-x + in emacs mode by default. + +i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former + case, anything bound to quoted-insert) to quote characters in the search + string. + +j. Documentation has been significantly updated. + +k. New `force-meta-prefix' bindable variable, which forces the use of ESC as + the meta prefix when using "\M-" in key bindings instead of overloading + convert-meta. + +l. The default value for `readline-colored-completion-prefix' no longer has a + leading `.'; the original report was based on a misunderstanding. + +m. There is a new bindable command, `export-completions', which writes the + possible completions for a word to the standard output in a defined format. + +n. Readline can reset its idea of the screen dimensions when executing after + a SIGCONT. + +------------------------------------------------------------------------------- This document details the changes between this version, readline-8.2, and the previous version, readline-8.1. diff --git a/INSTALL b/INSTALL index 293ef70..52ba8eb 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Basic Installation ================== -These are installation instructions for Readline-8.2. +These are installation instructions for Readline. The simplest way to compile readline is: @@ -14,12 +14,17 @@ The simplest way to compile readline is: Running `configure' takes some time. While running, it prints some messages telling which features it is checking for. + If you want to build readline in a directory other than the source + directory, just run `configure' using a full pathname, for instance: + + bash /usr/local/src/readline/readline-8.3/configure + 2. Type `make' to compile readline and build the static readline - and history libraries. If supported, the shared readline and history - libraries will be built also. See below for instructions on compiling - the other parts of the distribution. Typing `make everything' will - cause the static and shared libraries (if supported) and the example - programs to be built. + and history libraries. If supported, this will build the shared + readline and history libraries also. See below for instructions on + compiling the other parts of the distribution. Typing `make everything' + will build the static and shared libraries (if supported) and the + example programs. 3. Type `make install' to install the static readline and history libraries, the readline include files, the documentation, and, if @@ -44,6 +49,27 @@ results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). +To find out more about the options and arguments that the `configure' +script understands, type + + bash-4.2$ ./configure --help + +at a shell prompt in your readline source directory. + +If you want to build readline in a directory separate from the source +directory - to build for multiple architectures, for example - just use +the full path to the configure script. The following commands will +build readline in a directory under `/usr/local/build' from the source code +in `/usr/local/src/readline/readline-8.3': + + mkdir /usr/local/build/readline-8.3 + cd /usr/local/build/readline-8.3 + bash /usr/local/src/readline/readline-8.3/configure + make + +See `Compiling For Multiple Architectures' below for more information +about building in a directory separate from the source. + If you need to do unusual things to compile readline, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to so they can @@ -93,12 +119,11 @@ Installation Names ================== By default, `make install' will install the readline libraries in -`/usr/local/lib', the include files in -`/usr/local/include/readline', the man pages in `/usr/local/man', -and the info files in `/usr/local/info'. You can specify an -installation prefix other than `/usr/local' by giving `configure' -the option `--prefix=PATH' or by supplying a value for the -DESTDIR variable when running `make install'. +`/usr/local/lib', the include files in `/usr/local/include/readline', +the man pages in `/usr/local/man', and the info files in `/usr/local/info'. +You can specify an installation prefix other than `/usr/local' by +giving `configure' the option `--prefix=PATH' or by supplying a value for +the DESTDIR variable when running `make install'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. diff --git a/MANIFEST b/MANIFEST index db689b3..73e95a8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -82,6 +82,7 @@ vi_keymap.c f vi_mode.c f xfree.c f xmalloc.c f +gettimeofday.c f history.c f histexpand.c f histfile.c f @@ -89,14 +90,14 @@ histsearch.c f patchlevel f shlib/Makefile.in f support/config.guess f -support/config.rpath f +support/config.rpath f 755 support/config.sub f -support/install.sh f -support/mkdirs f +support/install-sh f 755 +support/mkdirs f 755 support/mkdist f -support/mkinstalldirs f +support/mkinstalldirs f 755 support/shobj-conf f -support/shlib-install f +support/shlib-install f 755 support/wcwidth.c f doc/Makefile.in f doc/texinfo.tex f @@ -111,8 +112,8 @@ doc/hstech.texi f doc/hsuser.texi f doc/readline.3 f doc/history.3 f -doc/texi2dvi f -doc/texi2html f +doc/texi2dvi f 755 +doc/texi2html f 755 examples/Makefile.in f examples/excallback.c f examples/fileman.c f @@ -125,6 +126,8 @@ examples/rlevent.c f examples/rlkeymaps.c f examples/rltest.c f examples/rl-callbacktest.c f +examples/rl-callbacktest2.c f +examples/rl-callbacktest3.c f examples/rl-timeout.c f examples/rl-test-timeout f examples/rl.c f @@ -142,17 +145,19 @@ examples/rlfe/Makefile.in f examples/rlfe/README f examples/rlfe/config.h.in f examples/rlfe/configure f 755 -examples/rlfe/configure.in f +examples/rlfe/configure.ac f examples/rlfe/extern.h f examples/rlfe/os.h f examples/rlfe/pty.c f examples/rlfe/rlfe.c f examples/rlfe/screen.h f -examples/rlwrap-0.30.tar.gz f +examples/rlwrap-0.46.1.tar.gz f # formatted documentation, from MANIFEST.doc doc/readline.ps f doc/history.ps f doc/rluserman.ps f +doc/readline_3.ps f +doc/history_3.ps f doc/readline.dvi f doc/history.dvi f doc/rluserman.dvi f @@ -164,8 +169,8 @@ doc/history.html f doc/rluserman.html f doc/readline.0 f doc/history.0 f -doc/readline_3.ps f -doc/history_3.ps f +doc/readline_3.pdf f +doc/history_3.pdf f doc/history.pdf f doc/readline.pdf f doc/rluserman.pdf f diff --git a/Makefile.in b/Makefile.in index 2120daa..54bd19a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ ## -*- text -*- ## # Master Makefile for the GNU readline library. -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2024 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 @@ -37,6 +37,8 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh = @install_sh@ + CC = @CC@ RANLIB = @RANLIB@ AR = @AR@ @@ -78,6 +80,7 @@ CFLAGS = @CFLAGS@ LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' @BRACKETED_PASTE@ CPPFLAGS = @CPPFLAGS@ +STYLE_CFLAGS = @STYLE_CFLAGS@ DEFS = @DEFS@ @CROSS_COMPILE@ LOCAL_DEFS = @LOCAL_DEFS@ @@ -87,7 +90,7 @@ TERMCAP_LIB = @TERMCAP_LIB@ INCLUDES = -I. -I$(srcdir) XCCFLAGS = $(ASAN_CFLAGS) $(DEFS) $(LOCAL_DEFS) $(INCLUDES) $(CPPFLAGS) -CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) +CCFLAGS = $(XCCFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(STYLE_CFLAGS) # could add -Werror here GCC_LINT_FLAGS = -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \ @@ -98,6 +101,9 @@ GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT_FLAGS) @CFLAGS@ @LOCAL_CFLAGS@ ASAN_XCFLAGS = -fsanitize=address -fno-omit-frame-pointer ASAN_XLDFLAGS = -fsanitize=address +UBSAN_XCFLAGS = -fsanitize=undefined -fsanitize-recover -fstack-protector +UBSAN_XLDFLAGS = -fsanitize=undefined + install_examples = @EXAMPLES_INSTALL_TARGET@ .c.o: @@ -120,7 +126,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)/gettimeofday.c # The header files for this library. HSOURCES = $(srcdir)/readline.h $(srcdir)/rldefs.h $(srcdir)/chardefs.h \ @@ -139,7 +145,7 @@ 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 $(HISTOBJ) $(TILDEOBJ) $(COLORSOBJ) \ - xmalloc.o xfree.o compat.o + xmalloc.o xfree.o compat.o gettimeofday.o # The texinfo files which document this library. DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo @@ -167,7 +173,7 @@ all: $(TARGETS) everything: all examples asan: - ${MAKE} ${MFLAGS} ASAN_CFLAGS='${ASAN_XCFLAGS}' ASAN_LDFLAGS='${ASAN_XLDFLAGS}' everything + ${MAKE} ASAN_CFLAGS='${ASAN_XCFLAGS}' ASAN_LDFLAGS='${ASAN_XLDFLAGS}' everything static: $(STATIC_LIBS) @@ -191,7 +197,7 @@ readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c ./libreadline.a ${TERMCAP_LIB} lint: force - $(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static + $(MAKE) CCFLAGS='$(GCC_LINT_CFLAGS)' static Makefile makefile: config.status $(srcdir)/Makefile.in CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status @@ -216,15 +222,15 @@ stamp-h: config.status $(srcdir)/config.h.in shared: force -test -d shlib || mkdir shlib - ( cd shlib ; ${MAKE} ${MFLAGS} all ) + ( cd shlib ; ${MAKE} all ) documentation: force -test -d doc || mkdir doc - -( cd doc && $(MAKE) $(MFLAGS) ) + -( cd doc && $(MAKE) ) examples: force -test -d examples || mkdir examples - -(cd examples && ${MAKE} ${MFLAGS} all ) + -(cd examples && ${MAKE} all ) force: @@ -268,32 +274,32 @@ installdirs: $(srcdir)/support/mkinstalldirs uninstall: uninstall-headers uninstall-doc uninstall-examples uninstall-pc -test -n "$(DESTDIR)$(libdir)" && cd $(DESTDIR)$(libdir) && \ ${RM} libreadline.a libreadline.old libhistory.a libhistory.old $(SHARED_LIBS) - -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) + -( cd shlib; ${MAKE} DESTDIR=${DESTDIR} uninstall ) install-shared: installdirs install-headers shared install-doc install-pc - ( cd shlib ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install ) + ( cd shlib ; ${MAKE} DESTDIR=${DESTDIR} install ) uninstall-shared: maybe-uninstall-headers maybe-uninstall-pc - -( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) + -( cd shlib; ${MAKE} DESTDIR=${DESTDIR} uninstall ) install-examples: installdirs install-headers - -( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install ) + -( cd examples ; ${MAKE} DESTDIR=${DESTDIR} install ) uninstall-examples: maybe-uninstall-headers - -( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall ) + -( cd examples; ${MAKE} 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; \ + ${MAKE} 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; \ + ${MAKE} infodir=$(infodir) DESTDIR=${DESTDIR} uninstall; \ fi ) TAGS: force @@ -302,22 +308,24 @@ TAGS: force tags: force -( cd $(srcdir) && $(CTAGS) $(CSOURCES) $(HSOURCES) ) -clean: force +.PHONY: clean maintainer-clean distclean mostlyclean + +mostlyclean: force $(RM) $(OBJECTS) $(STATIC_LIBS) $(RM) readline readline.exe - ( cd shlib && $(MAKE) $(MFLAGS) $@ ) - -( cd doc && $(MAKE) $(MFLAGS) $@ ) - -( cd examples && $(MAKE) $(MFLAGS) $@ ) + ( cd shlib && $(MAKE) $@ ) + -( cd doc && $(MAKE) $@ ) + -( cd examples && $(MAKE) $@ ) -mostlyclean: clean - ( cd shlib && $(MAKE) $(MFLAGS) $@ ) - -( cd doc && $(MAKE) $(MFLAGS) $@ ) - -( cd examples && $(MAKE) $(MFLAGS) $@ ) +clean: mostlyclean + ( cd shlib && $(MAKE) $@ ) + -( cd doc && $(MAKE) $@ ) + -( cd examples && $(MAKE) $@ ) distclean maintainer-clean: clean - ( cd shlib && $(MAKE) $(MFLAGS) $@ ) - -( cd doc && $(MAKE) $(MFLAGS) $@ ) - -( cd examples && $(MAKE) $(MFLAGS) $@ ) + ( cd shlib && $(MAKE) $@ ) + -( cd doc && $(MAKE) $@ ) + -( cd examples && $(MAKE) $@ ) $(RM) Makefile $(RM) $(CREATED_CONFIGURE) $(RM) $(CREATED_TAGS) @@ -329,7 +337,7 @@ history.pc: config.status $(srcdir)/history.pc.in $(SHELL) config.status info dvi html pdf ps: - -( cd doc && $(MAKE) $(MFLAGS) $@ ) + -( cd doc && $(MAKE) $@ ) install-info: install-dvi: @@ -454,6 +462,9 @@ xfree.o: ansi_stdlib.h xmalloc.o: ${BUILD_DIR}/config.h xmalloc.o: ansi_stdlib.h +gettimeofday.o: ${BUILD_DIR}/config.h +gettimeofday.o: posixtime.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 diff --git a/NEWS b/NEWS index 1d88606..1fc6989 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,54 @@ +This is a terse description of the new features added to readline-8.3 since +the release of readline-8.2. + +New Features in Readline + +a. Output a newline if there is no prompt and readline reads an empty line. + +b. The history library falls back to stdio when writing the history list if + mmap fails. + +c. New bindable variable `search-ignore-case', causes readline to perform + case-insensitive incremental and non-incremental history searches. + +d. rl_full_quoting_desired: new application-settable variable, causes all + completions to be quoted as if they were filenames. + +e. rl_macro_display_hook: new application-settable function pointer, used if + the application wants to print macro values itself instead of letting + readline do it + +f. rl_reparse_colors: new application-callable function, reparses $LS_COLORS + (presumably after the user changes it) + +g. rl_completion_rewrite_hook: new application-settable function pointer, + called to modify the word being completed before comparing it against + pathnames from the file system. + +h. execute-named-command: a new bindable command that reads the name of a + readline command from the standard input and executes it. Bound to M-x + in emacs mode by default. + +i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former + case, anything bound to quoted-insert) to quote characters in the search + string. + +j. Documentation has been significantly updated. + +k. New `force-meta-prefix' bindable variable, which forces the use of ESC as + the meta prefix when using "\M-" in key bindings instead of overloading + convert-meta. + +l. The default value for `readline-colored-completion-prefix' no longer has a + leading `.'; the original report was based on a misunderstanding. + +m. There is a new bindable command, `export-completions', which writes the + possible completions for a word to the standard output in a defined format. + +n. Readline can reset its idea of the screen dimensions when executing after + a SIGCONT. + +------------------------------------------------------------------------------- This is a terse description of the new features added to readline-8.2 since the release of readline-8.1. diff --git a/README b/README index 83cdb23..75eaa2f 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ Introduction ============ -This is the Gnu Readline library, version 8.2. +This is the Gnu Readline library, version 8.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 @@ -33,7 +33,8 @@ may work: env CC=cc ./configure Read the file INSTALL in this directory for more information about how -to customize and control the build process. +to customize and control the build process, including how to build readline +in a directory other than the source directory. The file rlconf.h contains C preprocessor defines that enable and disable certain Readline features. @@ -47,7 +48,7 @@ Examples There are several example programs that use Readline features in the examples directory. The `rl' program is of particular interest. It is a command-line interface to Readline, suitable for use in shell -scripts in place of `read'. +scripts in place of `read' (but look at bash's `read -e' first). Shared Libraries ================ diff --git a/aclocal.m4 b/aclocal.m4 index cc97bd4..ae2d8ae 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -3,7 +3,7 @@ dnl Bash specific tests dnl dnl Some derived from PDKSH 5.1.3 autoconf tests dnl -dnl Copyright (C) 1987-2021 Free Software Foundation, Inc. +dnl Copyright (C) 1987-2025 Free Software Foundation, Inc. dnl dnl @@ -69,11 +69,7 @@ AC_DEFUN(BASH_DECL_PRINTF, AC_CACHE_VAL(bash_cv_printf_declared, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include -#ifdef __STDC__ typedef int (*_bashfunc)(const char *, ...); -#else -typedef int (*_bashfunc)(); -#endif #include int main() @@ -238,6 +234,9 @@ AC_CACHE_VAL(bash_cv_dup2_broken, #include #include #include +#ifdef HAVE_UNISTD_H +# include +#endif /* HAVE_UNISTD_H */ int main() { @@ -432,6 +431,7 @@ AC_CACHE_VAL(bash_cv_sizeof_rlim_cur, #endif #include #include +int main() { struct rlimit r; @@ -457,6 +457,7 @@ AC_CACHE_VAL(bash_cv_sizeof_quad_t, #include #endif +int main() { #if HAVE_QUAD_T @@ -558,18 +559,8 @@ AC_CACHE_VAL(bash_cv_getenv_redef, # include #endif #include -#ifndef __STDC__ -# ifndef const -# define const -# endif -#endif char * -getenv (name) -#if defined (__linux__) || defined (__bsdi__) || defined (convex) - const char *name; -#else - char const *name; -#endif /* !__linux__ && !__bsdi__ && !convex */ +getenv (const char *name) { return "42"; } @@ -599,7 +590,6 @@ fi # We should check for putenv before calling this AC_DEFUN(BASH_FUNC_STD_PUTENV, [ -AC_REQUIRE([AC_C_PROTOTYPES]) AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if HAVE_STDLIB_H @@ -608,16 +598,7 @@ AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv, #if HAVE_STDDEF_H #include #endif -#ifndef __STDC__ -# ifndef const -# define const -# endif -#endif -#ifdef PROTOTYPES extern int putenv (char *); -#else -extern int putenv (); -#endif ]], [[return (putenv == 0);]] )], [bash_cv_std_putenv=yes], [bash_cv_std_putenv=no] )]) @@ -629,7 +610,6 @@ fi # We should check for unsetenv before calling this AC_DEFUN(BASH_FUNC_STD_UNSETENV, [ -AC_REQUIRE([AC_C_PROTOTYPES]) AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if HAVE_STDLIB_H @@ -638,16 +618,7 @@ AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unset #if HAVE_STDDEF_H #include #endif -#ifndef __STDC__ -# ifndef const -# define const -# endif -#endif -#ifdef PROTOTYPES extern int unsetenv (const char *); -#else -extern int unsetenv (); -#endif ]], [[return (unsetenv == 0);]] )], [bash_cv_std_unsetenv=yes], [bash_cv_std_unsetenv=no] )]) @@ -841,9 +812,7 @@ AC_CACHE_VAL(bash_cv_func_strcoll_broken, #include int -main(c, v) -int c; -char *v[]; +main(int c, char **v) { int r1, r2; char *deflocale, *defcoll; @@ -966,8 +935,8 @@ AC_CACHE_VAL(bash_cv_termcap_lib, [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, - [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, - [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw, + [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw, + [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])])])])])]) if test "X$_bash_needmsg" = "Xyes"; then AC_MSG_CHECKING(which library has the termcap functions) @@ -983,9 +952,15 @@ TERMCAP_DEP= elif test $bash_cv_termcap_lib = libtinfo; then TERMCAP_LIB=-ltinfo TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libncursesw; then +TERMCAP_LIB=-lncursesw +TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libcurses; then +TERMCAP_LIB=-lcurses +TERMCAP_DEP= elif test $bash_cv_termcap_lib = libc; then TERMCAP_LIB= TERMCAP_DEP= @@ -1050,7 +1025,7 @@ dnl like _AC_STRUCT_DIRENT(MEMBER) but public AC_DEFUN(BASH_STRUCT_DIRENT, [ AC_REQUIRE([AC_HEADER_DIRENT]) -AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, bash_cv_dirent_has_$1=no, +AC_CHECK_MEMBERS(struct dirent.$1, [], [], [[ #include #include @@ -1074,35 +1049,9 @@ AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, bash_cv_dirent_has ]]) ]) -AC_DEFUN(BASH_STRUCT_DIRENT_D_INO, -[AC_REQUIRE([AC_HEADER_DIRENT]) -AC_MSG_CHECKING(for struct dirent.d_ino) -AC_CACHE_VAL(bash_cv_dirent_has_d_ino, [BASH_STRUCT_DIRENT([d_ino])]) -AC_MSG_RESULT($bash_cv_dirent_has_d_ino) -if test $bash_cv_dirent_has_d_ino = yes; then -AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO) -fi -]) - -AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO, -[AC_REQUIRE([AC_HEADER_DIRENT]) -AC_MSG_CHECKING(for struct dirent.d_fileno) -AC_CACHE_VAL(bash_cv_dirent_has_d_fileno, [BASH_STRUCT_DIRENT([d_fileno])]) -AC_MSG_RESULT($bash_cv_dirent_has_d_fileno) -if test $bash_cv_dirent_has_d_fileno = yes; then -AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO) -fi -]) - -AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN, -[AC_REQUIRE([AC_HEADER_DIRENT]) -AC_MSG_CHECKING(for struct dirent.d_namlen) -AC_CACHE_VAL(bash_cv_dirent_has_d_namlen, [BASH_STRUCT_DIRENT([d_namlen])]) -AC_MSG_RESULT($bash_cv_dirent_has_d_namlen) -if test $bash_cv_dirent_has_d_namlen = yes; then -AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN) -fi -]) +AC_DEFUN([BASH_STRUCT_DIRENT_D_INO], [BASH_STRUCT_DIRENT([d_ino])]) +AC_DEFUN([BASH_STRUCT_DIRENT_D_FILENO], [BASH_STRUCT_DIRENT([d_fileno])]) +AC_DEFUN([BASH_STRUCT_DIRENT_D_NAMLEN], [BASH_STRUCT_DIRENT([d_namlen])]) AC_DEFUN(BASH_STRUCT_TIMEVAL, [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h) @@ -1345,15 +1294,13 @@ AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers, #endif #include -typedef void sigfunc(); +typedef void sigfunc(int); volatile int nsigint; #ifdef HAVE_POSIX_SIGNALS sigfunc * -set_signal_handler(sig, handler) - int sig; - sigfunc *handler; +set_signal_handler(int sig, sigfunc *handler) { struct sigaction act, oact; act.sa_handler = handler; @@ -1368,8 +1315,7 @@ set_signal_handler(sig, handler) #endif void -sigint(s) -int s; +sigint(int s) { nsigint++; } @@ -1607,13 +1553,15 @@ AC_DEFUN(BASH_CHECK_DEV_FD, [AC_MSG_CHECKING(whether /dev/fd is available) AC_CACHE_VAL(bash_cv_dev_fd, [bash_cv_dev_fd="" -if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then +if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then # check for systems like FreeBSD 5 that only provide /dev/fd/[012] if (exec test -r /dev/fd/3 3 int -main(c, v) -int c; -char **v; +main(int c, char **v) { int w; setlocale(LC_ALL, "en_US.UTF-8"); w = wcwidth (0x0301); + if (w != 0) + exit (0); + w = wcwidth (0x200b); exit (w == 0); /* exit 0 if wcwidth broken */ } ]])], [bash_cv_wcwidth_broken=yes], [bash_cv_wcwidth_broken=no], @@ -2093,31 +2047,17 @@ AC_DEFUN([BASH_FUNC_VSNPRINTF], if test X$ac_cv_func_vsnprintf = Xyes; then AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf], [AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#if HAVE_STDARG_H #include -#else -#include -#endif #include #include static int -#if HAVE_STDARG_H foo(const char *fmt, ...) -#else -foo(format, va_alist) - const char *format; - va_dcl -#endif { va_list args; int n; -#if HAVE_STDARG_H va_start(args, fmt); -#else - va_start(args); -#endif n = vsnprintf(0, 0, fmt, args); va_end (args); return n; @@ -2154,9 +2094,7 @@ AC_CACHE_VAL(bash_cv_wexitstatus_offset, #include int -main(c, v) - int c; - char **v; +main(int c, char **v) { pid_t pid, p; int s, i, n; @@ -2230,6 +2168,43 @@ main(int c, char **v) fi ]) +AC_DEFUN([BASH_FUNC_BRK], +[ + AC_MSG_CHECKING([for brk]) + AC_CACHE_VAL(ac_cv_func_brk, + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[ void *x = brk (0); ]])], + [ac_cv_func_brk=yes],[ac_cv_func_brk=no])]) + AC_MSG_RESULT($ac_cv_func_brk) + if test X$ac_cv_func_brk = Xyes; then + AC_CACHE_CHECK([for working brk], [bash_cv_func_brk], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include + +int +main(int c, char **v) +{ + void *x; + + x = brk (0); + exit ((x == (void *)-1) ? 1 : 0); +} +]])],[bash_cv_func_brk=yes],[bash_cv_func_brk=no],[AC_MSG_WARN([cannot check working brk if cross-compiling]) + bash_cv_func_brk=yes +])]) + if test $bash_cv_func_brk = no; then + ac_cv_func_brk=no + fi + fi + if test $ac_cv_func_brk = yes; then + AC_DEFINE(HAVE_BRK, 1, + [Define if you have a working brk function.]) + fi +]) + AC_DEFUN(BASH_FUNC_FNMATCH_EQUIV_FALLBACK, [AC_MSG_CHECKING(whether fnmatch can be used to check bracket equivalence classes) AC_CACHE_VAL(bash_cv_fnmatch_equiv_fallback, @@ -2265,3 +2240,68 @@ else fi AC_DEFINE_UNQUOTED([FNMATCH_EQUIV_FALLBACK], [$bash_cv_fnmatch_equiv_value], [Whether fnmatch can be used for bracket equivalence classes]) ]) + +AC_DEFUN([BASH_FUNC_STRCHRNUL], +[ + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CACHE_CHECK([whether strchrnul works], + [bash_cv_func_strchrnul_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[ +#include +]], +[[const char *buf = "abc"; + return strchrnul (buf, 'd') != buf + 3; +]] +)], +[bash_cv_func_strchrnul_works=yes], [bash_cv_func_strchrnul_works=no], +[bash_cv_func_strchrnul_works=no] +)]) + +if test "$bash_cv_func_strchrnul_works" = "no"; then +AC_LIBOBJ([strchrnul]) +fi +]) + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +#if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +#fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) diff --git a/ansi_stdlib.h b/ansi_stdlib.h index 7dc2ee0..3cb3e07 100644 --- a/ansi_stdlib.h +++ b/ansi_stdlib.h @@ -2,7 +2,7 @@ /* A minimal stdlib.h containing extern declarations for those functions that bash uses. */ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993,2023 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. @@ -32,13 +32,7 @@ extern double strtod (); /* Memory allocation functions. */ /* Generic pointer type. */ #ifndef PTR_T - -#if defined (__STDC__) # define PTR_T void * -#else -# define PTR_T char * -#endif - #endif /* PTR_T */ extern PTR_T malloc (); diff --git a/bind.c b/bind.c index 880db8c..6aaa637 100644 --- a/bind.c +++ b/bind.c @@ -1,6 +1,6 @@ /* bind.c -- key binding and startup file support for the readline library. */ -/* Copyright (C) 1987-2022 Free Software Foundation, Inc. +/* Copyright (C) 1987-2024 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. @@ -65,20 +65,15 @@ extern int errno; #include "rlshell.h" #include "xmalloc.h" -#if !defined (strchr) && !defined (__STDC__) -extern char *strchr (), *strrchr (); -#endif /* !strchr && !__STDC__ */ - /* Variables exported by this file. */ Keymap rl_binding_keymap; +/* Functions exported by this file. */ +rl_macro_print_func_t *rl_macro_display_hook = (rl_macro_print_func_t *)NULL; + static int _rl_skip_to_delim (char *, int, int); -#if defined (USE_VARARGS) && defined (PREFER_STDARG) static void _rl_init_file_error (const char *, ...) __attribute__((__format__ (printf, 1, 2))); -#else -static void _rl_init_file_error (); -#endif static rl_command_func_t *_rl_function_of_keyseq_internal (const char *, size_t, Keymap, int *); @@ -103,6 +98,15 @@ static int currently_reading_init_file; /* used only in this file */ static int _rl_prefer_visible_bell = 1; +/* Currently confined to this file for key bindings. If enabled (> 0), we + force meta key bindings to use the meta prefix (ESC). If unset (-1) or + disabled (0), we use the current value of _rl_convert_meta_chars_to_ascii + as in previous readline versions. */ +static int _rl_force_meta_prefix = 0; + +/* Do we want to force binding "\M-C" to the meta prefix (ESC-C)? */ +#define FORCE_META_PREFIX() (_rl_force_meta_prefix > 0 ? 1 : _rl_convert_meta_chars_to_ascii) + #define OP_EQ 1 #define OP_NE 2 #define OP_GT 3 @@ -142,7 +146,7 @@ rl_bind_key (int key, rl_command_func_t *function) return (key); /* Want to make this a multi-character key sequence with an ESC prefix */ - if (META_CHAR (key) && _rl_convert_meta_chars_to_ascii) + if (META_CHAR (key) && FORCE_META_PREFIX()) { if (_rl_keymap[ESC].type == ISKMAP) { @@ -262,7 +266,7 @@ rl_unbind_function_in_map (rl_command_func_t *func, Keymap map) map[i].function = (rl_command_func_t *)NULL; rval = 1; } - else if (map[i].type == ISKMAP) /* TAG:readline-8.1 */ + else if (map[i].type == ISKMAP) { int r; r = rl_unbind_function_in_map (func, FUNCTION_TO_KEYMAP (map, i)); @@ -423,19 +427,8 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map) return -1; } - /* We now rely on rl_translate_keyseq to do this conversion, so this - check is superfluous. */ -#if 0 - if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii) - { - ic = UNMETA (ic); - if (map[ESC].type == ISKMAP) - { - prevmap = map; - map = FUNCTION_TO_KEYMAP (map, ESC); - } - } -#endif + /* We rely on rl_translate_keyseq to do convert meta-chars to key + sequences with the meta prefix (ESC). */ if ((i + 1) < keys_len) { @@ -531,8 +524,7 @@ rl_translate_keyseq (const char *seq, char *array, int *len) /* When there are incomplete prefixes \C- or \M- (has_control || has_meta) without base character at the end of SEQ, they are processed as the - prefixes for '\0'. - */ + prefixes for '\0'. */ for (i = l = 0; (c = seq[i]) || has_control || has_meta; i++) { /* Only backslashes followed by a non-null character are handled @@ -623,21 +615,28 @@ rl_translate_keyseq (const char *seq, char *array, int *len) c = (c == '?') ? RUBOUT : CTRL (_rl_to_upper (c)); has_control = 0; } + if (has_meta) - { - c = META (c); - has_meta = 0; - } + c = META (c); - /* If convert-meta is turned on, convert a meta char to a key sequence */ - if (META_CHAR (c) && _rl_convert_meta_chars_to_ascii) + /* If force-meta-prefix is turned on, convert a meta char to a key + sequence, but only if it uses the \M- syntax. */ + if (META_CHAR (c) && has_meta && FORCE_META_PREFIX()) { - array[l++] = ESC; /* ESC is meta-prefix */ - array[l++] = UNMETA (c); + int x = UNMETA (c); + if (x) + { + array[l++] = ESC; /* ESC is meta-prefix */ + array[l++] = x; + } + else + array[l++] = c; /* just do the best we can without sticking a NUL in there. */ } else array[l++] = (c); + has_meta = 0; + /* Null characters may be processed for incomplete prefixes at the end of sequence */ if (seq[i] == '\0') @@ -685,7 +684,8 @@ char * rl_untranslate_keyseq (int seq) { static char kseq[16]; - int i, c; + int i; + unsigned char c; i = 0; c = seq; @@ -696,35 +696,22 @@ rl_untranslate_keyseq (int seq) kseq[i++] = '-'; c = UNMETA (c); } - else if (c == ESC) + + if (c == ESC) /* look at _rl_force_meta_prefix here? */ { kseq[i++] = '\\'; c = 'e'; } - else if (CTRL_CHAR (c)) + else if (CTRL_CHAR (c) || c == RUBOUT) { kseq[i++] = '\\'; kseq[i++] = 'C'; kseq[i++] = '-'; - c = _rl_to_lower (UNCTRL (c)); - } - else if (c == RUBOUT) - { - kseq[i++] = '\\'; - kseq[i++] = 'C'; - kseq[i++] = '-'; - c = '?'; + c = (c == RUBOUT) ? '?' : _rl_to_lower (UNCTRL (c)); } - if (c == ESC) - { - kseq[i++] = '\\'; - c = 'e'; - } - else if (c == '\\' || c == '"') - { - kseq[i++] = '\\'; - } + if (c == '\\' || c == '"') + kseq[i++] = '\\'; kseq[i++] = (unsigned char) c; kseq[i] = '\0'; @@ -735,9 +722,9 @@ char * _rl_untranslate_macro_value (char *seq, int use_escapes) { char *ret, *r, *s; - int c; + unsigned char c; - r = ret = (char *)xmalloc (7 * strlen (seq) + 1); + r = ret = (char *)xmalloc (8 * strlen (seq) + 1); for (s = seq; *s; s++) { c = *s; @@ -748,7 +735,9 @@ _rl_untranslate_macro_value (char *seq, int use_escapes) *r++ = '-'; c = UNMETA (c); } - else if (c == ESC) + + /* We want to keep from printing literal control chars */ + if (c == ESC) { *r++ = '\\'; c = 'e'; @@ -773,15 +762,10 @@ _rl_untranslate_macro_value (char *seq, int use_escapes) c = '?'; } - if (c == ESC) - { - *r++ = '\\'; - c = 'e'; - } - else if (c == '\\' || c == '"') + if (c == '\\' || c == '"') *r++ = '\\'; - *r++ = (unsigned char)c; + *r++ = c; } *r = '\0'; return ret; @@ -820,7 +804,7 @@ _rl_function_of_keyseq_internal (const char *keyseq, size_t len, Keymap map, int { unsigned char ic = keyseq[i]; - if (META_CHAR (ic) && _rl_convert_meta_chars_to_ascii) + if (META_CHAR (ic) && FORCE_META_PREFIX()) /* XXX - might not want this */ { if (map[ESC].type == ISKMAP) { @@ -889,21 +873,30 @@ int rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map) { register int i, j, parsing_digits; - unsigned char ic; + unsigned int ic; /* int to handle ANYOTHERKEY */ Keymap map0; if (map == 0) map = _rl_keymap; map0 = map; - /* The digits following the initial one (e.g., the binding to digit-argument) - or the optional `-' in a binding to digit-argument or universal-argument - are not added to rl_executing_keyseq. This is basically everything read by - rl_digit_loop. The parsing_digits logic is here in case they ever are. */ + /* Make sure to add the digits following the initial one (e.g., the binding + to digit-argument) and the optional `-' in a binding to digit-argument + or universal-argument to rl_executing_keyseq. This is basically + everything read by rl_digit_loop. */ for (i = j = parsing_digits = 0; keyseq && i < len; i++) { ic = keyseq[i]; + if (parsing_digits == 2) + { + if (ic == '-') /* skip over runs of minus chars */ + { + j = i + 1; + continue; + } + parsing_digits = 1; + } if (parsing_digits) { if (_rl_digit_p (ic)) @@ -916,10 +909,11 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map) if (map[ic].type == ISKMAP) { - if (i + 1 == len) - return -1; map = FUNCTION_TO_KEYMAP (map, ic); - continue; + if (i + 1 == len) + ic = ANYOTHERKEY; + else + continue; } if (map[ic].type == ISFUNC) { @@ -938,16 +932,11 @@ rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map) /* This logic should be identical to rl_digit_loop */ /* We accept M-- as equivalent to M--1, C-u- as equivalent to C-u-1 - but set parsing_digits to 2 to note that we saw `-' */ - if (map[ic].function == rl_universal_argument && (i + 1 == '-')) - { - i++; - parsing_digits = 2; - } - if (map[ic].function == rl_digit_argument && ic == '-') - { - parsing_digits = 2; - } + but set parsing_digits to 2 to note that we saw `-'. See above + for the check that skips over one or more `-' characters. */ + if (map[ic].function == rl_universal_argument || + (map[ic].function == rl_digit_argument && ic == '-')) + parsing_digits = 2; map = map0; j = i + 1; @@ -1141,25 +1130,11 @@ _rl_read_init_file (const char *filename, int include_level) } static void -#if defined (PREFER_STDARG) _rl_init_file_error (const char *format, ...) -#else -_rl_init_file_error (va_alist) - va_dcl -#endif { va_list args; -#if defined (PREFER_VARARGS) - char *format; -#endif -#if defined (PREFER_STDARG) va_start (args, format); -#else - va_start (args); - format = va_arg (args, char *); -#endif - fprintf (stderr, "readline: "); if (currently_reading_init_file) fprintf (stderr, "%s: line %d: ", current_readline_init_file, @@ -1257,7 +1232,7 @@ const char *rl_readline_name = "other"; /* Stack of previous values of parsing_conditionalized_out. */ static unsigned char *if_stack = (unsigned char *)NULL; static int if_stack_depth; -static int if_stack_size; +static size_t if_stack_size; /* Push _rl_parsing_conditionalized_out, and set parser state based on ARGS. */ @@ -1682,7 +1657,6 @@ rl_parse_and_bind (char *string) if (_rl_stricmp (string, "set") == 0) { char *var, *value, *e; - int s; var = string + i; /* Make VAR point to start of variable name. */ @@ -1860,7 +1834,7 @@ rl_parse_and_bind (char *string) if (*funname == '\'' || *funname == '"') { char useq[2]; - int fl = strlen (funname); + size_t fl = strlen (funname); useq[0] = key; useq[1] = '\0'; if (fl && funname[fl - 1] == *funname) @@ -1890,6 +1864,7 @@ rl_parse_and_bind (char *string) false. */ #define V_SPECIAL 0x1 +#define V_DEPRECATED 0x02 static const struct { const char * const name; @@ -1913,6 +1888,7 @@ static const struct { { "enable-keypad", &_rl_enable_keypad, 0 }, { "enable-meta-key", &_rl_enable_meta, 0 }, { "expand-tilde", &rl_complete_with_tilde_expansion, 0 }, + { "force-meta-prefix", &_rl_force_meta_prefix, 0 }, { "history-preserve-point", &_rl_history_preserve_point, 0 }, { "horizontal-scroll-mode", &_rl_horizontal_scroll_mode, 0 }, { "input-meta", &_rl_meta_flag, 0 }, @@ -1927,6 +1903,7 @@ static const struct { { "prefer-visible-bell", &_rl_prefer_visible_bell, V_SPECIAL }, { "print-completions-horizontally", &_rl_print_completions_horizontally, 0 }, { "revert-all-at-newline", &_rl_revert_all_at_newline, 0 }, + { "search-ignore-case", &_rl_search_case_fold, 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 }, @@ -2605,17 +2582,13 @@ _rl_get_keyname (int key) char *keyname; int i, c; - keyname = (char *)xmalloc (8); + keyname = (char *)xmalloc (9); c = key; /* Since this is going to be used to write out keysequence-function pairs for possible inclusion in an inputrc file, we don't want to do any special meta processing on KEY. */ -#if 1 - /* XXX - Experimental */ - /* We might want to do this, but the old version of the code did not. */ - /* If this is an escape character, we don't want to do any more processing. Just add the special ESC key sequence and return. */ if (c == ESC) @@ -2625,28 +2598,23 @@ _rl_get_keyname (int key) keyname[2] = '\0'; return keyname; } -#endif - /* RUBOUT is translated directly into \C-? */ - if (key == RUBOUT) + if (key == ANYOTHERKEY) { - keyname[0] = '\\'; - keyname[1] = 'C'; - keyname[2] = '-'; - keyname[3] = '?'; - keyname[4] = '\0'; + keyname[0] = '\0'; return keyname; } i = 0; + /* Now add special prefixes needed for control characters. This can potentially change C. */ - if (CTRL_CHAR (c)) + if (CTRL_CHAR (c) || c == RUBOUT) { keyname[i++] = '\\'; keyname[i++] = 'C'; keyname[i++] = '-'; - c = _rl_to_lower (UNCTRL (c)); + c = (c == RUBOUT) ? '?' : _rl_to_lower (UNCTRL (c)); } /* XXX experimental code. Turn the characters that are not ASCII or @@ -2688,7 +2656,7 @@ rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) { register int key; char **result; - int result_index, result_size; + size_t result_index, result_size; result = (char **)NULL; result_index = result_size = 0; @@ -2724,53 +2692,24 @@ rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) { char **seqs; register int i; + char *keyname; + size_t knlen; /* Find the list of keyseqs in this map which have FUNCTION as their target. Add the key sequences found to RESULT. */ - if (map[key].function) - seqs = - rl_invoking_keyseqs_in_map (function, FUNCTION_TO_KEYMAP (map, key)); - else + if (map[key].function == 0) break; + seqs = rl_invoking_keyseqs_in_map (function, FUNCTION_TO_KEYMAP (map, key)); if (seqs == 0) break; + keyname = _rl_get_keyname (key); + knlen = RL_STRLEN (keyname); + for (i = 0; seqs[i]; i++) { - char *keyname = (char *)xmalloc (6 + strlen (seqs[i])); - - if (key == ESC) - { - /* If ESC is the meta prefix and we're converting chars - with the eighth bit set to ESC-prefixed sequences, then - we can use \M-. Otherwise we need to use the sequence - for ESC. */ - if (_rl_convert_meta_chars_to_ascii && map[ESC].type == ISKMAP) - sprintf (keyname, "\\M-"); - else - sprintf (keyname, "\\e"); - } - else - { - int c = key, l = 0; - if (CTRL_CHAR (c) || c == RUBOUT) - { - keyname[l++] = '\\'; - keyname[l++] = 'C'; - keyname[l++] = '-'; - c = (c == RUBOUT) ? '?' : _rl_to_lower (UNCTRL (c)); - } - - if (c == '\\' || c == '"') - keyname[l++] = '\\'; - - keyname[l++] = (char) c; - keyname[l++] = '\0'; - } - - strcat (keyname, seqs[i]); - xfree (seqs[i]); + char *x; if (result_index + 2 > result_size) { @@ -2778,10 +2717,16 @@ rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map) result = (char **)xrealloc (result, result_size * sizeof (char *)); } - result[result_index++] = keyname; + x = xmalloc (knlen + RL_STRLEN (seqs[i]) + 1); + strcpy (x, keyname); + strcpy (x + knlen, seqs[i]); + xfree (seqs[i]); + + result[result_index++] = x; result[result_index] = (char *)NULL; } + xfree (keyname); xfree (seqs); } break; @@ -2798,73 +2743,72 @@ rl_invoking_keyseqs (rl_command_func_t *function) return (rl_invoking_keyseqs_in_map (function, _rl_keymap)); } -/* Print all of the functions and their bindings to rl_outstream. If - PRINT_READABLY is non-zero, then print the output in such a way - that it can be read back in. */ void -rl_function_dumper (int print_readably) +rl_print_keybinding (const char *name, Keymap kmap, int print_readably) { - register int i; - const char **names; - const char *name; + rl_command_func_t *function; + char **invokers; - names = rl_funmap_names (); - - fprintf (rl_outstream, "\n"); + function = rl_named_function (name); + invokers = function ? rl_invoking_keyseqs_in_map (function, kmap ? kmap : _rl_keymap) : (char **)NULL; - for (i = 0; name = names[i]; i++) + if (print_readably) { - rl_command_func_t *function; - char **invokers; - - function = rl_named_function (name); - invokers = rl_invoking_keyseqs_in_map (function, _rl_keymap); - - if (print_readably) + if (!invokers) + fprintf (rl_outstream, "# %s (not bound)\n", name); + else { - if (!invokers) - fprintf (rl_outstream, "# %s (not bound)\n", name); - else - { - register int j; + register int j; - for (j = 0; invokers[j]; j++) - { - fprintf (rl_outstream, "\"%s\": %s\n", - invokers[j], name); - xfree (invokers[j]); - } - - xfree (invokers); + for (j = 0; invokers[j]; j++) + { + fprintf (rl_outstream, "\"%s\": %s\n", invokers[j], name); + xfree (invokers[j]); } + + xfree (invokers); } + } + else + { + if (!invokers) + fprintf (rl_outstream, "%s is not bound to any keys\n", name); else { - if (!invokers) - fprintf (rl_outstream, "%s is not bound to any keys\n", - name); - else - { - register int j; + register int j; - fprintf (rl_outstream, "%s can be found on ", name); + fprintf (rl_outstream, "%s can be found on ", name); - for (j = 0; invokers[j] && j < 5; j++) - { - fprintf (rl_outstream, "\"%s\"%s", invokers[j], - invokers[j + 1] ? ", " : ".\n"); - } + for (j = 0; invokers[j] && j < 5; j++) + fprintf (rl_outstream, "\"%s\"%s", invokers[j], invokers[j + 1] ? ", " : ".\n"); - if (j == 5 && invokers[j]) - fprintf (rl_outstream, "...\n"); + if (j == 5 && invokers[j]) + fprintf (rl_outstream, "...\n"); - for (j = 0; invokers[j]; j++) - xfree (invokers[j]); + for (j = 0; invokers[j]; j++) + xfree (invokers[j]); - xfree (invokers); - } + xfree (invokers); } } +} + +/* Print all of the functions and their bindings to rl_outstream. If + PRINT_READABLY is non-zero, then print the output in such a way + that it can be read back in. */ +void +rl_function_dumper (int print_readably) +{ + register int i; + const char **names; + const char *name; + + names = rl_funmap_names (); + + fprintf (rl_outstream, "\n"); + + for (i = 0; name = names[i]; i++) + rl_print_keybinding (name, _rl_keymap, print_readably); xfree (names); } @@ -2885,9 +2829,9 @@ rl_dump_functions (int count, int key) static void _rl_macro_dumper_internal (int print_readably, Keymap map, char *prefix) { - register int key; + int key; char *keyname, *out; - int prefix_len; + size_t prefix_len; for (key = 0; key < KEYMAP_SIZE; key++) { @@ -2897,6 +2841,16 @@ _rl_macro_dumper_internal (int print_readably, Keymap map, char *prefix) keyname = _rl_get_keyname (key); out = _rl_untranslate_macro_value ((char *)map[key].function, 0); + /* If the application wants to print macros, let it. Give it the + ascii-fied value with backslash escapes, so it will have to use + rl_macro_bind (with its call to rl_translate_keyseq) to get the + same value back. */ + if (rl_macro_display_hook) + { + (*rl_macro_display_hook) (keyname, out, print_readably, prefix); + break; + } + if (print_readably) fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "", keyname, @@ -2960,10 +2914,40 @@ rl_dump_macros (int count, int key) static char * _rl_get_string_variable_value (const char *name) { - static char numbuf[32]; + static char numbuf[64]; /* more than enough for INTMAX_MAX */ char *ret; - if (_rl_stricmp (name, "bell-style") == 0) + if (_rl_stricmp (name, "active-region-start-color") == 0) + { + if (_rl_active_region_start_color == 0) + return 0; + ret = _rl_untranslate_macro_value (_rl_active_region_start_color, 0); + if (ret) + { + strncpy (numbuf, ret, sizeof (numbuf) - 1); + xfree (ret); + numbuf[sizeof(numbuf) - 1] = '\0'; + } + else + numbuf[0] = '\0'; + return numbuf; + } + else if (_rl_stricmp (name, "active-region-end-color") == 0) + { + if (_rl_active_region_end_color == 0) + return 0; + ret = _rl_untranslate_macro_value (_rl_active_region_end_color, 0); + if (ret) + { + strncpy (numbuf, ret, sizeof (numbuf) - 1); + xfree (ret); + numbuf[sizeof(numbuf) - 1] = '\0'; + } + else + numbuf[0] = '\0'; + return numbuf; + } + else if (_rl_stricmp (name, "bell-style") == 0) { switch (_rl_bell_preference) { @@ -2980,24 +2964,40 @@ _rl_get_string_variable_value (const char *name) return (_rl_comment_begin ? _rl_comment_begin : RL_COMMENT_BEGIN_DEFAULT); else if (_rl_stricmp (name, "completion-display-width") == 0) { +#if defined (HAVE_VSNPRINTF) + snprintf (numbuf, sizeof (numbuf), "%d", _rl_completion_columns); +#else sprintf (numbuf, "%d", _rl_completion_columns); +#endif return (numbuf); } else if (_rl_stricmp (name, "completion-prefix-display-length") == 0) { +#if defined (HAVE_VSNPRINTF) + snprintf (numbuf, sizeof (numbuf), "%d", _rl_completion_prefix_display_length); +#else sprintf (numbuf, "%d", _rl_completion_prefix_display_length); +#endif return (numbuf); } else if (_rl_stricmp (name, "completion-query-items") == 0) { +#if defined (HAVE_VSNPRINTF) + snprintf (numbuf, sizeof (numbuf), "%d", rl_completion_query_items); +#else sprintf (numbuf, "%d", rl_completion_query_items); +#endif return (numbuf); } else if (_rl_stricmp (name, "editing-mode") == 0) return (rl_get_keymap_name_from_edit_mode ()); else if (_rl_stricmp (name, "history-size") == 0) { - sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : 0); +#if defined (HAVE_VSNPRINTF) + snprintf (numbuf, sizeof (numbuf), "%d", history_is_stifled() ? history_max_entries : -1); +#else + sprintf (numbuf, "%d", history_is_stifled() ? history_max_entries : -1); +#endif return (numbuf); } else if (_rl_stricmp (name, "isearch-terminators") == 0) @@ -3024,7 +3024,11 @@ _rl_get_string_variable_value (const char *name) } else if (_rl_stricmp (name, "keyseq-timeout") == 0) { - sprintf (numbuf, "%d", _rl_keyseq_timeout); +#if defined (HAVE_VSNPRINTF) + snprintf (numbuf, sizeof (numbuf), "%d", _rl_keyseq_timeout); +#else + sprintf (numbuf, "%d", _rl_keyseq_timeout); +#endif return (numbuf); } else if (_rl_stricmp (name, "emacs-mode-string") == 0) diff --git a/callback.c b/callback.c index 7209ec3..180b683 100644 --- a/callback.c +++ b/callback.c @@ -1,6 +1,6 @@ /* callback.c -- functions to use readline as an X `callback' mechanism. */ -/* Copyright (C) 1987-2022 Free Software Foundation, Inc. +/* Copyright (C) 1987-2024 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. @@ -116,8 +116,8 @@ rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *linefunc) do { \ if (rl_persistent_signal_handlers == 0) \ { \ - rl_clear_signals (); \ - if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \ + rl_clear_signals (); \ + if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \ } \ return; \ } while (0) @@ -323,6 +323,15 @@ rl_callback_handler_remove (void) rl_linefunc = NULL; RL_UNSETSTATE (RL_STATE_CALLBACK); RL_CHECK_SIGNALS (); + + /* Do what we need to do to manage the undo list if we haven't already done + it in rl_callback_read_char(). If there's no undo list, we don't need to + do anything. It doesn't matter if we try to revert all previous lines a + second time; none of the history entries will have an undo list. */ + if (rl_undo_list) + readline_common_teardown (); + /* At this point, rl_undo_list == NULL. */ + if (in_handler) { in_handler = 0; @@ -363,7 +372,7 @@ rl_callback_sigcleanup (void) if (RL_ISSTATE (RL_STATE_ISEARCH)) _rl_isearch_cleanup (_rl_iscxt, 0); else if (RL_ISSTATE (RL_STATE_NSEARCH)) - _rl_nsearch_cleanup (_rl_nscxt, 0); + _rl_nsearch_sigcleanup (_rl_nscxt, 0); else if (RL_ISSTATE (RL_STATE_VIMOTION)) RL_UNSETSTATE (RL_STATE_VIMOTION); else if (RL_ISSTATE (RL_STATE_NUMERICARG)) @@ -373,6 +382,9 @@ rl_callback_sigcleanup (void) } else if (RL_ISSTATE (RL_STATE_MULTIKEY)) RL_UNSETSTATE (RL_STATE_MULTIKEY); + else if (RL_ISSTATE (RL_STATE_READSTR)) + _rl_readstr_sigcleanup (_rl_rscxt, 0); + if (RL_ISSTATE (RL_STATE_CHARSEARCH)) RL_UNSETSTATE (RL_STATE_CHARSEARCH); diff --git a/chardefs.h b/chardefs.h index 24a25f1..02f7e17 100644 --- a/chardefs.h +++ b/chardefs.h @@ -55,7 +55,7 @@ #define largest_char 255 /* Largest character value. */ #define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0)) -#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char) +#define META_CHAR(c) ((unsigned char)(c) > meta_character_threshold && (unsigned char)(c) <= largest_char) #define CTRL(c) ((c) & control_character_mask) #define META(c) ((c) | meta_character_bit) diff --git a/colors.c b/colors.c index 4212c64..329acce 100644 --- a/colors.c +++ b/colors.c @@ -2,7 +2,7 @@ Modified by Chet Ramey for Readline. - Copyright (C) 1985, 1988, 1990-1991, 1995-2021 + Copyright (C) 1985, 1988, 1990-1991, 1995-2021, 2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -73,7 +73,7 @@ static bool is_colored (enum indicator_no type); static void restore_default_color (void); -#define RL_COLOR_PREFIX_EXTENSION ".readline-colored-completion-prefix" +#define RL_COLOR_PREFIX_EXTENSION "readline-colored-completion-prefix" COLOR_EXT_TYPE *_rl_color_ext_list = 0; diff --git a/complete.c b/complete.c index 70a0a60..9abdede 100644 --- a/complete.c +++ b/complete.c @@ -1,6 +1,6 @@ /* complete.c -- filename completion for readline. */ -/* Copyright (C) 1987-2021 Free Software Foundation, Inc. +/* Copyright (C) 1987-2025 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. @@ -77,12 +77,12 @@ extern int errno; # include "colors.h" #endif -#ifdef __STDC__ -typedef int QSFUNC (const void *, const void *); -#else -typedef int QSFUNC (); +#ifndef MIN +#define MIN(x,y) (((x) < (y)) ? (x): (y)) #endif +typedef int QSFUNC (const void *, const void *); + #ifdef HAVE_LSTAT # define LSTAT lstat #else @@ -153,6 +153,8 @@ static int complete_get_screenwidth (void); static char *make_quoted_replacement (char *, int, char *); +static void _rl_export_completions (char **, char *, int, int); + /* **************************************************************** */ /* */ /* Completion matching, from readline's point of view. */ @@ -250,11 +252,24 @@ rl_icppfunc_t *rl_filename_stat_hook = (rl_icppfunc_t *)NULL; either return its first argument (if no conversion takes place) or newly-allocated memory. This can, for instance, convert filenames between character sets for comparison against what's typed at the - keyboard. The returned value is what is added to the list of - matches. The second argument is the length of the filename to be - converted. */ + keyboard (after its potential modification by rl_completion_rewrite_hook). + The returned value is what is added to the list of matches. + The second argument is the length of the filename to be converted. */ rl_dequote_func_t *rl_filename_rewrite_hook = (rl_dequote_func_t *)NULL; +/* If non-zero, this is the address of a function to call before + comparing the filename portion of a word to be completed with directory + entries from the filesystem. This takes the address of the partial word + to be completed, after any rl_filename_dequoting_function has been applied. + The function should either return its first argument (if no conversion + takes place) or newly-allocated memory. This can, for instance, convert + the filename portion of the completion word to a character set suitable + for comparison against directory entries read from the filesystem (after + their potential modification by rl_filename_rewrite_hook). + The returned value is what is added to the list of matches. + The second argument is the length of the filename to be converted. */ +rl_dequote_func_t *rl_completion_rewrite_hook = (rl_dequote_func_t *)NULL; + /* Non-zero means readline completion functions perform tilde expansion. */ int rl_complete_with_tilde_expansion = 0; @@ -340,6 +355,15 @@ int rl_filename_completion_desired = 0; entry finder function. */ int rl_filename_quoting_desired = 1; +/* Non-zero means we should apply filename-type quoting to all completions + even if we are not otherwise treating the matches as filenames. This is + ALWAYS zero on entry, and can only be changed within a completion entry + finder function. */ +int rl_full_quoting_desired = 0; + +#define QUOTING_DESIRED() \ + (rl_full_quoting_desired || (rl_filename_completion_desired && rl_filename_quoting_desired)) + /* This function, if defined, is called by the completer when real filename completion is done, after all the matching names have been generated. It is passed a (char**) known as matches in the code below. @@ -455,6 +479,7 @@ rl_complete (int ignore, int invoking_key) int rl_possible_completions (int ignore, int invoking_key) { + last_completion_failed = 0; rl_completion_invoking_key = invoking_key; return (rl_complete_internal ('?')); } @@ -484,12 +509,50 @@ rl_completion_mode (rl_command_func_t *cfunc) return TAB; } +/********************************************/ +/* */ +/* Completion signal handling and cleanup */ +/* */ +/********************************************/ + +/* State to clean up and free if completion is interrupted by a signal. */ +typedef struct { + char **matches; + char *saved_line; +} complete_sigcleanarg_t; + +static void +_rl_complete_sigcleanup (int sig, void *ptr) +{ + complete_sigcleanarg_t *arg; + + if (sig == SIGINT) /* XXX - for now */ + { + arg = ptr; + _rl_free_match_list (arg->matches); + FREE (arg->saved_line); + _rl_complete_display_matches_interrupt = 1; + } +} + /************************************/ /* */ /* Completion utility functions */ /* */ /************************************/ +static inline size_t +vector_len (char **vector) +{ + size_t ret; + + if (vector == 0 || vector[0] == 0) + return (size_t)0; + for (ret = 0; vector[ret]; ret++) + ; + return ret; +} + /* Reset public readline state on a signal or other event. */ void _rl_reset_completion_state (void) @@ -498,16 +561,6 @@ _rl_reset_completion_state (void) rl_completion_quote_character = 0; } -static void -_rl_complete_sigcleanup (int sig, void *ptr) -{ - if (sig == SIGINT) /* XXX - for now */ - { - _rl_free_match_list ((char **)ptr); - _rl_complete_display_matches_interrupt = 1; - } -} - /* Set default values for readline word completion. These are the variables that application completion functions can change or inspect. */ static void @@ -516,6 +569,7 @@ set_completion_defaults (int what_to_do) /* Only the completion entry function can change these. */ rl_filename_completion_desired = 0; rl_filename_quoting_desired = 1; + rl_full_quoting_desired = 0; rl_completion_type = what_to_do; rl_completion_suppress_append = rl_completion_suppress_quote = 0; rl_completion_append_character = ' '; @@ -827,7 +881,8 @@ fnprint (const char *to_print, int prefix_bytes, const char *real_pathname) possible completions. Only cut off prefix_bytes if we're going to be printing the ellipsis, which takes precedence over coloring the completion prefix (see print_filename() below). */ - if (_rl_completion_prefix_display_length > 0 && prefix_bytes >= print_len) + if (_rl_completion_prefix_display_length > 0 && prefix_bytes >= print_len && + prefix_bytes > _rl_completion_prefix_display_length) prefix_bytes = 0; #if defined (COLOR_SUPPORT) @@ -846,13 +901,16 @@ fnprint (const char *to_print, int prefix_bytes, const char *real_pathname) printed_len = ELLIPSIS_LEN; } #if defined (COLOR_SUPPORT) - else if (prefix_bytes && _rl_colored_completion_prefix > 0) + else if (prefix_bytes && _rl_completion_prefix_display_length <= 0 && + _rl_colored_completion_prefix > 0) { common_prefix_len = prefix_bytes; prefix_bytes = 0; /* XXX - print color indicator start here */ colored_prefix_start (); } + else + common_prefix_len = prefix_bytes = 0; /* no ellipsis or color */ #endif s = to_print + prefix_bytes; @@ -1261,8 +1319,7 @@ remove_duplicate_matches (char **matches) char **temp_array; /* Sort the items. */ - for (i = 0; matches[i]; i++) - ; + i = vector_len (matches); /* Sort the array without matches[0], since we need it to stay in place no matter what. */ @@ -1319,8 +1376,9 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) int low; /* Count of max-matched characters. */ int lx; char *dtext; /* dequoted TEXT, if needed */ + size_t si1, si2; + size_t len1, len2; #if defined (HANDLE_MULTIBYTE) - int v; size_t v1, v2; mbstate_t ps1, ps2; WCHAR_T wc1, wc2; @@ -1345,7 +1403,10 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) memset (&ps2, 0, sizeof (mbstate_t)); } #endif - for (si = 0; (c1 = match_list[i][si]) && (c2 = match_list[i + 1][si]); si++) + len1 = strlen (match_list[i]); + len2 = strlen (match_list[i + 1]); + + for (si1 = si2 = 0; (c1 = match_list[i][si1]) && (c2 = match_list[i + 1][si2]); si1++,si2++) { if (_rl_completion_case_fold) { @@ -1355,8 +1416,8 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) #if defined (HANDLE_MULTIBYTE) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) { - 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); + v1 = MBRTOWC (&wc1, match_list[i]+si1, len1 - si1, &ps1); + v2 = MBRTOWC (&wc2, match_list[i+1]+si2, len2 - si2, &ps2); if (MB_INVALIDCH (v1) || MB_INVALIDCH (v2)) { if (c1 != c2) /* do byte comparison */ @@ -1370,8 +1431,11 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) } if (wc1 != wc2) break; - else if (v1 > 1) - si += v1 - 1; + + if (v1 > 1) + si1 += v1 - 1; + if (v2 > 1) + si2 += v2 - 1; } else #endif @@ -1379,6 +1443,7 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) break; } + si = MIN (si1, si2); /* use shorter of matches of different length */ if (low > si) low = si; } @@ -1412,10 +1477,8 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text) check against the list of matches FI */ dtext = (char *)NULL; - if (rl_filename_completion_desired && - rl_filename_dequoting_function && - rl_completion_found_quote && - rl_filename_quoting_desired) + if (QUOTING_DESIRED() && rl_completion_found_quote && + rl_filename_dequoting_function) { dtext = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character); text = dtext; @@ -1543,7 +1606,7 @@ rl_display_match_list (char **matches, int len, int max) /* check again in case of /usr/src/ */ temp = rl_filename_completion_desired ? strrchr (t, '/') : 0; common_length = temp ? fnwidth (temp) : fnwidth (t); - sind = temp ? strlen (temp) : strlen (t); + sind = temp ? RL_STRLEN (temp) : RL_STRLEN (t); if (common_length > max || sind > max) common_length = sind = 0; @@ -1630,7 +1693,7 @@ rl_display_match_list (char **matches, int len, int max) if (_rl_page_completions && lines >= (_rl_screenheight - 1) && i < count) { lines = _rl_internal_pager (lines); - if (lines < 0) + if (lines < 0 || _rl_complete_display_matches_interrupt) return; } } @@ -1658,7 +1721,7 @@ rl_display_match_list (char **matches, int len, int max) if (_rl_page_completions && lines >= _rl_screenheight - 1) { lines = _rl_internal_pager (lines); - if (lines < 0) + if (lines < 0 || _rl_complete_display_matches_interrupt) return; } } @@ -1745,7 +1808,9 @@ display_matches (char **matches) } } - rl_display_match_list (matches, len, max); + /* We rely on the caller to set MATCHES to 0 when this returns. */ + if (_rl_complete_display_matches_interrupt == 0) + rl_display_match_list (matches, len, max); rl_forced_update_display (); rl_display_fixed = 1; @@ -1768,9 +1833,7 @@ make_quoted_replacement (char *match, int mtype, char *qc) matches don't require a quoted substring. */ replacement = match; - should_quote = match && rl_completer_quote_characters && - rl_filename_completion_desired && - rl_filename_quoting_desired; + should_quote = match && rl_completer_quote_characters && QUOTING_DESIRED(); if (should_quote) should_quote = should_quote && (!qc || !*qc || @@ -1784,6 +1847,11 @@ make_quoted_replacement (char *match, int mtype, char *qc) should_quote = rl_filename_quote_characters ? (_rl_strpbrk (match, rl_filename_quote_characters) != 0) : 0; + /* If we saw a quote in the original word, but readline thinks the + match doesn't need to be quoted, and the application has a filename + quoting function, give the application a chance to quote it if + needed so we don't second-guess the user. */ + should_quote |= *qc == 0 && rl_completion_found_quote && mtype != NO_MATCH && rl_filename_quoting_function; do_replace = should_quote ? mtype : NO_MATCH; /* Quote the replacement, since we found an embedded @@ -1791,6 +1859,7 @@ make_quoted_replacement (char *match, int mtype, char *qc) if (do_replace != NO_MATCH && rl_filename_quoting_function) replacement = (*rl_filename_quoting_function) (match, do_replace, qc); } + return (replacement); } @@ -1976,8 +2045,7 @@ compare_match (char *text, const char *match) char *temp; int r; - if (rl_filename_completion_desired && rl_filename_quoting_desired && - rl_completion_found_quote && rl_filename_dequoting_function) + if (QUOTING_DESIRED() && rl_completion_found_quote && rl_filename_dequoting_function) { temp = (*rl_filename_dequoting_function) (text, rl_completion_quote_character); r = strcmp (temp, match); @@ -1995,16 +2063,19 @@ compare_match (char *text, const char *match) `!' means to do standard completion, and list all possible completions if there is more than one. `@' means to do standard completion, and list all possible completions if - there is more than one and partial completion is not possible. */ + there is more than one and partial completion is not possible. + `$' implements a protocol for exporting completions and information about + what is being completed to another process via rl_outstream. */ int rl_complete_internal (int what_to_do) { char **matches; rl_compentry_func_t *our_func; - int start, end, delimiter, found_quote, i, nontrivial_lcd; + int start, end, delimiter, found_quote, i, nontrivial_lcd, do_display; char *text, *saved_line_buffer; char quote_char; int tlen, mlen, saved_last_completion_failed; + complete_sigcleanarg_t cleanarg; /* state to clean up on signal */ RL_SETSTATE(RL_STATE_COMPLETING); @@ -2039,8 +2110,7 @@ rl_complete_internal (int what_to_do) strcmp directly. */ /* nontrivial_lcd is set if the common prefix adds something to the word being completed. */ - if (rl_filename_completion_desired && rl_filename_quoting_desired && - rl_completion_found_quote && rl_filename_dequoting_function) + if (QUOTING_DESIRED() && rl_completion_found_quote && rl_filename_dequoting_function) { char *t; t = (*rl_filename_dequoting_function) (text, rl_completion_quote_character); @@ -2052,9 +2122,11 @@ rl_complete_internal (int what_to_do) nontrivial_lcd = matches && strcmp (text, matches[0]) != 0; if (what_to_do == '!' || what_to_do == '@') tlen = strlen (text); - xfree (text); - if (matches == 0) + if (what_to_do != '$') + xfree (text); + + if (matches == 0 && what_to_do != '$') /* we can export no completions */ { rl_ding (); FREE (saved_line_buffer); @@ -2070,7 +2142,7 @@ rl_complete_internal (int what_to_do) rl_filename_completion_function does this. */ i = rl_filename_completion_desired; - if (postprocess_matches (&matches, i) == 0) + if (postprocess_matches (&matches, i) == 0 && what_to_do != '$') /* we can export no completions */ { rl_ding (); FREE (saved_line_buffer); @@ -2084,6 +2156,8 @@ rl_complete_internal (int what_to_do) if (matches && matches[0] && *matches[0]) last_completion_failed = 0; + do_display = 0; + switch (what_to_do) { case TAB: @@ -2117,13 +2191,13 @@ rl_complete_internal (int what_to_do) { if (what_to_do == '!') { - display_matches (matches); + do_display = 1; break; } else if (what_to_do == '@') { if (nontrivial_lcd == 0) - display_matches (matches); + do_display = 1; break; } else if (rl_editing_mode != vi_mode) @@ -2147,23 +2221,16 @@ rl_complete_internal (int what_to_do) append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd); break; } - - if (rl_completion_display_matches_hook == 0) - { - _rl_sigcleanup = _rl_complete_sigcleanup; - _rl_sigcleanarg = matches; - _rl_complete_display_matches_interrupt = 0; - } - display_matches (matches); - if (_rl_complete_display_matches_interrupt) - { - matches = 0; /* already freed by rl_complete_sigcleanup */ - _rl_complete_display_matches_interrupt = 0; - if (rl_signal_event_hook) - (*rl_signal_event_hook) (); /* XXX */ - } - _rl_sigcleanup = 0; - _rl_sigcleanarg = 0; + /*FALLTHROUGH*/ + + case '%': /* used by menu_complete */ + case '|': /* add this for unconditional display */ + do_display = 1; + break; + + case '$': + _rl_export_completions (matches, text, start, end); + xfree (text); break; default: @@ -2176,6 +2243,34 @@ rl_complete_internal (int what_to_do) return 1; } + /* If we need to display the match list, set up to clean it up on receipt of + a signal and do it here. If the application has registered a function to + display the matches, let it do the work. */ + if (do_display) + { + if (rl_completion_display_matches_hook == 0) + { + _rl_sigcleanup = _rl_complete_sigcleanup; + cleanarg.matches = matches; + cleanarg.saved_line = saved_line_buffer; + _rl_sigcleanarg = &cleanarg; + _rl_complete_display_matches_interrupt = 0; + } + + display_matches (matches); + + if (_rl_complete_display_matches_interrupt) + { + matches = 0; /* Both already freed by _rl_complete_sigcleanup */ + saved_line_buffer = 0; + _rl_complete_display_matches_interrupt = 0; + if (rl_signal_event_hook) + (*rl_signal_event_hook) (); + } + _rl_sigcleanup = 0; + _rl_sigcleanarg = 0; + } + _rl_free_match_list (matches); /* Check to see if the line has changed through all of this manipulation. */ @@ -2216,7 +2311,7 @@ rl_completion_matches (const char *text, rl_compentry_func_t *entry_function) register int i; /* Number of slots in match_list. */ - int match_list_size; + size_t match_list_size; /* The list of matches. */ char **match_list; @@ -2281,9 +2376,9 @@ rl_completion_matches (const char *text, rl_compentry_func_t *entry_function) char * rl_username_completion_function (const char *text, int state) { -#if defined (__WIN32__) || defined (__OPENNT) +#if defined (_WIN32) || defined (__OPENNT) || !defined (HAVE_GETPWENT) return (char *)NULL; -#else /* !__WIN32__ && !__OPENNT) */ +#else /* !_WIN32 && !__OPENNT) && HAVE_GETPWENT */ static char *username = (char *)NULL; static struct passwd *entry; static int namelen, first_char, first_char_loc; @@ -2298,25 +2393,19 @@ rl_username_completion_function (const char *text, int state) username = savestring (&text[first_char_loc]); namelen = strlen (username); -#if defined (HAVE_GETPWENT) setpwent (); -#endif } -#if defined (HAVE_GETPWENT) while (entry = getpwent ()) { /* Null usernames should result in all users as possible completions. */ if (namelen == 0 || (STREQN (username, entry->pw_name, namelen))) break; } -#endif if (entry == 0) { -#if defined (HAVE_GETPWENT) endpwent (); -#endif return ((char *)NULL); } else @@ -2332,7 +2421,7 @@ rl_username_completion_function (const char *text, int state) return (value); } -#endif /* !__WIN32__ && !__OPENNT */ +#endif /* !_WIN32 && !__OPENNT && HAVE_GETPWENT */ } /* Return non-zero if CONVFN matches FILENAME up to the length of FILENAME @@ -2343,18 +2432,7 @@ rl_username_completion_function (const char *text, int state) static int complete_fncmp (const char *convfn, int convlen, const char *filename, int 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 + size_t len; if (filename_len == 0) return 1; @@ -2362,100 +2440,26 @@ complete_fncmp (const char *convfn, int convlen, const char *filename, int filen 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) + if (_rl_completion_case_fold) { - /* Case-insensitive comparison treating _ and - as equivalent */ + /* Case-insensitive comparison treating _ and - as equivalent if + _rl_completion_case_map is non-zero */ #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 - { - 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); - } - - 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; - } + return (_rl_mb_strcaseeqn (convfn, convlen, filename, filename_len, len, _rl_completion_case_map)); else #endif if ((_rl_to_lower (convfn[0]) == _rl_to_lower (filename[0])) && - (convlen >= filename_len) && - (_rl_strnicmp (filename, convfn, filename_len) == 0)) - return 1; + (convlen >= filename_len)) + return (_rl_strcaseeqn (convfn, filename, len, _rl_completion_case_map)); } else { + /* XXX - add new _rl_mb_streqn function (like mbsncmp) instead of + relying on byte equivalence? */ if ((convfn[0] == filename[0]) && (convlen >= filename_len) && (strncmp (filename, convfn, filename_len) == 0)) @@ -2477,7 +2481,8 @@ rl_filename_completion_function (const char *text, int state) static char *users_dirname = (char *)NULL; static int filename_len; char *temp, *dentry, *convfn; - int dirlen, dentlen, convlen; + size_t dirlen; + int dentlen, convlen; int tilde_dirname; struct dirent *entry; @@ -2586,6 +2591,18 @@ rl_filename_completion_function (const char *text, int state) } filename_len = strlen (filename); + /* Normalize the filename if the application has set a rewrite hook. */ + if (*filename && rl_completion_rewrite_hook) + { + temp = (*rl_completion_rewrite_hook) (filename, filename_len); + if (temp != filename) + { + xfree (filename); + filename = temp; + filename_len = strlen (filename); + } + } + rl_filename_completion_desired = 1; } @@ -2598,6 +2615,7 @@ rl_filename_completion_function (const char *text, int state) /* Now that we have some state, we can read the directory. */ entry = (struct dirent *)NULL; + convfn = dentry = 0; while (directory && (entry = readdir (directory))) { convfn = dentry = entry->d_name; @@ -2615,17 +2633,20 @@ rl_filename_completion_function (const char *text, int state) if (filename_len == 0) { if (_rl_match_hidden_files == 0 && HIDDEN_FILE (convfn)) - continue; + { + if (convfn != dentry) + xfree (convfn); + continue; + } if (convfn[0] != '.' || (convfn[1] && (convfn[1] != '.' || convfn[2]))) break; } - else - { - if (complete_fncmp (convfn, convlen, filename, filename_len)) - break; - } + else if (complete_fncmp (convfn, convlen, filename, filename_len)) + break; + else if (convfn != dentry) + xfree (convfn); } if (entry == 0) @@ -2777,8 +2798,8 @@ rl_old_menu_complete (int count, int invoking_key) RL_UNSETSTATE(RL_STATE_COMPLETING); - for (match_list_size = 0; matches[match_list_size]; match_list_size++) - ; + match_list_size = vector_len (matches); + /* matches[0] is lcd if match_list_size > 1, but the circular buffer code below should take care of it. */ @@ -2847,7 +2868,7 @@ rl_menu_complete (int count, int ignore) static int full_completion = 0; /* set to 1 if menu completion should reinitialize on next call */ static int orig_start, orig_end; static char quote_char; - static int delimiter, cstate; + static int delimiter; /* The first time through, we generate the list of matches and set things up to insert them. */ @@ -2912,8 +2933,7 @@ rl_menu_complete (int count, int ignore) RL_UNSETSTATE(RL_STATE_COMPLETING); - for (match_list_size = 0; matches[match_list_size]; match_list_size++) - ; + match_list_size = vector_len (matches); if (match_list_size == 0) { @@ -2943,7 +2963,7 @@ rl_menu_complete (int count, int ignore) if (rl_completion_query_items > 0 && match_list_size >= rl_completion_query_items) { rl_ding (); - FREE (matches); + _rl_free_match_list (matches); matches = (char **)0; full_completion = 1; return (0); @@ -3012,3 +3032,58 @@ rl_backward_menu_complete (int count, int key) arguments for menu-complete, and vice versa. */ return (rl_menu_complete (-count, key)); } + +/* This implements a protocol to export completions to another process or + calling application via rl_outstream. + + MATCHES are the possible completions for TEXT, which is the text between + START and END in rl_line_buffer. + + We print: + N - the number of matches + T - the word being completed + S:E - the start and end offsets of T in rl_line_buffer + then each match, one per line + + If there are no matches, MATCHES is NULL, N will be 0, and there will be + no output after S:E. + + Since MATCHES[0] can be empty if there is no common prefix of the elements + of MATCHES, applications should be prepared to deal with an empty line + preceding the matches. +*/ + +static void +_rl_export_completions (char **matches, char *text, int start, int end) +{ + size_t len, i; + + len = vector_len (matches); + + if (RL_ISSTATE (RL_STATE_TERMPREPPED)) + fprintf (rl_outstream, "\r\n"); + fprintf (rl_outstream, "%zd\n", len); + fprintf (rl_outstream, "%s\n", text); + fprintf (rl_outstream, "%d:%d\n", start, end); /* : because it's not a radix character */ + for (i = 0; i < len; i++) + { + print_filename (matches[i], matches[i], 0); + fprintf (rl_outstream, "\n"); + } + fflush (rl_outstream); +} + +int +rl_export_completions (int count, int key) +{ + rl_complete_internal ('$'); + + /* Clear the line buffer, currently requires a count argument. */ + if (count > 1) + { + rl_delete_text (0, rl_end); /* undoable */ + rl_point = rl_mark = 0; + } + + return 0; +} diff --git a/config.h.in b/config.h.in index 521e778..71b051e 100644 --- a/config.h.in +++ b/config.h.in @@ -1,3 +1,21 @@ +/* config.h.in for the GNU readline library. */ + +/* Copyright (C) 1994-2024 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 . +*/ + /* config.h.in. Maintained by hand. */ /* Template definitions for autoconf */ @@ -27,6 +45,8 @@ #undef ssize_t +#undef mode_t + #undef const #undef volatile @@ -87,6 +107,15 @@ /* Define if you have the mbrtowc function. */ #undef HAVE_MBRTOWC +/* Define if you have the mbscasecmp function. */ +#undef HAVE_MBSCASECMP + +/* Define if you have the mbscmp function. */ +#undef HAVE_MBSCMP + +/* Define if you have the mbsncmp function. */ +#undef HAVE_MBSNCMP + /* Define if you have the mbsrtowcs function. */ #undef HAVE_MBSRTOWCS @@ -131,6 +160,12 @@ /* Define if you have the tcgetattr function. */ #undef HAVE_TCGETATTR +/* Define if you have the tcgetwinsize function. */ +#undef HAVE_TCGETWINSIZE + +/* Define if you have the tcsetwinsize function. */ +#undef HAVE_TCSETWINSIZE + /* Define if you have the towlower function. */ #undef HAVE_TOWLOWER @@ -146,6 +181,12 @@ /* Define if you have the wcscoll function. */ #undef HAVE_WCSCOLL +#undef HAVE_WCSLEN +#undef HAVE_WCSNLEN + +/* Define if you have the wcsnrtombs function. */ +#undef HAVE_WCSNRTOMBS + /* Define if you have the wctype function. */ #undef HAVE_WCTYPE diff --git a/configure b/configure index cb4e07a..e74c229 100755 --- a/configure +++ b/configure @@ -1,12 +1,12 @@ #! /bin/sh -# From configure.ac for Readline 8.2, version 2.97. +# From configure.ac for Readline 8.3, version 2.103. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for readline 8.2. +# Generated by GNU Autoconf 2.72 for readline 8.3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, # Inc. # # @@ -18,7 +18,6 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -27,12 +26,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( +else case e in #( + e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi @@ -104,7 +104,7 @@ IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as `sh COMMAND' +# We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 @@ -134,15 +134,14 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. +# out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="as_nop=: -if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh NULLCMD=: @@ -150,12 +149,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else \$as_nop - case \`(set -o) 2>/dev/null\` in #( +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi " @@ -173,8 +173,9 @@ 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 \$as_nop - exitcode=1; echo positional parameters were not saved. +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac fi test x\$exitcode = x0 || exit 1 blah=\$(echo \$(echo blah)) @@ -188,14 +189,15 @@ test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null then : as_have_required=yes -else $as_nop - as_have_required=no +else case e in #( + e) as_have_required=no ;; +esac fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do @@ -228,12 +230,13 @@ IFS=$as_save_IFS if $as_found then : -else $as_nop - if { test -f "$SHELL" || test -f "$SHELL.exe"; } && +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null then : CONFIG_SHELL=$SHELL as_have_required=yes -fi +fi ;; +esac fi @@ -255,7 +258,7 @@ case $- in # (((( esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. +# out after a failed 'exec'. printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi @@ -275,7 +278,8 @@ $0: a modern shell, or manually run the script under such a $0: shell if you do have one." fi exit 1 -fi +fi ;; +esac fi fi SHELL=${CONFIG_SHELL-/bin/sh} @@ -314,14 +318,6 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -390,11 +386,12 @@ then : { eval $1+=\$2 }' -else $as_nop - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -408,21 +405,14 @@ then : { as_val=$(( $* )) }' -else $as_nop - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith -# as_fn_nop -# --------- -# Do nothing but, unlike ":", preserve the value of $?. -as_fn_nop () -{ - return $? -} -as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -496,6 +486,8 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits /[$]LINENO/= ' <$as_myself | sed ' + t clear + :clear s/[$]LINENO.*/&-/ t lineno b @@ -544,7 +536,6 @@ esac as_echo='printf %s\n' as_echo_n='printf %s' - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -556,9 +547,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -583,10 +574,12 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated test -n "$DJDIR" || exec 7<&0 /dev/null && - as_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -903,7 +898,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_fn_error $? "invalid feature name: \`$ac_useropt'" + as_fn_error $? "invalid feature name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1116,7 +1111,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_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1132,7 +1127,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_fn_error $? "invalid package name: \`$ac_useropt'" + as_fn_error $? "invalid package name: '$ac_useropt'" ac_useropt_orig=$ac_useropt ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1162,8 +1157,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" ;; *=*) @@ -1171,7 +1166,7 @@ Try \`$0 --help' for more information" # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1221,7 +1216,7 @@ do 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' +# There might be people who depend on the old broken behavior: '$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias @@ -1289,7 +1284,7 @@ if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." 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_msg="sources are in $srcdir, but 'cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` @@ -1317,7 +1312,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 8.2 to adapt to many kinds of systems. +'configure' configures readline 8.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1331,11 +1326,11 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print 'checking ...' messages --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' + -C, --config-cache alias for '--cache-file=config.cache' -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] + --srcdir=DIR find the sources in DIR [configure dir or '..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @@ -1343,10 +1338,10 @@ Installation directories: --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. For better control, use the options below. @@ -1383,7 +1378,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of readline 8.2:";; + short | recursive ) echo "Configuration of readline 8.3:";; esac cat <<\_ACEOF @@ -1400,6 +1395,7 @@ Optional Features: disable bracketed paste by default [[default=enable]] --disable-largefile omit support for large files + --enable-year2038 support timestamps after 2038 Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1420,7 +1416,7 @@ Some influential environment variables: you have headers in a nonstandard directory CPP C preprocessor -Use these variables to override the choices made by `configure' or to help +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 . @@ -1487,10 +1483,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -readline configure 8.2 -generated by GNU Autoconf 2.71 +readline configure 8.3 +generated by GNU Autoconf 2.72 -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2023 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1529,11 +1525,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 } && test -s conftest.$ac_objext then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 ;; +esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval @@ -1552,8 +1549,8 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> @@ -1561,10 +1558,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" -else $as_nop - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1573,44 +1572,6 @@ printf "%s\n" "$ac_res" >&6; } } # ac_fn_c_check_header_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\"" -printf "%s\n" "$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 - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - } -then : - ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -1623,8 +1584,8 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" +else case e in #( + e) eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 @@ -1654,12 +1615,14 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else $as_nop - eval "$3=yes" +else case e in #( + e) eval "$3=yes" ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1699,11 +1662,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 } then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 + ac_retval=1 ;; +esac fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would @@ -1726,15 +1690,15 @@ printf %s "checking for $2... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. */ + which can conflict with char $2 (void); below. */ #include #undef $2 @@ -1745,7 +1709,7 @@ else $as_nop #ifdef __cplusplus extern "C" #endif -char $2 (); +char $2 (void); /* 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. */ @@ -1764,11 +1728,13 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : eval "$3=yes" -else $as_nop - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1807,12 +1773,13 @@ printf "%s\n" "$ac_try_echo"; } >&5 test $ac_status = 0; }; } then : ac_retval=0 -else $as_nop - printf "%s\n" "$as_me: program exited with status $ac_status" >&5 +else case e in #( + e) printf "%s\n" "$as_me: program exited with status $ac_status" >&5 printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=$ac_status + ac_retval=$ac_status ;; +esac fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno @@ -1820,6 +1787,45 @@ fi } # ac_fn_c_try_run +# 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\"" +printf "%s\n" "$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 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including @@ -1832,8 +1838,8 @@ printf %s "checking for $2.$3... " >&6; } if eval test \${$4+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int @@ -1849,8 +1855,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int @@ -1866,12 +1872,15 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$4=yes" -else $as_nop - eval "$4=no" +else case e in #( + e) eval "$4=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi eval ac_res=\$$4 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1893,8 +1902,8 @@ printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 -else $as_nop - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` +else case e in #( + e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1918,12 +1927,14 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$3=yes" -else $as_nop - eval "$3=no" +else case e in #( + e) eval "$3=no" ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS - + ;; +esac fi eval ac_res=\$$3 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -1977,18 +1988,19 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid; break -else $as_nop - as_fn_arith $ac_mid + 1 && ac_lo=$as_val +else case e in #( + e) as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int @@ -2023,20 +2035,23 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_lo=$ac_mid; break -else $as_nop - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val +else case e in #( + e) as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else $as_nop - ac_lo= ac_hi= +else case e in #( + e) ac_lo= ac_hi= ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. @@ -2059,8 +2074,9 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_hi=$ac_mid -else $as_nop - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +else case e in #( + e) as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done @@ -2108,8 +2124,9 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : echo >>conftest.val; read $3 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 8.2, which was -generated by GNU Autoconf 2.71. Invocation command line was +It was created by readline $as_me 8.3, which was +generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -2391,10 +2408,10 @@ esac printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } fi done @@ -2430,9 +2447,7 @@ struct stat; /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; +static char *e (char **p, int i) { return p[i]; } @@ -2446,6 +2461,21 @@ static char *f (char * (*g) (char **, int), char **p, ...) return s; } +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These do not provoke an error unfortunately, instead are silently treated @@ -2473,16 +2503,19 @@ ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); # Test code for whether the C compiler supports C99 (global declarations) ac_c_conftest_c99_globals=' -// Does the compiler advertise C99 conformance? +/* Does the compiler advertise C99 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L # error "Compiler does not advertise C99 conformance" #endif +// See if C++-style comments work. + #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); +extern void free (void *); // Check varargs macros. These examples are taken from C99 6.10.3.5. // dprintf is used instead of fprintf to avoid needing to declare @@ -2532,7 +2565,6 @@ typedef const char *ccp; static inline int test_restrict (ccp restrict text) { - // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) @@ -2598,6 +2630,8 @@ ac_c_conftest_c99_main=' ia->datasize = 10; for (int i = 0; i < ia->datasize; ++i) ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); // Check named initializers. struct named_init ni = { @@ -2619,7 +2653,7 @@ ac_c_conftest_c99_main=' # Test code for whether the C compiler supports C11 (global declarations) ac_c_conftest_c11_globals=' -// Does the compiler advertise C11 conformance? +/* Does the compiler advertise C11 conformance? */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L # error "Compiler does not advertise C11 conformance" #endif @@ -2813,8 +2847,9 @@ IFS=$as_save_IFS if $as_found then : -else $as_nop - as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac fi @@ -2842,12 +2877,12 @@ 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,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) @@ -2856,18 +2891,18 @@ printf "%s\n" "$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 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. @@ -2883,11 +2918,11 @@ printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## @@ -2909,7 +2944,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" -LIBVERSION=8.2 +LIBVERSION=8.3 @@ -2923,15 +2958,16 @@ printf %s "checking build system type... " >&6; } if test ${ac_cv_build+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_build_alias=$build_alias +else case e in #( + e) ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 printf "%s\n" "$ac_cv_build" >&6; } @@ -2958,14 +2994,15 @@ printf %s "checking host system type... " >&6; } if test ${ac_cv_host+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "x$host_alias" = x; then +else case e in #( + e) if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 printf "%s\n" "$ac_cv_host" >&6; } @@ -3101,8 +3138,8 @@ ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval test \${ac_cv_prog_make_${ac_make}_set+y} then : printf %s "(cached) " >&6 -else $as_nop - cat >conftest.make <<\_ACEOF +else case e in #( + e) cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' @@ -3114,7 +3151,8 @@ case `${MAKE-make} -f conftest.make 2>/dev/null` in *) eval ac_cv_prog_make_${ac_make}_set=no;; esac -rm -f conftest.make +rm -f conftest.make ;; +esac fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -3148,8 +3186,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3171,7 +3209,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3193,8 +3232,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +else case e in #( + e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3216,7 +3255,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3251,8 +3291,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3274,7 +3314,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3296,8 +3337,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no @@ -3336,7 +3377,8 @@ if test $ac_prog_rejected = yes; then ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3360,8 +3402,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3383,7 +3425,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3409,8 +3452,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +else case e in #( + e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3432,7 +3475,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3470,8 +3514,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$CC"; then +else case e in #( + e) if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3493,7 +3537,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi CC=$ac_cv_prog_CC if test -n "$CC"; then @@ -3515,8 +3560,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_CC+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_CC"; then +else case e in #( + e) if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -3538,7 +3583,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then @@ -3567,10 +3613,10 @@ fi fi -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3642,8 +3688,8 @@ printf "%s\n" "$ac_try_echo"; } >&5 printf "%s\n" "$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' + # 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, # so that the user can short-circuit this test for compilers unknown to # Autoconf. @@ -3663,7 +3709,7 @@ do ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' + # safe: cross compilers may not add the suffix if given an '-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. @@ -3674,8 +3720,9 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else $as_nop - ac_file='' +else case e in #( + e) ac_file='' ;; +esac fi if test -z "$ac_file" then : @@ -3684,13 +3731,14 @@ printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 printf %s "checking for C compiler default output file name... " >&6; } @@ -3714,10 +3762,10 @@ printf "%s\n" "$ac_try_echo"; } >&5 printf "%s\n" "$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 -# `rm'. + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in @@ -3727,11 +3775,12 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } ;; +esac fi rm -f conftest conftest$ac_cv_exeext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3747,6 +3796,8 @@ int main (void) { FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; return ferror (f) || fclose (f) != 0; ; @@ -3786,26 +3837,27 @@ printf "%s\n" "$ac_try_echo"; } >&5 if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } fi fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 printf "%s\n" "$cross_compiling" >&6; } -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out ac_clean_files=$ac_clean_files_save { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 printf %s "checking for suffix of object files... " >&6; } if test ${ac_cv_objext+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3837,16 +3889,18 @@ then : break;; esac done -else $as_nop - printf "%s\n" "$as_me: failed program was:" >&5 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } ;; +esac fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 printf "%s\n" "$ac_cv_objext" >&6; } @@ -3857,8 +3911,8 @@ printf %s "checking whether the compiler supports GNU C... " >&6; } if test ${ac_cv_c_compiler_gnu+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3875,12 +3929,14 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_compiler_gnu=yes -else $as_nop - ac_compiler_gnu=no +else case e in #( + e) ac_compiler_gnu=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } @@ -3898,8 +3954,8 @@ printf %s "checking whether $CC accepts -g... " >&6; } if test ${ac_cv_prog_cc_g+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_save_c_werror_flag=$ac_c_werror_flag +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" @@ -3917,8 +3973,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes -else $as_nop - CFLAGS="" +else case e in #( + e) CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3933,8 +3989,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else $as_nop - ac_c_werror_flag=$ac_save_c_werror_flag +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3951,12 +4007,15 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 printf "%s\n" "$ac_cv_prog_cc_g" >&6; } @@ -3983,8 +4042,8 @@ printf %s "checking for $CC option to enable C11 features... " >&6; } if test ${ac_cv_prog_cc_c11+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c11=no +else case e in #( + e) ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4001,25 +4060,28 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c11" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC +CC=$ac_save_CC ;; +esac fi if test "x$ac_cv_prog_cc_c11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c11" = x +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" + CC="$CC $ac_cv_prog_cc_c11" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 + ac_prog_cc_stdc=c11 ;; +esac fi fi if test x$ac_prog_cc_stdc = xno @@ -4029,8 +4091,8 @@ printf %s "checking for $CC option to enable C99 features... " >&6; } if test ${ac_cv_prog_cc_c99+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c99=no +else case e in #( + e) ac_cv_prog_cc_c99=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4047,25 +4109,28 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC +CC=$ac_save_CC ;; +esac fi if test "x$ac_cv_prog_cc_c99" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c99" = x +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" + CC="$CC $ac_cv_prog_cc_c99" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 + ac_prog_cc_stdc=c99 ;; +esac fi fi if test x$ac_prog_cc_stdc = xno @@ -4075,8 +4140,8 @@ printf %s "checking for $CC option to enable C89 features... " >&6; } if test ${ac_cv_prog_cc_c89+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_prog_cc_c89=no +else case e in #( + e) ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4093,25 +4158,28 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC +CC=$ac_save_CC ;; +esac fi if test "x$ac_cv_prog_cc_c89" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } -else $as_nop - if test "x$ac_cv_prog_cc_c89" = x +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" + CC="$CC $ac_cv_prog_cc_c89" ;; +esac fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 + ac_prog_cc_stdc=c89 ;; +esac fi fi @@ -4162,8 +4230,8 @@ printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } if test ${ac_cv_safe_to_define___extensions__+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 @@ -4179,10 +4247,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_safe_to_define___extensions__=yes -else $as_nop - ac_cv_safe_to_define___extensions__=no +else case e in #( + e) ac_cv_safe_to_define___extensions__=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } @@ -4192,8 +4262,8 @@ printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } if test ${ac_cv_should_define__xopen_source+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_should_define__xopen_source=no +else case e in #( + e) ac_cv_should_define__xopen_source=no if test $ac_cv_header_wchar_h = yes then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4212,8 +4282,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE 500 @@ -4231,10 +4301,12 @@ if ac_fn_c_try_compile "$LINENO" then : ac_cv_should_define__xopen_source=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +fi ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } @@ -4259,6 +4331,8 @@ printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + printf "%s\n" "#define __STDC_WANT_IEC_60559_EXT__ 1" >>confdefs.h + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h @@ -4278,8 +4352,9 @@ then : printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h -else $as_nop - MINIX= +else case e in #( + e) MINIX= ;; +esac fi if test $ac_cv_safe_to_define___extensions__ = yes then : @@ -4296,353 +4371,34 @@ fi # If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS if test -n "$want_auto_cflags" ; then AUTO_CFLAGS="-g ${GCC:+-O2}" - STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}" +# STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}" + STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}" fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "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+y} + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} then : printf %s "(cached) " >&6 -else $as_nop - # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - -else $as_nop - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" -then : - # Broken: success on invalid input. -continue -else $as_nop - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : - -else $as_nop - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - 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" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" '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 - 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" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - 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 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - 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" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" '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 - 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" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - 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 -fi - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -if test $ac_cv_c_compiler_gnu = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 -printf %s "checking whether $CC needs -traditional... " >&6; } -if test ${ac_cv_prog_gcc_traditional+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_pattern="Autoconf.*'x'" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1 -then : - ac_cv_prog_gcc_traditional=yes -else $as_nop - ac_cv_prog_gcc_traditional=no -fi -rm -rf conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1 -then : - ac_cv_prog_gcc_traditional=yes -fi -rm -rf conftest* - - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 -printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - - - # Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -printf %s "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test ${ac_cv_path_install+y} -then : - printf %s "(cached) " >&6 -else $as_nop - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do IFS=$as_save_IFS case $as_dir in #((( @@ -4695,7 +4451,8 @@ esac IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir - + ;; +esac fi if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install @@ -4726,8 +4483,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$AR"; then +else case e in #( + e) if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4749,7 +4506,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi AR=$ac_cv_prog_AR if test -n "$AR"; then @@ -4771,8 +4529,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_AR+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_AR"; then +else case e in #( + e) 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 @@ -4794,7 +4552,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then @@ -4829,8 +4588,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$RANLIB"; then +else case e in #( + e) if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4852,7 +4611,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then @@ -4874,8 +4634,8 @@ printf %s "checking for $ac_word... " >&6; } if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 -else $as_nop - if test -n "$ac_ct_RANLIB"; then +else case e in #( + e) if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4897,7 +4657,8 @@ done done IFS=$as_save_IFS -fi +fi ;; +esac fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then @@ -4924,6 +4685,20 @@ else fi + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + + MAKE_SHELL=/bin/sh @@ -4939,8 +4714,8 @@ printf %s "checking for an ANSI C-conforming const... " >&6; } if test ${ac_cv_c_const+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -5004,10 +4779,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_const=yes -else $as_nop - ac_cv_c_const=no +else case e in #( + e) ac_cv_c_const=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 printf "%s\n" "$ac_cv_c_const" >&6; } @@ -5022,8 +4799,8 @@ printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_c_inline=no +else case e in #( + e) ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5041,7 +4818,8 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } @@ -5075,8 +4853,8 @@ printf %s "checking whether char is unsigned... " >&6; } if test ${ac_cv_c_char_unsigned+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int @@ -5093,10 +4871,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_char_unsigned=no -else $as_nop - ac_cv_c_char_unsigned=yes +else case e in #( + e) ac_cv_c_char_unsigned=yes ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 printf "%s\n" "$ac_cv_c_char_unsigned" >&6; } @@ -5110,8 +4890,8 @@ printf %s "checking for working volatile... " >&6; } if test ${ac_cv_c_volatile+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -5128,10 +4908,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_c_volatile=yes -else $as_nop - ac_cv_c_volatile=no +else case e in #( + e) ac_cv_c_volatile=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 printf "%s\n" "$ac_cv_c_volatile" >&6; } @@ -5146,20 +4928,34 @@ ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : -else $as_nop - +else case e in #( + e) printf "%s\n" "#define size_t unsigned int" >>confdefs.h - + ;; +esac fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes then : -else $as_nop - +else case e in #( + e) printf "%s\n" "#define ssize_t int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes +then : + +else case e in #( + e) +printf "%s\n" "#define mode_t int" >>confdefs.h + ;; +esac fi @@ -5168,8 +4964,8 @@ printf %s "checking whether stat file-mode macros are broken... " >&6; } if test ${ac_cv_header_stat_broken+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -5194,10 +4990,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : ac_cv_header_stat_broken=no -else $as_nop - ac_cv_header_stat_broken=yes +else case e in #( + e) ac_cv_header_stat_broken=yes ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 printf "%s\n" "$ac_cv_header_stat_broken" >&6; } @@ -5209,14 +5007,14 @@ fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` + as_ac_Header=`printf "%s\n" "ac_cv_header_dirent_$ac_hdr" | sed "$as_sed_sh"` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 printf %s "checking for $ac_hdr that defines DIR... " >&6; } if eval test \${$as_ac_Header+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> @@ -5233,10 +5031,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : eval "$as_ac_Header=yes" -else $as_nop - eval "$as_ac_Header=no" +else case e in #( + e) eval "$as_ac_Header=no" ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi eval ac_res=\$$as_ac_Header { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 @@ -5244,7 +5044,7 @@ printf "%s\n" "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes" then : cat >>confdefs.h <<_ACEOF -#define `printf "%s\n" "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_hdr" | sed "$as_sed_cpp"` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -5258,15 +5058,21 @@ printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS +else case e in #( + e) ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char opendir (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (void); int main (void) { @@ -5297,11 +5103,13 @@ done if test ${ac_cv_search_opendir+y} then : -else $as_nop - ac_cv_search_opendir=no +else case e in #( + e) ac_cv_search_opendir=no ;; +esac fi rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +LIBS=$ac_func_search_save_LIBS ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } @@ -5318,15 +5126,21 @@ printf %s "checking for library containing opendir... " >&6; } if test ${ac_cv_search_opendir+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_func_search_save_LIBS=$LIBS +else case e in #( + e) ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char opendir (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (void); int main (void) { @@ -5357,11 +5171,13 @@ done if test ${ac_cv_search_opendir+y} then : -else $as_nop - ac_cv_search_opendir=no +else case e in #( + e) ac_cv_search_opendir=no ;; +esac fi rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +LIBS=$ac_func_search_save_LIBS ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 printf "%s\n" "$ac_cv_search_opendir" >&6; } @@ -5477,6 +5293,18 @@ if test "x$ac_cv_func_tcgetattr" = xyes then : printf "%s\n" "#define HAVE_TCGETATTR 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "tcgetwinsize" "ac_cv_func_tcgetwinsize" +if test "x$ac_cv_func_tcgetwinsize" = xyes +then : + printf "%s\n" "#define HAVE_TCGETWINSIZE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "tcsetwinsize" "ac_cv_func_tcsetwinsize" +if test "x$ac_cv_func_tcsetwinsize" = xyes +then : + printf "%s\n" "#define HAVE_TCSETWINSIZE 1" >>confdefs.h + fi ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" if test "x$ac_cv_func_vsnprintf" = xyes @@ -5518,36 +5346,26 @@ then : fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -printf %s "checking for uid_t in sys/types.h... " >&6; } -if test ${ac_cv_type_uid_t+y} +ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default" +if test "x$ac_cv_type_uid_t" = xyes then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1 -then : - ac_cv_type_uid_t=yes -else $as_nop - ac_cv_type_uid_t=no -fi -rm -rf conftest* - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 -printf "%s\n" "$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then +else case e in #( + e) printf "%s\n" "#define uid_t int" >>confdefs.h + ;; +esac +fi +ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default" +if test "x$ac_cv_type_gid_t" = xyes +then : +else case e in #( + e) printf "%s\n" "#define gid_t int" >>confdefs.h - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 @@ -5555,8 +5373,8 @@ printf %s "checking for working chown... " >&6; } if test ${ac_cv_func_chown_works+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : case "$host_os" in # (( # Guess yes on glibc systems. @@ -5564,8 +5382,8 @@ then : # If we don't know, assume the worst. *) ac_cv_func_chown_works=no ;; esac -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include @@ -5593,15 +5411,18 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_chown_works=yes -else $as_nop - ac_cv_func_chown_works=no +else case e in #( + e) ac_cv_func_chown_works=no ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi rm -f conftest.chown - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 printf "%s\n" "$ac_cv_func_chown_works" >&6; } @@ -5616,8 +5437,8 @@ printf %s "checking for working strcoll... " >&6; } if test ${ac_cv_func_strcoll_works+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : case "$host_os" in # (( # Guess yes on glibc systems. @@ -5625,8 +5446,8 @@ then : # If we don't know, assume the worst. *) ac_cv_func_strcoll_works=no ;; esac -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int @@ -5642,13 +5463,16 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : ac_cv_func_strcoll_works=yes -else $as_nop - ac_cv_func_strcoll_works=no +else case e in #( + e) ac_cv_func_strcoll_works=no ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5 printf "%s\n" "$ac_cv_func_strcoll_works" >&6; } @@ -5806,31 +5630,34 @@ if test ${enable_largefile+y} then : enableval=$enable_largefile; fi - -if test "$enable_largefile" != no; then - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -printf %s "checking for special C compiler options needed for large files... " >&6; } -if test ${ac_cv_sys_largefile_CC+y} +if test "$enable_largefile,$enable_year2038" != no,no +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable large file support" >&5 +printf %s "checking for $CC option to enable large file support... " >&6; } +if test ${ac_cv_sys_largefile_opts+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) ac_save_CC="$CC" + ac_opt_found=no + for ac_opt in "none needed" "-D_FILE_OFFSET_BITS=64" "-D_LARGE_FILES=1" "-n32"; do + if test x"$ac_opt" != x"none needed" +then : + CC="$ac_save_CC $ac_opt" +fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, +#ifndef FTYPE +# define FTYPE off_t +#endif + /* Check that FTYPE can represent 2**63 - 1 correctly. + We can't simply define LARGE_FTYPE to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) +#define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) + int FTYPE_is_large[(LARGE_FTYPE % 2147483629 == 721 + && LARGE_FTYPE % 2147483647 == 1) ? 1 : -1]; int main (void) @@ -5840,142 +5667,88 @@ main (void) return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - CC="$CC -n32" + if test x"$ac_opt" = x"none needed" +then : + # GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. + CC="$CC -DFTYPE=ino_t" if ac_fn_c_try_compile "$LINENO" then : - ac_cv_sys_largefile_CC=' -n32'; break + +else case e in #( + e) CC="$CC -D_FILE_OFFSET_BITS=64" + if ac_fn_c_try_compile "$LINENO" +then : + ac_opt='-D_FILE_OFFSET_BITS=64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if test ${ac_cv_sys_file_offset_bits+y} -then : - printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=no; break + ac_cv_sys_largefile_opts=$ac_opt + ac_opt_found=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ + test $ac_opt_found = no || break + done + CC="$ac_save_CC" - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_sys_file_offset_bits=64; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done + test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected" ;; +esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h -;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_opts" >&5 +printf "%s\n" "$ac_cv_sys_largefile_opts" >&6; } + +ac_have_largefile=yes +case $ac_cv_sys_largefile_opts in #( + "none needed") : + ;; #( + "supported through gnulib") : + ;; #( + "support not detected") : + ac_have_largefile=no ;; #( + "-D_FILE_OFFSET_BITS=64") : + +printf "%s\n" "#define _FILE_OFFSET_BITS 64" >>confdefs.h + ;; #( + "-D_LARGE_FILES=1") : + +printf "%s\n" "#define _LARGE_FILES 1" >>confdefs.h + ;; #( + "-n32") : + CC="$CC -n32" ;; #( + *) : + as_fn_error $? "internal error: bad value for \$ac_cv_sys_largefile_opts" "$LINENO" 5 ;; esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } -if test ${ac_cv_sys_large_files+y} + +if test "$enable_year2038" != no +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option for timestamps after 2038" >&5 +printf %s "checking for $CC option for timestamps after 2038... " >&6; } +if test ${ac_cv_sys_year2038_opts+y} then : printf %s "(cached) " >&6 -else $as_nop - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" +else case e in #( + e) ac_save_CPPFLAGS="$CPPFLAGS" + ac_opt_found=no + for ac_opt in "none needed" "-D_TIME_BITS=64" "-D__MINGW_USE_VC2005_COMPAT" "-U_USE_32_BIT_TIME_T -D__MINGW_USE_VC2005_COMPAT"; do + if test x"$ac_opt" != x"none needed" then : - ac_cv_sys_large_files=no; break + CPPFLAGS="$ac_save_CPPFLAGS $ac_opt" fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + + #include + /* Check that time_t can represent 2**32 - 1 correctly. */ + #define LARGE_TIME_T \\ + ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) + int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 + && LARGE_TIME_T % 65537 == 0) + ? 1 : -1]; + int main (void) { @@ -5986,38 +5759,60 @@ main (void) _ACEOF if ac_fn_c_try_compile "$LINENO" then : - ac_cv_sys_large_files=1; break + ac_cv_sys_year2038_opts="$ac_opt" + ac_opt_found=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done + test $ac_opt_found = no || break + done + CPPFLAGS="$ac_save_CPPFLAGS" + test $ac_opt_found = yes || ac_cv_sys_year2038_opts="support not detected" ;; +esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -printf "%s\n" "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h -;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_year2038_opts" >&5 +printf "%s\n" "$ac_cv_sys_year2038_opts" >&6; } + +ac_have_year2038=yes +case $ac_cv_sys_year2038_opts in #( + "none needed") : + ;; #( + "support not detected") : + ac_have_year2038=no ;; #( + "-D_TIME_BITS=64") : + +printf "%s\n" "#define _TIME_BITS 64" >>confdefs.h + ;; #( + "-D__MINGW_USE_VC2005_COMPAT") : + +printf "%s\n" "#define __MINGW_USE_VC2005_COMPAT 1" >>confdefs.h + ;; #( + "-U_USE_32_BIT_TIME_T"*) : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "the 'time_t' type is currently forced to be 32-bit. It +will stop working after mid-January 2038. Remove +_USE_32BIT_TIME_T from the compiler flags. +See 'config.log' for more details" "$LINENO" 5; } ;; #( + *) : + as_fn_error $? "internal error: bad value for \$ac_cv_sys_year2038_opts" "$LINENO" 5 ;; esac -rm -rf conftest* - fi + fi +fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for type of signal functions" >&5 printf %s "checking for type of signal functions... " >&6; } if test ${bash_cv_signal_vintage+y} then : printf %s "(cached) " >&6 -else $as_nop - +else case e in #( + e) if test ${bash_cv_posix_signals+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6039,12 +5834,14 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : bash_cv_posix_signals=yes -else $as_nop - bash_cv_posix_signals=no - +else case e in #( + e) bash_cv_posix_signals=no + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi @@ -6054,8 +5851,8 @@ else if test ${bash_cv_bsd_signals+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6074,12 +5871,14 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : bash_cv_bsd_signals=yes -else $as_nop - bash_cv_bsd_signals=no - +else case e in #( + e) bash_cv_bsd_signals=no + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi @@ -6089,8 +5888,8 @@ fi if test ${bash_cv_sysv_signals+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6111,12 +5910,14 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : bash_cv_sysv_signals=yes -else $as_nop - bash_cv_sysv_signals=no - +else case e in #( + e) bash_cv_sysv_signals=no + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi @@ -6127,7 +5928,8 @@ fi fi fi fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_signal_vintage" >&5 @@ -6149,15 +5951,15 @@ printf %s "checking if signal handlers must be reinstalled when invoked... " >&6 if test ${bash_cv_must_reinstall_sighandlers+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&5 printf "%s\n" "$as_me: WARNING: cannot check signal handling if cross compiling -- defaulting to no" >&2;} bash_cv_must_reinstall_sighandlers=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6166,15 +5968,13 @@ else $as_nop #endif #include -typedef void sigfunc(); +typedef void sigfunc(int); volatile int nsigint; #ifdef HAVE_POSIX_SIGNALS sigfunc * -set_signal_handler(sig, handler) - int sig; - sigfunc *handler; +set_signal_handler(int sig, sigfunc *handler) { struct sigaction act, oact; act.sa_handler = handler; @@ -6189,8 +5989,7 @@ set_signal_handler(sig, handler) #endif void -sigint(s) -int s; +sigint(int s) { nsigint++; } @@ -6209,13 +6008,16 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : bash_cv_must_reinstall_sighandlers=no -else $as_nop - bash_cv_must_reinstall_sighandlers=yes +else case e in #( + e) bash_cv_must_reinstall_sighandlers=yes ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_must_reinstall_sighandlers" >&5 @@ -6232,8 +6034,8 @@ printf %s "checking for presence of POSIX-style sigsetjmp/siglongjmp... " >&6; } if test ${bash_cv_func_sigsetjmp+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to $bash_cv_posix_signals" >&5 printf "%s\n" "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to $bash_cv_posix_signals" >&2;} @@ -6243,8 +6045,8 @@ printf "%s\n" "$as_me: WARNING: cannot check for sigsetjmp/siglongjmp if cross-c bash_cv_func_sigsetjmp=missing fi -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef HAVE_UNISTD_H @@ -6300,13 +6102,16 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : bash_cv_func_sigsetjmp=present -else $as_nop - bash_cv_func_sigsetjmp=missing +else case e in #( + e) bash_cv_func_sigsetjmp=missing ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_sigsetjmp" >&5 @@ -6321,8 +6126,8 @@ printf %s "checking for lstat... " >&6; } if test ${bash_cv_func_lstat+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6339,11 +6144,13 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : bash_cv_func_lstat=yes -else $as_nop - bash_cv_func_lstat=no +else case e in #( + e) bash_cv_func_lstat=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_lstat" >&5 printf "%s\n" "$bash_cv_func_lstat" >&6; } @@ -6357,15 +6164,15 @@ printf %s "checking whether or not strcoll and strcmp differ... " >&6; } if test ${bash_cv_func_strcoll_broken+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&5 printf "%s\n" "$as_me: WARNING: cannot check strcoll if cross compiling -- defaulting to no" >&2;} bash_cv_func_strcoll_broken=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6376,9 +6183,7 @@ else $as_nop #include int -main(c, v) -int c; -char *v[]; +main(int c, char **v) { int r1, r2; char *deflocale, *defcoll; @@ -6410,30 +6215,306 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : bash_cv_func_strcoll_broken=yes -else $as_nop - bash_cv_func_strcoll_broken=no +else case e in #( + e) bash_cv_func_strcoll_broken=no ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi + ;; +esac +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strcoll_broken" >&5 +printf "%s\n" "$bash_cv_func_strcoll_broken" >&6; } +if test $bash_cv_func_strcoll_broken = yes; then +printf "%s\n" "#define STRCOLL_BROKEN 1" >>confdefs.h + +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "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+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + ;; +esac +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5 +printf %s "checking for egrep -e... " >&6; } +if test ${ac_cv_path_EGREP_TRADITIONAL+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$EGREP_TRADITIONAL"; then + ac_path_EGREP_TRADITIONAL_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue +# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. + # Check for GNU $ac_path_EGREP_TRADITIONAL +case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" + "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" + ac_path_EGREP_TRADITIONAL_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_TRADITIONAL_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then + : + fi +else + ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL +fi + + if test "$ac_cv_path_EGREP_TRADITIONAL" +then : + ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" +else case e in #( + e) if test -z "$EGREP_TRADITIONAL"; then + ac_path_EGREP_TRADITIONAL_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue +# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. + # Check for GNU $ac_path_EGREP_TRADITIONAL +case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP_TRADITIONAL' >> "conftest.nl" + "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" + ac_path_EGREP_TRADITIONAL_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + $ac_path_EGREP_TRADITIONAL_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strcoll_broken" >&5 -printf "%s\n" "$bash_cv_func_strcoll_broken" >&6; } -if test $bash_cv_func_strcoll_broken = yes; then -printf "%s\n" "#define STRCOLL_BROKEN 1" >>confdefs.h - + ;; +esac +fi ;; +esac fi - +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 +printf "%s\n" "$ac_cv_path_EGREP_TRADITIONAL" >&6; } + EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getpw functions are declared in pwd.h" >&5 printf %s "checking whether getpw functions are declared in pwd.h... " >&6; } if test ${bash_cv_getpw_declared+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6444,14 +6525,16 @@ else $as_nop _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "getpwuid" >/dev/null 2>&1 + $EGREP_TRADITIONAL "getpwuid" >/dev/null 2>&1 then : bash_cv_getpw_declared=yes -else $as_nop - bash_cv_getpw_declared=no +else case e in #( + e) bash_cv_getpw_declared=no ;; +esac fi rm -rf conftest* - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_getpw_declared" >&5 @@ -6467,25 +6550,23 @@ printf %s "checking whether termios.h defines TIOCGWINSZ... " >&6; } if test ${ac_cv_sys_tiocgwinsz_in_termios_h+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +$ac_includes_default #include -#ifdef TIOCGWINSZ - yes -#endif +const int tiocgwinsz = TIOCGWINSZ; _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 +if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_tiocgwinsz_in_termios_h=yes -else $as_nop - ac_cv_sys_tiocgwinsz_in_termios_h=no +else case e in #( + e) ac_cv_sys_tiocgwinsz_in_termios_h=no ;; +esac fi -rm -rf conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5 printf "%s\n" "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; } @@ -6496,25 +6577,23 @@ printf %s "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; } if test ${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +$ac_includes_default #include -#ifdef TIOCGWINSZ - yes -#endif +const int tiocgwinsz = TIOCGWINSZ; _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1 +if ac_fn_c_try_compile "$LINENO" then : ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes -else $as_nop - ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no +else case e in #( + e) ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no ;; +esac fi -rm -rf conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5 printf "%s\n" "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; } @@ -6541,8 +6620,8 @@ printf %s "checking for sig_atomic_t in signal.h... " >&6; } if test ${ac_cv_have_sig_atomic_t+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -6556,11 +6635,13 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_have_sig_atomic_t=yes -else $as_nop - ac_cv_have_sig_atomic_t=no +else case e in #( + e) ac_cv_have_sig_atomic_t=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_sig_atomic_t" >&5 printf "%s\n" "$ac_cv_have_sig_atomic_t" >&6; } @@ -6573,8 +6654,8 @@ printf %s "checking for sig_atomic_t... " >&6; } if test ${bash_cv_type_sig_atomic_t+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #if HAVE_STDLIB_H @@ -6593,14 +6674,16 @@ else $as_nop _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "sig_atomic_t" >/dev/null 2>&1 + $EGREP_TRADITIONAL "sig_atomic_t" >/dev/null 2>&1 then : bash_cv_type_sig_atomic_t=yes -else $as_nop - bash_cv_type_sig_atomic_t=no +else case e in #( + e) bash_cv_type_sig_atomic_t=no ;; +esac fi rm -rf conftest* - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_sig_atomic_t" >&5 @@ -6619,8 +6702,8 @@ printf %s "checking for TIOCSTAT in sys/ioctl.h... " >&6; } if test ${bash_cv_tiocstat_in_ioctl+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6636,11 +6719,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_tiocstat_in_ioctl=yes -else $as_nop - bash_cv_tiocstat_in_ioctl=no - +else case e in #( + e) bash_cv_tiocstat_in_ioctl=no + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_tiocstat_in_ioctl" >&5 @@ -6655,8 +6740,8 @@ printf %s "checking for FIONREAD in sys/ioctl.h... " >&6; } if test ${bash_cv_fionread_in_ioctl+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6672,11 +6757,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_fionread_in_ioctl=yes -else $as_nop - bash_cv_fionread_in_ioctl=no - +else case e in #( + e) bash_cv_fionread_in_ioctl=no + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_fionread_in_ioctl" >&5 @@ -6691,8 +6778,8 @@ printf %s "checking for speed_t in sys/types.h... " >&6; } if test ${bash_cv_speed_t_in_sys_types+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -6706,10 +6793,12 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_speed_t_in_sys_types=yes -else $as_nop - bash_cv_speed_t_in_sys_types=no +else case e in #( + e) bash_cv_speed_t_in_sys_types=no ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_speed_t_in_sys_types" >&5 @@ -6724,13 +6813,13 @@ printf %s "checking for struct winsize in sys/ioctl.h and termios.h... " >&6; } if test ${bash_cv_struct_winsize_header+y} then : printf %s "(cached) " >&6 -else $as_nop - +else case e in #( + e) if test ${bash_cv_struct_winsize_ioctl+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6750,19 +6839,21 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_struct_winsize_ioctl=yes -else $as_nop - bash_cv_struct_winsize_ioctl=no +else case e in #( + e) bash_cv_struct_winsize_ioctl=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - + ;; +esac fi if test ${bash_cv_struct_winsize_termios+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -6782,11 +6873,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_struct_winsize_termios=yes -else $as_nop - bash_cv_struct_winsize_termios=no +else case e in #( + e) bash_cv_struct_winsize_termios=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - + ;; +esac fi @@ -6798,7 +6891,8 @@ elif test $bash_cv_struct_winsize_termios = yes; then else bash_cv_struct_winsize_header=other fi - + ;; +esac fi if test $bash_cv_struct_winsize_header = ioctl_h; then @@ -6817,13 +6911,6 @@ printf "%s\n" "not found" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_ino" >&5 -printf %s "checking for struct dirent.d_ino... " >&6; } -if test ${bash_cv_dirent_has_d_ino+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" " #include @@ -6852,28 +6939,10 @@ then : printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h -bash_cv_dirent_has_d_ino=yes -else $as_nop - bash_cv_dirent_has_d_ino=no -fi - - -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_ino" >&5 -printf "%s\n" "$bash_cv_dirent_has_d_ino" >&6; } -if test $bash_cv_dirent_has_d_ino = yes; then -printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct dirent.d_fileno" >&5 -printf %s "checking for struct dirent.d_fileno... " >&6; } -if test ${bash_cv_dirent_has_d_fileno+y} -then : - printf %s "(cached) " >&6 -else $as_nop ac_fn_c_check_member "$LINENO" "struct dirent" "d_fileno" "ac_cv_member_struct_dirent_d_fileno" " @@ -6903,28 +6972,17 @@ then : printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h -bash_cv_dirent_has_d_fileno=yes -else $as_nop - bash_cv_dirent_has_d_fileno=no -fi - fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_dirent_has_d_fileno" >&5 -printf "%s\n" "$bash_cv_dirent_has_d_fileno" >&6; } -if test $bash_cv_dirent_has_d_fileno = yes; then -printf "%s\n" "#define HAVE_STRUCT_DIRENT_D_FILENO 1" >>confdefs.h - -fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timeval in sys/time.h and time.h" >&5 printf %s "checking for struct timeval in sys/time.h and time.h... " >&6; } if test ${bash_cv_struct_timeval+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if HAVE_SYS_TIME_H #include @@ -6943,11 +7001,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_struct_timeval=yes -else $as_nop - bash_cv_struct_timeval=no +else case e in #( + e) bash_cv_struct_timeval=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_struct_timeval" >&5 @@ -6970,8 +7030,8 @@ printf %s "checking for $CC options needed to detect all undeclared functions... if test ${ac_cv_c_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_save_CFLAGS=$CFLAGS +else case e in #( + e) ac_save_CFLAGS=$CFLAGS ac_cv_c_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" @@ -6990,8 +7050,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : -else $as_nop - # This test program should compile successfully. +else case e in #( + e) # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the @@ -7019,26 +7079,29 @@ then : if test x"$ac_arg" = x then : ac_cv_c_undeclared_builtin_options='none needed' -else $as_nop - ac_cv_c_undeclared_builtin_options=$ac_arg +else case e in #( + e) ac_cv_c_undeclared_builtin_options=$ac_arg ;; +esac fi break fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } case $ac_cv_c_undeclared_builtin_options in #( 'cannot detect') : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "cannot make $CC report undeclared builtins -See \`config.log' for more details" "$LINENO" 5; } ;; #( +See 'config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_c_undeclared_builtin_options='' ;; #( *) : @@ -7050,8 +7113,9 @@ ac_fn_check_decl "$LINENO" "AUDIT_USER_TTY" "ac_cv_have_decl_AUDIT_USER_TTY" "#i if test "x$ac_cv_have_decl_AUDIT_USER_TTY" = xyes then : ac_have_decl=1 -else $as_nop - ac_have_decl=0 +else case e in #( + e) ac_have_decl=0 ;; +esac fi printf "%s\n" "#define HAVE_DECL_AUDIT_USER_TTY $ac_have_decl" >>confdefs.h @@ -7070,27 +7134,33 @@ fi if test ${bash_cv_termcap_lib+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_fn_c_check_func "$LINENO" "tgetent" "ac_cv_func_tgetent" +else case e in #( + e) ac_fn_c_check_func "$LINENO" "tgetent" "ac_cv_func_tgetent" if test "x$ac_cv_func_tgetent" = xyes then : bash_cv_termcap_lib=libc -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 printf %s "checking for tgetent in -ltermcap... " >&6; } if test ${ac_cv_lib_termcap_tgetent+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char tgetent (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); int main (void) { @@ -7102,34 +7172,42 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_termcap_tgetent=yes -else $as_nop - ac_cv_lib_termcap_tgetent=no +else case e in #( + e) ac_cv_lib_termcap_tgetent=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +LIBS=$ac_check_lib_save_LIBS ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5 printf "%s\n" "$ac_cv_lib_termcap_tgetent" >&6; } if test "x$ac_cv_lib_termcap_tgetent" = xyes then : bash_cv_termcap_lib=libtermcap -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltinfo" >&5 printf %s "checking for tgetent in -ltinfo... " >&6; } if test ${ac_cv_lib_tinfo_tgetent+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char tgetent (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); int main (void) { @@ -7141,34 +7219,42 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_tinfo_tgetent=yes -else $as_nop - ac_cv_lib_tinfo_tgetent=no +else case e in #( + e) ac_cv_lib_tinfo_tgetent=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +LIBS=$ac_check_lib_save_LIBS ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgetent" >&5 printf "%s\n" "$ac_cv_lib_tinfo_tgetent" >&6; } if test "x$ac_cv_lib_tinfo_tgetent" = xyes then : bash_cv_termcap_lib=libtinfo -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5 +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5 printf %s "checking for tgetent in -lcurses... " >&6; } if test ${ac_cv_lib_curses_tgetent+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char tgetent (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); int main (void) { @@ -7180,34 +7266,42 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_lib_curses_tgetent=yes -else $as_nop - ac_cv_lib_curses_tgetent=no +else case e in #( + e) ac_cv_lib_curses_tgetent=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +LIBS=$ac_check_lib_save_LIBS ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5 printf "%s\n" "$ac_cv_lib_curses_tgetent" >&6; } if test "x$ac_cv_lib_curses_tgetent" = xyes then : bash_cv_termcap_lib=libcurses -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5 -printf %s "checking for tgetent in -lncurses... " >&6; } -if test ${ac_cv_lib_ncurses_tgetent+y} +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5 +printf %s "checking for tgetent in -lncursesw... " >&6; } +if test ${ac_cv_lib_ncursesw_tgetent+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncurses $LIBS" +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lncursesw $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char tgetent (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); int main (void) { @@ -7218,35 +7312,43 @@ return tgetent (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_ncurses_tgetent=yes -else $as_nop - ac_cv_lib_ncurses_tgetent=no + ac_cv_lib_ncursesw_tgetent=yes +else case e in #( + e) ac_cv_lib_ncursesw_tgetent=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +LIBS=$ac_check_lib_save_LIBS ;; +esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5 -printf "%s\n" "$ac_cv_lib_ncurses_tgetent" >&6; } -if test "x$ac_cv_lib_ncurses_tgetent" = xyes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5 +printf "%s\n" "$ac_cv_lib_ncursesw_tgetent" >&6; } +if test "x$ac_cv_lib_ncursesw_tgetent" = xyes then : - bash_cv_termcap_lib=libncurses -else $as_nop - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncursesw" >&5 -printf %s "checking for tgetent in -lncursesw... " >&6; } -if test ${ac_cv_lib_ncursesw_tgetent+y} + bash_cv_termcap_lib=libncursesw +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5 +printf %s "checking for tgetent in -lncurses... " >&6; } +if test ${ac_cv_lib_ncurses_tgetent+y} then : printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-lncursesw $LIBS" +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* 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. */ -char tgetent (); + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); int main (void) { @@ -7257,33 +7359,42 @@ return tgetent (); _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_ncursesw_tgetent=yes -else $as_nop - ac_cv_lib_ncursesw_tgetent=no + ac_cv_lib_ncurses_tgetent=yes +else case e in #( + e) ac_cv_lib_ncurses_tgetent=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +LIBS=$ac_check_lib_save_LIBS ;; +esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_tgetent" >&5 -printf "%s\n" "$ac_cv_lib_ncursesw_tgetent" >&6; } -if test "x$ac_cv_lib_ncursesw_tgetent" = xyes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5 +printf "%s\n" "$ac_cv_lib_ncurses_tgetent" >&6; } +if test "x$ac_cv_lib_ncurses_tgetent" = xyes then : - bash_cv_termcap_lib=libncursesw -else $as_nop - bash_cv_termcap_lib=gnutermcap + bash_cv_termcap_lib=libncurses +else case e in #( + e) bash_cv_termcap_lib=gnutermcap ;; +esac fi - + ;; +esac fi - + ;; +esac fi - + ;; +esac fi - + ;; +esac fi - + ;; +esac fi - + ;; +esac fi if test "X$_bash_needmsg" = "Xyes"; then @@ -7302,9 +7413,15 @@ TERMCAP_DEP= elif test $bash_cv_termcap_lib = libtinfo; then TERMCAP_LIB=-ltinfo TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libncursesw; then +TERMCAP_LIB=-lncursesw +TERMCAP_DEP= elif test $bash_cv_termcap_lib = libncurses; then TERMCAP_LIB=-lncurses TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libcurses; then +TERMCAP_LIB=-lcurses +TERMCAP_DEP= elif test $bash_cv_termcap_lib = libc; then TERMCAP_LIB= TERMCAP_DEP= @@ -7339,6 +7456,7 @@ esac case "$TERMCAP_LIB" in -ltinfo) TERMCAP_PKG_CONFIG_LIB=tinfo ;; -lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;; +-lncursesw) TERMCAP_PKG_CONFIG_LIB=ncursesw ;; -lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;; -ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;; *) TERMCAP_PKG_CONFIG_LIB=termcap ;; @@ -7350,8 +7468,8 @@ printf %s "checking for nl_langinfo and CODESET... " >&6; } if test ${am_cv_langinfo_codeset+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -7365,16 +7483,20 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : am_cv_langinfo_codeset=yes -else $as_nop - am_cv_langinfo_codeset=no +else case e in #( + e) am_cv_langinfo_codeset=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_langinfo_codeset" >&5 printf "%s\n" "$am_cv_langinfo_codeset" >&6; } if test $am_cv_langinfo_codeset = yes; then + printf "%s\n" "#define HAVE_NL_LANGINFO 1" >>confdefs.h + printf "%s\n" "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h @@ -7421,7 +7543,7 @@ fi ac_fn_c_check_func "$LINENO" "mbscasecmp" "ac_cv_func_mbscasecmp" if test "x$ac_cv_func_mbscasecmp" = xyes then : - printf "%s\n" "#define HAVE_MBSCMP 1" >>confdefs.h + printf "%s\n" "#define HAVE_MBSCASECMP 1" >>confdefs.h fi @@ -7432,6 +7554,13 @@ then : fi +ac_fn_c_check_func "$LINENO" "mbsncmp" "ac_cv_func_mbsncmp" +if test "x$ac_cv_func_mbsncmp" = xyes +then : + printf "%s\n" "#define HAVE_MBSNCMP 1" >>confdefs.h + +fi + ac_fn_c_check_func "$LINENO" "mbsnrtowcs" "ac_cv_func_mbsnrtowcs" if test "x$ac_cv_func_mbsnrtowcs" = xyes then : @@ -7452,13 +7581,14 @@ if test "x$ac_cv_func_mbschr" = xyes then : printf "%s\n" "#define HAVE_MBSCHR 1" >>confdefs.h -else $as_nop - case " $LIBOBJS " in +else case e in #( + e) case " $LIBOBJS " in *" mbschr.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mbschr.$ac_objext" ;; esac - + ;; +esac fi @@ -7497,19 +7627,27 @@ then : fi +ac_fn_c_check_func "$LINENO" "wcsnrtombs" "ac_cv_func_wcsnrtombs" +if test "x$ac_cv_func_wcsnrtombs" = xyes +then : + printf "%s\n" "#define HAVE_WCSNRTOMBS 1" >>confdefs.h + +fi + ac_fn_c_check_func "$LINENO" "wcswidth" "ac_cv_func_wcswidth" if test "x$ac_cv_func_wcswidth" = xyes then : printf "%s\n" "#define HAVE_WCSWIDTH 1" >>confdefs.h -else $as_nop - case " $LIBOBJS " in +else case e in #( + e) case " $LIBOBJS " in *" wcswidth.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS wcswidth.$ac_objext" ;; esac - + ;; +esac fi @@ -7519,8 +7657,8 @@ printf %s "checking whether mbrtowc and mbstate_t are properly declared... " >&6 if test ${ac_cv_func_mbrtowc+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -7538,11 +7676,13 @@ _ACEOF if ac_fn_c_try_link "$LINENO" then : ac_cv_func_mbrtowc=yes -else $as_nop - ac_cv_func_mbrtowc=no +else case e in #( + e) ac_cv_func_mbrtowc=no ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext + conftest$ac_exeext conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5 printf "%s\n" "$ac_cv_func_mbrtowc" >&6; } @@ -7596,8 +7736,8 @@ printf %s "checking for wchar_t in wchar.h... " >&6; } if test ${bash_cv_type_wchar_t+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -7615,11 +7755,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_type_wchar_t=yes -else $as_nop - bash_cv_type_wchar_t=no - +else case e in #( + e) bash_cv_type_wchar_t=no + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wchar_t" >&5 printf "%s\n" "$bash_cv_type_wchar_t" >&6; } @@ -7634,8 +7776,8 @@ printf %s "checking for wctype_t in wctype.h... " >&6; } if test ${bash_cv_type_wctype_t+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -7653,11 +7795,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_type_wctype_t=yes -else $as_nop - bash_cv_type_wctype_t=no - +else case e in #( + e) bash_cv_type_wctype_t=no + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wctype_t" >&5 printf "%s\n" "$bash_cv_type_wctype_t" >&6; } @@ -7672,8 +7816,8 @@ printf %s "checking for wint_t in wctype.h... " >&6; } if test ${bash_cv_type_wint_t+y} then : printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -7691,11 +7835,13 @@ _ACEOF if ac_fn_c_try_compile "$LINENO" then : bash_cv_type_wint_t=yes -else $as_nop - bash_cv_type_wint_t=no - +else case e in #( + e) bash_cv_type_wint_t=no + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_type_wint_t" >&5 printf "%s\n" "$bash_cv_type_wint_t" >&6; } @@ -7710,13 +7856,13 @@ printf %s "checking for wcwidth broken with unicode combining characters... " >& if test ${bash_cv_wcwidth_broken+y} then : printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes +else case e in #( + e) if test "$cross_compiling" = yes then : bash_cv_wcwidth_broken=no -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -7727,14 +7873,15 @@ else $as_nop #include int -main(c, v) -int c; -char **v; +main(int c, char **v) { int w; setlocale(LC_ALL, "en_US.UTF-8"); w = wcwidth (0x0301); + if (w != 0) + exit (0); + w = wcwidth (0x200b); exit (w == 0); /* exit 0 if wcwidth broken */ } @@ -7742,13 +7889,16 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : bash_cv_wcwidth_broken=yes -else $as_nop - bash_cv_wcwidth_broken=no +else case e in #( + e) bash_cv_wcwidth_broken=no ;; +esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_wcwidth_broken" >&5 printf "%s\n" "$bash_cv_wcwidth_broken" >&6; } @@ -7773,28 +7923,30 @@ fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 printf %s "checking size of wchar_t... " >&6; } if test ${ac_cv_sizeof_wchar_t+y} then : printf %s "(cached) " >&6 -else $as_nop - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default" +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "$ac_includes_default" then : -else $as_nop - if test "$ac_cv_type_wchar_t" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +else case e in #( + e) if test "$ac_cv_type_wchar_t" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5; } +See 'config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_wchar_t=0 - fi + fi ;; +esac fi - + ;; +esac fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 printf "%s\n" "$ac_cv_sizeof_wchar_t" >&6; } @@ -7919,6 +8071,7 @@ CFLAGS="$CFLAGS $STYLE_CFLAGS" + ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc history.pc" @@ -7935,8 +8088,8 @@ cat >confcache <<\_ACEOF # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the # following values. _ACEOF @@ -7966,14 +8119,14 @@ printf "%s\n" "$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 + # 'set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) - # `set' quotes correctly as required by POSIX, so do not add quotes. + # 'set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | @@ -8034,6 +8187,12 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +# Check whether --enable-year2038 was given. +if test ${enable_year2038+y} +then : + enableval=$enable_year2038; +fi + : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -8063,7 +8222,6 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -as_nop=: if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 then : emulate sh @@ -8072,12 +8230,13 @@ then : # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else $as_nop - case `(set -o) 2>/dev/null` in #( +else case e in #( + e) case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; +esac ;; esac fi @@ -8149,7 +8308,7 @@ IFS=$as_save_IFS ;; esac -# We did not find ourselves, most probably we were run as `sh COMMAND' +# We did not find ourselves, most probably we were run as 'sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 @@ -8178,7 +8337,6 @@ as_fn_error () } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -8218,11 +8376,12 @@ then : { eval $1+=\$2 }' -else $as_nop - as_fn_append () +else case e in #( + e) as_fn_append () { eval $1=\$$1\$2 - } + } ;; +esac fi # as_fn_append # as_fn_arith ARG... @@ -8236,11 +8395,12 @@ then : { as_val=$(( $* )) }' -else $as_nop - as_fn_arith () +else case e in #( + e) as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` - } + } ;; +esac fi # as_fn_arith @@ -8323,9 +8483,9 @@ if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then @@ -8406,10 +8566,12 @@ as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated # Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated exec 6>&1 @@ -8424,8 +8586,8 @@ 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 8.2, which was -generated by GNU Autoconf 2.71. Invocation command line was +This file was extended by readline $as_me 8.3, which was +generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -8457,7 +8619,7 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions +'$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. @@ -8492,11 +8654,11 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -readline config.status 8.2 -configured by $0, generated by GNU Autoconf 2.71, +readline config.status 8.3 +configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" -Copyright (C) 2021 Free Software Foundation, Inc. +Copyright (C) 2023 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -8556,8 +8718,8 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; + as_fn_error $? "ambiguous option: '$1' +Try '$0 --help' for more information.";; --help | --hel | -h ) printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -8565,8 +8727,8 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; @@ -8623,7 +8785,7 @@ do "history.pc") CONFIG_FILES="$CONFIG_FILES history.pc" ;; "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; esac done @@ -8643,7 +8805,7 @@ fi # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. +# after its creation but before its name has been assigned to '$tmp'. $debug || { tmp= ac_tmp= @@ -8667,7 +8829,7 @@ ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. +# This happens for instance with './config.status config.h'. if test -n "$CONFIG_FILES"; then @@ -8825,13 +8987,13 @@ fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. +# This happens for instance with './config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF -# Transform confdefs.h into an awk script `defines.awk', embedded as +# Transform confdefs.h into an awk script 'defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. @@ -8941,7 +9103,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -8963,19 +9125,19 @@ do -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. + # because $ac_f cannot contain ':'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done - # Let's still pretend it is `configure' which instantiates (i.e., don't + # Let's still pretend it is 'configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` @@ -9103,7 +9265,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 esac _ACEOF -# Neutralize VPATH when `$srcdir' = `.'. +# Neutralize VPATH when '$srcdir' = '.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -9133,9 +9295,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$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 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" diff --git a/configure.ac b/configure.ac index 15501fa..5599d12 100644 --- a/configure.ac +++ b/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-2022 Free Software Foundation, Inc. +# Copyright (C) 1987-2024 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,9 +20,9 @@ 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 . -AC_REVISION([for Readline 8.2, version 2.97]) +AC_REVISION([for Readline 8.3, version 2.103]) -AC_INIT(readline, 8.2, bug-readline@gnu.org) +AC_INIT(readline, 8.3, bug-readline@gnu.org) dnl make sure we are using a recent autoconf version AC_PREREQ(2.69) @@ -32,7 +32,7 @@ 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=8.2 +LIBVERSION=8.3 AC_CANONICAL_HOST AC_CANONICAL_BUILD @@ -118,10 +118,12 @@ AC_USE_SYSTEM_EXTENSIONS # If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS if test -n "$want_auto_cflags" ; then AUTO_CFLAGS="-g ${GCC:+-O2}" - STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}" +# STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}" + STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}" fi -AC_PROG_GCC_TRADITIONAL +dnl this macro is obsolete +dnl AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL AC_CHECK_TOOL(AR, ar) dnl Set default for ARFLAGS, since autoconf does not have a macro for it. @@ -129,6 +131,8 @@ dnl This allows people to set it when running configure or make test -n "$ARFLAGS" || ARFLAGS="cr" AC_PROG_RANLIB +AM_PROG_INSTALL_SH + MAKE_SHELL=/bin/sh AC_SUBST(MAKE_SHELL) @@ -145,12 +149,15 @@ AC_C_VOLATILE AC_TYPE_SIZE_T AC_CHECK_TYPE(ssize_t, int) +AC_TYPE_MODE_T + AC_HEADER_STAT AC_HEADER_DIRENT AC_CHECK_FUNCS(fcntl gettimeofday kill lstat pselect readlink select setitimer) -AC_CHECK_FUNCS(fnmatch memmove putenv setenv setlocale \ - strcasecmp strpbrk sysconf tcgetattr vsnprintf) +AC_CHECK_FUNCS(fnmatch memmove putenv setenv setlocale strcasecmp \ + strpbrk sysconf tcgetattr tcgetwinsize tcsetwinsize \ + vsnprintf) AC_CHECK_FUNCS(isascii isxdigit) AC_CHECK_FUNCS(getpwent getpwnam getpwuid) @@ -220,6 +227,7 @@ esac case "$TERMCAP_LIB" in -ltinfo) TERMCAP_PKG_CONFIG_LIB=tinfo ;; -lcurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;; +-lncursesw) TERMCAP_PKG_CONFIG_LIB=ncursesw ;; -lncurses) TERMCAP_PKG_CONFIG_LIB=ncurses ;; -ltermcap) TERMCAP_PKG_CONFIG_LIB=termcap ;; *) TERMCAP_PKG_CONFIG_LIB=termcap ;; @@ -325,6 +333,7 @@ AC_SUBST(CFLAGS) AC_SUBST(LOCAL_CFLAGS) AC_SUBST(LOCAL_LDFLAGS) AC_SUBST(LOCAL_DEFS) +AC_SUBST(STYLE_CFLAGS) AC_SUBST(AR) AC_SUBST(ARFLAGS) diff --git a/display.c b/display.c index 803d4ce..9aa8c7b 100644 --- a/display.c +++ b/display.c @@ -1,6 +1,6 @@ /* display.c -- readline redisplay facility. */ -/* Copyright (C) 1987-2022 Free Software Foundation, Inc. +/* Copyright (C) 1987-2025 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. @@ -59,10 +59,6 @@ #include "rlprivate.h" #include "xmalloc.h" -#if !defined (strchr) && !defined (__STDC__) -extern char *strchr (), *strrchr (); -#endif /* !strchr && !__STDC__ */ - static void putc_face (int, int, char *); static void puts_face (const char *, const char *, int); static void norm_face (char *, int); @@ -282,6 +278,10 @@ static int prompt_physical_chars; characters in the prompt or use heuristics about where they are. */ static int *local_prompt_newlines; +/* An array saying how many invisible characters are in each line of the + prompt. */ +static int *local_prompt_invis_chars; + /* set to a non-zero value by rl_redisplay if we are marking modified history lines and the current line is so marked. */ static int modmark; @@ -295,6 +295,7 @@ static int line_totbytes; static char *saved_local_prompt; static char *saved_local_prefix; static int *saved_local_prompt_newlines; +static int *saved_local_prompt_invis_chars; static int saved_last_invisible; static int saved_visible_length; @@ -356,7 +357,7 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) { char *r, *ret, *p, *igstart, *nprompt, *ms; int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars; - int mlen, newlines, newlines_guess, bound, can_add_invis; + int mlen, newlines, newlines_guess, bound, can_add_invis, lastinvis; int mb_cur_max; /* We only expand the mode string for the last line of a multiline prompt @@ -399,7 +400,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) *vlp = l; local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * 2); - local_prompt_newlines[0] = 0; + local_prompt_invis_chars = (int *) xrealloc (local_prompt_invis_chars, sizeof (int) * 2); + local_prompt_newlines[0] = local_prompt_invis_chars[0] = 0; local_prompt_newlines[1] = -1; return r; @@ -414,15 +416,20 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) newlines_guess = (_rl_screenwidth > 0) ? APPROX_DIV(l, _rl_screenwidth) : APPROX_DIV(l, 80); local_prompt_newlines = (int *) xrealloc (local_prompt_newlines, sizeof (int) * (newlines_guess + 1)); local_prompt_newlines[newlines = 0] = 0; + local_prompt_invis_chars = (int *) xrealloc (local_prompt_invis_chars, sizeof (int) * (newlines_guess + 1)); + local_prompt_invis_chars[0] = 0; for (rl = 1; rl <= newlines_guess; rl++) - local_prompt_newlines[rl] = -1; + { + local_prompt_newlines[rl] = -1; + local_prompt_invis_chars[rl] = 0; + } rl = physchars = 0; /* mode string now part of nprompt */ invfl = 0; /* invisible chars in first line of prompt */ invflset = 0; /* we only want to set invfl once */ igstart = 0; /* we're not ignoring any characters yet */ - for (ignoring = last = ninvis = 0, p = nprompt; p && *p; p++) + for (ignoring = last = ninvis = lastinvis = 0, p = nprompt; p && *p; p++) { /* This code strips the invisible character string markers RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE */ @@ -447,6 +454,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) counter. */ if (invflset && newlines == 1) invfl = ninvis; + local_prompt_invis_chars[newlines - 1] = ninvis - lastinvis; + lastinvis = ninvis; } if (p != (igstart + 1)) last = r - ret - 1; @@ -511,6 +520,8 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) else new = r - ret; local_prompt_newlines[++newlines] = new; + local_prompt_invis_chars[newlines - 1] = ninvis - lastinvis; + lastinvis = ninvis; } /* What if a physical character of width >= 2 is split? There is @@ -525,6 +536,9 @@ expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp) if (rl <= _rl_screenwidth) invfl = ninvis; + /* Make sure we account for invisible characters on the last line. */ + local_prompt_invis_chars[newlines] = ninvis - lastinvis; + *r = '\0'; if (lp) *lp = rl; @@ -591,13 +605,22 @@ rl_expand_prompt (char *prompt) FREE (local_prompt); FREE (local_prompt_prefix); + /* Set default values for variables expand_prompt sets */ local_prompt = local_prompt_prefix = (char *)0; local_prompt_len = 0; prompt_last_invisible = prompt_invis_chars_first_line = 0; prompt_visible_length = prompt_physical_chars = 0; + if (local_prompt_invis_chars == 0) + local_prompt_invis_chars = (int *)xmalloc (sizeof (int)); + local_prompt_invis_chars[0] = 0; + if (prompt == 0 || *prompt == 0) - return (0); + { + local_prompt = xmalloc (sizeof (char)); + local_prompt[0] = '\0'; + return (0); + } p = strrchr (prompt, '\n'); if (p == 0) @@ -641,8 +664,8 @@ rl_expand_prompt (char *prompt) static void realloc_line (int minsize) { - int minimum_size; - int newsize, delta; + size_t minimum_size; + size_t newsize, delta; minimum_size = DEFAULT_LINE_BUFFER_SIZE; if (minsize < minimum_size) @@ -684,7 +707,7 @@ init_line_structures (int minsize) if (line_size > minsize) minsize = line_size; } - realloc_line (minsize); + realloc_line (minsize); if (vis_lbreaks == 0) { @@ -758,16 +781,39 @@ _rl_optimize_redisplay (void) _rl_quick_redisplay = 1; } +/* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */ +#define INVIS_FIRST() (local_prompt_invis_chars[0]) +#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0) + +#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) +#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) +#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) +#define VIS_CHARS(line) (visible_line + vis_lbreaks[line]) +#define VIS_FACE(line) (vis_face + vis_lbreaks[line]) +#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line) +#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line) +#define INV_LINE(line) (invisible_line + inv_lbreaks[line]) +#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line]) + +#define INV_CHARS_CURRENT_PROMPT_LINE(line) \ + (local_prompt_invis_chars[line] > 0) + +#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \ + _rl_last_c_pos != o_cpos && \ + _rl_last_c_pos > wrap_offset && \ + o_cpos < prompt_last_invisible) + /* Basic redisplay algorithm. See comments inline. */ void rl_redisplay (void) { int in, out, c, linenum, cursor_linenum; int inv_botlin, lb_botlin, lb_linenum, o_cpos; - int newlines, lpos, temp, n0, num, prompt_lines_estimate; + int newlines, lpos, temp, num; char *prompt_this_line; char cur_face; int hl_begin, hl_end; + int short_circuit; int mb_cur_max = MB_CUR_MAX; #if defined (HANDLE_MULTIBYTE) WCHAR_T wc; @@ -953,7 +999,7 @@ rl_redisplay (void) the line breaks in the prompt string in expand_prompt, taking invisible characters into account, and if lpos exceeds the screen width, we copy the data in the loop below. */ - lpos = prompt_physical_chars + modmark; + lpos = local_prompt ? prompt_physical_chars + modmark : 0; #if defined (HANDLE_MULTIBYTE) memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int)); @@ -964,9 +1010,9 @@ rl_redisplay (void) in the first physical line of the prompt. wrap_offset - prompt_invis_chars_first_line is usually the number of invis chars on the second (or, more generally, last) line. */ - - /* This is zero-based, used to set the newlines */ - prompt_lines_estimate = lpos / _rl_screenwidth; + /* XXX - There is code that assumes that all the invisible characters occur + on the first and last prompt lines; change that to use + local_prompt_invis_chars */ /* what if lpos is already >= _rl_screenwidth before we start drawing the contents of the command line? */ @@ -982,6 +1028,7 @@ rl_redisplay (void) } /* Now set lpos from the last newline */ + /* XXX - change to use local_prompt_invis_chars[] */ if (mb_cur_max > 1 && rl_byte_oriented == 0 && prompt_multibyte_chars > 0) lpos = _rl_col_width (local_prompt, temp, local_prompt_len, 1) - (wrap_offset - prompt_invis_chars_first_line); else @@ -1044,6 +1091,8 @@ rl_redisplay (void) wc_width = (temp >= 0) ? temp : 1; } } + else + wc_width = 1; /* make sure it's set for the META_CHAR check */ #endif if (in == rl_point) @@ -1053,31 +1102,32 @@ rl_redisplay (void) } #if defined (HANDLE_MULTIBYTE) - if (META_CHAR (c) && _rl_output_meta_chars == 0) /* XXX - clean up */ + if (META_CHAR (c) && wc_bytes == 1 && wc_width == 1) #else if (META_CHAR (c)) #endif { +#if 0 + /* TAG: readline-8.4 20230227 */ + /* https://savannah.gnu.org/support/index.php?110830 + asking for non-printing meta characters to be printed using an + escape sequence. */ + + /* isprint(c) handles bytes up to UCHAR_MAX */ + if (_rl_output_meta_chars == 0 || isprint (c) == 0) +#else if (_rl_output_meta_chars == 0) +#endif { char obuf[5]; int olen; +#if defined (HAVE_VSNPRINTF) + olen = snprintf (obuf, sizeof (obuf), "\\%o", c); +#else olen = sprintf (obuf, "\\%o", c); - - if (lpos + olen >= _rl_screenwidth) - { - temp = _rl_screenwidth - lpos; - CHECK_INV_LBREAKS (); - inv_lbreaks[++newlines] = out + temp; -#if defined (HANDLE_MULTIBYTE) - line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; #endif - lpos = olen - temp; - } - else - lpos += olen; - + for (temp = 0; temp < olen; temp++) { invis_addc (&out, obuf[temp], cur_face); @@ -1249,26 +1299,6 @@ rl_redisplay (void) second and subsequent lines start at inv_lbreaks[N], offset by OFFSET (which has already been calculated above). */ -#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset) -#define WRAP_OFFSET(line, offset) ((line == 0) \ - ? (offset ? INVIS_FIRST() : 0) \ - : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0)) -#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) -#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) -#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) -#define VIS_CHARS(line) (visible_line + vis_lbreaks[line]) -#define VIS_FACE(line) (vis_face + vis_lbreaks[line]) -#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line) -#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line) -#define INV_LINE(line) (invisible_line + inv_lbreaks[line]) -#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line]) - -#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \ - _rl_last_c_pos != o_cpos && \ - _rl_last_c_pos > wrap_offset && \ - o_cpos < prompt_last_invisible) - - /* We don't want to highlight anything that's going to be off the top of the display; if the current line takes up more than an entire screen, just mark the lines that won't be displayed as having a @@ -1283,9 +1313,54 @@ rl_redisplay (void) norm_face (INV_LINE_FACE(linenum), INV_LLEN (linenum)); } + /* XXX - experimental new code */ + /* Now that _rl_last_v_pos is a logical count, not bounded by the + number of physical screen lines, this is a start at being able + to redisplay lines that consume more than the number of physical + screen lines in more than a simple `move-to-the-next-line' way. + + If the new line has more lines than there are physical screen + lines, and the cursor would be off the top of the screen if we + displayed all the new lines, clear the screen without killing + the scrollback buffer, clear out the visible line so we do a + complete redraw, and make the loop break when we have displayed + a physical screen full of lines. Do the same if we are going to + move the cursor to a line that's greater than the number of + physical screen lines when we weren't before. + + SHORT_CIRCUIT says where to break the loop. Pretty simple right now. */ + short_circuit = -1; + if (inv_botlin >= _rl_screenheight) + { + int extra; + + extra = inv_botlin - _rl_screenheight; /* lines off the top */ + /* cursor in portion of line that would be off screen or in + the lines that exceed the number of physical screen lines. */ + if (cursor_linenum <= extra || + (cursor_linenum >= _rl_screenheight && _rl_vis_botlin <= _rl_screenheight)) + { + if (cursor_linenum <= extra) + short_circuit = _rl_screenheight; + _rl_clear_screen (0); + if (visible_line) + memset (visible_line, 0, line_size); + rl_on_new_line (); + } + /* The cursor is beyond the number of lines that would be off + the top, but we still want to display only the first + _RL_SCREENHEIGHT lines starting at the beginning of the line. */ + else if (cursor_linenum > extra && cursor_linenum <= _rl_screenheight && + _rl_vis_botlin <= _rl_screenheight) + short_circuit = _rl_screenheight; + } + /* For each line in the buffer, do the updating display. */ for (linenum = 0; linenum <= inv_botlin; linenum++) { + if (short_circuit >= 0 && linenum == short_circuit) + break; + /* This can lead us astray if we execute a program that changes the locale from a non-multibyte to a multibyte one. */ o_cpos = _rl_last_c_pos; @@ -1319,6 +1394,7 @@ rl_redisplay (void) between the first and last lines of the prompt, if the prompt consumes more than two lines. It's usually right */ /* XXX - not sure this is ever executed */ + /* XXX - use local_prompt_invis_chars[linenum] */ _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line); /* If this is the line with the prompt, we might need to @@ -1388,20 +1464,29 @@ rl_redisplay (void) ((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth); } } - _rl_vis_botlin = inv_botlin; + _rl_vis_botlin = (short_circuit >= 0) ? short_circuit : inv_botlin; /* CHANGED_SCREEN_LINE is set to 1 if we have moved to a different screen line during this redisplay. */ changed_screen_line = _rl_last_v_pos != cursor_linenum; if (changed_screen_line) { + int physpos; + + /* The physpos calculation is to account for lines with differing + numbers of invisible characters. */ + if (mb_cur_max == 1 || rl_byte_oriented) + physpos = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset); + + /* Move to the line where the cursor will be. */ _rl_move_vert (cursor_linenum); + /* If we moved up to the line with the prompt using _rl_term_up, the physical cursor position on the screen stays the same, but the buffer position needs to be adjusted to account for invisible characters. */ - if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == 0 && wrap_offset) - _rl_last_c_pos += wrap_offset; + if ((mb_cur_max == 1 || rl_byte_oriented) && cursor_linenum == prompt_last_screen_line) + _rl_last_c_pos = physpos + WRAP_OFFSET (cursor_linenum, wrap_offset); } /* Now we move the cursor to where it needs to be. First, make @@ -1414,18 +1499,53 @@ rl_redisplay (void) invisible character in the prompt string. */ /* XXX - why not use local_prompt_len? */ nleft = prompt_visible_length + wrap_offset; - if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 && - _rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt) + if (cursor_linenum == prompt_last_screen_line) { - _rl_cr (); - if (modmark) - _rl_output_some_chars ("*", 1); - - _rl_output_some_chars (local_prompt, nleft); - if (mb_cur_max > 1 && rl_byte_oriented == 0) - _rl_last_c_pos = _rl_col_width (local_prompt, 0, nleft, 1) - wrap_offset + modmark; + int pmt_offset = local_prompt_newlines ? local_prompt_newlines[cursor_linenum] : 0; + int curline_invchars = local_prompt_invis_chars ? local_prompt_invis_chars[cursor_linenum] : wrap_offset; + int cursor_bufpos; + + /* cursor_bufpos is where the portion of the prompt that appears + on the current screen line begins in the buffer. It is a + buffer position, an index into curline + (local_prompt + pmt_offset) */ + cursor_bufpos = pmt_offset; + if (mb_cur_max == 1 || rl_byte_oriented) + cursor_bufpos += _rl_last_c_pos; else - _rl_last_c_pos = nleft + modmark; + cursor_bufpos += _rl_last_c_pos + curline_invchars; + + if (local_prompt && local_prompt_invis_chars[cursor_linenum] && + _rl_last_c_pos > 0 && + cursor_bufpos <= prompt_last_invisible) + { + _rl_cr (); + if (modmark) + _rl_output_some_chars ("*", 1); + + /* If the number of characters in local_prompt is greater + than the screen width, the prompt wraps. We only want to + print the portion after the line wrap. */ + + /* Make sure we set _rl_last_c_pos based on the number of + characters we actually output, since we start at column 0. */ + if (cursor_linenum > 0 && pmt_offset > 0 && nleft > pmt_offset) + _rl_output_some_chars (local_prompt + pmt_offset, nleft - pmt_offset); + else + { + _rl_output_some_chars (local_prompt, nleft); + pmt_offset = 0; /* force for calculation below */ + } + + if (mb_cur_max > 1 && rl_byte_oriented == 0) + /* Start width calculation where we started output. */ + _rl_last_c_pos = _rl_col_width (local_prompt, pmt_offset, nleft, 1) - WRAP_OFFSET(cursor_linenum, wrap_offset) + modmark; + else + /* Index into invisible_line+inv_lbreaks[cursor_linenum], + since that's what we use in the call to + _rl_move_cursor_relative below. */ + _rl_last_c_pos = nleft + modmark - inv_lbreaks[cursor_linenum]; /* buffer position */ + } } /* Where on that line? And where does that line start @@ -1444,6 +1564,7 @@ rl_redisplay (void) the prompt, and there's no good way to tell it, we compensate for those characters here and call _rl_backspace() directly if necessary */ + /* XXX - might need to check cursor_linenum == prompt_last_screen_line like above. */ if (wrap_offset && cursor_linenum == 0 && nleft < _rl_last_c_pos) { /* TX == new physical cursor position in multibyte locale. */ @@ -1652,7 +1773,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l { char *ofd, *ols, *oe, *nfd, *nls, *ne; char *ofdf, *nfdf, *olsf, *nlsf; - int temp, lendiff, wsatend, od, nd, twidth, o_cpos; + int temp, lendiff, wsatend, od, nd, o_cpos; int current_invis_chars; int col_lendiff, col_temp; int bytes_to_insert; @@ -1783,8 +1904,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l _rl_output_some_chars below. */ if (newwidth > 0) { - int count, i, j; - char *optr; + int i, j; puts_face (new, new_face, newbytes); _rl_last_c_pos = newwidth; @@ -1895,6 +2015,8 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l /* See comments at dumb_update: for an explanation of this heuristic */ if (nmax < omax) goto clear_rest_of_line; + /* XXX - need to use WRAP_OFFSET(current_line, wrap_offset) instead of + W_OFFSET - XXX */ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset))) goto clear_rest_of_line; else @@ -1981,7 +2103,11 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l 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 0 if (t > 0 && UNICODE_COMBINING_CHAR (wc) && WCWIDTH (wc) == 0) +#else + if (t > 0 && IS_COMBINING_CHAR (wc)) +#endif { old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY); new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY); @@ -1998,6 +2124,8 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l #if defined (HANDLE_MULTIBYTE) /* Find the last character that is the same between the two lines. This bounds the region that needs to change. */ + /* In this case, `last character' means the one farthest from the end of + the line. */ if (mb_cur_max > 1 && rl_byte_oriented == 0) { ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY); @@ -2014,7 +2142,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l *olsf != *nlsf) break; - if (*ols == ' ') + if (*ols != ' ') wsatend = 0; ols = old + _rl_find_prev_mbchar (old, ols - old, MB_FIND_ANY); @@ -2076,14 +2204,30 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l } /* count of invisible characters in the current invisible line. */ - current_invis_chars = W_OFFSET (current_line, wrap_offset); + current_invis_chars = WRAP_OFFSET (current_line, wrap_offset); if (_rl_last_v_pos != current_line) { _rl_move_vert (current_line); /* We have moved up to a new screen line. This line may or may not have invisible characters on it, but we do our best to recalculate visible_wrap_offset based on what we know. */ - if (current_line == 0) + /* This first clause handles the case where the prompt has been + recalculated (e.g., by rl_message) but the old prompt is still on + the visible line because we haven't overwritten it yet. We want + to somehow use the old prompt information, but we only want to do + this once. */ + if (current_line == 0 && saved_local_prompt && old[0] == saved_local_prompt[0] && memcmp (old, saved_local_prompt, saved_local_length) == 0) + visible_wrap_offset = saved_invis_chars_first_line; + /* This clause handles the opposite: the prompt has been restored (e.g., + by rl_clear_message) but the old saved_local_prompt (now NULL, so we + can't directly check it) is still on the visible line because we + haven't overwritten it yet. We guess that there aren't any invisible + characters in any of the prompts we put in with rl_message */ + else if (current_line == 0 && local_prompt && new[0] == local_prompt[0] && + (memcmp (new, local_prompt, local_prompt_len) == 0) && + (memcmp (old, local_prompt, local_prompt_len) != 0)) + visible_wrap_offset = 0; + else if (current_line == 0) visible_wrap_offset = prompt_invis_chars_first_line; /* XXX */ #if 0 /* XXX - not yet */ else if (current_line == prompt_last_screen_line && wrap_offset > prompt_invis_chars_first_line) @@ -2140,6 +2284,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l else /* We take wrap_offset into account here so we can pass correct information to _rl_move_cursor_relative. */ + /* XXX - can use local_prompt_invis_chars[0] instead of wrap_offset */ _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark; cpos_adjusted = 1; } @@ -2183,6 +2328,7 @@ dumb_update: wrap_offset-prompt_invis_chars_first_line on the assumption that this is the number of invisible characters in the last line of the prompt. */ + /* XXX - CHANGE THIS USING local_prompt_invis_chars[current_line] */ if (wrap_offset > prompt_invis_chars_first_line && current_line == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth && @@ -2201,6 +2347,20 @@ dumb_update: wrap_offset >= prompt_invis_chars_first_line && _rl_horizontal_scroll_mode == 0) ADJUST_CPOS (prompt_invis_chars_first_line); + /* XXX - This is experimental. It's a start at supporting + prompts where a non-terminal line contains the last + invisible characters. We assume that we can use the + local_prompt_invis_chars array and that the current line + is completely filled with characters to _rl_screenwidth, + so we can either adjust by the number of bytes in the + current line or just go straight to _rl_screenwidth */ + else if (current_line > 0 && current_line < prompt_last_screen_line && + INV_CHARS_CURRENT_PROMPT_LINE(current_line) && + _rl_horizontal_scroll_mode == 0) + { + _rl_last_c_pos = _rl_screenwidth; + cpos_adjusted = 1; + } } else _rl_last_c_pos += temp; @@ -2212,6 +2372,8 @@ dumb_update: know for sure, so we use another heuristic calclulation below. */ if (nmax < omax) goto clear_rest_of_line; /* XXX */ + /* XXX - use WRAP_OFFSET(current_line, wrap_offset) here instead of + W_OFFSET since current_line == 0 */ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset))) goto clear_rest_of_line; else @@ -2680,8 +2842,6 @@ rl_on_new_line_with_prompt (void) int rl_forced_update_display (void) { - register char *temp; - if (visible_line) memset (visible_line, 0, line_size); @@ -2763,7 +2923,7 @@ _rl_move_cursor_relative (int new, const char *data, const char *dataf) (prompt_last_invisible) in the last line. IN_INVISLINE is the offset of DATA in invisible_line */ in_invisline = 0; - if (data > invisible_line && data < invisible_line+inv_lbreaks[_rl_inv_botlin+1]) + if (data > invisible_line && _rl_inv_botlin < inv_lbsize && data < invisible_line+inv_lbreaks[_rl_inv_botlin+1]) in_invisline = data - invisible_line; /* Use NEW when comparing against the last invisible character in the @@ -2866,9 +3026,25 @@ _rl_move_vert (int to) { register int delta, i; - if (_rl_last_v_pos == to || to > _rl_screenheight) + if (_rl_last_v_pos == to) return; +#if 0 + /* If we're being asked to move to a line beyond the screen height, and + we're currently at the last physical line, issue a newline and let the + terminal take care of scrolling the display. */ + if (to >= _rl_screenheight) + { + if (_rl_last_v_pos == _rl_screenheight) + { + putc ('\n', rl_outstream); + _rl_cr (); + _rl_last_c_pos = 0; + } + return; + } +#endif + if ((delta = to - _rl_last_v_pos) > 0) { for (i = 0; i < delta; i++) @@ -2952,29 +3128,15 @@ rl_character_len (int c, int pos) mini-modeline. */ static int msg_saved_prompt = 0; -#if defined (USE_VARARGS) int -#if defined (PREFER_STDARG) rl_message (const char *format, ...) -#else -rl_message (va_alist) - va_dcl -#endif { va_list args; -#if defined (PREFER_VARARGS) - char *format; -#endif #if defined (HAVE_VSNPRINTF) int bneed; #endif -#if defined (PREFER_STDARG) va_start (args, format); -#else - va_start (args); - format = va_arg (args, char *); -#endif if (msg_buf == 0) msg_buf = xmalloc (msg_bufsiz = 128); @@ -2987,12 +3149,7 @@ rl_message (va_alist) 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 @@ -3023,40 +3180,6 @@ rl_message (va_alist) return 0; } -#else /* !USE_VARARGS */ -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[msg_bufsiz - 1] = '\0'; /* overflow? */ - - rl_display_prompt = msg_buf; - if (saved_local_prompt == 0) - { - 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, 0, &prompt_visible_length, - &prompt_last_invisible, - &prompt_invis_chars_first_line, - &prompt_physical_chars); - local_prompt_prefix = (char *)NULL; - local_prompt_len = local_prompt ? strlen (local_prompt) : 0; - (*rl_redisplay_function) (); - - return 0; -} -#endif /* !USE_VARARGS */ /* How to clear things from the "echo-area". */ int @@ -3098,10 +3221,12 @@ rl_save_prompt (void) saved_invis_chars_first_line = prompt_invis_chars_first_line; saved_physical_chars = prompt_physical_chars; saved_local_prompt_newlines = local_prompt_newlines; + saved_local_prompt_invis_chars = local_prompt_invis_chars; local_prompt = local_prompt_prefix = (char *)0; local_prompt_len = 0; local_prompt_newlines = (int *)0; + local_prompt_invis_chars = (int *)0; prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0; prompt_invis_chars_first_line = prompt_physical_chars = 0; @@ -3113,11 +3238,13 @@ rl_restore_prompt (void) FREE (local_prompt); FREE (local_prompt_prefix); FREE (local_prompt_newlines); + FREE (local_prompt_invis_chars); local_prompt = saved_local_prompt; local_prompt_prefix = saved_local_prefix; local_prompt_len = saved_local_length; local_prompt_newlines = saved_local_prompt_newlines; + local_prompt_invis_chars = saved_local_prompt_invis_chars; prompt_prefix_length = saved_prefix_length; prompt_last_invisible = saved_last_invisible; @@ -3130,7 +3257,7 @@ rl_restore_prompt (void) saved_local_length = 0; saved_last_invisible = saved_visible_length = saved_prefix_length = 0; saved_invis_chars_first_line = saved_physical_chars = 0; - saved_local_prompt_newlines = 0; + saved_local_prompt_newlines = saved_local_prompt_invis_chars = 0; } char * @@ -3318,7 +3445,7 @@ _rl_update_final (void) full_lines = 1; } _rl_move_vert (_rl_vis_botlin); - woff = W_OFFSET(_rl_vis_botlin, wrap_offset); + woff = W_OFFSET(_rl_vis_botlin, wrap_offset); /* XXX - WRAP_OFFSET? */ botline_length = VIS_LLEN(_rl_vis_botlin) - woff; /* If we've wrapped lines, remove the final xterm line-wrap flag. */ if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth) @@ -3327,7 +3454,7 @@ _rl_update_final (void) /* LAST_LINE includes invisible characters, so if you want to get the last character of the first line, you have to take WOFF into account. - This needs to be done for both calls to _rl_move_cursor_relative, + This needs to be done both for calls to _rl_move_cursor_relative, which takes a buffer position as the first argument, and any direct subscripts of LAST_LINE. */ last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */ diff --git a/doc/Makefile.in b/doc/Makefile.in index 20a3618..b0ac6d9 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,7 +1,7 @@ # This makefile for Readline library documentation is in -*- text -*- mode. # Emacs likes it that way. -# Copyright (C) 1996-2009 Free Software Foundation, Inc. +# Copyright (C) 1996-2024 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 @@ -38,7 +38,7 @@ man3ext = .3 man3dir = $(mandir)/$(manpfx)3 # set this to a value to have the HTML documentation installed -htmldir = +htmldir = @htmldir@ # Support an alternate destination root directory for package building DESTDIR = @@ -73,7 +73,7 @@ HISTSRC = $(srcdir)/history.texi $(srcdir)/hsuser.texi \ $(srcdir)/hstech.texi $(srcdir)/version.texi $(srcdir)/fdl.texi # This should be a program that converts troff to an ascii-readable format -NROFF = groff -Tascii +NROFF = groff -Tascii -P -c # This should be a program that converts troff to postscript GROFF = groff @@ -83,7 +83,7 @@ INFOOBJ = readline.info history.info rluserman.info PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps HTMLOBJ = readline.html history.html rluserman.html TEXTOBJ = readline.0 history.0 -PDFOBJ = readline.pdf history.pdf rluserman.pdf +PDFOBJ = readline.pdf history.pdf rluserman.pdf readline_3.pdf history_3.pdf INTERMEDIATE_OBJ = rlman.dvi @@ -95,9 +95,17 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ) $(PDFOBJ) $(RM) $@ -${NROFF} -man $< > $@ -.ps.pdf: +.3.pdf: $(RM) $@ - -${PSPDF} $< + -${GROFF} -man -T pdf $< > $@ + +.3.ps: + $(RM) $@ + -${GROFF} -man $< > $@ + +#.ps.pdf: +# $(RM) $@ +# -${PSPDF} $< .dvi.pdf: $(RM) $@ @@ -107,8 +115,9 @@ DIST_DOCS = $(DVIOBJ) $(PSOBJ) $(HTMLOBJ) $(INFOOBJ) $(TEXTOBJ) $(PDFOBJ) # $(RM) $@ # -${TEXI2PDF} $< -all: info dvi html ps text pdf +all: info html text pdf dvi nodvi: info html text +everything: all ps xdist: $(DIST_DOCS) @@ -120,24 +129,38 @@ text: $(TEXTOBJ) pdf: $(PDFOBJ) readline.dvi: $(RLSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rlman.texi - mv rlman.dvi readline.dvi + $(RM) $@ + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) -o $@ $(srcdir)/rlman.texi readline.info: $(RLSRC) + $(RM) $@ $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texi +readline.pdf: $(RLSRC) + $(RM) $@ + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) -o $@ $(srcdir)/rlman.texi + rluserman.dvi: $(RLSRC) + $(RM) $@ TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/rluserman.texi rluserman.info: $(RLSRC) + $(RM) $@ $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/rluserman.texi +rluserman.pdf: $(RLSRC) + $(RM) $@ + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) -o $@ $(srcdir)/rlman.texi + history.dvi: ${HISTSRC} TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/history.texi history.info: ${HISTSRC} $(MAKEINFO) --no-split -I $(TEXINPUTDIR) -o $@ $(srcdir)/history.texi +history.pdf: $(HISTSRC) + TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/history.texi + readline.ps: readline.dvi $(RM) $@ $(DVIPS) readline.dvi @@ -154,7 +177,7 @@ history.ps: history.dvi # This leaves readline.html and rlman.html -- rlman.html is for www.gnu.org # readline.html: ${RLSRC} - $(MAKEINFO) -o $@ --html --no-split -I$(TEXINPUTDIR) $(srcdir)/rlman.texi + $(MAKEINFO) -o $@ --html --no-split -I$(TEXINPUTDIR) -o $@ $(srcdir)/rlman.texi rlman.html: ${RLSRC} $(MAKEINFO) -o $@ --html --no-split -I$(TEXINPUTDIR) $(srcdir)/rlman.texi @@ -166,47 +189,47 @@ history.html: ${HISTSRC} $(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/history.texi readline.0: readline.3 +history.0: history.3 readline_3.ps: $(srcdir)/readline.3 - ${RM} $@ - ${GROFF} -man < $(srcdir)/readline.3 > $@ + $(RM) $@ + -${GROFF} -man $< > $@ -history.0: history.3 +readline_3.pdf: $(srcdir)/readline.3 + $(RM) $@ + -${GROFF} -man -T pdf $< > $@ history_3.ps: $(srcdir)/history.3 - ${RM} $@ - ${GROFF} -man < $(srcdir)/history.3 > $@ - -readline.pdf: $(RLSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/rlman.texi - mv rlman.pdf $@ + $(RM) $@ + -${GROFF} -man $< > $@ -history.pdf: $(HISTSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/history.texi +history_3.pdf: $(srcdir)/history.3 + $(RM) $@ + -${GROFF} -man -T pdf $< > $@ -rluserman.pdf: $(RLSRC) - TEXINPUTS=.:$(TEXINPUTDIR):$$TEXINPUTS $(TEXI2PDF) $(srcdir)/rluserman.texi +.PHONY: clean maintainer-clean distclean mostlyclean maybe-clean -clean: +mostlyclean: $(RM) *.aux *.bak *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps \ *.pgs *.bt *.bts *.rw *.rws *.fns *.kys *.tps *.vrs *.o \ core *.core -mostlyclean: clean +clean: mostlyclean distclean: clean maybe-clean $(RM) $(INTERMEDIATE_OBJ) $(RM) Makefile maybe-clean: - -if test "X$(topdir)" != "X.." && test "X$(topdir)" != "X$(BUILD_DIR)"; then \ + -TD=$$(cd $(topdir) && pwd -P) ; \ + BD=$$(cd $(BUILD_DIR) && pwd -P) ; \ + if test "X$$TD" != "X$$BD"; then \ $(RM) $(DIST_DOCS); \ fi maintainer-clean: clean $(RM) $(DIST_DOCS) $(RM) $(INTERMEDIATE_OBJ) - $(RM) $(PDFOBJ) $(RM) Makefile installdirs: $(topdir)/support/mkdirs @@ -259,6 +282,29 @@ install: installdirs fi ; \ fi +install-html: html + -if test -n "${htmldir}" ; then \ + if test -f readline.html; then \ + ${INSTALL_DATA} readline.html $(DESTDIR)$(htmldir)/readline.html; \ + else \ + ${INSTALL_DATA} $(srcdir)/readline.html $(DESTDIR)$(htmldir)/readline.html; \ + fi ; \ + if test -f history.html; then \ + ${INSTALL_DATA} history.html $(DESTDIR)$(htmldir)/history.html; \ + else \ + ${INSTALL_DATA} $(srcdir)/history.html $(DESTDIR)$(htmldir)/history.html; \ + fi ; \ + if test -f rluserman.html; then \ + ${INSTALL_DATA} rluserman.html $(DESTDIR)$(htmldir)/rluserman.html; \ + else \ + ${INSTALL_DATA} $(srcdir)/rluserman.html $(DESTDIR)$(htmldir)/rluserman.html; \ + fi ; \ + fi + +install-dvi: +install-pdf: +install-ps: + uninstall: $(RM) $(DESTDIR)$(infodir)/readline.info $(RM) $(DESTDIR)$(infodir)/rluserman.info @@ -270,3 +316,10 @@ uninstall: $(RM) $(DESTDIR)$(htmldir)/rluserman.html ; \ $(RM) $(DESTDIR)$(htmldir)/history.html ; \ fi + +uninstall-html: + -if test -n "${htmldir}" ; then \ + $(RM) $(DESTDIR)$(htmldir)/readline.html ; \ + $(RM) $(DESTDIR)$(htmldir)/rluserman.html ; \ + $(RM) $(DESTDIR)$(htmldir)/history.html ; \ + fi diff --git a/doc/history.0 b/doc/history.0 index 2bf3b1a..1b94885 100644 --- a/doc/history.0 +++ b/doc/history.0 @@ -1,23 +1,28 @@ -HISTORY(3) Library Functions Manual HISTORY(3) +_H_I_S_T_O_R_Y(3) Library Functions Manual _H_I_S_T_O_R_Y(3) - - -NAME +NNAAMMEE history - GNU History Library -COPYRIGHT - The GNU History Library is Copyright (C) 1989-2020 by the Free Software +CCOOPPYYRRIIGGHHTT + The GNU History Library is Copyright (C) 1989-2025 by the Free Software Foundation, Inc. -DESCRIPTION - Many programs read input from the user a line at a time. The GNU His- - tory library is able to keep track of those lines, associate arbitrary - data with each line, and utilize information from previous lines in +DDEESSCCRRIIPPTTIIOONN + Many programs read input from the user a line at a time. The GNU His- + tory library is able to keep track of those lines, associate arbitrary + data with each line, and utilize information from previous lines when composing new ones. -HISTORY EXPANSION - The history library supports a history expansion feature that is iden- - tical to the history expansion in bash. This section describes what + The History library provides functions that allow applications to their + _h_i_s_t_o_r_y, the set of previously-typed lines, which it keeps in a list. + Applications can choose which lines to save into a history list, how + many commands to save, save a history list to a file, read a history + list from a file, and display lines from the history in various for- + mats. + +HHIISSTTOORRYY EEXXPPAANNSSIIOONN + The history library supports a history expansion feature that is iden- + tical to the history expansion in bbaasshh. This section describes what syntax features are available. History expansions introduce words from the history list into the input @@ -25,116 +30,139 @@ HISTORY(3) Library Functions Manual HISTORY(3) previous command into the current input line, or fix errors in previous commands quickly. - History expansion is usually performed immediately after a complete - line is read. It takes place in two parts. The first is to determine - which line from the history list to use during substitution. The sec- - ond is to select portions of that line for inclusion into the current - one. The line selected from the history is the event, and the portions - of that line that are acted upon are words. Various modifiers are - available to manipulate the selected words. The line is broken into - words in the same fashion as bash does when reading input, so that sev- - eral words that would otherwise be separated are considered one word - when surrounded by quotes (see the description of history_tokenize() - below). History expansions are introduced by the appearance of the - history expansion character, which is ! by default. Only backslash (\) - and single quotes can quote the history expansion character. - - Event Designators - An event designator is a reference to a command line entry in the his- - tory list. Unless the reference is absolute, events are relative to - the current position in the history list. - - ! Start a history substitution, except when followed by a blank, - newline, = or (. - !n Refer to command line n. - !-n Refer to the current command minus n. - !! Refer to the previous command. This is a synonym for `!-1'. - !string - Refer to the most recent command preceding the current position - in the history list starting with string. - !?string[?] + History expansion is usually performed immediately after a complete + line is read. It takes place in two parts. The first is to determine + which history list entry to use during substitution. The second is to + select portions of that entry to include into the current one. + + The entry selected from the history is the _e_v_e_n_t, and the portions of + that entry that are acted upon are _w_o_r_d_s. Various _m_o_d_i_f_i_e_r_s are avail- + able to manipulate the selected words. The entry is split into words + in the same fashion as bbaasshh does when reading input, so that several + words that would otherwise be separated are considered one word when + surrounded by quotes (see the description of hhiissttoorryy__ttookkeenniizzee(()) below). + The _e_v_e_n_t _d_e_s_i_g_n_a_t_o_r selects the event, the optional _w_o_r_d _d_e_s_i_g_n_a_t_o_r + selects words from the event, and various optional _m_o_d_i_f_i_e_r_s are avail- + able to manipulate the selected words. + + History expansions are introduced by the appearance of the history ex- + pansion character, which is !! by default. History expansions may ap- + pear anywhere in the input, but do not nest. + + Only backslash (\\) and single quotes can quote the history expansion + character. + + There is a special abbreviation for substitution, active when the _q_u_i_c_k + _s_u_b_s_t_i_t_u_t_i_o_n character (default ^^) is the first character on the line. + It selects the previous history list entry, using an event designator + equivalent to !!!!, and substitutes one string for another in that entry. + It is described below under EEvveenntt DDeessiiggnnaattoorrss. This is the only his- + tory expansion that does not begin with the history expansion charac- + ter. + + EEvveenntt DDeessiiggnnaattoorrss + An event designator is a reference to an entry in the history list. + The event designator consists of the portion of the word beginning with + the history expansion character and ending with the word designator if + present, or the end of the word. Unless the reference is absolute, + events are relative to the current position in the history list. + + !! Start a history substitution, except when followed by a bbllaannkk, + newline, carriage return, =, or (. + !!_n Refer to history list entry _n. + !!--_n Refer to the current entry minus _n. + !!!! Refer to the previous entry. This is a synonym for "!-1". + !!_s_t_r_i_n_g Refer to the most recent command preceding the current position - in the history list containing string. The trailing ? may be - omitted if string is followed immediately by a newline. If - string is missing, the string from the most recent search is - used; it is an error if there is no previous search string. - ^string1^string2^ - Quick substitution. Repeat the last command, replacing string1 - with string2. Equivalent to ``!!:s^string1^string2^'' (see Mod- - ifiers below). - !# The entire command line typed so far. - - Word Designators - Word designators are used to select desired words from the event. A : - separates the event specification from the word designator. It may be - omitted if the word designator begins with a ^, $, *, -, or %. Words - are numbered from the beginning of the line, with the first word being - denoted by 0 (zero). Words are inserted into the current line sepa- - rated by single spaces. - - 0 (zero) - The zeroth word. For the shell, this is the command word. - n The nth word. - ^ The first argument. That is, word 1. - $ The last word. This is usually the last argument, but will ex- - pand to the zeroth word if there is only one word in the line. - % The first word matched by the most recent `?string?' search, if - the search string begins with a character that is part of a - word. - x-y A range of words; `-y' abbreviates `0-y'. - * All of the words but the zeroth. This is a synonym for `1-$'. - It is not an error to use * if there is just one word in the - event; the empty string is returned in that case. - x* Abbreviates x-$. - x- Abbreviates x-$ like x*, but omits the last word. If x is miss- + in the history list starting with _s_t_r_i_n_g. + !!??_s_t_r_i_n_g[[??]] + Refer to the most recent command preceding the current position + in the history list containing _s_t_r_i_n_g. The trailing ?? may be + omitted if _s_t_r_i_n_g is followed immediately by a newline. If + _s_t_r_i_n_g is missing, this uses the string from the most recent + search; it is an error if there is no previous search string. + ^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^ + Quick substitution. Repeat the previous command, replacing + _s_t_r_i_n_g_1 with _s_t_r_i_n_g_2. Equivalent to "!!:s^_s_t_r_i_n_g_1^_s_t_r_i_n_g_2^" + (see MMooddiiffiieerrss below). + !!## The entire command line typed so far. + + WWoorrdd DDeessiiggnnaattoorrss + Word designators are used to select desired words from the event. They + are optional; if the word designator isn't supplied, the history expan- + sion uses the entire event. A :: separates the event specification from + the word designator. It may be omitted if the word designator begins + with a ^^, $$, **, --, or %%. Words are numbered from the beginning of the + line, with the first word being denoted by 0 (zero). Words are in- + serted into the current line separated by single spaces. + + 00 ((zzeerroo)) + The zeroth word. For the shell, and many other applications, + this is the command word. + _n The _nth word. + ^^ The first argument: word 1. + $$ The last word. This is usually the last argument, but expands + to the zeroth word if there is only one word in the line. + %% The first word matched by the most recent "?_s_t_r_i_n_g?" search, if + the search string begins with a character that is part of a + word. By default, searches begin at the end of each line and + proceed to the beginning, so the first word matched is the one + closest to the end of the line. + _x--_y A range of words; "-_y" abbreviates "0-_y". + ** All of the words but the zeroth. This is a synonym for "_1_-_$". + It is not an error to use ** if there is just one word in the + event; it expands to the empty string in that case. + xx** Abbreviates _x_-_$. + xx-- Abbreviates _x_-_$ like xx**, but omits the last word. If xx is miss- ing, it defaults to 0. If a word designator is supplied without an event specification, the - previous command is used as the event. - - Modifiers - After the optional word designator, there may appear a sequence of one - or more of the following modifiers, each preceded by a `:'. These mod- - ify, or edit, the word or words selected from the history event. - - h Remove a trailing file name component, leaving only the head. - t Remove all leading file name components, leaving the tail. - r Remove a trailing suffix of the form .xxx, leaving the basename. - e Remove all but the trailing suffix. - p Print the new command but do not execute it. - q Quote the substituted words, escaping further substitutions. - x Quote the substituted words as with q, but break into words at - blanks and newlines. The q and x modifiers are mutually exclu- - sive; the last one supplied is used. - s/old/new/ - Substitute new for the first occurrence of old in the event + previous command is used as the event, equivalent to !!!!. + + MMooddiiffiieerrss + After the optional word designator, the expansion may include a se- + quence of one or more of the following modifiers, each preceded by a + ":". These modify, or edit, the word or words selected from the his- + tory event. + + hh Remove a trailing filename component, leaving only the head. + tt Remove all leading filename components, leaving the tail. + rr Remove a trailing suffix of the form _._x_x_x, leaving the basename. + ee Remove all but the trailing suffix. + pp Print the new command but do not execute it. + qq Quote the substituted words, escaping further substitutions. + xx Quote the substituted words as with qq, but break into words at + bbllaannkkss and newlines. The qq and xx modifiers are mutually exclu- + sive; expansion uses the last one supplied. + ss//_o_l_d//_n_e_w// + Substitute _n_e_w for the first occurrence of _o_l_d in the event line. Any character may be used as the delimiter in place of /. The final delimiter is optional if it is the last character of - the event line. The delimiter may be quoted in old and new with - a single backslash. If & appears in new, it is replaced by old. - A single backslash will quote the &. If old is null, it is set - to the last old substituted, or, if no previous history substi- - tutions took place, the last string in a !?string[?] search. - If new is null, each matching old is deleted. - & Repeat the previous substitution. - g Cause changes to be applied over the entire event line. This is - used in conjunction with `:s' (e.g., `:gs/old/new/') or `:&'. - If used with `:s', any delimiter can be used in place of /, and + the event line. A single backslash quotes the delimiter in _o_l_d + and _n_e_w. If & appears in _n_e_w, it is replaced with _o_l_d. A sin- + gle backslash quotes the &. If _o_l_d is null, it is set to the + last _o_l_d substituted, or, if no previous history substitutions + took place, the last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]] search. If _n_e_w is + null, each matching _o_l_d is deleted. + && Repeat the previous substitution. + gg Cause changes to be applied over the entire event line. This is + used in conjunction with "::ss" (e.g., "::ggss//_o_l_d//_n_e_w//") or "::&&". + If used with "::ss", any delimiter can be used in place of /, and the final delimiter is optional if it is the last character of - the event line. An a may be used as a synonym for g. - G Apply the following `s' or `&' modifier once to each word in the + the event line. An aa may be used as a synonym for gg. + GG Apply the following "ss" or "&&" modifier once to each word in the event line. -PROGRAMMING WITH HISTORY FUNCTIONS - This section describes how to use the History library in other pro- +PPRROOGGRRAAMMMMIINNGG WWIITTHH HHIISSTTOORRYY FFUUNNCCTTIIOONNSS + This section describes how to use the History library in other pro- grams. - Introduction to History - A programmer using the History library has available functions for re- - membering lines on a history list, associating arbitrary data with a - line, removing lines from the list, searching through the list for a - line containing an arbitrary text string, and referencing any line in - the list directly. In addition, a history expansion function is avail- + IInnttrroodduuccttiioonn ttoo HHiissttoorryy + A programmer using the History library has available functions for re- + membering lines on a history list, associating arbitrary data with a + line, removing lines from the list, searching through the list for a + line containing an arbitrary text string, and referencing any line in + the list directly. In addition, a history _e_x_p_a_n_s_i_o_n function is avail- able which provides for a consistent user interface across different programs. @@ -142,24 +170,24 @@ HISTORY(3) Library Functions Manual HISTORY(3) fit of a consistent user interface with a set of well-known commands for manipulating the text of previous lines and using that text in new commands. The basic history manipulation commands are identical to the - history substitution provided by bash. + history substitution provided by bbaasshh. - The programmer can also use the readline library, which includes some + The programmer can also use the readline library, which includes some history manipulation by default, and has the added advantage of command line editing. Before declaring any functions using any functionality the History li- brary provides in other code, an application writer should include the - file  in any file that uses the History library's + file _<_r_e_a_d_l_i_n_e_/_h_i_s_t_o_r_y_._h_> in any file that uses the History library's features. It supplies extern declarations for all of the library's public functions and variables, and declares all of the public data structures. - History Storage + HHiissttoorryy SSttoorraaggee The history list is an array of history entries. A history entry is declared as follows: - typedef void * histdata_t; + _t_y_p_e_d_e_f _v_o_i_d _* hhiissttddaattaa__tt;; typedef struct _hist_entry { char *line; @@ -169,7 +197,7 @@ HISTORY(3) Library Functions Manual HISTORY(3) The history list itself might therefore be declared as - HIST_ENTRY ** the_history_list; + _H_I_S_T___E_N_T_R_Y _*_* tthhee__hhiissttoorryy__lliisstt;; The state of the History library is encapsulated into a single struc- ture: @@ -178,328 +206,330 @@ HISTORY(3) Library Functions Manual HISTORY(3) * A structure used to pass around the current state of the history. */ typedef struct _hist_state { - HIST_ENTRY **entries; /* Pointer to the entries themselves. */ - int offset; /* The location pointer within this array. */ - int length; /* Number of elements within this array. */ - int size; /* Number of slots allocated to this array. */ + HIST_ENTRY **entries; /* Pointer to entry records. */ + int offset; /* The current record. */ + int length; /* Number of records in list. */ + int size; /* Number of records allocated. */ int flags; } HISTORY_STATE; - If the flags member includes HS_STIFLED, the history has been stifled. + If the flags member includes HHSS__SSTTIIFFLLEEDD, the history has been stifled. -History Functions +HHiissttoorryy FFuunnccttiioonnss This section describes the calling sequence for the various functions exported by the GNU History library. - Initializing History and State Management + IInniittiiaalliizziinngg HHiissttoorryy aanndd SSttaattee MMaannaaggeemmeenntt This section describes functions used to initialize and manage the state of the History library when you want to use the history functions in your program. - void using_history (void) - Begin a session in which the history functions might be used. This + _v_o_i_d uussiinngg__hhiissttoorryy (_v_o_i_d) + Begin a session in which the history functions might be used. This initializes the interactive variables. - HISTORY_STATE * history_get_history_state (void) + _H_I_S_T_O_R_Y___S_T_A_T_E _* hhiissttoorryy__ggeett__hhiissttoorryy__ssttaattee (_v_o_i_d) Return a structure describing the current state of the input history. - void history_set_history_state (HISTORY_STATE *state) - Set the state of the history list according to state. + _v_o_i_d hhiissttoorryy__sseett__hhiissttoorryy__ssttaattee (_H_I_S_T_O_R_Y___S_T_A_T_E _*_s_t_a_t_e) + Set the state of the history list according to _s_t_a_t_e. - - History List Management - These functions manage individual entries on the history list, or set + HHiissttoorryy LLiisstt MMaannaaggeemmeenntt + These functions manage individual entries on the history list, or set parameters managing the list itself. - void add_history (const char *string) - Place string at the end of the history list. The associated data field - (if any) is set to NULL. If the maximum number of history entries has - been set using stifle_history(), and the new number of history entries + _v_o_i_d aadddd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) + Place _s_t_r_i_n_g at the end of the history list. The associated data field + (if any) is set to NNUULLLL. If the maximum number of history entries has + been set using ssttiiffllee__hhiissttoorryy(()), and the new number of history entries would exceed that maximum, the oldest history entry is removed. - void add_history_time (const char *string) + _v_o_i_d aadddd__hhiissttoorryy__ttiimmee (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) Change the time stamp associated with the most recent history entry to - string. + _s_t_r_i_n_g. - HIST_ENTRY * remove_history (int which) - Remove history entry at offset which from the history. The removed el- + _H_I_S_T___E_N_T_R_Y _* rreemmoovvee__hhiissttoorryy (_i_n_t _w_h_i_c_h) + Remove history entry at offset _w_h_i_c_h from the history. The removed el- ement is returned so you can free the line, data, and containing struc- ture. - histdata_t free_history_entry (HIST_ENTRY *histent) - Free the history entry histent and any history library private data as- - sociated with it. Returns the application-specific data so the caller + _h_i_s_t_d_a_t_a___t ffrreeee__hhiissttoorryy__eennttrryy (_H_I_S_T___E_N_T_R_Y _*_h_i_s_t_e_n_t) + Free the history entry _h_i_s_t_e_n_t and any history library private data as- + sociated with it. Returns the application-specific data so the caller can dispose of it. - HIST_ENTRY * replace_history_entry (int which, const char *line, hist- - data_t data) - Make the history entry at offset which have line and data. This re- - turns the old entry so the caller can dispose of any application-spe- - cific data. In the case of an invalid which, a NULL pointer is re- + _H_I_S_T___E_N_T_R_Y _* rreeppllaaccee__hhiissttoorryy__eennttrryy (_i_n_t _w_h_i_c_h_, _c_o_n_s_t _c_h_a_r _*_l_i_n_e_, _h_i_s_t_- + _d_a_t_a___t _d_a_t_a) + Make the history entry at offset _w_h_i_c_h have _l_i_n_e and _d_a_t_a. This re- + turns the old entry so the caller can dispose of any application-spe- + cific data. In the case of an invalid _w_h_i_c_h, a NNUULLLL pointer is re- turned. - void clear_history (void) + _v_o_i_d cclleeaarr__hhiissttoorryy (_v_o_i_d) Clear the history list by deleting all the entries. - void stifle_history (int max) - Stifle the history list, remembering only the last max entries. The - history list will contain only max entries at a time. + _v_o_i_d ssttiiffllee__hhiissttoorryy (_i_n_t _m_a_x) + Stifle the history list, remembering only the last _m_a_x entries. The + history list will contain only _m_a_x entries at a time. - int unstifle_history (void) - Stop stifling the history. This returns the previously-set maximum - number of history entries (as set by stifle_history()). history was + _i_n_t uunnssttiiffllee__hhiissttoorryy (_v_o_i_d) + Stop stifling the history. This returns the previously-set maximum + number of history entries (as set by ssttiiffllee__hhiissttoorryy(())). history was stifled. The value is positive if the history was stifled, negative if it wasn't. - int history_is_stifled (void) + _i_n_t hhiissttoorryy__iiss__ssttiifflleedd (_v_o_i_d) Returns non-zero if the history is stifled, zero if it is not. - - Information About the History List + IInnffoorrmmaattiioonn AAbboouutt tthhee HHiissttoorryy LLiisstt These functions return information about the entire history list or in- dividual list entries. - HIST_ENTRY ** history_list (void) - Return a NULL terminated array of HIST_ENTRY * which is the current in- + _H_I_S_T___E_N_T_R_Y _*_* hhiissttoorryy__lliisstt (_v_o_i_d) + Return a NNUULLLL terminated array of _H_I_S_T___E_N_T_R_Y _* which is the current in- put history. Element 0 of this list is the beginning of time. If - there is no history, return NULL. + there is no history, return NNUULLLL. - int where_history (void) + _i_n_t wwhheerree__hhiissttoorryy (_v_o_i_d) Returns the offset of the current history element. - HIST_ENTRY * current_history (void) + _H_I_S_T___E_N_T_R_Y _* ccuurrrreenntt__hhiissttoorryy (_v_o_i_d) Return the history entry at the current position, as determined by - where_history(). If there is no entry there, return a NULL pointer. + wwhheerree__hhiissttoorryy(()). If there is no entry there, return a NNUULLLL pointer. - HIST_ENTRY * history_get (int offset) - Return the history entry at position offset. The range of valid values - of offset starts at history_base and ends at history_length - 1. If - there is no entry there, or if offset is outside the valid range, re- - turn a NULL pointer. + _H_I_S_T___E_N_T_R_Y _* hhiissttoorryy__ggeett (_i_n_t _o_f_f_s_e_t) + Return the history entry at position _o_f_f_s_e_t. The range of valid values + of _o_f_f_s_e_t starts at hhiissttoorryy__bbaassee and ends at hhiissttoorryy__lleennggtthh - 1. If + there is no entry there, or if _o_f_f_s_e_t is outside the valid range, re- + turn a NNUULLLL pointer. - time_t history_get_time (HIST_ENTRY *) - Return the time stamp associated with the history entry passed as the + _t_i_m_e___t hhiissttoorryy__ggeett__ttiimmee (_H_I_S_T___E_N_T_R_Y _*) + Return the time stamp associated with the history entry passed as the argument. - int history_total_bytes (void) - Return the number of bytes that the primary history entries are using. - This function returns the sum of the lengths of all the lines in the + _i_n_t hhiissttoorryy__ttoottaall__bbyytteess (_v_o_i_d) + Return the number of bytes that the primary history entries are using. + This function returns the sum of the lengths of all the lines in the history. - - Moving Around the History List + MMoovviinngg AArroouunndd tthhee HHiissttoorryy LLiisstt These functions allow the current index into the history list to be set or changed. - int history_set_pos (int pos) - Set the current history offset to pos, an absolute index into the list. - Returns 1 on success, 0 if pos is less than zero or greater than the + _i_n_t hhiissttoorryy__sseett__ppooss (_i_n_t _p_o_s) + Set the current history offset to _p_o_s, an absolute index into the list. + Returns 1 on success, 0 if _p_o_s is less than zero or greater than the number of history entries. - HIST_ENTRY * previous_history (void) - Back up the current history offset to the previous history entry, and - return a pointer to that entry. If there is no previous entry, return - a NULL pointer. + _H_I_S_T___E_N_T_R_Y _* pprreevviioouuss__hhiissttoorryy (_v_o_i_d) + Back up the current history offset to the previous history entry, and + return a pointer to that entry. If there is no previous entry, return + a NNUULLLL pointer. - HIST_ENTRY * next_history (void) - If the current history offset refers to a valid history entry, incre- - ment the current history offset. If the possibly-incremented history + _H_I_S_T___E_N_T_R_Y _* nneexxtt__hhiissttoorryy (_v_o_i_d) + If the current history offset refers to a valid history entry, incre- + ment the current history offset. If the possibly-incremented history offset refers to a valid history entry, return a pointer to that entry; - otherwise, return a NULL pointer. - + otherwise, return a NNUULLLL pointer. - Searching the History List + SSeeaarrcchhiinngg tthhee HHiissttoorryy LLiisstt These functions allow searching of the history list for entries con- taining a specific string. Searching may be performed both forward and - backward from the current history position. The search may be an- - chored, meaning that the string must match at the beginning of the his- + backward from the current history position. The search may be _a_n_- + _c_h_o_r_e_d, meaning that the string must match at the beginning of the his- tory entry. - int history_search (const char *string, int direction) - Search the history for string, starting at the current history offset. - If direction is less than 0, then the search is through previous en- - tries, otherwise through subsequent entries. If string is found, then + _i_n_t hhiissttoorryy__sseeaarrcchh (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n) + Search the history for _s_t_r_i_n_g, starting at the current history offset. + If _d_i_r_e_c_t_i_o_n is less than 0, then the search is through previous en- + tries, otherwise through subsequent entries. If _s_t_r_i_n_g is found, then the current history index is set to that history entry, and the value - returned is the offset in the line of the entry where string was found. - Otherwise, nothing is changed, and a -1 is returned. - - int history_search_prefix (const char *string, int direction) - Search the history for string, starting at the current history offset. - The search is anchored: matching lines must begin with string. If di- - rection is less than 0, then the search is through previous entries, - otherwise through subsequent entries. If string is found, then the - current history index is set to that entry, and the return value is 0. - Otherwise, nothing is changed, and a -1 is returned. - - int history_search_pos (const char *string, int direction, int pos) - Search for string in the history list, starting at pos, an absolute in- - dex into the list. If direction is negative, the search proceeds back- - ward from pos, otherwise forward. Returns the absolute index of the - history element where string was found, or -1 otherwise. - - - Managing the History File - The History library can read the history from and write it to a file. + returned is the offset in the line of the entry where _s_t_r_i_n_g was found. + Otherwise, nothing is changed, and the function returns -1. + + _i_n_t hhiissttoorryy__sseeaarrcchh__pprreeffiixx (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n) + Search the history for _s_t_r_i_n_g, starting at the current history offset. + The search is anchored: matching lines must begin with _s_t_r_i_n_g. If _d_i_- + _r_e_c_t_i_o_n is less than 0, then the search is through previous entries, + otherwise through subsequent entries. If _s_t_r_i_n_g is found, then the + current history index is set to that entry, and the return value is 0. + Otherwise, nothing is changed, and the function returns -1. + + _i_n_t hhiissttoorryy__sseeaarrcchh__ppooss (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n_, _i_n_t _p_o_s) + Search for _s_t_r_i_n_g in the history list, starting at _p_o_s, an absolute in- + dex into the list. If _d_i_r_e_c_t_i_o_n is negative, the search proceeds back- + ward from _p_o_s, otherwise forward. Returns the absolute index of the + history element where _s_t_r_i_n_g was found, or -1 otherwise. + + MMaannaaggiinngg tthhee HHiissttoorryy FFiillee + The History library can read the history from and write it to a file. This section documents the functions for managing a history file. - int read_history (const char *filename) - Add the contents of filename to the history list, a line at a time. If - filename is NULL, then read from ~/.history. Returns 0 if successful, - or errno if not. - - int read_history_range (const char *filename, int from, int to) - Read a range of lines from filename, adding them to the history list. - Start reading at line from and end at to. If from is zero, start at - the beginning. If to is less than from, then read until the end of the - file. If filename is NULL, then read from ~/.history. Returns 0 if - successful, or errno if not. - - int write_history (const char *filename) - Write the current history to filename, overwriting filename if neces- - sary. If filename is NULL, then write the history list to ~/.history. - Returns 0 on success, or errno on a read or write error. - - - int append_history (int nelements, const char *filename) - Append the last nelements of the history list to filename. If filename - is NULL, then append to ~/.history. Returns 0 on success, or errno on + _i_n_t rreeaadd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) + Add the contents of _f_i_l_e_n_a_m_e to the history list, a line at a time. If + _f_i_l_e_n_a_m_e is NNUULLLL, then read from _~_/_._h_i_s_t_o_r_y. Returns 0 if successful, + or eerrrrnnoo if not. + + _i_n_t rreeaadd__hhiissttoorryy__rraannggee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t _f_r_o_m_, _i_n_t _t_o) + Read a range of lines from _f_i_l_e_n_a_m_e, adding them to the history list. + Start reading at line _f_r_o_m and end at _t_o. If _f_r_o_m is zero, start at + the beginning. If _t_o is less than _f_r_o_m, then read until the end of the + file. If _f_i_l_e_n_a_m_e is NNUULLLL, then read from _~_/_._h_i_s_t_o_r_y. Returns 0 if + successful, or eerrrrnnoo if not. + + _i_n_t wwrriittee__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) + Write the current history to _f_i_l_e_n_a_m_e, overwriting _f_i_l_e_n_a_m_e if neces- + sary. If _f_i_l_e_n_a_m_e is NNUULLLL, then write the history list to _~_/_._h_i_s_t_o_r_y. + Returns 0 on success, or eerrrrnnoo on a read or write error. + + _i_n_t aappppeenndd__hhiissttoorryy (_i_n_t _n_e_l_e_m_e_n_t_s_, _c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e) + Append the last _n_e_l_e_m_e_n_t_s of the history list to _f_i_l_e_n_a_m_e. If _f_i_l_e_n_a_m_e + is NNUULLLL, then append to _~_/_._h_i_s_t_o_r_y. Returns 0 on success, or eerrrrnnoo on a read or write error. - int history_truncate_file (const char *filename, int nlines) - Truncate the history file filename, leaving only the last nlines lines. - If filename is NULL, then ~/.history is truncated. Returns 0 on suc- - cess, or errno on failure. + _i_n_t hhiissttoorryy__ttrruunnccaattee__ffiillee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t _n_l_i_n_e_s) + Truncate the history file _f_i_l_e_n_a_m_e, leaving only the last _n_l_i_n_e_s lines. + If _f_i_l_e_n_a_m_e is NNUULLLL, then _~_/_._h_i_s_t_o_r_y is truncated. Returns 0 on suc- + cess, or eerrrrnnoo on failure. - - History Expansion + HHiissttoorryy EExxppaannssiioonn These functions implement history expansion. - int history_expand (char *string, char **output) - Expand string, placing the result into output, a pointer to a string. + _i_n_t hhiissttoorryy__eexxppaanndd (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _c_h_a_r _*_*_o_u_t_p_u_t) + Expand _s_t_r_i_n_g, placing the result into _o_u_t_p_u_t, a pointer to a string. Returns: - 0 If no expansions took place (or, if the only change in - the text was the removal of escape characters preceding + 0 If no expansions took place (or, if the only change in + the text was the removal of escape characters preceding the history expansion character); 1 if expansions did take place; -1 if there was an error in expansion; - 2 if the returned line should be displayed, but not exe- - cuted, as with the :p modifier. - If an error occurred in expansion, then output contains a descriptive + 2 if the returned line should be displayed, but not exe- + cuted, as with the ::pp modifier. + If an error occurred in expansion, then _o_u_t_p_u_t contains a descriptive error message. - char * get_history_event (const char *string, int *cindex, int qchar) - Returns the text of the history event beginning at string + *cindex. - *cindex is modified to point to after the event specifier. At function - entry, cindex points to the index into string where the history event - specification begins. qchar is a character that is allowed to end the - event specification in addition to the ``normal'' terminating charac- - ters. - - char ** history_tokenize (const char *string) - Return an array of tokens parsed out of string, much as the shell - might. The tokens are split on the characters in the history_word_de- - limiters variable, and shell quoting conventions are obeyed. + _c_h_a_r _* ggeett__hhiissttoorryy__eevveenntt (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _*_c_i_n_d_e_x_, _i_n_t _q_c_h_a_r) + Returns the text of the history event beginning at _s_t_r_i_n_g + _*_c_i_n_d_e_x. + _*_c_i_n_d_e_x is modified to point to after the event specifier. At function + entry, _c_i_n_d_e_x points to the index into _s_t_r_i_n_g where the history event + specification begins. _q_c_h_a_r is a character that is allowed to end the + event specification in addition to the "normal" terminating characters. - char * history_arg_extract (int first, int last, const char *string) - Extract a string segment consisting of the first through last arguments - present in string. Arguments are split using history_tokenize(). + _c_h_a_r _*_* hhiissttoorryy__ttookkeenniizzee (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) + Return an array of tokens parsed out of _s_t_r_i_n_g, much as the shell + might. The tokens are split on the characters in the hhiissttoorryy__wwoorrdd__ddee-- + lliimmiitteerrss variable, and shell quoting conventions are obeyed. + _c_h_a_r _* hhiissttoorryy__aarrgg__eexxttrraacctt (_i_n_t _f_i_r_s_t_, _i_n_t _l_a_s_t_, _c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g) + Extract a string segment consisting of the _f_i_r_s_t through _l_a_s_t arguments + present in _s_t_r_i_n_g. Arguments are split using hhiissttoorryy__ttookkeenniizzee(()). - History Variables + HHiissttoorryy VVaarriiaabblleess This section describes the externally-visible variables exported by the GNU History Library. - int history_base + _i_n_t hhiissttoorryy__bbaassee The logical offset of the first entry in the history list. - int history_length + _i_n_t hhiissttoorryy__lleennggtthh The number of entries currently stored in the history list. - int history_max_entries - The maximum number of history entries. This must be changed using sti- - fle_history(). + _i_n_t hhiissttoorryy__mmaaxx__eennttrriieess + The maximum number of history entries. This must be changed using ssttii-- + ffllee__hhiissttoorryy(()). - int history_write_timestamps + _i_n_t hhiissttoorryy__wwrriittee__ttiimmeessttaammppss If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, meaning that time- stamps are not saved. The current timestamp format uses the value of - history_comment_char to delimit timestamp entries in the history file. - If that variable does not have a value (the default), timestamps will - not be written. + _h_i_s_t_o_r_y___c_o_m_m_e_n_t___c_h_a_r to delimit timestamp entries in the history file. + If that variable does not have a value (the default), the history li- + brary will not write timestamps. - char history_expansion_char - The character that introduces a history event. The default is !. Set- + _c_h_a_r hhiissttoorryy__eexxppaannssiioonn__cchhaarr + The character that introduces a history event. The default is !!. Set- ting this to 0 inhibits history expansion. - char history_subst_char + _c_h_a_r hhiissttoorryy__ssuubbsstt__cchhaarr The character that invokes word substitution if found at the start of a - line. The default is ^. + line. The default is ^^. - char history_comment_char + _c_h_a_r hhiissttoorryy__ccoommmmeenntt__cchhaarr During tokenization, if this character is seen as the first character of a word, then it and all subsequent characters up to a newline are ignored, suppressing history expansion for the remainder of the line. This is disabled by default. - char * history_word_delimiters - The characters that separate tokens for history_tokenize(). The de- - fault value is " \t\n()<>;&|". + _c_h_a_r _* hhiissttoorryy__wwoorrdd__ddeelliimmiitteerrss + The characters that separate tokens for hhiissttoorryy__ttookkeenniizzee(()). The de- + fault value is "" \\tt\\nn(())<<>>;;&&||"". - char * history_no_expand_chars + _c_h_a_r _* hhiissttoorryy__nnoo__eexxppaanndd__cchhaarrss The list of characters which inhibit history expansion if found immedi- - ately following history_expansion_char. The default is space, tab, - newline, \r, and =. + ately following hhiissttoorryy__eexxppaannssiioonn__cchhaarr. The default is space, tab, + newline, \\rr, and ==. - char * history_search_delimiter_chars - The list of additional characters which can delimit a history search - string, in addition to space, tab, : and ? in the case of a substring + _c_h_a_r _* hhiissttoorryy__sseeaarrcchh__ddeelliimmiitteerr__cchhaarrss + The list of additional characters which can delimit a history search + string, in addition to space, tab, _: and _? in the case of a substring search. The default is empty. - int history_quotes_inhibit_expansion - If non-zero, double-quoted words are not scanned for the history expan- - sion character or the history comment character. The default value is - 0. - - rl_linebuf_func_t * history_inhibit_expansion_function - This should be set to the address of a function that takes two argu- - ments: a char * (string) and an int index into that string (i). It - should return a non-zero value if the history expansion starting at - string[i] should not be performed; zero if the expansion should be - done. It is intended for use by applications like bash that use the - history expansion character for additional purposes. By default, this - variable is set to NULL. - -FILES - ~/.history + _i_n_t hhiissttoorryy__qquuootteess__iinnhhiibbiitt__eexxppaannssiioonn + If non-zero, the history expansion code implements shell-like quoting: + single-quoted words are not scanned for the history expansion character + or the history comment character, and double-quoted words may have his- + tory expansion performed, since single quotes are not special within + double quotes. The default value is 0. + + _i_n_t hhiissttoorryy__qquuoottiinngg__ssttaattee + An application may set this variable to indicate that the current line + being expanded is subject to existing quoting. If set to _', history + expansion assumes that the line is single-quoted and inhibit expansion + until it reads an unquoted closing single quote; if set to _", history + expansion assumes the line is double quoted until it reads an unquoted + closing double quote. If set to zero, the default, history expansion + assumes the line is not quoted and treats quote characters within the + line as described above. This is only effective if hhiissttoorryy__qquuootteess__iinn-- + hhiibbiitt__eexxppaannssiioonn is set. + + _r_l___l_i_n_e_b_u_f___f_u_n_c___t _* hhiissttoorryy__iinnhhiibbiitt__eexxppaannssiioonn__ffuunnccttiioonn + This should be set to the address of a function that takes two argu- + ments: a cchhaarr ** (_s_t_r_i_n_g) and an iinntt index into that string (_i). It + should return a non-zero value if the history expansion starting at + _s_t_r_i_n_g_[_i_] should not be performed; zero if the expansion should be + done. It is intended for use by applications like bbaasshh that use the + history expansion character for additional purposes. By default, this + variable is set to NNUULLLL. + +FFIILLEESS + _~_/_._h_i_s_t_o_r_y Default filename for reading and writing saved history -SEE ALSO - The Gnu Readline Library, Brian Fox and Chet Ramey - The Gnu History Library, Brian Fox and Chet Ramey - bash(1) - readline(3) +SSEEEE AALLSSOO + _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey + _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey + _b_a_s_h(1) + _r_e_a_d_l_i_n_e(3) -AUTHORS +AAUUTTHHOORRSS Brian Fox, Free Software Foundation bfox@gnu.org Chet Ramey, Case Western Reserve University chet.ramey@case.edu -BUG REPORTS - If you find a bug in the history library, you should report it. But - first, you should make sure that it really is a bug, and that it ap- - pears in the latest version of the history library that you have. +BBUUGG RREEPPOORRTTSS + If you find a bug in the hhiissttoorryy library, you should report it. But + first, you should make sure that it really is a bug, and that it ap- + pears in the latest version of the hhiissttoorryy library that you have. - Once you have determined that a bug actually exists, mail a bug report - to bug-readline@gnu.org. If you have a fix, you are welcome to mail - that as well! Suggestions and `philosophical' bug reports may be - mailed to bug-readline@gnu.org or posted to the Usenet newsgroup - gnu.bash.bug. + Once you have determined that a bug actually exists, mail a bug report + to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix, you are welcome to mail + that as well! Suggestions and "philosophical" bug reports may be + mailed to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g or posted to the Usenet newsgroup + ggnnuu..bbaasshh..bbuugg. Comments and bug reports concerning this manual page should be directed - to chet.ramey@case.edu. - - + to _c_h_e_t_._r_a_m_e_y_@_c_a_s_e_._e_d_u. -GNU History 8.1 2020 July 17 HISTORY(3) +GNU History 8.3 2024 December 31 _H_I_S_T_O_R_Y(3) diff --git a/doc/history.3 b/doc/history.3 index 06419cf..53be120 100644 --- a/doc/history.3 +++ b/doc/history.3 @@ -6,29 +6,68 @@ .\" Case Western Reserve University .\" chet.ramey@case.edu .\" -.\" Last Change: Fri Jul 17 09:43:01 EDT 2020 +.\" Last Change: Tue Dec 31 13:35:52 EST 2024 .\" -.TH HISTORY 3 "2020 July 17" "GNU History 8.1" +.TH HISTORY 3 "2024 December 31" "GNU History 8.3" .\" +.ie \n(.g \{\ +.ds ' \(aq +.ds " \(dq +.ds ^ \(ha +.ds ~ \(ti +.\} +.el \{\ +.ds ' ' +.\" \*" is not usable in macro arguments on AT&T troff (DWB, Solaris 10) +.ds " ""\" two adjacent quotes and no space before this comment +.ds ^ ^ +.ds ~ ~ +.\} +. +.\" Fix broken EX/EE macros on DWB troff. +.\" Detect it: only DWB sets up a `)Y` register. +.if \n(.g .nr )Y 0 \" silence "groff -wreg" warning +.if \n()Y \{\ +.\" Revert the undesired changes to indentation. +.am EX +.in -5n +.. +.am EE +.in +5n +.. +.\} +. .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. +.\" \% at the beginning of the string protects the filename from hyphenation. .\" .de FN -\fI\|\\$1\|\fP +\%\fI\|\\$1\|\fP +.. +.\" +.\" Quotation macro: generate consistent quoted strings that don't rely +.\" on the presence of the `CW' constant-width font. +.\" +.de Q +.ie \n(.g \(lq\\$1\(rq\\$2 +.el \{\ +. if t ``\\$1''\\$2 +. if n "\\$1"\\$2 +.\} .. .ds lp \fR\|(\fP .ds rp \fR\|)\fP .\" FnN return-value fun-name N arguments -.de Fn1 +.de F1 \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3\fP\\*(rp .br .. -.de Fn2 +.de F2 .if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4\fP\\*(rp .if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4\fP\\*(rp .br .. -.de Fn3 +.de F3 .if t \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3,\|\\$4,\|\\$5\fP\|\\*(rp .if n \fI\\$1\fP \fB\\$2\fP \\*(lp\fI\\$3, \\$4, \\$5\fP\\*(rp .br @@ -40,18 +79,26 @@ .SH NAME history \- GNU History Library .SH COPYRIGHT -.if t The GNU History Library is Copyright \(co 1989-2020 by the Free Software Foundation, Inc. -.if n The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc. +.if t The GNU History Library is Copyright \(co 1989-2025 by the Free Software Foundation, Inc. +.if n The GNU History Library is Copyright (C) 1989-2025 by the Free Software Foundation, Inc. .SH DESCRIPTION -Many programs read input from the user a line at a time. The GNU +Many programs read input from the user a line at a time. +The GNU History library is able to keep track of those lines, associate arbitrary -data with each line, and utilize information from previous lines in -composing new ones. +data with each line, and utilize information from previous lines when +composing new ones. .PP +The History library provides functions that allow applications to their +\fIhistory\fP, the set of previously-typed lines, +which it keeps in a list. +Applications can choose which lines to save into a history list, how +many commands to save, save a history list to a file, read a history +list from a file, and display lines from the history in various +formats. .SH "HISTORY EXPANSION" The history library supports a history expansion feature that is identical to the history expansion in -.BR bash. +.BR bash . This section describes what syntax features are available. .PP History expansions introduce words from the history list into @@ -62,25 +109,46 @@ fix errors in previous commands quickly. History expansion is usually performed immediately after a complete line is read. It takes place in two parts. -The first is to determine which line from the history list +The first is to determine which history list entry to use during substitution. -The second is to select portions of that line for inclusion into +The second is to select portions of that entry to include into the current one. -The line selected from the history is the \fIevent\fP, -and the portions of that line that are acted upon are \fIwords\fP. +.PP +The entry selected from the history is the \fIevent\fP, +and the portions of that entry that are acted upon are \fIwords\fP. Various \fImodifiers\fP are available to manipulate the selected words. -The line is broken into words in the same fashion as \fBbash\fP +The entry is split into words in the same fashion as \fBbash\fP does when reading input, -so that several words that would otherwise be separated +so that several words that would otherwise be separated are considered one word when surrounded by quotes (see the description of \fBhistory_tokenize()\fP below). +The \fIevent designator\fP selects the event, the optional +\fIword designator\fP selects words from the event, and +various optional \fImodifiers\fP are available to manipulate the +selected words. +.PP History expansions are introduced by the appearance of the history expansion character, which is \^\fB!\fP\^ by default. +History expansions may appear anywhere in the input, but do not nest. +.PP Only backslash (\^\fB\e\fP\^) and single quotes can quote the history expansion character. +.PP +There is a special abbreviation for substitution, active when the +\fIquick substitution\fP character (default \fB\*^\fP) +is the first character on the line. +It selects the previous history list entry, using an event designator +equivalent to \fB!!\fP, +and substitutes one string for another in that entry. +It is described below under \fBEvent Designators\fP. +This is the only history expansion that does not begin with the history +expansion character. .SS Event Designators -An event designator is a reference to a command line entry in the -history list. +An event designator is a reference to an entry in the history list. +The event designator +consists of the portion of the word beginning with the history +expansion character and ending with the word designator if present, +or the end of the word. Unless the reference is absolute, events are relative to the current position in the history list. .PP @@ -89,43 +157,48 @@ position in the history list. .B ! Start a history substitution, except when followed by a .BR blank , -newline, = or (. +newline, carriage return, =, +or (. .TP -.B !\fIn\fR -Refer to command line +.B !\fIn\fP +Refer to history list entry .IR n . .TP -.B !\-\fIn\fR -Refer to the current command minus +.B !\-\fIn\fP +Refer to the current entry minus .IR n . .TP .B !! -Refer to the previous command. This is a synonym for `!\-1'. +Refer to the previous entry. +This is a synonym for +.Q !\-1 . .TP -.B !\fIstring\fR -Refer to the most recent command -preceding the current position in the history list -starting with +.B !\fIstring\fP +Refer to the most recent command preceding the current position in the +history list starting with .IR string . .TP -.B !?\fIstring\fR\fB[?]\fR -Refer to the most recent command -preceding the current position in the history list -containing +.B !?\fIstring\fR\fB[?]\fP +Refer to the most recent command preceding the current position in the +history list containing .IR string . The trailing \fB?\fP may be omitted if .I string is followed immediately by a newline. -If \fIstring\fP is missing, the string from the most recent search is used; +If \fIstring\fP is missing, this uses +the string from the most recent search; it is an error if there is no previous search string. .TP -.B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u -Quick substitution. Repeat the last command, replacing +.B \d\s+2\*^\s-2\u\fIstring1\fP\d\s+2\*^\s-2\u\fIstring2\fP\d\s+2\*^\s-2\u +.\" was .B \*^\fIstring1\fP\*^\fIstring2\fP\*^ +Quick substitution. +Repeat the previous command, replacing .I string1 with .IR string2 . Equivalent to -``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u'' +.Q !!:s\d\s+2\*^\s-2\u\fIstring1\fP\d\s+2\*^\s-2\u\fIstring2\fP\d\s+2\*^\s-2\u +.\" was .Q !!:s\*^\fIstring1\fP\*^\fIstring2\fP\*^ (see \fBModifiers\fP below). .TP .B !# @@ -133,11 +206,13 @@ The entire command line typed so far. .PD .SS Word Designators Word designators are used to select desired words from the event. +They are optional; if the word designator isn't supplied, the history +expansion uses the entire event. A .B : separates the event specification from the word designator. It may be omitted if the word designator begins with a -.BR ^ , +.BR \*^ , .BR $ , .BR * , .BR \- , @@ -150,32 +225,43 @@ Words are inserted into the current line separated by single spaces. .PD 0 .TP .B 0 (zero) -The zeroth word. For the shell, this is the command -word. +The zeroth word. +For the shell, and many other applications, this is the command word. .TP .I n -The \fIn\fRth word. +The \fIn\fPth word. .TP -.B ^ -The first argument. That is, word 1. +.B \*^ +The first argument: word 1. .TP .B $ -The last word. This is usually the last argument, but will expand to the +The last word. +This is usually the last argument, but expands to the zeroth word if there is only one word in the line. .TP .B % -The first word matched by the most recent `?\fIstring\fR?' search, +The first word matched by the most recent +.Q ?\fIstring\fP? +search, if the search string begins with a character that is part of a word. +By default, searches begin at the end of each line and proceed to the +beginning, so the first word matched is the one closest to the end of +the line. .TP .I x\fB\-\fPy -A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'. +A range of words; +.Q \-\fIy\fP +abbreviates +.Q 0\-\fIy\fP . .TP .B * -All of the words but the zeroth. This is a synonym -for `\fI1\-$\fP'. It is not an error to use +All of the words but the zeroth. +This is a synonym for +.Q \fI1\-$\fP . +It is not an error to use .B * -if there is just one -word in the event; the empty string is returned in that case. +if there is just one word in the event; +it expands to the empty string in that case. .TP .B x* Abbreviates \fIx\-$\fP. @@ -186,20 +272,20 @@ If \fBx\fP is missing, it defaults to 0. .PD .PP If a word designator is supplied without an event specification, the -previous command is used as the event. +previous command is used as the event, equivalent to \fB!!\fP. .SS Modifiers -After the optional word designator, there may appear a sequence of -one or more of the following modifiers, each preceded by a `:'. +After the optional word designator, the expansion may include a +sequence of one or more of the following modifiers, each preceded by a +.Q : . These modify, or edit, the word or words selected from the history event. .PP .PD 0 -.PP .TP .B h -Remove a trailing file name component, leaving only the head. +Remove a trailing filename component, leaving only the head. .TP .B t -Remove all leading file name components, leaving the tail. +Remove all leading filename components, leaving the tail. .TP .B r Remove a trailing suffix of the form \fI.xxx\fP, leaving the @@ -220,8 +306,8 @@ Quote the substituted words as with but break into words at .B blanks and newlines. -The \fBq\fP and \fBx\fP modifiers are mutually exclusive; the last one -supplied is used. +The \fBq\fP and \fBx\fP modifiers are mutually exclusive; +expansion uses the last one supplied. .TP .B s/\fIold\fP/\fInew\fP/ Substitute @@ -232,15 +318,15 @@ in the event line. Any character may be used as the delimiter in place of /. The final delimiter is optional if it is the last character of the event line. -The delimiter may be quoted in +A single backslash quotes the delimiter in .I old and -.I new -with a single backslash. If & appears in +.IR new . +If & appears in .IR new , -it is replaced by +it is replaced with .IR old . -A single backslash will quote the &. +A single backslash quotes the &. If .I old is null, it is set to the last @@ -249,7 +335,7 @@ substituted, or, if no previous history substitutions took place, the last .I string in a -.B !?\fIstring\fR\fB[?]\fR +.B !?\fIstring\fP[?] search. If .I new @@ -261,21 +347,30 @@ is deleted. Repeat the previous substitution. .TP .B g -Cause changes to be applied over the entire event line. This is -used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR') -or `\fB:&\fP'. If used with -`\fB:s\fP', any delimiter can be used -in place of /, and the final delimiter is optional +Cause changes to be applied over the entire event line. +This is used in conjunction with +.Q \fB:s\fP +(e.g., +.Q \fB:gs/\fIold\fP/\fInew\fP/\fR ) +or +.Q \fB:&\fP . +If used with +.Q \fB:s\fP , +any delimiter can be used in place of /, +and the final delimiter is optional if it is the last character of the event line. An \fBa\fP may be used as a synonym for \fBg\fP. .TP .B G -Apply the following `\fBs\fP' or `\fB&\fP' modifier once to each word -in the event line. +Apply the following +.Q \fBs\fP +or +.Q \fB&\fP +modifier once to each word in the event line. .PD .SH "PROGRAMMING WITH HISTORY FUNCTIONS" This section describes how to use the History library in other programs. -.SS Introduction to History +.SS "Introduction to History" A programmer using the History library has available functions for remembering lines on a history list, associating arbitrary data with a line, removing lines from the list, searching through the list @@ -310,11 +405,13 @@ declared as follows: .Vb "typedef void *" histdata_t; .PP .nf +.EX typedef struct _hist_entry { char *line; char *timestamp; histdata_t data; } HIST_ENTRY; +.EE .fi .PP The history list itself might therefore be declared as @@ -324,16 +421,18 @@ The history list itself might therefore be declared as The state of the History library is encapsulated into a single structure: .PP .nf +.EX /* * A structure used to pass around the current state of the history. */ typedef struct _hist_state { - HIST_ENTRY **entries; /* Pointer to the entries themselves. */ - int offset; /* The location pointer within this array. */ - int length; /* Number of elements within this array. */ - int size; /* Number of slots allocated to this array. */ + HIST_ENTRY **entries; /* Pointer to entry records. */ + int offset; /* The current record. */ + int length; /* Number of records in list. */ + int size; /* Number of records allocated. */ int flags; } HISTORY_STATE; +.EE .fi .PP If the flags member includes \fBHS_STIFLED\fP, the history has been @@ -345,192 +444,182 @@ exported by the GNU History library. This section describes functions used to initialize and manage the state of the History library when you want to use the history functions in your program. - -.Fn1 void using_history void +.PP +.F1 void using_history void Begin a session in which the history functions might be used. This initializes the interactive variables. - -.Fn1 "HISTORY_STATE *" history_get_history_state void +.PP +.F1 "HISTORY_STATE *" history_get_history_state void Return a structure describing the current state of the input history. - -.Fn1 void history_set_history_state "HISTORY_STATE *state" +.PP +.F1 void history_set_history_state "HISTORY_STATE *state" Set the state of the history list according to \fIstate\fP. - .SS History List Management These functions manage individual entries on the history list, or set parameters managing the list itself. - -.Fn1 void add_history "const char *string" +.PP +.F1 void add_history "const char *string" Place \fIstring\fP at the end of the history list. The associated data field (if any) is set to \fBNULL\fP. If the maximum number of history entries has been set using \fBstifle_history()\fP, and the new number of history entries would exceed that maximum, the oldest history entry is removed. - -.Fn1 void add_history_time "const char *string" +.PP +.F1 void add_history_time "const char *string" Change the time stamp associated with the most recent history entry to \fIstring\fP. - -.Fn1 "HIST_ENTRY *" remove_history "int which" +.PP +.F1 "HIST_ENTRY *" remove_history "int which" Remove history entry at offset \fIwhich\fP from the history. The removed element is returned so you can free the line, data, and containing structure. - -.Fn1 "histdata_t" free_history_entry "HIST_ENTRY *histent" +.PP +.F1 "histdata_t" free_history_entry "HIST_ENTRY *histent" Free the history entry \fIhistent\fP and any history library private data associated with it. Returns the application-specific data so the caller can dispose of it. - -.Fn3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data" +.PP +.F3 "HIST_ENTRY *" replace_history_entry "int which" "const char *line" "histdata_t data" Make the history entry at offset \fIwhich\fP have \fIline\fP and \fIdata\fP. This returns the old entry so the caller can dispose of any application-specific data. In the case of an invalid \fIwhich\fP, a \fBNULL\fP pointer is returned. - -.Fn1 void clear_history "void" +.PP +.F1 void clear_history "void" Clear the history list by deleting all the entries. - -.Fn1 void stifle_history "int max" +.PP +.F1 void stifle_history "int max" Stifle the history list, remembering only the last \fImax\fP entries. The history list will contain only \fImax\fP entries at a time. - -.Fn1 int unstifle_history "void" +.PP +.F1 int unstifle_history "void" Stop stifling the history. This returns the previously-set maximum number of history entries (as set by \fBstifle_history()\fP). -history was stifled. The value is positive if the history was +history was stifled. +The value is positive if the history was stifled, negative if it wasn't. - -.Fn1 int history_is_stifled "void" +.PP +.F1 int history_is_stifled "void" Returns non-zero if the history is stifled, zero if it is not. - .SS Information About the History List - These functions return information about the entire history list or individual list entries. - -.Fn1 "HIST_ENTRY **" history_list "void" +.PP +.F1 "HIST_ENTRY **" history_list "void" Return a \fBNULL\fP terminated array of \fIHIST_ENTRY *\fP which is the current input history. Element 0 of this list is the beginning of time. If there is no history, return \fBNULL\fP. - -.Fn1 int where_history "void" +.PP +.F1 int where_history "void" Returns the offset of the current history element. - -.Fn1 "HIST_ENTRY *" current_history "void" +.PP +.F1 "HIST_ENTRY *" current_history "void" Return the history entry at the current position, as determined by \fBwhere_history()\fP. If there is no entry there, return a \fBNULL\fP pointer. - -.Fn1 "HIST_ENTRY *" history_get "int offset" +.PP +.F1 "HIST_ENTRY *" history_get "int offset" Return the history entry at position \fIoffset\fP. The range of valid values of \fIoffset\fP starts at \fBhistory_base\fP and ends at \fBhistory_length\fP \- 1. If there is no entry there, or if \fIoffset\fP is outside the valid range, return a \fBNULL\fP pointer. - -.Fn1 "time_t" history_get_time "HIST_ENTRY *" +.PP +.F1 "time_t" history_get_time "HIST_ENTRY *" Return the time stamp associated with the history entry passed as the argument. - -.Fn1 int history_total_bytes "void" +.PP +.F1 int history_total_bytes "void" Return the number of bytes that the primary history entries are using. This function returns the sum of the lengths of all the lines in the history. - .SS Moving Around the History List - These functions allow the current index into the history list to be set or changed. - -.Fn1 int history_set_pos "int pos" +.PP +.F1 int history_set_pos "int pos" Set the current history offset to \fIpos\fP, an absolute index into the list. Returns 1 on success, 0 if \fIpos\fP is less than zero or greater than the number of history entries. - -.Fn1 "HIST_ENTRY *" previous_history "void" +.PP +.F1 "HIST_ENTRY *" previous_history "void" Back up the current history offset to the previous history entry, and return a pointer to that entry. If there is no previous entry, return a \fBNULL\fP pointer. - -.Fn1 "HIST_ENTRY *" next_history "void" +.PP +.F1 "HIST_ENTRY *" next_history "void" If the current history offset refers to a valid history entry, increment the current history offset. If the possibly-incremented history offset refers to a valid history entry, return a pointer to that entry; otherwise, return a \fBNULL\fP pointer. - .SS Searching the History List - These functions allow searching of the history list for entries containing a specific string. Searching may be performed both forward and backward from the current history position. The search may be \fIanchored\fP, meaning that the string must match at the beginning of the history entry. - -.Fn2 int history_search "const char *string" "int direction" +.PP +.F2 int history_search "const char *string" "int direction" Search the history for \fIstring\fP, starting at the current history offset. If \fIdirection\fP is less than 0, then the search is through previous entries, otherwise through subsequent entries. If \fIstring\fP is found, then the current history index is set to that history entry, and the value returned is the offset in the line of the entry where -\fIstring\fP was found. Otherwise, nothing is changed, and a -1 is -returned. - -.Fn2 int history_search_prefix "const char *string" "int direction" +\fIstring\fP was found. +Otherwise, nothing is changed, and the function returns \-1. +.PP +.F2 int history_search_prefix "const char *string" "int direction" Search the history for \fIstring\fP, starting at the current history offset. The search is anchored: matching lines must begin with \fIstring\fP. If \fIdirection\fP is less than 0, then the search is through previous entries, otherwise through subsequent entries. If \fIstring\fP is found, then the -current history index is set to that entry, and the return value is 0. -Otherwise, nothing is changed, and a -1 is returned. - -.Fn3 int history_search_pos "const char *string" "int direction" "int pos" +current history index is set to that entry, and the return value is 0. +Otherwise, nothing is changed, and the function returns \-1. +.PP +.F3 int history_search_pos "const char *string" "int direction" "int pos" Search for \fIstring\fP in the history list, starting at \fIpos\fP, an absolute index into the list. If \fIdirection\fP is negative, the search proceeds backward from \fIpos\fP, otherwise forward. Returns the absolute -index of the history element where \fIstring\fP was found, or -1 otherwise. - +index of the history element where \fIstring\fP was found, or \-1 otherwise. .SS Managing the History File The History library can read the history from and write it to a file. This section documents the functions for managing a history file. - -.Fn1 int read_history "const char *filename" +.PP +.F1 int read_history "const char *filename" Add the contents of \fIfilename\fP to the history list, a line at a time. -If \fIfilename\fP is \fBNULL\fP, then read from \fI~/.history\fP. +If \fIfilename\fP is \fBNULL\fP, then read from \fI\*~/.history\fP. Returns 0 if successful, or \fBerrno\fP if not. - -.Fn3 int read_history_range "const char *filename" "int from" "int to" +.PP +.F3 int read_history_range "const char *filename" "int from" "int to" Read a range of lines from \fIfilename\fP, adding them to the history list. Start reading at line \fIfrom\fP and end at \fIto\fP. If \fIfrom\fP is zero, start at the beginning. If \fIto\fP is less than \fIfrom\fP, then read until the end of the file. If \fIfilename\fP is -\fBNULL\fP, then read from \fI~/.history\fP. Returns 0 if successful, +\fBNULL\fP, then read from \fI\*~/.history\fP. Returns 0 if successful, or \fBerrno\fP if not. - -.Fn1 int write_history "const char *filename" +.PP +.F1 int write_history "const char *filename" Write the current history to \fIfilename\fP, overwriting \fIfilename\fP if necessary. -If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI~/.history\fP. +If \fIfilename\fP is \fBNULL\fP, then write the history list to \fI\*~/.history\fP. Returns 0 on success, or \fBerrno\fP on a read or write error. - - -.Fn2 int append_history "int nelements" "const char *filename" +.PP +.F2 int append_history "int nelements" "const char *filename" Append the last \fInelements\fP of the history list to \fIfilename\fP. -If \fIfilename\fP is \fBNULL\fP, then append to \fI~/.history\fP. +If \fIfilename\fP is \fBNULL\fP, then append to \fI\*~/.history\fP. Returns 0 on success, or \fBerrno\fP on a read or write error. - -.Fn2 int history_truncate_file "const char *filename" "int nlines" +.PP +.F2 int history_truncate_file "const char *filename" "int nlines" Truncate the history file \fIfilename\fP, leaving only the last \fInlines\fP lines. -If \fIfilename\fP is \fBNULL\fP, then \fI~/.history\fP is truncated. +If \fIfilename\fP is \fBNULL\fP, then \fI\*~/.history\fP is truncated. Returns 0 on success, or \fBerrno\fP on failure. - .SS History Expansion - These functions implement history expansion. - -.Fn2 int history_expand "char *string" "char **output" +.PP +.F2 int history_expand "const char *string" "char **output" Expand \fIstring\fP, placing the result into \fIoutput\fP, a pointer to a string. Returns: .RS @@ -544,7 +633,7 @@ character); 1 if expansions did take place; .TP --1 +\-1 if there was an error in expansion; .TP 2 @@ -554,82 +643,103 @@ as with the \fB:p\fP modifier. .RE If an error occurred in expansion, then \fIoutput\fP contains a descriptive error message. - -.Fn3 "char *" get_history_event "const char *string" "int *cindex" "int qchar" +.PP +.F3 "char *" get_history_event "const char *string" "int *cindex" "int qchar" Returns the text of the history event beginning at \fIstring\fP + \fI*cindex\fP. \fI*cindex\fP is modified to point to after the event specifier. At function entry, \fIcindex\fP points to the index into \fIstring\fP where the history event specification begins. \fIqchar\fP is a character that is allowed to end the event specification in addition -to the ``normal'' terminating characters. - -.Fn1 "char **" history_tokenize "const char *string" +to the +.Q normal +terminating characters. +.PP +.F1 "char **" history_tokenize "const char *string" Return an array of tokens parsed out of \fIstring\fP, much as the shell might. The tokens are split on the characters in the \fBhistory_word_delimiters\fP variable, and shell quoting conventions are obeyed. - -.Fn3 "char *" history_arg_extract "int first" "int last" "const char *string" +.PP +.F3 "char *" history_arg_extract "int first" "int last" "const char *string" Extract a string segment consisting of the \fIfirst\fP through \fIlast\fP arguments present in \fIstring\fP. Arguments are split using \fBhistory_tokenize()\fP. - .SS History Variables - This section describes the externally-visible variables exported by the GNU History Library. - +.PP .Vb int history_base The logical offset of the first entry in the history list. - +.PP .Vb int history_length The number of entries currently stored in the history list. - +.PP .Vb int history_max_entries The maximum number of history entries. This must be changed using \fBstifle_history()\fP. - +.PP .Vb int history_write_timestamps If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, meaning that timestamps are not saved. The current timestamp format uses the value of \fIhistory_comment_char\fP -to delimit timestamp entries in the history file. If that variable does -not have a value (the default), timestamps will not be written. - +to delimit timestamp entries in the history file. +If that variable does +not have a value (the default), +the history library will not write timestamps. +.PP .Vb char history_expansion_char -The character that introduces a history event. The default is \fB!\fP. +The character that introduces a history event. +The default is \fB!\fP. Setting this to 0 inhibits history expansion. - +.PP .Vb char history_subst_char The character that invokes word substitution if found at the start of -a line. The default is \fB^\fP. - +a line. +The default is \fB\*^\fP. +.PP .Vb char history_comment_char During tokenization, if this character is seen as the first character of a word, then it and all subsequent characters up to a newline are ignored, suppressing history expansion for the remainder of the line. This is disabled by default. - +.PP .Vb "char *" history_word_delimiters The characters that separate tokens for \fBhistory_tokenize()\fP. -The default value is \fB"\ \et\en()<>;&|"\fP. - +The default value is \fB\*"\ \et\en()<>;&|\*"\fP. +.PP .Vb "char *" history_no_expand_chars The list of characters which inhibit history expansion if found immediately following \fBhistory_expansion_char\fP. The default is space, tab, newline, \fB\er\fP, and \fB=\fP. - +.PP .Vb "char *" history_search_delimiter_chars The list of additional characters which can delimit a history search string, in addition to space, tab, \fI:\fP and \fI?\fP in the case of a substring search. The default is empty. - +.PP .Vb int history_quotes_inhibit_expansion -If non-zero, double-quoted words are not scanned for the history expansion -character or the history comment character. The default value is 0. - +If non-zero, the history expansion code implements shell-like quoting: +single-quoted words are not scanned for the history expansion +character or the history comment character, and double-quoted words may +have history expansion performed, since single quotes are not special +within double quotes. +The default value is 0. +.PP +.Vb int history_quoting_state +An application may set this variable to indicate that the current line +being expanded is subject to existing quoting. +If set to \fI\*'\fP, +history expansion assumes that the line is single-quoted and +inhibit expansion until it reads an unquoted closing single quote; +if set to \fI\*"\fP, history expansion assumes the line is double quoted +until it reads an unquoted closing double quote. +If set to zero, the default, +history expansion assumes the line is not quoted and +treats quote characters within the line as described above. +This is only effective if \fBhistory_quotes_inhibit_expansion\fP is set. +.PP .Vb "rl_linebuf_func_t *" history_inhibit_expansion_function This should be set to the address of a function that takes two arguments: a \fBchar *\fP (\fIstring\fP) @@ -641,9 +751,9 @@ It is intended for use by applications like \fBbash\fP that use the history expansion character for additional purposes. By default, this variable is set to \fBNULL\fP. .SH FILES -.PD 0 +.PD 0 .TP -.FN ~/.history +.FN \*~/.history Default filename for reading and writing saved history .PD .SH "SEE ALSO" @@ -677,8 +787,10 @@ library that you have. Once you have determined that a bug actually exists, mail a bug report to \fIbug\-readline\fP@\fIgnu.org\fP. If you have a fix, you are welcome to mail that -as well! Suggestions and `philosophical' bug reports may be mailed -to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet +as well! Suggestions and +.Q philosophical +bug reports may be mailed +to \fIbug\-readline\fP@\fIgnu.org\fP or posted to the Usenet newsgroup .BR gnu.bash.bug . .PP diff --git a/doc/history.dvi b/doc/history.dvi index bf33fe4fe16d8443c10debc72b40fa9910be4006..1cdf80606693a23e094e2e42fc9b71439ae33324 100644 GIT binary patch delta 12120 zc-nnh3w#vSxzFxQLIMd8LLdPIf=CD^OF}>%A{gXh0HMmm2P#ZJ9c_PN8g_> z`{l?3&sMcOaMfv9vxJ`Dl=>-CyB_iM{I-u=;psDlCz=B4uB%S_;}JOu0}V@fVqQSj z{hHE3WZgDGasr+#TDHo*Qqc`n>#)O0izaCuWMUhPmo;5cqxKA6V=c_w)L2h)x3qD; z8hqCw*)dJ6>)Kb+*to+QQo5*BlOkqBiMA%Z2L(fg;cA!|A<3}32SpgV_t~m81wyyQ#`SOqG3<^Q ziWKO2ly0v?V{wD{glj$1Qg;h&UavQge4D@3^C`KzV7X8^>uBn|f=-Y32PH@Du&PQIadRbvPx9qWF)506B8Id94gu;BJ`rPK)SUtk?RHxwF-bFY zpOydEVREW}#icl+J*4>U5J9!WhCxk@aB-F#JmNkQxsMY;y5{v8MRu z$dw`4)@86=fG9eg1pWxieuJPHR1F2!ZLkrVoUbcKK{^A4?g_%lm8d@)51@=T{Dp`2 z$3e&F1!`3Gb@kAL!Zr!<;vvplLU);9fbvk{T%GBbcySpz3aS=fkS_;Rnl`SOuC>Ia zmq}6fJWE8vMdWI5H6R%Y;iKu2CR@Tsmq>oxFCN8@qpAh;H0bof<*Ti8 z!(>TAUnG4I)eb1d5IUB)`uVhg!~gtHxtTFEE{S3=g}E-Z8ZC-IX*ef4J$a;^+dM0ajd%ljSzzEOs@R+-|eZ1?KyhdAJbH`sj*aFi?|Y zvdT}=csjDHxN$B9-g)6R@VFappr3&!aIC_7ldcl?a{z&NIB zr30wLfE<+KVFMhe<{)1eUuD(>On_kkBxpTJBU04vVBn%eaU}W!F%Af_A!jT}1Exq?9hU_oM@yK(b@dbZu|XF%r>koqSd+qalX0114Zy_@ z@dWeec%riP5$eICjva3{c&zC7+;(8!4SWhuEWv>;Aru|&j_cs?Nzohup>K&JX1k7- z?M?U`PC~sz3e&d`W4%>X2pZF;fCnXDhJXLN2`k=d=pP4_cWC z)U4IG#GDc63GtOdYA`9jGT3O$!EKgVWShe

zbKk0QX)6X092FfiJzwetHN1|zy= zK@d#jk6w(!lKG>XQCobSEJ=tGL_4E8!QXUdO;~I5Ja|V@29k*yw6kXWtfB>5S4G3J zPW_Z^NG>m3FLnK#!~T1SM&HlR^m zL%JH+2`MYvC?aJ`b(T%^nBu+1TVQX%9uk$?S@`w4r?@$2iT9r9V;*nicYKtFH6x0S z!381m(|rc+1B8Yin>dld(=)1JN$;$PsvGElz~q>m5YmzcU~wr?3@T)l)Rs>MRl#}R zFCXQ3lzd&j&(lL58#dQl^gZ&?usPlvH;@a5PcTXQUY04{JuKnIFwZz}@K>jTb9K-p z<={LJp7>BDm@&&DzD7d0e{r_a^=LIn7LP%;l>-o9nxk-%cmxpy=m3ly#?o;`IVy#bS?*_QILdqWVf3PxNTTeqb~(y04PpD>P<577FkmP@(M@9Rw9bANk~8lb;LMO zzz)VJ)kq{0`+Qw6>$7VS)`f##;~+_E#rnvG^y1(MaWI5%itEsuulHPA8S21QO zUmFjE{_PkWrN>ahAPK`VF`(l*!0Dhvzon^oAzQ_wm@GwNVNgd8SyZ`w2E_9gx+J8a zS>vs7?<`3>hLoX<=-fvAr*nH)!c%hq1SBHGBPx9Fd`5#lBGJv6djN6Qpt_><29L(x zs_}pvJ!JI=6C>_U@~aV(%pSIDJ<7yXY?XZeaT*!8_w(m^>(k&b-p^B9i=d3|zwuKr zO@-ue7<60uYvkDxWGzV;PIDtZeow-vVlJ-JaYk0Y@~f4usX#ynQW5{|B%zVx0138@ z9Ako`8M6@EsE4DZ4NjHSJKmaF+Dye2L!C@Jj;Q^{&vL*p+db$Y*Zko3dy0`x(J&8S zQA0 z!ut2B(|(y1rMY1Xiw8}eJ*G2t6>Uczu5k{- zfca0}tr$2r*Pyl>i5V<7sU;loqfC6zxL?v)0Xl?ye8D&YeoYM=UF8{9o5XPaZn6lm zU6GfUnl@&wM<|Afx5xUxXBSjWpns`Vli;r(RNVwW|4}s!em0Do3qLoGD~C*X-?-1r zrrXjKlit0!50Wp?-uY?f5lP|QT8<(u)NC7c@Y@j74*_3u5DZ&I7`lww;`=icdl*B|5<0u5)2YH&U#2rmJ5ZYtw%4gz zEt0V)RH~ib4)=EnCAoimxoOkm!A{%jGK>RPP6$ddCoW0x`tfP-5Xlmh0abGyI+OQh zMemxqH<2`r9t;XN%j@ewv3M|>9%PqukoeUQI3$ECpzi}Oz&KW>6f@y}eRG+hM z`?wg0N8mNZz(Vkq0=XJ$1#;a*bHMz2FPiGWZmUx=Q53sE0=G{Hi{D{z5N(wKBNo36 z4$LrJVhn|-ARDk~L<*oFi{C+y1UBMOYg~bsQ7^4V1hg4b3t%S!65INCbeO-+u?PS& zib~y%teh|z1l&5o@{Si%BdR~}3Q+iwztvo19;*ek!2VtYYCG>SnN?ZdV>I;7?<4vp zWU4X=#-o1L6oND85)<3z`B}$hfS^ha({hulZqz2lz)4BhvAp(UTg^;}bB;(_i(=pg zmN@5dKr$qjvCkvYm@PC#)@z|aiKqm2Ou}4RoWN7wG?;Uk5fU8}K;R_x0}^t%nx@8E zfu3ynK0_|uFe!G1$sF zazgZ-4S*H>MwpeemUwj~s3|G>{;J8Q6hO$f+chP(X-LmNIk8PUT~LV;z#gAf(7vr1 zlp6>rtenTy&eL?CTNoyUlBTp{t)x(LIdXF}7lk|}ESW7~fZUKm1EHh|e1XtTt_^Cz z$yp6uEM(C7SR3Q-tfOm7eociMDWD8MZQu(o1@|l6XqwTbS;8vSakr4fSUHW7s9cO$lcXN3ecNlExgI%t(tGBHtht0wtcGGjmW()*dJrp* z-qq|@0T|H!FmgKTz0~&MFmZXTGd&h>0d~U=;(9yA6B?tE-jJ=eq}z z-W(EZEGMr_nMYo2989)1&LqWCOUQpU9xw;JSWDHAZVo2$m-R!jOQcp{cUdiXr;Vy7 z^OqI&Ub$lJij~a^moAtO@SlI^i|pbBRKw~8@P7c<5XBgOakhnPcZiUj@$ z9 zHeBkKwQE+S4K*olm_@>~Moxtwc?da!4LOU-kc~hAf{0@m%VAIXgl}7D>sWbu!D0)3|X08Cl zG=`%Y;x#rLK+=_2J<}8ei!lRDfb$O^;_UmVKAxVvv|!3Y+AjZgb~SmfsMPdXMR(jv z`LZTMNJQOsM$V>zq;Reqa$SVgu&O1Tdl>j{+(yWUI$yTkLeCP*KS!0}FMmR<`sr;2 z1x@Uv#r+t0z-T_*xp=|H)D3gH zJr`nHPS-NMXDO<8*{Y>Wu_;q|VmPWgwY=#Dh>Xe;6=dVWi&7`&{inx!LL}AWZn$h`~@kx`ic?W_jbCW&3Zkc zaws6*vqdzx0TLIwdJTj5UgViyceig%rk0pG#fF<>z*1S&Jc zWV}3)v;ZbP8~7{P&`$7Aw~fNCmcUPWWB_HvW};3rBGiW+3)p>DcJ7a0+UrOPOHa|@ zwS=V~^hr^8uWE7t>GjR8Mr4WlFumA>_w+u79>k6S($Qy(DcV?su>rW+D7RY)iA1t< zS@1rxg&ioHsq=Q!#h72xoS}P zc_!i^$YK)>mHOt|D?O%g_Dz;BL9(Q9_6=SU=g?yA7p@U0g42Uh53yZ+^!ln64}z(eRlnPq;IcGDq4pxUG(vX5_V&kkbNt#>V?tcNhWeDr6rL2<-@vGX?Pdo$b8VL9)7dmR(}aPX6IG*id<*Pw zCWM3kbYaPt6u<7yQT$axM)8BNgWf{1krko!>xN#Gqj;a~D%n8|+FBszq~YY1brnKI zULJxMIlOk2`MbNEUTjkQU1wi3gGjoSzp^0ByM{ScZnmDGaM(U0OK%y+<9lZXVnVoY z9@80dbY^~+(vlgaWf0yH?t|(U^@a)~Z8lYvCH``Av*Sn^h3#xlV?*?;>Nu-dG=-{+ zx9Xsr7tY4u99QNj&dUGA*IajYJyD}JcTJq%plY_`m)I@I3LC22Eo(2?xul5nmwr}^ znNkD#g?9#I+qz3if>636$L{K`_(LnXuq7aNa~og+`Eko2(*L?j^6QqPP{wV4li2=~ z@Jr<$5(?Cd`-WETC3^zXJ&%&N15tWmNG_LWnvGZm4&DBSn@nFTl%h%DwIYxaLWtH& zG)4k;AWkm@-7W)o&>Lq^9d@4@H)3%E(7G@U`QicAO#zVN*W@v%`S4RTn=J}9a=cd5 zrB)fZN)@?meScCG44Ohi7i}vx+)q0%xtY$EGZ*O%T{$<#P-eMVud1i_V!LmWpXN|( zZ2shrS2-Vu=)`%!MSvuh5DHV2OG4p-!Y75o=PWDAzz zx8{sFOq|olwz7m@3`z4HFpsh=G3q%1p*q91>R9T54#C^;S(+yFg!c#UqE@^=c!!YI zi`R>tKkD1)-$id3EFt(0WMPs8gMi>=-#g$Vd=(C>q@A!XKf;kpza!wRCQGM1!Sn7h z38@QJ56rpH(8-bwlf8l8(*onjhEn3YaTHjui0leYV;9lKLn}Pu{$X7+X?bzk`VW>m zU(eAmp!AHP61Sz*Ej4Vdc;@IBI!_Ik|)9o zg<)N@$i{G8>Vim_2jA^}f4FBb*%Z#*@t?hr_VpU;3WJX?y(w^1ZQif6muzGOA>C7>{M&yz>AD(~`b znb<-vsb;$0w2Qhc$K$}@PQUE>rzG@Qg@gI`zq>q z6lMwWZC+{O0K^427|_PS{hX@<-o~Zh0|r%x57VoPo?y#f`t3;8EicHl!IlYrj7a$B zrU)l?yQ6;=%an-fpdAviL2F8^FwBkvXO2{*4sE{8D~!5p0hwVwAe79zkQ_GyHA>WB zjS)x}3Gr}ZB0NGQ@YfPQD2Pm&1b?*Eq{6qG5GZ%nd2c_=0%gnKiUUg_X)ReX_H`v_ z;nXUlrfXmS+w;gbcZ`9cfy8*hop+3c^>3cJi4W0a9b~J)Ok%_MZ=V?uC7PCTN)d8Jo3#W_}#XySkLz zx1;+nd3o5feEvUhNOP_;q+2Z86W${a{Bz4Z_85VnU{)pYx$mP??2y$ht1w8^{HpSeYwC>&c=HB z58Iv0_cVAK4!x1@*;(Kj#-Eoi#^)n;)sgro-I3H9(8FR-V1-??fmmO&&Tg{ W<@L*}JanwW)8*+uUiW^;{`p@keqw|G delta 8947 zc-n1R4R{pgwa)C!CK93$NJ0o)AQ%V>Nk{^UB>WgeH2h15Em|a#-AQ&}cP7ltW)o~( zK|u>7FdSLtX05<2#f#8l*((0vQ_x$kXn!6-i>*bw@#fa2TESAU^)T+>e<6dJLfk^9flO%eWJ8=_p)~-&EyZa)mGQm_8#DRKHUUvd~Q`QYt>$XC2t0v;_DV=*yluDW| zs|szprK+~V^d4@jnQhr(!4Zn@NT`p!6?+d|KVwFZIU@g#4oz(zqlw|LthC4Zi@z{b zT(5>q{^B!6P&5GE^Nb!spCY=X0dRbAC4CCXill?u1|6EzDXS4Z)ZKfK9cZBb-5n$} zK$b!S|2?iY`2^qT@o;~JqU=YwH{glv6?}2m_T-i9t(<4ejS#)=phprQc2m(1Gk5f} ztAnx*FnnI&ooG1d-HK(1U8Yy!QHKB+DuhKv?udj$Ljqjk2oBnwA)&I;rfOl)K&Mpo z9vNmVOr9Sykt;jgW0vOM;dn4EwC74)9il?614G=E#AR3hYRuISm(59(j*X*Da7e0H^Q37AS3f zwRFj^DgozQT?$El!yMio4CPiX>5^ z?16zWk}wm(Di*LN`E55)JeKs=>6mkV ztes$-XI>{zsRx-=x~Ra5CDY*=SLw-K12tt0@Z_jM_(w^RK!6ED#~c!ljQG(RczVoy z&-xztWXwEI!@W>5c5=+*8}5nr+3C#`U^ystT2z;){;BB=xTK+_zYasJOC6$y=%r^a za?(X-*y)$^{0zV1LipzNagG2?4_$6oL=0t>nNz#0(STT3#I#{p4{BI8r~>6Sdz1C` zE%vH*SKlOyoqr=kp{=*VJLAUBpg$ZSv|Y}& zxvs_oLlQL%y+ia%I+fc8o1kL+Xkq_|ADxCp<9E(J%vSc7me!S-6VES6xqg)Nxaasf z@^47QBonoE>fHp%rsw#52#g?(A2mbRv6ZENMs%|l@#bNEyDt1Qddrh zVFg~8Fg11vKicA}DOYVv&Feq)n83r9-)c@LcKm`D9nUjrB4fW~Wq*yS2Y8b8DtQ zsO%62Vb{dqlKqTwPywRv0#yEkey+FMBw) z%fk9i@VoZ0JjI-+B+{rkSnDG?>xh;E$gE4SdUM)ay~*#ZVTriQlENJZbX%@&yDU6F zlZ=R_P$emDuuvrmmtWK+WFWdD&NJqmOs$ zUt@1vNl`l%{QCzG8clE0vnf`-g8vD`SC-F~1IIcBB8d1#OmH~D+!e7VY0W}n$cKuPXA1H2+wQ_rwt2)c$PFufB0*~JUi;X%9$}6llt2Sxw**7>NXKGJT4sinOz)8yTq8IjV7$fF+)`g zn~28vop9(lwG&xOcNVZ)XwKWuH0vyziLtDYD1LI3qgXTt(}*ec_sZ$Qeo|^;mFb!A zYVw(?KY2JA9;=xYyE=r%1)3Jn0MFH%Ba{s!G~u~A>&`UwWs?a6MPw(aa;N!KV4*07 z#MThfSVyYP7=R{)rLbjBCN;vSRI8HN%ywo0-!ou3>ePtE$hCmR>kbzOmi z`USA3uF^C4Z*Zor3D(u$3U}8Jhhz0e?;G*Glgwzu3_5|%zg}#|o^Q|meU#k5<~H(l z|D8?inpQV1T6+7!R0Xr$4IufV)snC=A&6a%2-3TM!o1tzpL5ReCBBD$d}=Ny94XmW z59Z3T@TYm*vDZEq6T)l%L?=1(phaP&{LQ5LgB53m<@O+@s_kv+n}|}^E!j&91^WRe zl^BvY*`$;lQ}y}dG65gD6C1MJ35+V)iKNLxDU*mYm29g+ohBwfn!lVQO<``s3xe}> z9DI4(NboI~I%XxIa9mgua4EdE@%t$p#e_8&js;_8RGHcTbCJg5jM7G|V)dLS;Rrni zTf1E_KFVoq8}Qkf%oq+z1ac!#q&y_CBA z681etIKpC=Oo5ApvB3IT2YrDUFX^lx2G8mn!Nx0K-80NUH~@Do_QALXLt*&B?XDlH z;M~GFp00&3^!9QbV!Lk72)td~xlK_bb%Up18ws=Gl66M`myVDMx(eOI{31BOD~M$h zy9r@XQo)>70faVK%a#jG==X>pPv9ifur%4ZXf@}V;l*^Gm(0C$KUYoNB~?L(i_pKk zdFfI}u@RmspE8(Cv=yl8JyN{=HYdE-CI8-d4+l+)$HVcpImyV9|KL2+9)BpuG*tKE`CQo5<@x2GRdj$Rk+HXTvC?X{U{`o;tZ?_(n49@+C z-HM$iVK+c5?kG#!^wq=FH&Rgx7OkBO3AKh&{2w2jlS#6MeP)85STJ9G|u#sRWX~j znEaXd(;S(05bEIpubxq<5~H$Cppjlm>{;3vVTIY_0W4z4SifQtx^3} zT6OIM@F$-_kB-nv9l#`#YX!xB({ZQ!eL)UdsI7(rbO*fjN>&{#MfSm9anmt?+l zoQu)>&yTYA5r$N9$i7KJ7u)3lcsvI0;!z5oBgz!wCuo>)q?y7E-zQNpD5w8{=~a#q zsVYaCRV)}fDO649sYm>9HZWE=GP3z@49z515nNCu+&F3Q9-2AcjfJ6_!i{CF3M6$w zGn@(*$4*zIO{C{kp@&=t85{;**(RIP80`L?(N zWJ2(5#_^D)8M$9Kg&zqi$Mczbp!w-YqY~NeHD8Oz*&k*^-xL-%l2xvJdsbIiyC-wt zQfMZ8EEn@5o14+`m5>v9bu5N2!%j*jz&5Y=8F~63G=ncHdKt!r15SS)HkwTd0n^*v z_uo@KZ1DFz^;A&Q;zCvyoDZKBj^sCf3Xdzl;|_zWR^!hftF!RuJF3DRgk>GGW3@iU z@lijU?IQU=$6*mM&c@=;2F&y@!Z@yiJvU->M6l_;-z<;Ppr&`amEmsv9Ueo?ffVCn@w2+0-c|K4Fud^ z5!as4j6pzXAKpI=2B!KMlwgE%S3Kr^GP7^_&LG%@)js?C35>_qVHl5&n5Ej^!BCF# zTZfBn_NCR}*q!dx*zHZ>{OJaKmY&NP#M=DFgE99JZSg6I!3GcHkK>Ga z+`(jv(PT473hld*3!@tbuMZjW(6=l)j&}yU+c_qucju0*tgInmLK!CRy(fs7akKaJ z=5j^gjXo|MDg5F~Sl3+%zl(b9tFyPFi}=DXuF=EflCF`Qupd7q*L4?hp3>4}bW;&G z0kK&(#Bhhs?y``gI&%^b!r(Lv`=h0B>HZhkR`})pRdDwEmuCJDv7dc&sK}c{dny-R z{w2G4r!Uv6^kpU+S@0BWK5*#=rJk36x#xjbc>Ab{a6ERyzH<|~VM%Z71m{X%k0G#m zIM!a*=1<^Yv?|%R52c%H;B<5t?0EPF+vdK9yX$Uz0lT`Hm3VPI zG71Wc)P?0iML>6T#2%3yFGozGaSC6z^p~f~F(2pt36?)p)SOOM<`SIDB56dnGv>C{ z#^ASc3I4Wb`+BgF-2?{M2qG&%xfKI9_+9JtZG|!HTh1DPNY$MS7veH(e_VL8oV~6$ zy&JBR+Y-W?Q)~^bmi~#Pp?CZ~x7!XL%q}5qEuEVkrk52^BXsLw3uJ=s`}}dYamM+) z2V{daLHhnD!RP(po4P^f0qC)(cBegN(Vcunf}ggC9N~OzR{{C$BVpzC+y$OT^>6cG z!t;W(CTgDyi{kVNMJKx$jTU4z6R&Ua8Rsx z+i0w(<>&xa2_Ya3C05yqRwF#z`pD{0gT0k~1tQVcjm2C3fJHJcIp@&_Jp8y9UxJsm z@8)lK@&c^f5ttiB$c_uo$ES!|yT5|&_&a@c$fAGUE-QwKZ|Ft6^Ty}-@6&U*Hh`~I>55|Y|rr01Hb-Fk9pthu5-?E zP14c1zTQK*4`%h4?Z*zmfjx!ra_>ki_^hnt?|V-OLs0bUvrB(~$L2p)$mLOqjLgc~ za-e7b-?Or)lRS6o^;Au5^1jCw4u{E)m3tnofooqZ=4K>|elqg9!mC+JK56OB%BAwc z|GfUNR#Tny{q)r#@Nb98J=RZYF%ca(eD*AGGCz6o+@)dAbgta< zlFpu;J(r)n<&UZ1@QXi`dw%mKdshC(;mOB8oShG&KP>mWH=8}%`QeDQ;d3xl}HnSU!ADex$Yy!7RD9O8*duY$;vGr(V7XN`~ d>*cSwSB`&`m6KI`a(5Zm%jFaw_PmGx{681{0>%IU diff --git a/doc/history.html b/doc/history.html index 3c258f4..62803d8 100644 --- a/doc/history.html +++ b/doc/history.html @@ -1,14 +1,14 @@ - + - + @@ -54,7 +52,6 @@ ul.no-bullet {list-style: none} -

GNU History Library

@@ -64,12 +61,12 @@ ul.no-bullet {list-style: none} -
-
+
+ -

GNU History Library

+

GNU History Library

This document describes the GNU History library, a programming tool that provides a consistent user interface for recalling lines of previously @@ -78,27 +75,27 @@ typed input. -

+
-
-
+
+ -

1 Using History Interactively

+

1 Using History Interactively

-

This chapter describes how to use the GNU History Library interactively, -from a user’s standpoint. It should be considered a user’s guide. For -information on using the GNU History Library in your own programs, -see Programming with GNU History. +

This chapter describes how to use the GNU History Library +interactively, from a user’s standpoint. +It should be considered a user’s guide. +For information on using the GNU History Library in your own programs, +see Programming with GNU History.

-