aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-02 13:42:37 -0700
committerTom Tromey <tom@tromey.com>2021-03-02 13:42:37 -0700
commitb4f26d541aa7224b70d363932e816e6e1a857633 (patch)
treed66d3fd86d996bdead07351e57dd8ec416381526
parentbbcdf9ab73018ff43855945fd72c642a67437d8b (diff)
downloadfsf-binutils-gdb-b4f26d541aa7224b70d363932e816e6e1a857633.zip
fsf-binutils-gdb-b4f26d541aa7224b70d363932e816e6e1a857633.tar.gz
fsf-binutils-gdb-b4f26d541aa7224b70d363932e816e6e1a857633.tar.bz2
Import GNU Readline 8.1
This imports readline 8.1. I did this via various hackery in a readline git repository to make a version of readline identical to gdb's, then did a git merge. readline/ChangeLog 2021-03-02 Tom Tromey <tom@tromey.com> * Import readline 8.1.
-rw-r--r--readline/ChangeLog4
-rw-r--r--readline/readline/CHANGELOG61
-rw-r--r--readline/readline/CHANGES123
-rw-r--r--readline/readline/INSTALL7
-rw-r--r--readline/readline/Makefile.in4
-rw-r--r--readline/readline/NEWS62
-rw-r--r--readline/readline/README2
-rw-r--r--readline/readline/aclocal.m42130
-rw-r--r--readline/readline/bind.c256
-rw-r--r--readline/readline/colors.c9
-rw-r--r--readline/readline/complete.c104
-rwxr-xr-xreadline/readline/configure66
-rw-r--r--readline/readline/configure.ac33
-rw-r--r--readline/readline/display.c824
-rw-r--r--readline/readline/doc/history.355
-rw-r--r--readline/readline/doc/history.texi2
-rw-r--r--readline/readline/doc/hstech.texi6
-rw-r--r--readline/readline/doc/hsuser.texi39
-rw-r--r--readline/readline/doc/readline.353
-rw-r--r--readline/readline/doc/rlman.texi2
-rw-r--r--readline/readline/doc/rltech.texi42
-rw-r--r--readline/readline/doc/rluser.texi79
-rw-r--r--readline/readline/doc/rluserman.texi2
-rwxr-xr-xreadline/readline/doc/texi2dvi1656
-rw-r--r--readline/readline/doc/version.texi12
-rw-r--r--readline/readline/emacs_keymap.c4
-rw-r--r--readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP3
-rw-r--r--readline/readline/examples/autoconf/RL_LIB_READLINE_VERSION1
-rw-r--r--readline/readline/examples/fileman.c4
-rw-r--r--readline/readline/funmap.c10
-rw-r--r--readline/readline/histexpand.c26
-rw-r--r--readline/readline/histfile.c52
-rw-r--r--readline/readline/input.c33
-rw-r--r--readline/readline/isearch.c75
-rw-r--r--readline/readline/kill.c110
-rw-r--r--readline/readline/mbutil.c106
-rw-r--r--readline/readline/misc.c63
-rw-r--r--readline/readline/patchlevel2
-rw-r--r--readline/readline/posixdir.h2
-rw-r--r--readline/readline/posixstat.h8
-rw-r--r--readline/readline/readline.c98
-rw-r--r--readline/readline/readline.h16
-rw-r--r--readline/readline/readline.pc.in2
-rw-r--r--readline/readline/rlmbutil.h2
-rw-r--r--readline/readline/rlprivate.h42
-rw-r--r--readline/readline/search.c47
-rw-r--r--readline/readline/shlib/Makefile.in2
-rw-r--r--readline/readline/signals.c87
-rwxr-xr-xreadline/readline/support/config.guess366
-rwxr-xr-xreadline/readline/support/config.sub648
-rwxr-xr-xreadline/readline/support/shlib-install36
-rwxr-xr-xreadline/readline/support/shobj-conf59
-rw-r--r--readline/readline/terminal.c76
-rw-r--r--readline/readline/text.c105
-rw-r--r--readline/readline/tilde.c18
-rw-r--r--readline/readline/undo.c2
-rw-r--r--readline/readline/util.c18
-rw-r--r--readline/readline/vi_mode.c182
58 files changed, 3783 insertions, 4155 deletions
diff --git a/readline/ChangeLog b/readline/ChangeLog
index 69ab913..4961f99 100644
--- a/readline/ChangeLog
+++ b/readline/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-02 Tom Tromey <tom@tromey.com>
+
+ * Import readline 8.1.
+
2020-06-30 Tom Tromey <tom@tromey.com>
* README: Update instructions.
diff --git a/readline/readline/CHANGELOG b/readline/readline/CHANGELOG
index 6fa1ebb..5c24e91 100644
--- a/readline/readline/CHANGELOG
+++ b/readline/readline/CHANGELOG
@@ -1,11 +1,4 @@
-2019-12-23 Eli Zaretskii <eliz@gnu.org>
-
- * posixstat.h (S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH)
- (S_IXOTH, S_IRWXG, S_IRWXO): Define if undefined, even if S_IRWXU
- is defined, because non-Posix systems may defined only the user
- bits.
-
-[Readline-specific changelog. Descriptions of changes to the source are
+\[Readline-specific changelog. Descriptions of changes to the source are
found in the bash changelog.]
6/9
@@ -1358,3 +1351,55 @@ Makefile.in
----
Makefile.in
- installdirs: create $(pkgconfigdir) if it doesn't exist
+
+
+ 4/8/2019
+ --------
+readline.pc.in
+ - change CFLAGS to include ${includedir} instead of ${includedir}/readline,
+ to support the recommended `#include <readline/readline.h>'. Report
+ and fix from Andrea Bolognani <abologna@redhat.com>
+
+ 5/13
+ ----
+configure.ac
+ - hpux: add -DTGETENT_BROKEN to LOCAL_CFLAGS
+
+ 8/28
+ ----
+configure.ac
+ - hpux: add -DTGETFLAG_BROKEN to LOCAL_CFLAGS
+
+ 9/6
+ ---
+examples/autoconf/RL_LIB_READLINE_VERSION
+ - include <stdlib.h> in the AC_TRY_RUN block to accommodate compilers
+ that treat functions without an existing prototype as fatal errors.
+ Report and fix from Florian Weimer <fweimer@redhat.com>
+
+ 12/13
+ -----
+support/shlib-install
+ - remove old code for FreeBSD and Dragonfly; they are ELF-only now and
+ can use the same code as Linux. Fix from
+ Baptiste Daroussin <bapt@FreeBSD.org>
+
+ 5/20/2020
+ ---------
+configure.ac
+ - bumped version number up to 8.1
+
+ 6/15
+ ----
+configure.ac
+ - add -Wno-parentheses -Wno-format-security to CFLAGS if gcc (or clang)
+ is the compiler
+
+ 10/29
+ -----
+configure.ac
+ - --enable-bracketed-paste-default: new invocation option, toggles the
+ default value of enable-bracketed-paste (on by default)
+
+INSTALL
+ - document new --enable-bracketed-paste-default configure option
diff --git a/readline/readline/CHANGES b/readline/readline/CHANGES
index 09eab6e..747fa41 100644
--- a/readline/readline/CHANGES
+++ b/readline/readline/CHANGES
@@ -1,3 +1,126 @@
+This document details the changes between this version, readline-8.1, and
+the previous version, readline-8.0.
+
+1. Changes to Readline
+
+a. There are a number of fixes that were found as the result of fuzzing with
+ random input.
+
+b. Changed the revert-all-at-newline behavior to make sure to start at the end
+ of the history list when doing it, instead of the line where the user hit
+ return.
+
+c. When parsing `set' commands from the inputrc file or an application, readline
+ now allows trailing whitespace.
+
+d. Fixed a bug that left a file descriptor open to the history file if the
+ file size was 0.
+
+e. Fixed a problem with binding key sequences containing meta characters.
+
+f. Fixed a bug that caused the wrong line to be displayed if the user tried to
+ move back beyond the beginning of the history list, or forward past the end
+ of the history list.
+
+g. If readline catches SIGTSTP, it now sets a hook that allows the calling
+ application to handle it if it desires.
+
+h. Fixed a redisplay problem with a prompt string containing embedded newlines.
+
+i. Fixed a problem with completing filenames containing invalid multibyte
+ sequences when case-insensitive comparisons are enabled.
+
+j. Fixed a redisplay problem with prompt strings containing invisible multibyte
+ characters.
+
+k. Fixed a problem with multibyte characters mapped to editing commands that
+ modify the search string in incremental search.
+
+l. Fixed a bug with maintaining the key sequence while resolving a bound
+ command in the presence of ambiguous sequences (sequences with a common
+ prefix), in most cases while attempting to unbind it.
+
+m. Fixed several buffer overflows found as the result of fuzzing.
+
+n. Reworked backslash handling when translating key sequences for key binding
+ to be more uniform and consistent, which introduces a slight backwards
+ incompatibility.
+
+o. Fixed a bug with saving the history that resulted in errors not being
+ propagated to the calling application when the history file is not writable.
+
+p. Readline only calls chown(2) on a newly-written history file if it really
+ needs to, instead of having it be a no-op.
+
+q. Readline now behaves better when operate-and-get-next is used when the
+ history list is `full': when there are already $HISTSIZE entries.
+
+r. Fixed a bug that could cause vi redo (`.') of a replace command not to work
+ correctly in the C or POSIX locale.
+
+s. Fixed a bug with vi-mode digit arguments that caused the last command to be
+ set incorrectly. This prevents yank-last-arg from working as intended, for
+ example.
+
+t. Make sure that all undo groups are closed when leaving vi insertion mode.
+
+u. Make sure that the vi-mode `C' and `c' commands enter insert mode even if
+ the motion command doesn't have any effect.
+
+v. Fixed several potential memory leaks in the callback mode context handling.
+
+w. If readline is handling a SIGTTOU, make sure SIGTTOU is blocked while
+ executing the terminal cleanup code, since it's no longer run in a signal
+ handling context.
+
+x. Fixed a bug that could cause an application with an application-specific
+ redisplay function to crash if the line data structures had not been
+ initialized.
+
+y. Terminals that are named "dumb" or unknown do not enable bracketed paste
+ by default.
+
+z. Ensure that disabling bracketed paste turns off highlighting the incremental
+ search string when the search is successful.
+
+2. New Features in Readline
+
+a. If a second consecutive completion attempt produces matches where the first
+ did not, treat it as a new completion attempt and insert a match as
+ appropriate.
+
+b. Bracketed paste mode works in more places: incremental search strings, vi
+ overstrike mode, character search, and reading numeric arguments.
+
+c. Readline automatically switches to horizontal scrolling if the terminal has
+ only one line.
+
+d. Unbinding all key sequences bound to a particular readline function now
+ descends into keymaps for multi-key sequences.
+
+e. rl-clear-display: new bindable command that clears the screen and, if
+ possible, the scrollback buffer (bound to emacs mode M-C-l by default).
+
+f. New active mark and face feature: when enabled, it will highlight the text
+ inserted by a bracketed paste (the `active region') and the text found by
+ incremental and non-incremental history searches. This is tied to bracketed
+ paste and can be disabled by turning off bracketed paste.
+
+g. Readline sets the mark in several additional commands.
+
+h. Bracketed paste mode is enabled by default. There is a configure-time
+ option (--enable-bracketed-paste-default) to set the default to on or off.
+
+i. Readline tries to take advantage of the more regular structure of UTF-8
+ characters to identify the beginning and end of characters when moving
+ through the line buffer.
+
+j. The bindable operate-and-get-next command (and its default bindings) are
+ now part of readline instead of a bash-specific addition.
+
+k. The signal cleanup code now blocks SIGINT while processing after a SIGINT.
+
+-------------------------------------------------------------------------------
This document details the changes between this version, readline-8.0, and the
previous version, readline-7.0.
diff --git a/readline/readline/INSTALL b/readline/readline/INSTALL
index afb4d53..4f0d7b0 100644
--- a/readline/readline/INSTALL
+++ b/readline/readline/INSTALL
@@ -1,7 +1,7 @@
Basic Installation
==================
-These are installation instructions for Readline-8.0.
+These are installation instructions for Readline-8.1.
The simplest way to compile readline is:
@@ -183,6 +183,11 @@ The readline `configure' recognizes a single `--with-PACKAGE' option:
`--enable-static'
Build the static libraries by default. The default is `yes'.
+
+`--enable-bracketed-paste-default'
+ Enable bracketed paste by default, so the initial value of the
+ `enable-bracketed-paste' Readline variable is `on'. The default
+ is `yes'.
Shared Libraries
================
diff --git a/readline/readline/Makefile.in b/readline/readline/Makefile.in
index bcbd18b..c01da8d 100644
--- a/readline/readline/Makefile.in
+++ b/readline/readline/Makefile.in
@@ -72,10 +72,10 @@ DESTDIR =
# Programs to make tags files.
ETAGS = etags
-CTAGS = ctags -tw
+CTAGS = ctags -w
CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
+LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' @BRACKETED_PASTE@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@ @CROSS_COMPILE@
diff --git a/readline/readline/NEWS b/readline/readline/NEWS
index 42be21e..56ab93a 100644
--- a/readline/readline/NEWS
+++ b/readline/readline/NEWS
@@ -1,3 +1,44 @@
+This is a terse description of the new features added to readline-8.1 since
+the release of readline-8.0.
+
+New Features in Readline
+
+a. If a second consecutive completion attempt produces matches where the first
+ did not, treat it as a new completion attempt and insert a match as
+ appropriate.
+
+b. Bracketed paste mode works in more places: incremental search strings, vi
+ overstrike mode, character search, and reading numeric arguments.
+
+c. Readline automatically switches to horizontal scrolling if the terminal has
+ only one line.
+
+d. Unbinding all key sequences bound to a particular readline function now
+ descends into keymaps for multi-key sequences.
+
+e. rl-clear-display: new bindable command that clears the screen and, if
+ possible, the scrollback buffer (bound to emacs mode M-C-l by default).
+
+f. New active mark and face feature: when enabled, it will highlight the text
+ inserted by a bracketed paste (the `active region') and the text found by
+ incremental and non-incremental history searches. This is tied to bracketed
+ paste and can be disabled by turning off bracketed paste.
+
+g. Readline sets the mark in several additional commands.
+
+h. Bracketed paste mode is enabled by default. There is a configure-time
+ option (--enable-bracketed-paste-default) to set the default to on or off.
+
+i. Readline tries to take advantage of the more regular structure of UTF-8
+ characters to identify the beginning and end of characters when moving
+ through the line buffer.
+
+j. The bindable operate-and-get-next command (and its default bindings) are
+ now part of readline instead of a bash-specific addition.
+
+k. The signal cleanup code now blocks SIGINT while processing after a SIGINT.
+
+-------------------------------------------------------------------------------
This is a terse description of the new features added to readline-8.0 since
the release of readline-7.0.
@@ -179,6 +220,27 @@ n. New application-settable variable: rl_signal_event_hook; function that is
by a signal. Currently not called for SIGHUP or SIGTERM.
-------------------------------------------------------------------------------
+This is a terse description of the new features added to readline-6.2 since
+the release of readline-6.1.
+
+a. The history library does not try to write the history filename in the
+ current directory if $HOME is unset. This closes a potential security
+ problem if the application does not specify a history filename.
+
+b. New bindable variable `completion-display-width' to set the number of
+ columns used when displaying completions.
+
+c. New bindable variable `completion-case-map' to cause case-insensitive
+ completion to treat `-' and `_' as identical.
+
+d. There are new bindable vi-mode command names to avoid readline's case-
+ insensitive matching not allowing them to be bound separately.
+
+e. New bindable variable `menu-complete-display-prefix' causes the menu
+ completion code to display the common prefix of the possible completions
+ before cycling through the list, instead of after.
+
+-------------------------------------------------------------------------------
This is a terse description of the new features added to readline-6.1 since
the release of readline-6.0.
diff --git a/readline/readline/README b/readline/readline/README
index 4fb0804..de98575 100644
--- a/readline/readline/README
+++ b/readline/readline/README
@@ -1,7 +1,7 @@
Introduction
============
-This is the Gnu Readline library, version 8.0.
+This is the Gnu Readline library, version 8.1.
The Readline library provides a set of functions for use by applications
that allow users to edit command lines as they are typed in. Both
diff --git a/readline/readline/aclocal.m4 b/readline/readline/aclocal.m4
index 1413267..6899e82 100644
--- a/readline/readline/aclocal.m4
+++ b/readline/readline/aclocal.m4
@@ -1,4 +1,4 @@
-nl
+dnl
dnl Bash specific tests
dnl
dnl Some derived from PDKSH 5.1.3 autoconf tests
@@ -10,6 +10,7 @@ AC_DEFUN(BASH_C_LONG_LONG,
ac_cv_c_long_long=yes
else
AC_TRY_RUN([
+#include <stdlib.h>
int
main()
{
@@ -33,6 +34,7 @@ AC_DEFUN(BASH_C_LONG_DOUBLE,
ac_cv_c_long_double=yes
else
AC_TRY_RUN([
+#include <stdlib.h>
int
main()
{
@@ -64,6 +66,8 @@ AC_DEFUN(BASH_HEADER_INTTYPES,
dnl
dnl check for typedef'd symbols in header files, but allow the caller to
dnl specify the include files to be checked in addition to the default
+dnl
+dnl This could be changed to use AC_COMPILE_IFELSE instead of AC_EGREP_CPP
dnl
dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
AC_DEFUN(BASH_CHECK_TYPE,
@@ -134,6 +138,8 @@ typedef int (*_bashfunc)(const char *, ...);
#else
typedef int (*_bashfunc)();
#endif
+#include <stdlib.h>
+int
main()
{
_bashfunc pf;
@@ -191,9 +197,11 @@ AC_CACHE_VAL(bash_cv_under_sys_siglist,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
#ifndef UNDER_SYS_SIGLIST_DECLARED
extern char *_sys_siglist[];
#endif
+int
main()
{
char *msg = (char *)_sys_siglist[2];
@@ -218,9 +226,11 @@ AC_CACHE_VAL(bash_cv_sys_siglist,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
#if !HAVE_DECL_SYS_SIGLIST
extern char *sys_siglist[];
#endif
+int
main()
{
char *msg = sys_siglist[2];
@@ -273,6 +283,8 @@ AC_CACHE_VAL(bash_cv_dup2_broken,
[AC_TRY_RUN([
#include <sys/types.h>
#include <fcntl.h>
+#include <stdlib.h>
+int
main()
{
int fd1, fd2, fl;
@@ -300,7 +312,8 @@ AC_DEFUN(BASH_FUNC_STRSIGNAL,
[AC_MSG_CHECKING([for the existence of strsignal])
AC_CACHE_VAL(bash_cv_have_strsignal,
[AC_TRY_LINK([#include <sys/types.h>
-#include <signal.h>],
+#include <signal.h>
+#include <string.h>],
[char *s = (char *)strsignal(2);],
bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
AC_MSG_RESULT($bash_cv_have_strsignal)
@@ -321,6 +334,9 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
#else
@@ -335,6 +351,8 @@ AC_CACHE_VAL(bash_cv_opendir_not_robust,
# include <ndir.h>
# endif
#endif /* HAVE_DIRENT_H */
+#include <stdlib.h>
+int
main()
{
DIR *dir;
@@ -514,6 +532,8 @@ AC_TRY_RUN([
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <stdlib.h>
+int
main()
{
#ifdef HAVE_QUAD_T
@@ -583,6 +603,7 @@ AC_CACHE_VAL(bash_cv_getenv_redef,
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#include <stdlib.h>
#ifndef __STDC__
# ifndef const
# define const
@@ -598,6 +619,7 @@ getenv (name)
{
return "42";
}
+int
main()
{
char *s;
@@ -684,6 +706,11 @@ AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
AC_CACHE_VAL(bash_cv_ulimit_maxfds,
[AC_TRY_RUN([
+#include <stdlib.h>
+#ifdef HAVE_ULIMIT_H
+#include <ulimit.h>
+#endif
+int
main()
{
long maxfds = ulimit(4, 0L);
@@ -707,7 +734,9 @@ AC_CACHE_VAL(bash_cv_getcwd_malloc,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
+int
main()
{
char *xpwd;
@@ -757,12 +786,13 @@ AC_CACHE_VAL(bash_cv_fnm_extmatch,
[AC_TRY_RUN([
#include <fnmatch.h>
+int
main()
{
#ifdef FNM_EXTMATCH
- exit (0);
+ return (0);
#else
- exit (1);
+ return (1);
#endif
}
], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
@@ -786,7 +816,9 @@ AC_CACHE_VAL(bash_cv_func_sigsetjmp,
#include <sys/types.h>
#include <signal.h>
#include <setjmp.h>
+#include <stdlib.h>
+int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
@@ -835,7 +867,10 @@ AC_CACHE_VAL(bash_cv_func_strcoll_broken,
#if defined (HAVE_LOCALE_H)
#include <locale.h>
#endif
+#include <string.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
@@ -881,6 +916,7 @@ AC_CACHE_VAL(bash_cv_printf_a_format,
[AC_TRY_RUN([
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
int
main()
@@ -934,6 +970,7 @@ AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
#include <sys/stat.h>
],
[
+int
main()
{
static struct stat a;
@@ -1142,12 +1179,17 @@ fi
AC_DEFUN(BASH_STRUCT_TIMEVAL,
[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
AC_CACHE_VAL(bash_cv_struct_timeval,
-[
-AC_EGREP_HEADER(struct timeval, sys/time.h,
- bash_cv_struct_timeval=yes,
- AC_EGREP_HEADER(struct timeval, time.h,
- bash_cv_struct_timeval=yes,
- bash_cv_struct_timeval=no))
+[AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#if HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
+ #include <time.h>
+ ]],
+ [[static struct timeval x; x.tv_sec = x.tv_usec;]]
+ )],
+ bash_cv_struct_timeval=yes,
+ bash_cv_struct_timeval=no)
])
AC_MSG_RESULT($bash_cv_struct_timeval)
if test $bash_cv_struct_timeval = yes; then
@@ -1241,6 +1283,11 @@ AC_CACHE_VAL(bash_cv_pgrp_pipe,
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#include <stdlib.h>
+int
main()
{
# ifdef GETPGRP_VOID
@@ -1305,6 +1352,7 @@ AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
typedef RETSIGTYPE sigfunc();
@@ -1335,6 +1383,7 @@ int s;
nsigint++;
}
+int
main()
{
nsigint = 0;
@@ -1418,8 +1467,11 @@ AC_CACHE_VAL(bash_cv_sys_named_pipes,
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdio.h>
+#include <stdlib.h>
/* Add more tests in here as appropriate. */
+int
main()
{
int fd, err;
@@ -1651,11 +1703,13 @@ AC_CACHE_VAL(bash_cv_unusable_rtsigs,
[AC_TRY_RUN([
#include <sys/types.h>
#include <signal.h>
+#include <stdlib.h>
#ifndef NSIG
# define NSIG 64
#endif
+int
main ()
{
int n_sigs = 2 * NSIG;
@@ -1770,6 +1824,7 @@ bash_cv_wcwidth_broken,
#include <locale.h>
#include <wchar.h>
+int
main(c, v)
int c;
char **v;
@@ -1834,9 +1889,11 @@ AC_CACHE_VAL(ac_cv_rl_version,
[AC_TRY_RUN([
#include <stdio.h>
#include <readline/readline.h>
+#include <stdlib.h>
extern int rl_gnu_readline_p;
+int
main()
{
FILE *fp;
@@ -1926,7 +1983,9 @@ AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
#endif
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
@@ -1969,10 +2028,12 @@ AC_CACHE_VAL(bash_cv_wcontinued_broken,
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
#ifndef errno
extern int errno;
#endif
+int
main()
{
int x;
@@ -2023,2036 +2084,6 @@ AC_DEFUN([AM_PATH_LISPDIR],
AC_SUBST(lispdir)
])
-dnl
-dnl tests added for gettext
-dnl
-# codeset.m4 serial AM1 (gettext-0.10.40)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_LANGINFO_CODESET],
-[
- AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
- [AC_TRY_LINK([#include <langinfo.h>],
- [char* cs = nl_langinfo(CODESET);],
- am_cv_langinfo_codeset=yes,
- am_cv_langinfo_codeset=no)
- ])
- if test $am_cv_langinfo_codeset = yes; then
- AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
- [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
- fi
-])
-# gettext.m4 serial 20 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-
-dnl Macro to add for using GNU gettext.
-
-dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
-dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
-dnl default (if it is not specified or empty) is 'no-libtool'.
-dnl INTLSYMBOL should be 'external' for packages with no intl directory,
-dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
-dnl If INTLSYMBOL is 'use-libtool', then a libtool library
-dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
-dnl depending on --{enable,disable}-{shared,static} and on the presence of
-dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
-dnl $(top_builddir)/intl/libintl.a will be created.
-dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
-dnl implementations (in libc or libintl) without the ngettext() function
-dnl will be ignored. If NEEDSYMBOL is specified and is
-dnl 'need-formatstring-macros', then GNU gettext implementations that don't
-dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
-dnl INTLDIR is used to find the intl libraries. If empty,
-dnl the value `$(top_builddir)/intl/' is used.
-dnl
-dnl The result of the configuration is one of three cases:
-dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
-dnl and used.
-dnl Catalog format: GNU --> install in $(datadir)
-dnl Catalog extension: .mo after installation, .gmo in source tree
-dnl 2) GNU gettext has been found in the system's C library.
-dnl Catalog format: GNU --> install in $(datadir)
-dnl Catalog extension: .mo after installation, .gmo in source tree
-dnl 3) No internationalization, always use English msgid.
-dnl Catalog format: none
-dnl Catalog extension: none
-dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
-dnl The use of .gmo is historical (it was needed to avoid overwriting the
-dnl GNU format catalogs when building on a platform with an X/Open gettext),
-dnl but we keep it in order not to force irrelevant filename changes on the
-dnl maintainers.
-dnl
-AC_DEFUN([AM_GNU_GETTEXT],
-[
- dnl Argument checking.
- ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
- [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
-])])])])])
- ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
- [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
-])])])])
- define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
- define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
-
- AC_REQUIRE([AM_PO_SUBDIRS])dnl
- ifelse(gt_included_intl, yes, [
- AC_REQUIRE([AM_INTL_SUBDIR])dnl
- ])
-
- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
-
- dnl Sometimes libintl requires libiconv, so first search for libiconv.
- dnl Ideally we would do this search only after the
- dnl if test "$USE_NLS" = "yes"; then
- dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
- dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
- dnl the configure script would need to contain the same shell code
- dnl again, outside any 'if'. There are two solutions:
- dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
- dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
- dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
- dnl documented, we avoid it.
- ifelse(gt_included_intl, yes, , [
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
- ])
-
- dnl Set USE_NLS.
- AM_NLS
-
- ifelse(gt_included_intl, yes, [
- BUILD_INCLUDED_LIBINTL=no
- USE_INCLUDED_LIBINTL=no
- ])
- LIBINTL=
- LTLIBINTL=
- POSUB=
-
- dnl If we use NLS figure out what method
- if test "$USE_NLS" = "yes"; then
- gt_use_preinstalled_gnugettext=no
- ifelse(gt_included_intl, yes, [
- AC_MSG_CHECKING([whether included gettext is requested])
- AC_ARG_WITH(included-gettext,
- [ --with-included-gettext use the GNU gettext library included here],
- nls_cv_force_use_gnu_gettext=$withval,
- nls_cv_force_use_gnu_gettext=no)
- AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
-
- nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
- if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
- ])
- dnl User does not insist on using GNU NLS library. Figure out what
- dnl to use. If GNU gettext is available we use this. Else we have
- dnl to fall back to GNU NLS library.
-
- dnl Add a version number to the cache macros.
- define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
- define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
- define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
-
- AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
- [AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern int *_nl_domain_bindings;],
- [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
- gt_cv_func_gnugettext_libc=yes,
- gt_cv_func_gnugettext_libc=no)])
-
- if test "$gt_cv_func_gnugettext_libc" != "yes"; then
- dnl Sometimes libintl requires libiconv, so first search for libiconv.
- ifelse(gt_included_intl, yes, , [
- AM_ICONV_LINK
- ])
- dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
- dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
- dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
- dnl even if libiconv doesn't exist.
- AC_LIB_LINKFLAGS_BODY([intl])
- AC_CACHE_CHECK([for GNU gettext in libintl],
- gt_cv_func_gnugettext_libintl,
- [gt_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $INCINTL"
- gt_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBINTL"
- dnl Now see whether libintl exists and does not depend on libiconv.
- AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
- [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
- gt_cv_func_gnugettext_libintl=yes,
- gt_cv_func_gnugettext_libintl=no)
- dnl Now see whether libintl exists and depends on libiconv.
- if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
- LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <libintl.h>
-]ifelse([$2], [need-formatstring-macros],
-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
-#endif
-changequote(,)dnl
-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
-changequote([,])dnl
-], [])[extern int _nl_msg_cat_cntr;
-extern
-#ifdef __cplusplus
-"C"
-#endif
-const char *_nl_expand_alias ();],
- [bindtextdomain ("", "");
-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
- [LIBINTL="$LIBINTL $LIBICONV"
- LTLIBINTL="$LTLIBINTL $LTLIBICONV"
- gt_cv_func_gnugettext_libintl=yes
- ])
- fi
- CPPFLAGS="$gt_save_CPPFLAGS"
- LIBS="$gt_save_LIBS"])
- fi
-
- dnl If an already present or preinstalled GNU gettext() is found,
- dnl use it. But if this macro is used in GNU gettext, and GNU
- dnl gettext is already preinstalled in libintl, we update this
- dnl libintl. (Cf. the install rule in intl/Makefile.in.)
- if test "$gt_cv_func_gnugettext_libc" = "yes" \
- || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
- && test "$PACKAGE" != gettext-runtime \
- && test "$PACKAGE" != gettext-tools; }; then
- gt_use_preinstalled_gnugettext=yes
- else
- dnl Reset the values set by searching for libintl.
- LIBINTL=
- LTLIBINTL=
- INCINTL=
- fi
-
- ifelse(gt_included_intl, yes, [
- if test "$gt_use_preinstalled_gnugettext" != "yes"; then
- dnl GNU gettext is not found in the C library.
- dnl Fall back on included GNU gettext library.
- nls_cv_use_gnu_gettext=yes
- fi
- fi
-
- if test "$nls_cv_use_gnu_gettext" = "yes"; then
- dnl Mark actions used to generate GNU NLS library.
- BUILD_INCLUDED_LIBINTL=yes
- USE_INCLUDED_LIBINTL=yes
- LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
- LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
- LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
- fi
-
- if test "$gt_use_preinstalled_gnugettext" = "yes" \
- || test "$nls_cv_use_gnu_gettext" = "yes"; then
- dnl Mark actions to use GNU gettext tools.
- CATOBJEXT=.gmo
- fi
- ])
-
- if test "$gt_use_preinstalled_gnugettext" = "yes" \
- || test "$nls_cv_use_gnu_gettext" = "yes"; then
- AC_DEFINE(ENABLE_NLS, 1,
- [Define to 1 if translation of program messages to the user's native language
- is requested.])
- else
- USE_NLS=no
- fi
- fi
-
- AC_MSG_CHECKING([whether to use NLS])
- AC_MSG_RESULT([$USE_NLS])
- if test "$USE_NLS" = "yes"; then
- AC_MSG_CHECKING([where the gettext function comes from])
- if test "$gt_use_preinstalled_gnugettext" = "yes"; then
- if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
- gt_source="external libintl"
- else
- gt_source="libc"
- fi
- else
- gt_source="included intl directory"
- fi
- AC_MSG_RESULT([$gt_source])
- fi
-
- if test "$USE_NLS" = "yes"; then
-
- if test "$gt_use_preinstalled_gnugettext" = "yes"; then
- if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
- AC_MSG_CHECKING([how to link with libintl])
- AC_MSG_RESULT([$LIBINTL])
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
- fi
-
- dnl For backward compatibility. Some packages may be using this.
- AC_DEFINE(HAVE_GETTEXT, 1,
- [Define if the GNU gettext() function is already present or preinstalled.])
- AC_DEFINE(HAVE_DCGETTEXT, 1,
- [Define if the GNU dcgettext() function is already present or preinstalled.])
- fi
-
- dnl We need to process the po/ directory.
- POSUB=po
- fi
-
- ifelse(gt_included_intl, yes, [
- dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
- dnl to 'yes' because some of the testsuite requires it.
- if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
- BUILD_INCLUDED_LIBINTL=yes
- fi
-
- dnl Make all variables we use known to autoconf.
- AC_SUBST(BUILD_INCLUDED_LIBINTL)
- AC_SUBST(USE_INCLUDED_LIBINTL)
- AC_SUBST(CATOBJEXT)
-
- dnl For backward compatibility. Some configure.ins may be using this.
- nls_cv_header_intl=
- nls_cv_header_libgt=
-
- dnl For backward compatibility. Some Makefiles may be using this.
- DATADIRNAME=share
- AC_SUBST(DATADIRNAME)
-
- dnl For backward compatibility. Some Makefiles may be using this.
- INSTOBJEXT=.mo
- AC_SUBST(INSTOBJEXT)
-
- dnl For backward compatibility. Some Makefiles may be using this.
- GENCAT=gencat
- AC_SUBST(GENCAT)
-
- dnl For backward compatibility. Some Makefiles may be using this.
- if test "$USE_INCLUDED_LIBINTL" = yes; then
- INTLOBJS="\$(GETTOBJS)"
- fi
- AC_SUBST(INTLOBJS)
-
- dnl Enable libtool support if the surrounding package wishes it.
- INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
- AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
- ])
-
- dnl For backward compatibility. Some Makefiles may be using this.
- INTLLIBS="$LIBINTL"
- AC_SUBST(INTLLIBS)
-
- dnl Make all documented variables known to autoconf.
- AC_SUBST(LIBINTL)
- AC_SUBST(LTLIBINTL)
- AC_SUBST(POSUB)
-])
-
-
-dnl Checks for all prerequisites of the intl subdirectory,
-dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
-dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
-AC_DEFUN([AM_INTL_SUBDIR],
-[
- AC_REQUIRE([AC_PROG_INSTALL])dnl
- AC_REQUIRE([AM_MKINSTALLDIRS])dnl
- AC_REQUIRE([AC_PROG_CC])dnl
- AC_REQUIRE([AC_CANONICAL_HOST])dnl
- AC_REQUIRE([AC_PROG_RANLIB])dnl
- AC_REQUIRE([AC_ISC_POSIX])dnl
- AC_REQUIRE([AC_HEADER_STDC])dnl
- AC_REQUIRE([AC_C_CONST])dnl
- AC_REQUIRE([AC_C_INLINE])dnl
- AC_REQUIRE([AC_TYPE_OFF_T])dnl
- AC_REQUIRE([AC_TYPE_SIZE_T])dnl
- AC_REQUIRE([AC_FUNC_ALLOCA])dnl
- AC_REQUIRE([AC_FUNC_MMAP])dnl
- AC_REQUIRE([jm_GLIBC21])dnl
- AC_REQUIRE([gt_INTDIV0])dnl
- AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
- AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
- AC_REQUIRE([gt_INTTYPES_PRI])dnl
-
- AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
-stdlib.h string.h unistd.h sys/param.h])
- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
-geteuid getgid getuid mempcpy munmap putenv setenv setlocale localeconv stpcpy \
-strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
-__fsetlocking])
-
- AM_ICONV
- AM_LANGINFO_CODESET
- if test $ac_cv_header_locale_h = yes; then
- AM_LC_MESSAGES
- fi
-
- dnl intl/plural.c is generated from intl/plural.y. It requires bison,
- dnl because plural.y uses bison specific features. It requires at least
- dnl bison-1.26 because earlier versions generate a plural.c that doesn't
- dnl compile.
- dnl bison is only needed for the maintainer (who touches plural.y). But in
- dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
- dnl the rule in general Makefile. Now, some people carelessly touch the
- dnl files or have a broken "make" program, hence the plural.c rule will
- dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
- dnl present or too old.
- AC_CHECK_PROGS([INTLBISON], [bison])
- if test -z "$INTLBISON"; then
- ac_verc_fail=yes
- else
- dnl Found it, now check the version.
- AC_MSG_CHECKING([version of bison])
-changequote(<<,>>)dnl
- ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
- case $ac_prog_version in
- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
-changequote([,])dnl
- ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
- esac
- AC_MSG_RESULT([$ac_prog_version])
- fi
- if test $ac_verc_fail = yes; then
- INTLBISON=:
- fi
-])
-
-
-dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
-AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
-# glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-# Test for the GNU C Library, version 2.1 or newer.
-# From Bruno Haible.
-
-AC_DEFUN([jm_GLIBC21],
- [
- AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
- ac_cv_gnu_library_2_1,
- [AC_EGREP_CPP([Lucky GNU user],
- [
-#include <features.h>
-#ifdef __GNU_LIBRARY__
- #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
- Lucky GNU user
- #endif
-#endif
- ],
- ac_cv_gnu_library_2_1=yes,
- ac_cv_gnu_library_2_1=no)
- ]
- )
- AC_SUBST(GLIBC21)
- GLIBC21="$ac_cv_gnu_library_2_1"
- ]
-)
-# iconv.m4 serial AM4 (gettext-0.11.3)
-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
-[
- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([iconv])
-])
-
-AC_DEFUN([AM_ICONV_LINK],
-[
- dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
- dnl those with the standalone portable GNU libiconv installed).
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-
- dnl Add $INCICONV to CPPFLAGS before performing the following checks,
- dnl because if the user has installed libiconv and not disabled its use
- dnl via --without-libiconv-prefix, he wants to use it. The first
- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
- am_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
-
- AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
- am_cv_func_iconv="no, consider installing GNU libiconv"
- am_cv_lib_iconv=no
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- am_cv_func_iconv=yes)
- if test "$am_cv_func_iconv" != yes; then
- am_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- am_cv_lib_iconv=yes
- am_cv_func_iconv=yes)
- LIBS="$am_save_LIBS"
- fi
- ])
- if test "$am_cv_func_iconv" = yes; then
- AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
- fi
- if test "$am_cv_lib_iconv" = yes; then
- AC_MSG_CHECKING([how to link with libiconv])
- AC_MSG_RESULT([$LIBICONV])
- else
- dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
- dnl either.
- CPPFLAGS="$am_save_CPPFLAGS"
- LIBICONV=
- LTLIBICONV=
- fi
- AC_SUBST(LIBICONV)
- AC_SUBST(LTLIBICONV)
-])
-
-AC_DEFUN([AM_ICONV],
-[
- AM_ICONV_LINK
- if test "$am_cv_func_iconv" = yes; then
- AC_MSG_CHECKING([for iconv declaration])
- AC_CACHE_VAL(am_cv_proto_iconv, [
- AC_TRY_COMPILE([
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
- AC_MSG_RESULT([$]{ac_t:-
- }[$]am_cv_proto_iconv)
- AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
- [Define as const if the declaration of iconv() needs const.])
- fi
-])
-# intdiv0.m4 serial 1 (gettext-0.11.3)
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([gt_INTDIV0],
-[
- AC_REQUIRE([AC_PROG_CC])dnl
- AC_REQUIRE([AC_CANONICAL_HOST])dnl
-
- AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
- gt_cv_int_divbyzero_sigfpe,
- [
- AC_TRY_RUN([
-#include <stdlib.h>
-#include <signal.h>
-
-static void
-#ifdef __cplusplus
-sigfpe_handler (int sig)
-#else
-sigfpe_handler (sig) int sig;
-#endif
-{
- /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
- exit (sig != SIGFPE);
-}
-
-int x = 1;
-int y = 0;
-int z;
-int nan;
-
-int main ()
-{
- signal (SIGFPE, sigfpe_handler);
-/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
-#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
- signal (SIGTRAP, sigfpe_handler);
-#endif
-/* Linux/SPARC yields signal SIGILL. */
-#if defined (__sparc__) && defined (__linux__)
- signal (SIGILL, sigfpe_handler);
-#endif
-
- z = x / y;
- nan = y / y;
- exit (1);
-}
-], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
- [
- # Guess based on the CPU.
- case "$host_cpu" in
- alpha* | i[34567]86 | m68k | s390*)
- gt_cv_int_divbyzero_sigfpe="guessing yes";;
- *)
- gt_cv_int_divbyzero_sigfpe="guessing no";;
- esac
- ])
- ])
- case "$gt_cv_int_divbyzero_sigfpe" in
- *yes) value=1;;
- *) value=0;;
- esac
- AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
- [Define if integer division by zero raises signal SIGFPE.])
-])
-# inttypes.m4 serial 1 (gettext-0.11.4)
-dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
-# <sys/types.h>.
-
-AC_DEFUN([gt_HEADER_INTTYPES_H],
-[
- AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
- [
- AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <inttypes.h>],
- [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
- ])
- if test $gt_cv_header_inttypes_h = yes; then
- AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
- [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
- fi
-])
-# inttypes_h.m4 serial 5 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
-[
- AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <inttypes.h>],
- [uintmax_t i = (uintmax_t) -1;],
- jm_ac_cv_header_inttypes_h=yes,
- jm_ac_cv_header_inttypes_h=no)])
- if test $jm_ac_cv_header_inttypes_h = yes; then
- AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
- [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
- and declares uintmax_t. ])
- fi
-])
-# inttypes-pri.m4 serial 1 (gettext-0.11.4)
-dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
-# macros to non-string values. This is the case on AIX 4.3.3.
-
-AC_DEFUN([gt_INTTYPES_PRI],
-[
- AC_REQUIRE([gt_HEADER_INTTYPES_H])
- if test $gt_cv_header_inttypes_h = yes; then
- AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
- gt_cv_inttypes_pri_broken,
- [
- AC_TRY_COMPILE([#include <inttypes.h>
-#ifdef PRId32
-char *p = PRId32;
-#endif
-], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
- ])
- fi
- if test "$gt_cv_inttypes_pri_broken" = yes; then
- AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
- [Define if <inttypes.h> exists and defines unusable PRI* macros.])
- fi
-])
-# isc-posix.m4 serial 2 (gettext-0.11.2)
-dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-# This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
-
-# This test replaces the one in autoconf.
-# Currently this macro should have the same name as the autoconf macro
-# because gettext's gettext.m4 (distributed in the automake package)
-# still uses it. Otherwise, the use in gettext.m4 makes autoheader
-# give these diagnostics:
-# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
-# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
-
-undefine([AC_ISC_POSIX])
-
-AC_DEFUN([AC_ISC_POSIX],
- [
- dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
- AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
- ]
-)
-# lcmessage.m4 serial 3 (gettext-0.11.3)
-dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
-
-# Check whether LC_MESSAGES is available in <locale.h>.
-
-AC_DEFUN([AM_LC_MESSAGES],
-[
- AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
- [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
- am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
- if test $am_cv_val_LC_MESSAGES = yes; then
- AC_DEFINE(HAVE_LC_MESSAGES, 1,
- [Define if your <locale.h> file defines LC_MESSAGES.])
- fi
-])
-# lib-ld.m4 serial 2 (gettext-0.12)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
-
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
-AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- acl_cv_prog_gnu_ld=yes
-else
- acl_cv_prog_gnu_ld=no
-fi])
-with_gnu_ld=$acl_cv_prog_gnu_ld
-])
-
-dnl From libtool-1.4. Sets the variable LD.
-AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [[\\/]* | [A-Za-z]:[\\/]*)]
- [re_direlt='/[^/][^/]*/\.\./']
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(acl_cv_path_LD,
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- acl_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_LIB_PROG_LD_GNU
-])
-# lib-link.m4 serial 4 (gettext-0.12)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
-dnl augments the CPPFLAGS variable.
-AC_DEFUN([AC_LIB_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- define([Name],[translit([$1],[./-], [___])])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
- undefine([Name])
- undefine([NAME])
-])
-
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
-dnl searches for libname and the libraries corresponding to explicit and
-dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. If found, it
-dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
-dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
-dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
-dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- define([Name],[translit([$1],[./-], [___])])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-
- dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
-
- dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
- dnl because if the user has installed lib[]Name and not disabled its use
- dnl via --without-lib[]Name-prefix, he wants to use it.
- ac_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-
- AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $LIB[]NAME"
- AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
- LIBS="$ac_save_LIBS"
- ])
- if test "$ac_cv_lib[]Name" = yes; then
- HAVE_LIB[]NAME=yes
- AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
- AC_MSG_CHECKING([how to link with lib[]$1])
- AC_MSG_RESULT([$LIB[]NAME])
- else
- HAVE_LIB[]NAME=no
- dnl If $LIB[]NAME didn't lead to a usable library, we don't need
- dnl $INC[]NAME either.
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- undefine([Name])
- undefine([NAME])
-])
-
-dnl Determine the platform dependent parameters needed to use rpath:
-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
-dnl hardcode_direct, hardcode_minus_L.
-AC_DEFUN([AC_LIB_RPATH],
-[
- AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
- AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
- AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
- AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
- CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
- ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
- . ./conftest.sh
- rm -f ./conftest.sh
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
- libext="$acl_cv_libext"
- shlibext="$acl_cv_shlibext"
- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
- hardcode_direct="$acl_cv_hardcode_direct"
- hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath do not hardcode runtime library paths],
- :, enable_rpath=yes)
-])
-
-dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
-[
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib$1-prefix],
-[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/lib"
- fi
- fi
-])
- dnl Search the library and its dependencies in $additional_libdir and
- dnl $LDFLAGS. Using breadth-first-seach.
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
- names_next_round='$1 $2'
- while test -n "$names_next_round"; do
- names_this_round="$names_next_round"
- names_next_round=
- for name in $names_this_round; do
- already_handled=
- for n in $names_already_handled; do
- if test "$n" = "$name"; then
- already_handled=yes
- break
- fi
- done
- if test -z "$already_handled"; then
- names_already_handled="$names_already_handled $name"
- dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
- dnl or AC_LIB_HAVE_LINKFLAGS call.
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
- eval value=\"\$HAVE_LIB$uppername\"
- if test -n "$value"; then
- if test "$value" = yes; then
- eval value=\"\$LIB$uppername\"
- test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
- eval value=\"\$LTLIB$uppername\"
- test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
- else
- dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
- dnl that this library doesn't exist. So just drop it.
- :
- fi
- else
- dnl Search the library lib$name in $additional_libdir and $LDFLAGS
- dnl and the already constructed $LIBNAME/$LTLIBNAME.
- found_dir=
- found_la=
- found_so=
- found_a=
- if test $use_additional = yes; then
- if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
- found_dir="$additional_libdir"
- found_so="$additional_libdir/lib$name.$shlibext"
- if test -f "$additional_libdir/lib$name.la"; then
- found_la="$additional_libdir/lib$name.la"
- fi
- else
- if test -f "$additional_libdir/lib$name.$libext"; then
- found_dir="$additional_libdir"
- found_a="$additional_libdir/lib$name.$libext"
- if test -f "$additional_libdir/lib$name.la"; then
- found_la="$additional_libdir/lib$name.la"
- fi
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
- if test "X$prefer_shared" = "Xyes" && test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
- found_dir="$dir"
- found_so="$dir/lib$name.$shlibext"
- if test -f "$dir/lib$name.la"; then
- found_la="$dir/lib$name.la"
- fi
- else
- if test -f "$dir/lib$name.$libext"; then
- found_dir="$dir"
- found_a="$dir/lib$name.$libext"
- if test -f "$dir/lib$name.la"; then
- found_la="$dir/lib$name.la"
- fi
- fi
- fi
- ;;
- esac
- if test "X$found_dir" != "X"; then
- break
- fi
- done
- fi
- if test "X$found_dir" != "X"; then
- dnl Found the library.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
- if test "X$found_so" != "X"; then
- dnl Linking with a shared library. We attempt to hardcode its
- dnl directory into the executable's runpath, unless it's the
- dnl standard /usr/lib.
- if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
- dnl No hardcoding is needed.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
- if test "$hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $found_dir"
- fi
- else
- dnl Rely on "-L$found_dir".
- dnl But don't add it if it's already contained in the LDFLAGS
- dnl or the already constructed $LIBNAME
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
- if test "$hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- fi
- else
- if test "X$found_a" != "X"; then
- dnl Linking with a static library.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
- else
- dnl We shouldn't come here, but anyway it's good to have a
- dnl fallback.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
- fi
- fi
- dnl Assume the include files are nearby.
- additional_includedir=
- case "$found_dir" in
- */lib | */lib/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
- additional_includedir="$basedir/include"
- ;;
- esac
- if test "X$additional_includedir" != "X"; then
- dnl Potentially add $additional_includedir to $INCNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's /usr/local/include and we are using GCC on Linux,
- dnl 3. if it's already present in $CPPFLAGS or the already
- dnl constructed $INCNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- for x in $CPPFLAGS $INC[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $INCNAME.
- INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- fi
- dnl Look for dependencies.
- if test -n "$found_la"; then
- dnl Read the .la file. It defines the variables
- dnl dlname, library_names, old_library, dependency_libs, current,
- dnl age, revision, installed, dlopen, dlpreopen, libdir.
- save_libdir="$libdir"
- case "$found_la" in
- */* | *\\*) . "$found_la" ;;
- *) . "./$found_la" ;;
- esac
- libdir="$save_libdir"
- dnl We use only dependency_libs.
- for dep in $dependency_libs; do
- case "$dep" in
- -L*)
- additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
- dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 3. if it's already present in $LDFLAGS or the already
- dnl constructed $LIBNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/lib"; then
- haveit=
- if test "X$additional_libdir" = "X/usr/local/lib"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LIBNAME.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- haveit=
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LTLIBNAME.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- ;;
- -R*)
- dir=`echo "X$dep" | sed -e 's/^X-R//'`
- if test "$enable_rpath" != no; then
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $dir"
- fi
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $dir"
- fi
- fi
- ;;
- -l*)
- dnl Handle this in the next round.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
- ;;
- *.la)
- dnl Handle this in the next round. Throw away the .la's
- dnl directory; it is already contained in a preceding -L
- dnl option.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
- ;;
- *)
- dnl Most likely an immediate library name.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
- ;;
- esac
- done
- fi
- else
- dnl Didn't find the library; assume it is in the system directories
- dnl known to the linker and runtime loader. (All the system
- dnl directories known to the linker should also be known to the
- dnl runtime loader, otherwise the system is severely misconfigured.)
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- done
- done
- if test "X$rpathdirs" != "X"; then
- if test -n "$hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
- done
- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
- dnl The -rpath options are cumulative.
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
- eval flag=\"$hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
- fi
- fi
- if test "X$ltrpathdirs" != "X"; then
- dnl When using libtool, the option that works for both libraries and
- dnl executables is -R. The -R options are cumulative.
- for found_dir in $ltrpathdirs; do
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
- done
- fi
-])
-
-dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
-dnl unless already present in VAR.
-dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
-dnl contains two or three consecutive elements that belong together.
-AC_DEFUN([AC_LIB_APPENDTOVAR],
-[
- for element in [$2]; do
- haveit=
- for x in $[$1]; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X$element"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- [$1]="${[$1]}${[$1]:+ }$element"
- fi
- done
-])
-# lib-prefix.m4 serial 2 (gettext-0.12)
-dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
-dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
-dnl require excessive bracketing.
-ifdef([AC_HELP_STRING],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
-
-dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
-dnl to access previously installed libraries. The basic assumption is that
-dnl a user will want packages to use other packages he previously installed
-dnl with the same --prefix option.
-dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
-dnl libraries, but is otherwise very convenient.
-AC_DEFUN([AC_LIB_PREFIX],
-[
- AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib-prefix],
-[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
- --without-lib-prefix don't search for libraries in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/lib"
- fi
- fi
-])
- if test $use_additional = yes; then
- dnl Potentially add $additional_includedir to $CPPFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's already present in $CPPFLAGS,
- dnl 3. if it's /usr/local/include and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- for x in $CPPFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $CPPFLAGS.
- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- dnl Potentially add $additional_libdir to $LDFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's already present in $LDFLAGS,
- dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/lib"; then
- haveit=
- for x in $LDFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_libdir" = "X/usr/local/lib"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LDFLAGS.
- LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- fi
-])
-
-dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
-dnl acl_final_exec_prefix, containing the values to which $prefix and
-dnl $exec_prefix will expand at the end of the configure script.
-AC_DEFUN([AC_LIB_PREPARE_PREFIX],
-[
- dnl Unfortunately, prefix and exec_prefix get only finally determined
- dnl at the end of configure.
- if test "X$prefix" = "XNONE"; then
- acl_final_prefix="$ac_default_prefix"
- else
- acl_final_prefix="$prefix"
- fi
- if test "X$exec_prefix" = "XNONE"; then
- acl_final_exec_prefix='${prefix}'
- else
- acl_final_exec_prefix="$exec_prefix"
- fi
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
-dnl variables prefix and exec_prefix bound to the values they will have
-dnl at the end of the configure script.
-AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
-[
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- $1
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-])
-# nls.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-
-AC_DEFUN([AM_NLS],
-[
- AC_MSG_CHECKING([whether NLS is requested])
- dnl Default is enabled NLS
- AC_ARG_ENABLE(nls,
- [ --disable-nls do not use Native Language Support],
- USE_NLS=$enableval, USE_NLS=yes)
- AC_MSG_RESULT($USE_NLS)
- AC_SUBST(USE_NLS)
-])
-
-AC_DEFUN([AM_MKINSTALLDIRS],
-[
- dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
- dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
- dnl Try to locate it.
- MKINSTALLDIRS=
- if test -n "$ac_aux_dir"; then
- case "$ac_aux_dir" in
- /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
- *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
- esac
- fi
- if test -z "$MKINSTALLDIRS"; then
- MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
- fi
- AC_SUBST(MKINSTALLDIRS)
-])
-# po.m4 serial 1 (gettext-0.12)
-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
-dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
-
-dnl Checks for all prerequisites of the po subdirectory.
-AC_DEFUN([AM_PO_SUBDIRS],
-[
- AC_REQUIRE([AC_PROG_MAKE_SET])dnl
- AC_REQUIRE([AC_PROG_INSTALL])dnl
- AC_REQUIRE([AM_MKINSTALLDIRS])dnl
- AC_REQUIRE([AM_NLS])dnl
-
- dnl Perform the following tests also if --disable-nls has been given,
- dnl because they are needed for "make dist" to work.
-
- dnl Search for GNU msgfmt in the PATH.
- dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
- dnl The second test excludes FreeBSD msgfmt.
- AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
- [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
- (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
- :)
- AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
-
- dnl Search for GNU xgettext 0.12 or newer in the PATH.
- dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
- dnl The second test excludes FreeBSD xgettext.
- AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
- [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
- (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
- :)
- dnl Remove leftover from FreeBSD xgettext call.
- rm -f messages.po
-
- dnl Search for GNU msgmerge 0.11 or newer in the PATH.
- AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
- [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
-
- dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
- dnl Test whether we really found GNU msgfmt.
- if test "$GMSGFMT" != ":"; then
- dnl If it is no GNU msgfmt we define it as : so that the
- dnl Makefiles still can work.
- if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
- (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- : ;
- else
- GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
- AC_MSG_RESULT(
- [found $GMSGFMT program is not GNU msgfmt; ignore it])
- GMSGFMT=":"
- fi
- fi
-
- dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
- dnl Test whether we really found GNU xgettext.
- if test "$XGETTEXT" != ":"; then
- dnl If it is no GNU xgettext we define it as : so that the
- dnl Makefiles still can work.
- if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
- (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
- : ;
- else
- AC_MSG_RESULT(
- [found xgettext program is not GNU xgettext; ignore it])
- XGETTEXT=":"
- fi
- dnl Remove leftover from FreeBSD xgettext call.
- rm -f messages.po
- fi
-
- AC_OUTPUT_COMMANDS([
- for ac_file in $CONFIG_FILES; do
- # Support "outfile[:infile[:infile...]]"
- case "$ac_file" in
- *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- esac
- # PO directories have a Makefile.in generated from Makefile.in.in.
- case "$ac_file" in */Makefile.in)
- # Adjust a relative srcdir.
- ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
- ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
- ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
- # In autoconf-2.13 it is called $ac_given_srcdir.
- # In autoconf-2.50 it is called $srcdir.
- test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
- case "$ac_given_srcdir" in
- .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
- /*) top_srcdir="$ac_given_srcdir" ;;
- *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
- if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
- rm -f "$ac_dir/POTFILES"
- test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
- cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
- POMAKEFILEDEPS="POTFILES.in"
- # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
- # on $ac_dir but don't depend on user-specified configuration
- # parameters.
- if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
- # The LINGUAS file contains the set of available languages.
- if test -n "$OBSOLETE_ALL_LINGUAS"; then
- test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
- fi
- ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
- # Hide the ALL_LINGUAS assigment from automake.
- eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
- POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
- else
- # The set of available languages was given in configure.in.
- eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
- fi
- case "$ac_given_srcdir" in
- .) srcdirpre= ;;
- *) srcdirpre='$(srcdir)/' ;;
- esac
- POFILES=
- GMOFILES=
- UPDATEPOFILES=
- DUMMYPOFILES=
- for lang in $ALL_LINGUAS; do
- POFILES="$POFILES $srcdirpre$lang.po"
- GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
- UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
- DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
- done
- # CATALOGS depends on both $ac_dir and the user's LINGUAS
- # environment variable.
- INST_LINGUAS=
- if test -n "$ALL_LINGUAS"; then
- for presentlang in $ALL_LINGUAS; do
- useit=no
- if test "%UNSET%" != "$LINGUAS"; then
- desiredlanguages="$LINGUAS"
- else
- desiredlanguages="$ALL_LINGUAS"
- fi
- for desiredlang in $desiredlanguages; do
- # Use the presentlang catalog if desiredlang is
- # a. equal to presentlang, or
- # b. a variant of presentlang (because in this case,
- # presentlang can be used as a fallback for messages
- # which are not translated in the desiredlang catalog).
- case "$desiredlang" in
- "$presentlang"*) useit=yes;;
- esac
- done
- if test $useit = yes; then
- INST_LINGUAS="$INST_LINGUAS $presentlang"
- fi
- done
- fi
- CATALOGS=
- if test -n "$INST_LINGUAS"; then
- for lang in $INST_LINGUAS; do
- CATALOGS="$CATALOGS $lang.gmo"
- done
- fi
- test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
- sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
- for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
- if test -f "$f"; then
- case "$f" in
- *.orig | *.bak | *~) ;;
- *) cat "$f" >> "$ac_dir/Makefile" ;;
- esac
- fi
- done
- fi
- ;;
- esac
- done],
- [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
- # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
- # from automake.
- eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
- # Capture the value of LINGUAS because we need it to compute CATALOGS.
- LINGUAS="${LINGUAS-%UNSET%}"
- ])
-])
-# progtest.m4 serial 3 (gettext-0.12)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-dnl
-dnl This file can can be used in projects which are not available under
-dnl the GNU General Public License or the GNU Library General Public
-dnl License but which still want to provide support for the GNU gettext
-dnl functionality.
-dnl Please note that the actual code of the GNU gettext library is covered
-dnl by the GNU Library General Public License, and the rest of the GNU
-dnl gettext package package is covered by the GNU General Public License.
-dnl They are *not* in the public domain.
-
-dnl Authors:
-dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
-
-# Search path for a program which passes the given test.
-
-dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
-dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
-AC_DEFUN([AM_PATH_PROG_WITH_TEST],
-[
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-
-# Find out how to test for executable files. Don't use a zero-byte file,
-# as systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
- ac_executable_p="test -x"
-else
- ac_executable_p="test -f"
-fi
-rm -f conf$$.file
-
-# Extract the first word of "$2", so it can be a program name with args.
-set dummy $2; ac_word=[$]2
-AC_MSG_CHECKING([for $ac_word])
-AC_CACHE_VAL(ac_cv_path_$1,
-[case "[$]$1" in
- [[\\/]]* | ?:[[\\/]]*)
- ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
- ;;
- *)
- ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in ifelse([$5], , $PATH, [$5]); do
- IFS="$ac_save_IFS"
- test -z "$ac_dir" && ac_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
- if [$3]; then
- ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
- break 2
- fi
- fi
- done
- done
- IFS="$ac_save_IFS"
-dnl If no 4th arg is given, leave the cache variable unset,
-dnl so AC_PATH_PROGS will keep looking.
-ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
-])dnl
- ;;
-esac])dnl
-$1="$ac_cv_path_$1"
-if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
- AC_MSG_RESULT([$]$1)
-else
- AC_MSG_RESULT(no)
-fi
-AC_SUBST($1)dnl
-])
-# stdint_h.m4 serial 3 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
-# doesn't clash with <sys/types.h>, and declares uintmax_t.
-
-AC_DEFUN([jm_AC_HEADER_STDINT_H],
-[
- AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <stdint.h>],
- [uintmax_t i = (uintmax_t) -1;],
- jm_ac_cv_header_stdint_h=yes,
- jm_ac_cv_header_stdint_h=no)])
- if test $jm_ac_cv_header_stdint_h = yes; then
- AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
- [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
- and declares uintmax_t. ])
- fi
-])
-# uintmax_t.m4 serial 7 (gettext-0.12)
-dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-AC_PREREQ(2.13)
-
-# Define uintmax_t to 'unsigned long' or 'unsigned long long'
-# if it is not already defined in <stdint.h> or <inttypes.h>.
-
-AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
-[
- AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
- AC_REQUIRE([jm_AC_HEADER_STDINT_H])
- if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
- AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
- test $ac_cv_type_unsigned_long_long = yes \
- && ac_type='unsigned long long' \
- || ac_type='unsigned long'
- AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
- [Define to unsigned long or unsigned long long
- if <stdint.h> and <inttypes.h> don't define.])
- else
- AC_DEFINE(HAVE_UINTMAX_T, 1,
- [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
- fi
-])
-# ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
-dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License. As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Paul Eggert.
-
-AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
-[
- AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
- [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
- [unsigned long long ullmax = (unsigned long long) -1;
- return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
- ac_cv_type_unsigned_long_long=yes,
- ac_cv_type_unsigned_long_long=no)])
- if test $ac_cv_type_unsigned_long_long = yes; then
- AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
- [Define if you have the unsigned long long type.])
- fi
-])
-
dnl From gnulib
AC_DEFUN([BASH_FUNC_FPURGE],
[
@@ -4068,7 +2099,9 @@ AC_DEFUN([BASH_FUNC_SNPRINTF],
AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
[AC_TRY_RUN([
#include <stdio.h>
+#include <stdlib.h>
+int
main()
{
int n;
@@ -4125,6 +2158,7 @@ foo(format, va_alist)
return n;
}
+int
main()
{
int n;
@@ -4154,6 +2188,7 @@ AC_CACHE_VAL(bash_cv_wexitstatus_offset,
#include <sys/wait.h>
+int
main(c, v)
int c;
char **v;
@@ -4172,7 +2207,7 @@ main(c, v)
exit (255);
/* crack s */
- for (i = 0; i < (sizeof(s) - 8); i++)
+ for (i = 0; i < (sizeof(s) * 8); i++)
{
n = (s >> i) & 0xff;
if (n == 42)
@@ -4195,7 +2230,12 @@ AC_DEFINE_UNQUOTED([WEXITSTATUS_OFFSET], [$bash_cv_wexitstatus_offset], [Offset
AC_DEFUN([BASH_FUNC_SBRK],
[
- AC_CHECK_FUNCS_ONCE([sbrk])
+ AC_MSG_CHECKING([for sbrk])
+ AC_CACHE_VAL(ac_cv_func_sbrk,
+ [AC_TRY_LINK([#include <unistd.h>],
+ [ void *x = sbrk (4096); ],
+ ac_cv_func_sbrk=yes, ac_cv_func_sbrk=no)])
+ AC_MSG_RESULT($ac_cv_func_sbrk)
if test X$ac_cv_func_sbrk = Xyes; then
AC_CACHE_CHECK([for working sbrk], [bash_cv_func_sbrk],
[AC_TRY_RUN([
@@ -4218,8 +2258,8 @@ main(int c, char **v)
ac_cv_func_sbrk=no
fi
fi
- if test $ac_cv_func_sbrk = no; then
- AC_DEFINE(HAVE_SBRK, 0,
+ if test $ac_cv_func_sbrk = yes; then
+ AC_DEFINE(HAVE_SBRK, 1,
[Define if you have a working sbrk function.])
fi
])
@@ -4242,7 +2282,7 @@ unsigned char string[4] = { '\xc3', '\xa4', '\0' };
int
main (int c, char **v)
{
- setlocale (LC_ALL, "de_DE.UTF-8");
+ setlocale (LC_ALL, "en_US.UTF-8");
if (fnmatch (pattern, (const char *)string, 0) != FNM_NOMATCH)
exit (0);
exit (1);
diff --git a/readline/readline/bind.c b/readline/readline/bind.c
index 57ae10f..87596dc 100644
--- a/readline/readline/bind.c
+++ b/readline/readline/bind.c
@@ -1,6 +1,6 @@
/* bind.c -- key binding and startup file support for the readline library. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -135,12 +135,13 @@ rl_add_defun (const char *name, rl_command_func_t *function, int key)
int
rl_bind_key (int key, rl_command_func_t *function)
{
- char keyseq[3];
+ char keyseq[4];
int l;
- if (key < 0)
+ if (key < 0 || key > largest_char)
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 (_rl_keymap[ESC].type == ISKMAP)
@@ -153,24 +154,43 @@ rl_bind_key (int key, rl_command_func_t *function)
escmap[key].function = function;
return (0);
}
- return (key);
+
+ /* Otherwise, let's just let rl_generic_bind handle the key sequence.
+ We start it off with ESC here and let the code below add the rest
+ of the sequence. */
+ keyseq[0] = ESC;
+ l = 1;
+ key = UNMETA(key);
+ goto bind_keyseq;
}
/* If it's bound to a function or macro, just overwrite. Otherwise we have
to treat it as a key sequence so rl_generic_bind handles shadow keymaps
- for us. If we are binding '\' make sure to escape it so it makes it
- through the call to rl_translate_keyseq. */
+ for us. If we are binding '\' or \C-@ (NUL) make sure to escape it so
+ it makes it through the call to rl_translate_keyseq. */
if (_rl_keymap[key].type != ISKMAP)
{
+ if (_rl_keymap[key].type == ISMACR)
+ xfree ((char *)_rl_keymap[key].function);
_rl_keymap[key].type = ISFUNC;
_rl_keymap[key].function = function;
}
else
{
l = 0;
+bind_keyseq:
if (key == '\\')
- keyseq[l++] = '\\';
- keyseq[l++] = key;
+ {
+ keyseq[l++] = '\\';
+ keyseq[l++] = '\\';
+ }
+ else if (key == '\0')
+ {
+ keyseq[l++] = '\\';
+ keyseq[l++] = '0';
+ }
+ else
+ keyseq[l++] = key;
keyseq[l] = '\0';
rl_bind_keyseq (keyseq, function);
}
@@ -242,6 +262,13 @@ 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 */
+ {
+ int r;
+ r = rl_unbind_function_in_map (func, FUNCTION_TO_KEYMAP (map, i));
+ if (r == 1)
+ rval = 1;
+ }
}
return rval;
}
@@ -352,7 +379,7 @@ int
rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
{
char *keys;
- int keys_len, prevkey;
+ int keys_len, prevkey, ic;
register int i;
KEYMAP_ENTRY k;
Keymap prevmap;
@@ -385,7 +412,6 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
for (i = 0; i < keys_len; i++)
{
unsigned char uc = keys[i];
- int ic;
if (i > 0)
prevkey = ic;
@@ -397,6 +423,9 @@ 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);
@@ -406,6 +435,7 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
map = FUNCTION_TO_KEYMAP (map, ESC);
}
}
+#endif
if ((i + 1) < keys_len)
{
@@ -439,9 +469,7 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
}
else
{
- if (map[ic].type == ISMACR)
- xfree ((char *)map[ic].function);
- else if (map[ic].type == ISKMAP)
+ if (map[ic].type == ISKMAP)
{
prevmap = map;
map = FUNCTION_TO_KEYMAP (map, ic);
@@ -454,6 +482,8 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
if (type == ISFUNC && data == 0)
data = (char *)_rl_null_function;
}
+ if (map[ic].type == ISMACR)
+ xfree ((char *)map[ic].function);
map[ic].function = KEYMAP_TO_FUNCTION (data);
map[ic].type = type;
@@ -492,59 +522,38 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
int
rl_translate_keyseq (const char *seq, char *array, int *len)
{
- register int i, c, l, temp;
+ register int i, l, temp;
+ int has_control, has_meta;
+ unsigned char c;
- for (i = l = 0; c = seq[i]; i++)
+ has_control = 0;
+ has_meta = 0;
+
+ /* 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'.
+ */
+ for (i = l = 0; (c = seq[i]) || has_control || has_meta; i++)
{
- if (c == '\\')
+ /* Only backslashes followed by a non-null character are handled
+ specially. Trailing backslash (backslash followed by '\0') is
+ processed as a normal character.
+ */
+ if (c == '\\' && seq[i + 1] != '\0')
{
c = seq[++i];
- if (c == 0)
+ /* Handle \C- and \M- prefixes. */
+ if (c == 'C' && seq[i + 1] == '-')
{
- array[l++] = '\\'; /* preserve trailing backslash */
- break;
+ i++;
+ has_control = 1;
+ continue;
}
-
- /* Handle \C- and \M- prefixes. */
- if ((c == 'C' || c == 'M') && seq[i + 1] == '-')
+ else if (c == 'M' && seq[i + 1] == '-')
{
- /* Handle special case of backwards define. */
- if (strncmp (&seq[i], "C-\\M-", 5) == 0)
- {
- array[l++] = ESC; /* ESC is meta-prefix */
- i += 5;
- array[l++] = CTRL (_rl_to_upper (seq[i]));
- }
- else if (c == 'M')
- {
- i++; /* seq[i] == '-' */
- /* XXX - obey convert-meta setting */
- if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP)
- array[l++] = ESC; /* ESC is meta-prefix */
- else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-')
- {
- i += 4;
- temp = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
- array[l++] = META (temp);
- }
- else
- {
- /* This doesn't yet handle things like \M-\a, which may
- or may not have any reasonable meaning. You're
- probably better off using straight octal or hex. */
- i++;
- array[l++] = META (seq[i]);
- }
- }
- else if (c == 'C')
- {
- i += 2;
- /* Special hack for C-?... */
- array[l++] = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i]));
- }
- if (seq[i] == '\0')
- break;
+ i++;
+ has_meta = 1;
continue;
}
@@ -555,34 +564,34 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
switch (c)
{
case 'a':
- array[l++] = '\007';
+ c = '\007';
break;
case 'b':
- array[l++] = '\b';
+ c = '\b';
break;
case 'd':
- array[l++] = RUBOUT; /* readline-specific */
+ c = RUBOUT; /* readline-specific */
break;
case 'e':
- array[l++] = ESC;
+ c = ESC;
break;
case 'f':
- array[l++] = '\f';
+ c = '\f';
break;
case 'n':
- array[l++] = NEWLINE;
+ c = NEWLINE;
break;
case 'r':
- array[l++] = RETURN;
+ c = RETURN;
break;
case 't':
- array[l++] = TAB;
+ c = TAB;
break;
case 'v':
- array[l++] = 0x0B;
+ c = 0x0B;
break;
case '\\':
- array[l++] = '\\';
+ c = '\\';
break;
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
@@ -590,7 +599,7 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
for (temp = 2, c -= '0'; ISOCTAL ((unsigned char)seq[i]) && temp--; i++)
c = (c * 8) + OCTVALUE (seq[i]);
i--; /* auto-increment in for loop */
- array[l++] = c & largest_char;
+ c &= largest_char;
break;
case 'x':
i++;
@@ -599,16 +608,40 @@ rl_translate_keyseq (const char *seq, char *array, int *len)
if (temp == 2)
c = 'x';
i--; /* auto-increment in for loop */
- array[l++] = c & largest_char;
+ c &= largest_char;
break;
default: /* backslashes before non-special chars just add the char */
- array[l++] = c;
+ c &= largest_char;
break; /* the backslash is stripped */
}
- continue;
}
- array[l++] = c;
+ /* Process \C- and \M- flags */
+ if (has_control)
+ {
+ /* Special treatment for C-? */
+ c = (c == '?') ? RUBOUT : CTRL (_rl_to_upper (c));
+ has_control = 0;
+ }
+ if (has_meta)
+ {
+ c = META (c);
+ has_meta = 0;
+ }
+
+ /* If convert-meta is turned on, convert a meta char to a key sequence */
+ if (META_CHAR (c) && _rl_convert_meta_chars_to_ascii)
+ {
+ array[l++] = ESC; /* ESC is meta-prefix */
+ array[l++] = UNMETA (c);
+ }
+ else
+ array[l++] = (c);
+
+ /* Null characters may be processed for incomplete prefixes at the end of
+ sequence */
+ if (seq[i] == '\0')
+ break;
}
*len = l;
@@ -756,7 +789,7 @@ _rl_untranslate_macro_value (char *seq, int use_escapes)
/* Return a pointer to the function that STRING represents.
If STRING doesn't have a matching function, then a NULL pointer
- is returned. */
+ is returned. The string match is case-insensitive. */
rl_command_func_t *
rl_named_function (const char *string)
{
@@ -809,7 +842,7 @@ _rl_function_of_keyseq_internal (const char *keyseq, size_t len, Keymap map, int
{
/* If this is the last key in the key sequence, return the
map. */
- if (keyseq[i + 1] == '\0')
+ if (i + 1 == len)
{
if (type)
*type = ISKMAP;
@@ -822,9 +855,9 @@ _rl_function_of_keyseq_internal (const char *keyseq, size_t len, Keymap map, int
/* If we're not at the end of the key sequence, and the current key
is bound to something other than a keymap, then the entire key
sequence is not bound. */
- else if (map[ic].type != ISKMAP && keyseq[i+1])
+ else if (map[ic].type != ISKMAP && i+1 < len)
return ((rl_command_func_t *)NULL);
- else /* map[ic].type != ISKMAP && keyseq[i+1] == 0 */
+ else /* map[ic].type != ISKMAP && i+1 == len */
{
if (type)
*type = map[ic].type;
@@ -1569,15 +1602,11 @@ rl_parse_and_bind (char *string)
/* Strip trailing whitespace from values of boolean variables. */
if (find_boolean_var (var) >= 0)
{
- /* remove trailing whitespace */
-remove_trailing:
- e = value + strlen (value) - 1;
- while (e >= value && whitespace (*e))
- e--;
- e++; /* skip back to whitespace or EOS */
-
- if (*e && e >= value)
- *e = '\0';
+ /* just read a whitespace-delimited word or empty string */
+ for (e = value; *e && whitespace (*e) == 0; e++)
+ ;
+ if (e > value)
+ *e = '\0'; /* cut off everything trailing */
}
else if ((i = find_string_var (var)) >= 0)
{
@@ -1589,9 +1618,24 @@ remove_trailing:
value++; /* skip past the quote */
}
else
- goto remove_trailing;
+ {
+ /* remove trailing whitespace */
+ e = value + strlen (value) - 1;
+ while (e >= value && whitespace (*e))
+ e--;
+ e++; /* skip back to whitespace or EOS */
+
+ if (*e && e >= value)
+ *e = '\0';
+ }
}
-
+ else
+ {
+ /* avoid calling rl_variable_bind just to find this out */
+ _rl_init_file_error ("%s: unknown variable name", var);
+ return 1;
+ }
+
rl_variable_bind (var, value);
return 0;
}
@@ -1768,7 +1812,7 @@ static const struct {
{ "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
{ "disable-completion", &rl_inhibit_completion, 0 },
{ "echo-control-characters", &_rl_echo_control_chars, 0 },
- { "enable-bracketed-paste", &_rl_enable_bracketed_paste, 0 },
+ { "enable-bracketed-paste", &_rl_enable_bracketed_paste, V_SPECIAL },
{ "enable-keypad", &_rl_enable_keypad, 0 },
{ "enable-meta-key", &_rl_enable_meta, 0 },
{ "expand-tilde", &rl_complete_with_tilde_expansion, 0 },
@@ -1834,6 +1878,8 @@ hack_special_boolean_var (int i)
}
else if (_rl_stricmp (name, "show-mode-in-prompt") == 0)
_rl_reset_prompt ();
+ else if (_rl_stricmp (name, "enable-bracketed-paste") == 0)
+ _rl_enable_active_region = _rl_enable_bracketed_paste;
}
typedef int _rl_sv_func_t PARAMS((const char *));
@@ -1903,7 +1949,7 @@ string_varname (int i)
}
/* A boolean value that can appear in a `set variable' command is true if
- the value is null or empty, `on' (case-insensitive), or "1". Any other
+ the value is null or empty, `on' (case-insensitive), or "1". All other
values result in 0 (false). */
static int
bool_to_int (const char *value)
@@ -1928,7 +1974,7 @@ rl_variable_value (const char *name)
return (_rl_get_string_variable_value (string_varlist[i].name));
/* Unknown variable names return NULL. */
- return 0;
+ return (char *)NULL;
}
int
@@ -1959,6 +2005,8 @@ rl_variable_bind (const char *name, const char *value)
}
v = (*string_varlist[i].set_func) (value);
+ if (v != 0)
+ _rl_init_file_error ("%s: could not set value to `%s'", name, value);
return v;
}
@@ -2581,20 +2629,22 @@ rl_invoking_keyseqs_in_map (rl_command_func_t *function, Keymap map)
else
sprintf (keyname, "\\e");
}
- else if (CTRL_CHAR (key))
- sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
- else if (key == RUBOUT)
- sprintf (keyname, "\\C-?");
- else if (key == '\\' || key == '"')
- {
- keyname[0] = '\\';
- keyname[1] = (char) key;
- keyname[2] = '\0';
- }
else
{
- keyname[0] = (char) key;
- keyname[1] = '\0';
+ 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]);
diff --git a/readline/readline/colors.c b/readline/readline/colors.c
index 81aecfe..9e37527 100644
--- a/readline/readline/colors.c
+++ b/readline/readline/colors.c
@@ -2,7 +2,7 @@
Modified by Chet Ramey for Readline.
- Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015, 2017
+ Copyright (C) 1985, 1988, 1990-1991, 1995-2010, 2012, 2015, 2017, 2019
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -32,6 +32,13 @@
#include "rlconf.h"
+#if defined __TANDEM
+# define _XOPEN_SOURCE_EXTENDED 1
+# define _TANDEM_SOURCE 1
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
#include <stdio.h>
#include "posixstat.h" // stat related macros (S_ISREG, ...)
diff --git a/readline/readline/complete.c b/readline/readline/complete.c
index adce0d6..fc5c3ad 100644
--- a/readline/readline/complete.c
+++ b/readline/readline/complete.c
@@ -1,6 +1,6 @@
/* complete.c -- filename completion for readline. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -21,11 +21,18 @@
#define READLINE_LIBRARY
+#if defined (__TANDEM)
+# define _XOPEN_SOURCE_EXTENDED 1
+#endif
+
#if defined (HAVE_CONFIG_H)
# include <config.h>
#endif
#include <sys/types.h>
+#if defined (__TANDEM)
+# include <sys/stat.h>
+#endif
#include <fcntl.h>
#if defined (HAVE_SYS_FILE_H)
# include <sys/file.h>
@@ -141,6 +148,7 @@ static int complete_fncmp PARAMS((const char *, int, const char *, int));
static void display_matches PARAMS((char **));
static int compute_lcd_of_matches PARAMS((char **, int, const char *));
static int postprocess_matches PARAMS((char ***, int));
+static int compare_match PARAMS((char *, const char *));
static int complete_get_screenwidth PARAMS((void));
static char *make_quoted_replacement PARAMS((char *, int, char *));
@@ -406,6 +414,7 @@ int rl_sort_completion_matches = 1;
/* Local variable states what happened during the last completion attempt. */
static int completion_changed_buffer;
+static int last_completion_failed = 0;
/* The result of the query to the user about displaying completion matches */
static int completion_y_or_n;
@@ -428,7 +437,11 @@ rl_complete (int ignore, int invoking_key)
if (rl_inhibit_completion)
return (_rl_insert_char (ignore, invoking_key));
- else if (rl_last_func == rl_complete && !completion_changed_buffer)
+#if 0
+ else if (rl_last_func == rl_complete && completion_changed_buffer == 0 && last_completion_failed == 0)
+#else
+ else if (rl_last_func == rl_complete && completion_changed_buffer == 0)
+#endif
return (rl_complete_internal ('?'));
else if (_rl_complete_show_all)
return (rl_complete_internal ('!'));
@@ -477,7 +490,7 @@ rl_completion_mode (rl_command_func_t *cfunc)
/* */
/************************************/
-/* Reset readline state on a signal or other event. */
+/* Reset public readline state on a signal or other event. */
void
_rl_reset_completion_state (void)
{
@@ -1330,12 +1343,13 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
memset (&ps2, 0, sizeof (mbstate_t));
}
#endif
- if (_rl_completion_case_fold)
+ for (si = 0; (c1 = match_list[i][si]) && (c2 = match_list[i + 1][si]); si++)
{
- for (si = 0;
- (c1 = _rl_to_lower(match_list[i][si])) &&
- (c2 = _rl_to_lower(match_list[i + 1][si]));
- si++)
+ if (_rl_completion_case_fold)
+ {
+ c1 = _rl_to_lower (c1);
+ c2 = _rl_to_lower (c2);
+ }
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
@@ -1347,8 +1361,11 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
break;
continue;
}
- wc1 = towlower (wc1);
- wc2 = towlower (wc2);
+ if (_rl_completion_case_fold)
+ {
+ wc1 = towlower (wc1);
+ wc2 = towlower (wc2);
+ }
if (wc1 != wc2)
break;
else if (v1 > 1)
@@ -1359,27 +1376,6 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
if (c1 != c2)
break;
}
- else
- {
- for (si = 0;
- (c1 = match_list[i][si]) &&
- (c2 = match_list[i + 1][si]);
- si++)
-#if defined (HANDLE_MULTIBYTE)
- if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- {
- mbstate_t ps_back;
- ps_back = ps1;
- if (!_rl_compare_chars (match_list[i], si, &ps1, match_list[i+1], si, &ps2))
- break;
- else if ((v = _rl_get_char_len (&match_list[i][si], &ps_back)) > 1)
- si += v - 1;
- }
- else
-#endif
- if (c1 != c2)
- break;
- }
if (low > si)
low = si;
@@ -1969,6 +1965,26 @@ _rl_free_match_list (char **matches)
xfree (matches);
}
+/* Compare a possibly-quoted filename TEXT from the line buffer and a possible
+ MATCH that is the product of filename completion, which acts on the dequoted
+ text. */
+static int
+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)
+ {
+ temp = (*rl_filename_dequoting_function) (text, rl_completion_quote_character);
+ r = strcmp (temp, match);
+ free (temp);
+ return r;
+ }
+ return (strcmp (text, match));
+}
+
/* Complete the word at or before point.
WHAT_TO_DO says what to do with the completion.
`?' means list the possible completions.
@@ -1986,10 +2002,12 @@ rl_complete_internal (int what_to_do)
int start, end, delimiter, found_quote, i, nontrivial_lcd;
char *text, *saved_line_buffer;
char quote_char;
- int tlen, mlen;
+ int tlen, mlen, saved_last_completion_failed;
RL_SETSTATE(RL_STATE_COMPLETING);
+ saved_last_completion_failed = last_completion_failed;
+
set_completion_defaults (what_to_do);
saved_line_buffer = rl_line_buffer ? savestring (rl_line_buffer) : (char *)NULL;
@@ -2013,7 +2031,7 @@ rl_complete_internal (int what_to_do)
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
/* nontrivial_lcd is set if the common prefix adds something to the word
being completed. */
- nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
+ nontrivial_lcd = matches && compare_match (text, matches[0]) != 0;
if (what_to_do == '!' || what_to_do == '@')
tlen = strlen (text);
xfree (text);
@@ -2023,6 +2041,7 @@ rl_complete_internal (int what_to_do)
rl_ding ();
FREE (saved_line_buffer);
completion_changed_buffer = 0;
+ last_completion_failed = 1;
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return (0);
@@ -2038,11 +2057,15 @@ rl_complete_internal (int what_to_do)
rl_ding ();
FREE (saved_line_buffer);
completion_changed_buffer = 0;
+ last_completion_failed = 1;
RL_UNSETSTATE(RL_STATE_COMPLETING);
_rl_reset_completion_state ();
return (0);
}
+ if (matches && matches[0] && *matches[0])
+ last_completion_failed = 0;
+
switch (what_to_do)
{
case TAB:
@@ -2098,6 +2121,15 @@ rl_complete_internal (int what_to_do)
break;
case '?':
+ /* Let's try to insert a single match here if the last completion failed
+ but this attempt returned a single match. */
+ if (saved_last_completion_failed && matches[0] && *matches[0] && matches[1] == 0)
+ {
+ insert_match (matches[0], start, matches[1] ? MULT_MATCH : SINGLE_MATCH, &quote_char);
+ append_to_match (matches[0], delimiter, quote_char, nontrivial_lcd);
+ break;
+ }
+
if (rl_completion_display_matches_hook == 0)
{
_rl_sigcleanup = _rl_complete_sigcleanup;
@@ -2761,7 +2793,7 @@ rl_old_menu_complete (int count, int invoking_key)
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
- strcmp (orig_text, matches[match_list_index]));
+ compare_match (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
@@ -2835,7 +2867,7 @@ rl_menu_complete (int count, int ignore)
matches = gen_completion_matches (orig_text, orig_start, orig_end,
our_func, found_quote, quote_char);
- nontrivial_lcd = matches && strcmp (orig_text, matches[0]) != 0;
+ nontrivial_lcd = matches && compare_match (orig_text, matches[0]) != 0;
/* If we are matching filenames, the attempted completion function will
have set rl_filename_completion_desired to a non-zero value. The basic
@@ -2942,7 +2974,7 @@ rl_menu_complete (int count, int ignore)
{
insert_match (matches[match_list_index], orig_start, SINGLE_MATCH, &quote_char);
append_to_match (matches[match_list_index], delimiter, quote_char,
- strcmp (orig_text, matches[match_list_index]));
+ compare_match (orig_text, matches[match_list_index]));
}
completion_changed_buffer = 1;
diff --git a/readline/readline/configure b/readline/readline/configure
index de7499e..6ea4545 100755
--- a/readline/readline/configure
+++ b/readline/readline/configure
@@ -1,7 +1,7 @@
#! /bin/sh
-# From configure.ac for Readline 8.0, version 2.85.
+# From configure.ac for Readline 8.1, version 2.90.
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for readline 8.0.
+# Generated by GNU Autoconf 2.69 for readline 8.1.
#
# Report bugs to <bug-readline@gnu.org>.
#
@@ -581,8 +581,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='readline'
PACKAGE_TARNAME='readline'
-PACKAGE_VERSION='8.0'
-PACKAGE_STRING='readline 8.0'
+PACKAGE_VERSION='8.1'
+PACKAGE_STRING='readline 8.1'
PACKAGE_BUGREPORT='bug-readline@gnu.org'
PACKAGE_URL=''
@@ -673,6 +673,7 @@ CFLAGS
CC
SET_MAKE
CROSS_COMPILE
+BRACKETED_PASTE
host_os
host_vendor
host_cpu
@@ -726,6 +727,7 @@ with_curses
enable_multibyte
enable_static
enable_install_examples
+enable_bracketed_paste_default
enable_largefile
'
ac_precious_vars='build_alias
@@ -1277,7 +1279,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.0 to adapt to many kinds of systems.
+\`configure' configures readline 8.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1342,7 +1344,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of readline 8.0:";;
+ short | recursive ) echo "Configuration of readline 8.1:";;
esac
cat <<\_ACEOF
@@ -1354,6 +1356,9 @@ Optional Features:
--enable-static build static libraries [[default=YES]]
--disable-install-examples
don't install examples [[default=install]]
+ --disable-bracketed-paste-default
+ disable bracketed paste by default
+ [[default=enable]]
--disable-largefile omit support for large files
Optional Packages:
@@ -1438,7 +1443,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-readline configure 8.0
+readline configure 8.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2090,7 +2095,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by readline $as_me 8.0, which was
+It was created by readline $as_me 8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2477,7 +2482,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers config.h"
-LIBVERSION=8.0
+LIBVERSION=8.1
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@@ -2569,6 +2574,7 @@ opt_multibyte=yes
opt_static_libs=yes
opt_shared_libs=no
opt_install_examples=no
+opt_bracketed_paste_default=yes
# Check whether --enable-multibyte was given.
if test "${enable_multibyte+set}" = set; then :
@@ -2586,11 +2592,24 @@ if test "${enable_install_examples+set}" = set; then :
fi
+# Check whether --enable-bracketed-paste-default was given.
+if test "${enable_bracketed_paste_default+set}" = set; then :
+ enableval=$enable_bracketed_paste_default; opt_bracketed_paste_default=$enableval
+fi
+
+
if test $opt_multibyte = no; then
$as_echo "#define NO_MULTIBYTE_SUPPORT 1" >>confdefs.h
fi
+if test $opt_bracketed_paste_default = yes; then
+ BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
+else
+ BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
+fi
+
+
CROSS_COMPILE=
@@ -2622,7 +2641,7 @@ echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_ve
echo ""
# We want these before the checks, so the checks can modify their values.
-test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
+test -z "$CFLAGS" && want_auto_cflags=1
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
@@ -3905,8 +3924,11 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
-# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
-test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+# If 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}"
+fi
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
@@ -5316,6 +5338,7 @@ else
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include <stdlib.h>
typedef RETSIGTYPE sigfunc();
@@ -5346,6 +5369,7 @@ int s;
nsigint++;
}
+int
main()
{
nsigint = 0;
@@ -5396,7 +5420,9 @@ else
#include <sys/types.h>
#include <signal.h>
#include <setjmp.h>
+#include <stdlib.h>
+int
main()
{
#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
@@ -5499,7 +5525,10 @@ else
#if defined (HAVE_LOCALE_H)
#include <locale.h>
#endif
+#include <string.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
@@ -5569,7 +5598,9 @@ else
#endif
#include <stdio.h>
#include <ctype.h>
+#include <stdlib.h>
+int
main(c, v)
int c;
char *v[];
@@ -6713,6 +6744,7 @@ else
#include <locale.h>
#include <wchar.h>
+int
main(c, v)
int c;
char **v;
@@ -6803,6 +6835,7 @@ esac
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
esac
# shared library configuration section
@@ -6883,6 +6916,11 @@ esac
+if test -n "$want_auto_cflags"; then
+ CFLAGS="$AUTO_CFLAGS"
+fi
+CFLAGS="$CFLAGS $STYLE_CFLAGS"
+
@@ -7409,7 +7447,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by readline $as_me 8.0, which was
+This file was extended by readline $as_me 8.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -7475,7 +7513,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-readline config.status 8.0
+readline config.status 8.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/readline/readline/configure.ac b/readline/readline/configure.ac
index b9b3e1c..912c99b 100644
--- a/readline/readline/configure.ac
+++ b/readline/readline/configure.ac
@@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu
dnl
dnl Process this file with autoconf to produce a configure script.
-# Copyright (C) 1987-2018 Free Software Foundation, Inc.
+# Copyright (C) 1987-2020 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,11 +20,11 @@ dnl Process this file with autoconf to produce a configure script.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-AC_REVISION([for Readline 8.0, version 2.85])
+AC_REVISION([for Readline 8.1, version 2.90])
m4_include([../../config/override.m4])
-AC_INIT(readline, 8.0, bug-readline@gnu.org)
+AC_INIT(readline, 8.1, bug-readline@gnu.org)
dnl make sure we are using a recent autoconf version
AC_PREREQ(2.50)
@@ -36,7 +36,7 @@ AC_CONFIG_AUX_DIR(../..)
AC_CONFIG_HEADERS(config.h)
dnl update the value of RL_READLINE_VERSION in readline.h when this changes
-LIBVERSION=8.0
+LIBVERSION=8.1
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
@@ -56,16 +56,26 @@ opt_multibyte=yes
opt_static_libs=yes
opt_shared_libs=no
opt_install_examples=no
+opt_bracketed_paste_default=yes
AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
+AC_ARG_ENABLE(bracketed-paste-default, AC_HELP_STRING([--disable-bracketed-paste-default], [disable bracketed paste by default [[default=enable]]]), opt_bracketed_paste_default=$enableval)
+
if test $opt_multibyte = no; then
AC_DEFINE(NO_MULTIBYTE_SUPPORT)
fi
+if test $opt_bracketed_paste_default = yes; then
+ BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=1'
+else
+ BRACKETED_PASTE='-DBRACKETED_PASTE_DEFAULT=0'
+fi
+AC_SUBST(BRACKETED_PASTE)
+
dnl load up the cross-building cache file -- add more cases and cache
dnl files as necessary
@@ -101,15 +111,18 @@ echo "Beginning configuration for readline-$LIBVERSION for ${host_cpu}-${host_ve
echo ""
# We want these before the checks, so the checks can modify their values.
-test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1
+test -z "$CFLAGS" && want_auto_cflags=1
AC_PROG_MAKE_SET
AC_PROG_CC
dnl AC_AIX
AC_MINIX
-# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS.
-test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O"
+# 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}"
+fi
AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
@@ -219,6 +232,7 @@ esac
case "$host_os" in
isc*) LOCAL_CFLAGS=-Disc386 ;;
+hpux*) LOCAL_CFLAGS="-DTGETENT_BROKEN -DTGETFLAG_BROKEN" ;;
esac
# shared library configuration section
@@ -297,6 +311,11 @@ esac
AC_SUBST(BUILD_DIR)
+if test -n "$want_auto_cflags"; then
+ CFLAGS="$AUTO_CFLAGS"
+fi
+CFLAGS="$CFLAGS $STYLE_CFLAGS"
+
AC_SUBST(CFLAGS)
AC_SUBST(LOCAL_CFLAGS)
AC_SUBST(LOCAL_LDFLAGS)
diff --git a/readline/readline/display.c b/readline/readline/display.c
index 89193b5..38b3d0e 100644
--- a/readline/readline/display.c
+++ b/readline/readline/display.c
@@ -1,6 +1,6 @@
/* display.c -- readline redisplay facility. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -63,23 +63,31 @@
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-static void update_line PARAMS((char *, char *, int, int, int, int));
+static void putc_face PARAMS((int, int, char *));
+static void puts_face PARAMS((const char *, const char *, int));
+static void norm_face PARAMS((char *, int));
+
+static void update_line PARAMS((char *, char *, char *, char *, int, int, int, int));
static void space_to_eol PARAMS((int));
static void delete_chars PARAMS((int));
static void insert_some_chars PARAMS((char *, int, int));
static void open_some_spaces PARAMS((int));
static void cr PARAMS((void));
static void redraw_prompt PARAMS((char *));
+static void _rl_move_cursor_relative PARAMS((int, const char *, const char *));
/* Values for FLAGS */
#define PMT_MULTILINE 0x01
static char *expand_prompt PARAMS((char *, int, int *, int *, int *, int *));
+#define DEFAULT_LINE_BUFFER_SIZE 1024
+
/* State of visible and invisible lines. */
struct line_state
{
char *line;
+ char *lface;
int *lbreaks;
int lbsize;
#if defined (HANDLE_MULTIBYTE)
@@ -102,7 +110,9 @@ static int line_structures_initialized = 0;
#define vis_lbsize (line_state_visible->lbsize)
#define visible_line (line_state_visible->line)
+#define vis_face (line_state_visible->lface)
#define invisible_line (line_state_invisible->line)
+#define inv_face (line_state_invisible->lface)
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int, int));
@@ -123,6 +133,10 @@ static int _rl_col_width PARAMS((const char *, int, int, int));
to use prompt_last_invisible directly. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
+
+#define FACE_NORMAL '0'
+#define FACE_STANDOUT '1'
+#define FACE_INVALID ((char)1)
/* **************************************************************** */
/* */
@@ -190,6 +204,8 @@ int _rl_last_v_pos = 0;
on screen minus 1. */
int _rl_vis_botlin = 0;
+static int _rl_quick_redisplay = 0;
+
/* This is a hint update_line gives to rl_redisplay that it has adjusted the
value of _rl_last_c_pos *and* taken the presence of any invisible chars in
the prompt into account. rl_redisplay notes this and does not do the
@@ -219,7 +235,11 @@ static int msg_bufsiz = 0;
static int forced_display;
/* Default and initial buffer size. Can grow. */
-static int line_size = 1024;
+static int line_size = 0;
+
+/* Set to a non-zero value if horizontal scrolling has been enabled
+ automatically because the terminal was resized to height 1. */
+static int horizontal_scrolling_autoset = 0; /* explicit initialization */
/* Variables to keep track of the expanded prompt string, which may
include invisible characters. */
@@ -574,11 +594,6 @@ rl_expand_prompt (char *prompt)
{
/* The prompt spans multiple lines. */
t = ++p;
- local_prompt = expand_prompt (p, PMT_MULTILINE,
- &prompt_visible_length,
- &prompt_last_invisible,
- &prompt_invis_chars_first_line,
- &prompt_physical_chars);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
@@ -588,11 +603,53 @@ rl_expand_prompt (char *prompt)
(int *)NULL,
(int *)NULL);
*t = c;
+
+ local_prompt = expand_prompt (p, PMT_MULTILINE,
+ &prompt_visible_length,
+ &prompt_last_invisible,
+ &prompt_invis_chars_first_line,
+ &prompt_physical_chars);
local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
return (prompt_prefix_length);
}
}
+/* Allocate the various line structures, making sure they can hold MINSIZE
+ bytes. If the existing line size can accommodate MINSIZE bytes, don't do
+ anything. */
+static void
+realloc_line (int minsize)
+{
+ int minimum_size;
+ int newsize, delta;
+
+ minimum_size = DEFAULT_LINE_BUFFER_SIZE;
+ if (minsize < minimum_size)
+ minsize = minimum_size;
+ if (minsize <= _rl_screenwidth) /* XXX - for gdb */
+ minsize = _rl_screenwidth + 1;
+ if (line_size >= minsize)
+ return;
+
+ newsize = minimum_size;
+ while (newsize < minsize)
+ newsize *= 2;
+
+ visible_line = (char *)xrealloc (visible_line, newsize);
+ vis_face = (char *)xrealloc (vis_face, newsize);
+
+ invisible_line = (char *)xrealloc (invisible_line, newsize);
+ inv_face = (char *)xrealloc (inv_face, newsize);
+
+ delta = newsize - line_size;
+ memset (visible_line + line_size, 0, delta);
+ memset (vis_face + line_size, FACE_NORMAL, delta);
+ memset (invisible_line + line_size, 1, delta);
+ memset (inv_face + line_size, FACE_INVALID, delta);
+
+ line_size = newsize;
+}
+
/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
@@ -601,33 +658,12 @@ rl_expand_prompt (char *prompt)
static void
init_line_structures (int minsize)
{
- register int n;
- int original_minsize = minsize;
-
- if (minsize <= _rl_screenwidth) /* XXX - for gdb */
- minsize = _rl_screenwidth + 1;
-
if (invisible_line == 0) /* initialize it */
{
- if (line_size < minsize)
- line_size = minsize;
- visible_line = (char *)xmalloc (line_size);
- invisible_line = (char *)xmalloc (line_size);
- }
- else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
- {
- line_size *= 2;
- if (line_size < minsize)
- line_size = minsize;
- visible_line = (char *)xrealloc (visible_line, line_size);
- invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
-
- for (n = original_minsize; n < line_size; n++)
- {
- visible_line[n] = 0;
- invisible_line[n] = 1;
+ if (line_size > minsize)
+ minsize = line_size;
}
+ realloc_line (minsize);
if (vis_lbreaks == 0)
{
@@ -649,16 +685,68 @@ init_line_structures (int minsize)
line_structures_initialized = 1;
}
-
+
+/* Convenience functions to add chars to the invisible line that update the
+ face information at the same time. */
+static void /* XXX - change this */
+invis_addc (int *outp, char c, char face)
+{
+ realloc_line (*outp + 1);
+ invisible_line[*outp] = c;
+ inv_face[*outp] = face;
+ *outp += 1;
+}
+
+static void
+invis_adds (int *outp, const char *str, int n, char face)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ invis_addc (outp, str[i], face);
+}
+
+static void
+invis_nul (int *outp)
+{
+ invis_addc (outp, '\0', 0);
+ *outp -= 1;
+}
+
+static void
+set_active_region (int *beg, int *end)
+{
+ if (rl_point >= 0 && rl_point <= rl_end && rl_mark >= 0 && rl_mark <= rl_end)
+ {
+ *beg = (rl_mark < rl_point) ? rl_mark : rl_point;
+ *end = (rl_mark < rl_point) ? rl_point : rl_mark;
+ }
+}
+
+/* Do whatever tests are necessary and tell update_line that it can do a
+ quick, dumb redisplay on the assumption that there are so many
+ differences between the old and new lines that it would be a waste to
+ compute all the differences.
+ Right now, it just sets _rl_quick_redisplay if the current visible line
+ is a single line (so we don't have to move vertically or mess with line
+ wrapping). */
+void
+_rl_optimize_redisplay (void)
+{
+ if (_rl_vis_botlin == 0)
+ _rl_quick_redisplay = 1;
+}
+
/* Basic redisplay algorithm. See comments inline. */
void
rl_redisplay (void)
{
- register int in, out, c, linenum, cursor_linenum;
- register char *line;
+ 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;
char *prompt_this_line;
+ char cur_face;
+ int hl_begin, hl_end;
int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
@@ -676,6 +764,14 @@ rl_redisplay (void)
_rl_block_sigint ();
RL_SETSTATE (RL_STATE_REDISPLAYING);
+ cur_face = FACE_NORMAL;
+ /* Can turn this into an array for multiple highlighted objects in addition
+ to the region */
+ hl_begin = hl_end = -1;
+
+ if (rl_mark_active_p ())
+ set_active_region (&hl_begin, &hl_end);
+
if (!rl_display_prompt)
rl_display_prompt = "";
@@ -687,12 +783,23 @@ rl_redisplay (void)
else if (line_size <= _rl_screenwidth)
init_line_structures (_rl_screenwidth + 1);
+ /* Enable horizontal scrolling automatically for terminals of height 1
+ where wrapping lines doesn't work. Disable it as soon as the terminal
+ height is increased again if it was automatically enabled. */
+ if (_rl_screenheight <= 1)
+ {
+ if (_rl_horizontal_scroll_mode == 0)
+ horizontal_scrolling_autoset = 1;
+ _rl_horizontal_scroll_mode = 1;
+ }
+ else if (horizontal_scrolling_autoset)
+ _rl_horizontal_scroll_mode = 0;
+
/* Draw the line into the buffer. */
cpos_buffer_position = -1;
prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars;
- line = invisible_line;
out = inv_botlin = 0;
/* Mark the line as modified or not. We only do this for history
@@ -700,8 +807,8 @@ rl_redisplay (void)
modmark = 0;
if (_rl_mark_modified_lines && current_history () && rl_undo_list)
{
- line[out++] = '*';
- line[out] = '\0';
+ invis_addc (&out, '*', cur_face);
+ invis_nul (&out);
modmark = 1;
}
@@ -714,7 +821,7 @@ rl_redisplay (void)
/* If the prompt to be displayed is the `primary' readline prompt (the
one passed to readline()), use the values we have already expanded.
If not, use what's already in rl_display_prompt. WRAP_OFFSET is the
- number of non-visible characters in the prompt string. */
+ number of non-visible characters (bytes) in the prompt string. */
/* This is where we output the characters in the prompt before the last
newline, if any. If there aren't any embedded newlines, we don't
write anything. Copy the last line of the prompt string into the line in
@@ -725,18 +832,8 @@ rl_redisplay (void)
_rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
if (local_prompt_len > 0)
- {
- temp = local_prompt_len + out + 2;
- if (temp >= line_size)
- {
- line_size = (temp + 1024) - (temp % 1024);
- visible_line = (char *)xrealloc (visible_line, line_size);
- line = invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
- strncpy (line + out, local_prompt, local_prompt_len);
- out += local_prompt_len;
- }
- line[out] = '\0';
+ invis_adds (&out, local_prompt, local_prompt_len, cur_face);
+ invis_nul (&out);
wrap_offset = local_prompt_len - prompt_visible_length;
}
else
@@ -759,17 +856,9 @@ rl_redisplay (void)
}
}
- prompt_physical_chars = pmtlen = strlen (prompt_this_line);
- temp = pmtlen + out + 2;
- if (temp >= line_size)
- {
- line_size = (temp + 1024) - (temp % 1024);
- visible_line = (char *)xrealloc (visible_line, line_size);
- line = invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
- strncpy (line + out, prompt_this_line, pmtlen);
- out += pmtlen;
- line[out] = '\0';
+ prompt_physical_chars = pmtlen = strlen (prompt_this_line); /* XXX */
+ invis_adds (&out, prompt_this_line, pmtlen, cur_face);
+ invis_nul (&out);
wrap_offset = prompt_invis_chars_first_line = 0;
}
@@ -850,8 +939,8 @@ rl_redisplay (void)
num = 0;
#endif
- /* prompt_invis_chars_first_line is the number of invisible characters in
- the first physical line of the prompt.
+ /* prompt_invis_chars_first_line is the number of invisible characters (bytes)
+ 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. */
@@ -907,6 +996,11 @@ rl_redisplay (void)
for (in = 0; in < rl_end; in++)
#endif
{
+ if (in == hl_begin)
+ cur_face = FACE_STANDOUT;
+ else if (in == hl_end)
+ cur_face = FACE_NORMAL;
+
c = (unsigned char)rl_line_buffer[in];
#if defined (HANDLE_MULTIBYTE)
@@ -931,14 +1025,6 @@ rl_redisplay (void)
}
#endif
- if (out + 8 >= line_size) /* XXX - 8 for \t */
- {
- line_size *= 2;
- visible_line = (char *)xrealloc (visible_line, line_size);
- invisible_line = (char *)xrealloc (invisible_line, line_size);
- line = invisible_line;
- }
-
if (in == rl_point)
{
cpos_buffer_position = out;
@@ -953,9 +1039,12 @@ rl_redisplay (void)
{
if (_rl_output_meta_chars == 0)
{
- sprintf (line + out, "\\%o", c);
+ char obuf[5];
+ int olen;
- if (lpos + 4 >= _rl_screenwidth)
+ olen = sprintf (obuf, "\\%o", c);
+
+ if (lpos + olen >= _rl_screenwidth)
{
temp = _rl_screenwidth - lpos;
CHECK_INV_LBREAKS ();
@@ -963,16 +1052,20 @@ rl_redisplay (void)
#if defined (HANDLE_MULTIBYTE)
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn;
#endif
- lpos = 4 - temp;
+ lpos = olen - temp;
}
else
- lpos += 4;
+ lpos += olen;
- out += 4;
+ for (temp = 0; temp < olen; temp++)
+ {
+ invis_addc (&out, obuf[temp], cur_face);
+ CHECK_LPOS ();
+ }
}
else
{
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
}
@@ -981,11 +1074,7 @@ rl_redisplay (void)
{
register int newout;
-#if 0
- newout = (out | (int)7) + 1;
-#else
newout = out + 8 - lpos % 8;
-#endif
temp = newout - out;
if (lpos + temp >= _rl_screenwidth)
{
@@ -998,19 +1087,19 @@ rl_redisplay (void)
#endif
lpos = temp - temp2;
while (out < newout)
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
}
else
{
while (out < newout)
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
lpos += temp;
}
}
#endif
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
- line[out++] = '\0'; /* XXX - sentinel */
+ invis_addc (&out, '\0', cur_face);
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
#if defined (HANDLE_MULTIBYTE)
@@ -1020,9 +1109,9 @@ rl_redisplay (void)
}
else if (CTRL_CHAR (c) || c == RUBOUT)
{
- line[out++] = '^';
+ invis_addc (&out, '^', cur_face);
CHECK_LPOS();
- line[out++] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
+ invis_addc (&out, CTRL_CHAR (c) ? UNCTRL (c) : '?', cur_face);
CHECK_LPOS();
}
else
@@ -1038,7 +1127,7 @@ rl_redisplay (void)
for (i = lpos; i < _rl_screenwidth; i++)
{
/* The space will be removed in update_line() */
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
_rl_wrapped_multicolumn++;
CHECK_LPOS();
}
@@ -1048,17 +1137,17 @@ rl_redisplay (void)
lb_linenum = newlines;
}
for (i = in; i < in+wc_bytes; i++)
- line[out++] = rl_line_buffer[i];
+ invis_addc (&out, rl_line_buffer[i], cur_face);
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
}
else
{
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
#else
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
#endif
}
@@ -1080,7 +1169,7 @@ rl_redisplay (void)
in++;
#endif
}
- line[out] = '\0';
+ invis_nul (&out);
line_totbytes = out;
if (cpos_buffer_position < 0)
{
@@ -1088,6 +1177,11 @@ rl_redisplay (void)
lb_linenum = newlines;
}
+ /* If we are switching from one line to multiple wrapped lines, we don't
+ want to do a dumb update (or we want to make it smarter). */
+ if (_rl_quick_redisplay && newlines > 0)
+ _rl_quick_redisplay = 0;
+
inv_botlin = lb_botlin = _rl_inv_botlin = newlines;
CHECK_INV_LBREAKS ();
inv_lbreaks[newlines+1] = out;
@@ -1124,7 +1218,7 @@ rl_redisplay (void)
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
- out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
+ out = _rl_find_prev_mbchar (invisible_line, _rl_screenchars, MB_FIND_ANY);
else
#endif
out = _rl_screenchars - 1;
@@ -1142,14 +1236,32 @@ rl_redisplay (void)
#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
+ `normal' face.
+ It's imperfect, but better than display corruption. */
+ if (rl_mark_active_p () && inv_botlin > _rl_screenheight)
+ {
+ int extra;
+
+ extra = inv_botlin - _rl_screenheight;
+ for (linenum = 0; linenum <= extra; linenum++)
+ norm_face (INV_LINE_FACE(linenum), INV_LLEN (linenum));
+ }
+
/* For each line in the buffer, do the updating display. */
for (linenum = 0; linenum <= inv_botlin; linenum++)
{
@@ -1157,7 +1269,9 @@ rl_redisplay (void)
the locale from a non-multibyte to a multibyte one. */
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
- update_line (VIS_LINE(linenum), INV_LINE(linenum), linenum,
+ update_line (VIS_LINE(linenum), VIS_LINE_FACE(linenum),
+ INV_LINE(linenum), INV_LINE_FACE(linenum),
+ linenum,
VIS_LLEN(linenum), INV_LLEN(linenum), inv_botlin);
/* update_line potentially changes _rl_last_c_pos, but doesn't
@@ -1205,19 +1319,35 @@ rl_redisplay (void)
_rl_clear_to_eol (nleft);
}
#if 0
- /* This segment is intended to handle the case where the prompt
- has invisible characters on the second line and the new line
+ /* This segment is intended to handle the case where the old
+ visible prompt has invisible characters and the new line
to be displayed needs to clear the rest of the old characters
- out (e.g., when printing the i-search prompt). In general,
- the case of the new line being shorter than the old.
- Incomplete */
- else if (linenum == prompt_last_screen_line &&
- prompt_physical_chars > _rl_screenwidth &&
- wrap_offset != prompt_invis_chars_first_line &&
+ out (e.g., when printing the i-search prompt): in general,
+ the case of the new line being shorter than the old. We need
+ to be at the end of the new line and the old line needs to be
+ longer than the current cursor position. It's not perfect,
+ since it uses the byte length of the first line, but this will
+ at worst result in some extra clear-to-end-of-lines. We can't
+ use the prompt length variables because they may not
+ correspond to the visible line (see printing the i-search
+ prompt above). The tests for differing numbers of invisible
+ characters may not matter and can probably be removed. */
+ else if (linenum == 0 &&
+ linenum == prompt_last_screen_line &&
_rl_last_c_pos == out &&
+ _rl_last_c_pos < visible_first_line_len &&
+ visible_wrap_offset &&
+ visible_wrap_offset != wrap_offset)
+ {
+ if (mb_cur_max > 1 && rl_byte_oriented == 0)
+ nleft = _rl_screenwidth - _rl_last_c_pos;
+ else
+ nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
+ if (nleft)
+ _rl_clear_to_eol (nleft);
+ }
#endif
-
/* Since the new first line is now visible, save its length. */
if (linenum == 0)
visible_first_line_len = (inv_botlin > 0) ? inv_lbreaks[1] : out - wrap_offset;
@@ -1232,7 +1362,7 @@ rl_redisplay (void)
{
tt = VIS_CHARS (linenum);
_rl_move_vert (linenum);
- _rl_move_cursor_relative (0, tt);
+ _rl_move_cursor_relative (0, tt, VIS_FACE(linenum));
_rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth);
}
@@ -1261,20 +1391,12 @@ rl_redisplay (void)
the characters from the current cursor position. But we
only need to reprint it if the cursor is before the last
invisible character in the prompt string. */
+ /* 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 &&
-#if 0
- _rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
-#else
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
-#endif
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- if (_rl_term_cr)
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
@@ -1288,8 +1410,8 @@ rl_redisplay (void)
/* Where on that line? And where does that line start
in the buffer? */
pos = inv_lbreaks[cursor_linenum];
- /* nleft == number of characters in the line buffer between the
- start of the line and the desired cursor position. */
+ /* nleft == number of characters (bytes) in the line buffer between
+ the start of the line and the desired cursor position. */
nleft = cpos_buffer_position - pos;
/* NLEFT is now a number of characters in a buffer. When in a
@@ -1320,9 +1442,9 @@ rl_redisplay (void)
point specified by a buffer position (NLEFT) that doesn't take
invisible characters into account. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
- _rl_move_cursor_relative (nleft, &invisible_line[pos]);
+ _rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
else if (nleft != _rl_last_c_pos)
- _rl_move_cursor_relative (nleft, &invisible_line[pos]);
+ _rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
}
}
else /* Do horizontal scrolling. Much simpler */
@@ -1378,7 +1500,7 @@ rl_redisplay (void)
/* If the first character on the screen isn't the first character
in the display line, indicate this with a special character. */
if (lmargin > 0)
- line[lmargin] = '<';
+ invisible_line[lmargin] = '<';
/* If SCREENWIDTH characters starting at LMARGIN do not encompass
the whole line, indicate that with a special character at the
@@ -1386,15 +1508,15 @@ rl_redisplay (void)
wrap offset into account. */
t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth;
if (t > 0 && t < out)
- line[t - 1] = '>';
+ invisible_line[t - 1] = '>';
if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
{
forced_display = 0;
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
- update_line (&visible_line[last_lmargin],
- &invisible_line[lmargin],
+ update_line (&visible_line[last_lmargin], &vis_face[last_lmargin],
+ &invisible_line[lmargin], &inv_face[lmargin],
0,
_rl_screenwidth + visible_wrap_offset,
_rl_screenwidth + (lmargin ? 0 : wrap_offset),
@@ -1419,7 +1541,7 @@ rl_redisplay (void)
if (visible_first_line_len > _rl_screenwidth)
visible_first_line_len = _rl_screenwidth;
- _rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin]);
+ _rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin], &inv_face[lmargin]);
last_lmargin = lmargin;
}
}
@@ -1440,22 +1562,64 @@ rl_redisplay (void)
visible_wrap_offset = 0;
else
visible_wrap_offset = wrap_offset;
+
+ _rl_quick_redisplay = 0;
}
RL_UNSETSTATE (RL_STATE_REDISPLAYING);
_rl_release_sigint ();
}
+static void
+putc_face (int c, int face, char *cur_face)
+{
+ char cf;
+ cf = *cur_face;
+ if (cf != face)
+ {
+ if (cf != FACE_NORMAL && cf != FACE_STANDOUT)
+ return;
+ if (face != FACE_NORMAL && face != FACE_STANDOUT)
+ return;
+ if (face == FACE_STANDOUT && cf == FACE_NORMAL)
+ _rl_standout_on ();
+ if (face == FACE_NORMAL && cf == FACE_STANDOUT)
+ _rl_standout_off ();
+ *cur_face = face;
+ }
+ if (c != EOF)
+ putc (c, rl_outstream);
+}
+
+static void
+puts_face (const char *str, const char *face, int n)
+{
+ int i;
+ char cur_face;
+
+ for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
+ putc_face (str[i], face[i], &cur_face);
+ putc_face (EOF, FACE_NORMAL, &cur_face);
+}
+
+static void
+norm_face (char *face, int n)
+{
+ memset (face, FACE_NORMAL, n);
+}
+
+#define ADJUST_CPOS(x) do { _rl_last_c_pos -= (x) ; cpos_adjusted = 1; } while (0)
+
/* PWP: update_line() is based on finding the middle difference of each
line on the screen; vis:
/old first difference
- /beginning of line | /old last same /old EOL
- v v v v
+ /beginning of line | /old last same /old EOL
+ v v v v
old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
new: eddie> Oh, my little buggy says to me, as lurgid as
- ^ ^ ^ ^
- \beginning of line | \new last same \new end of line
+ ^ ^ ^ ^
+ \beginning of line | \new last same \new end of line
\new first difference
All are character pointers for the sake of speed. Special cases for
@@ -1463,9 +1627,10 @@ new: eddie> Oh, my little buggy says to me, as lurgid as
Could be made even smarter, but this works well enough */
static void
-update_line (char *old, char *new, int current_line, int omax, int nmax, int inv_botlin)
+update_line (char *old, char *old_face, char *new, char *new_face, int current_line, int omax, int nmax, int inv_botlin)
{
- register char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ char *ofdf, *nfdf, *olsf, *nlsf;
int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
@@ -1600,17 +1765,24 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
int count, i, j;
char *optr;
- _rl_output_some_chars (new, newbytes);
+ puts_face (new, new_face, newbytes);
_rl_last_c_pos = newwidth;
_rl_last_v_pos++;
/* 5a. If the number of screen positions doesn't match, punt
- and do a dumb update. */
- if (newwidth != oldwidth)
+ and do a dumb update.
+ 5b. If the number of bytes is greater in the new line than
+ the old, do a dumb update, because there is no guarantee we
+ can extend the old line enough to fit the new bytes. */
+ if (newwidth != oldwidth || newbytes > oldbytes)
{
+ oe = old + omax;
ne = new + nmax;
nd = newbytes;
nfd = new + nd;
+ ofdf = old_face + oldbytes;
+ nfdf = new_face + newbytes;
+
goto dumb_update;
}
if (oldbytes != 0 && newbytes != 0)
@@ -1619,13 +1791,21 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
consume the first character of old. Fix up `old' so it
reflects the new screen contents. We use +1 in the
memmove call to copy the trailing NUL. */
- memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
+ /* (strlen(old+oldbytes) == (omax - oldbytes - 1)) */
+
+ /* Don't bother trying to fit the bytes if the number of bytes
+ doesn't change. */
+ if (oldbytes != newbytes)
+ {
+ memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
+ memmove (old_face+newbytes, old_face+oldbytes, strlen (old+oldbytes) + 1);
+ }
memcpy (old, new, newbytes);
+ memcpy (old_face, new_face, newbytes);
j = newbytes - oldbytes;
-
omax += j;
/* Fix up indices if we copy data from one line to another */
- for (i = current_line+1; i <= inv_botlin+1; i++)
+ for (i = current_line+1; j != 0 && i <= inv_botlin+1 && i <=_rl_vis_botlin+1; i++)
vis_lbreaks[i] += j;
}
}
@@ -1635,21 +1815,69 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
- old[0] = new[0];
+ {
+ old[0] = new[0];
+ old_face[0] = new_face[0];
+ }
}
}
else
#endif
{
if (new[0])
- putc (new[0], rl_outstream);
+ puts_face (new, new_face, 1);
else
putc (' ', rl_outstream);
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
- old[0] = new[0];
+ {
+ old[0] = new[0];
+ old_face[0] = new_face[0];
+ }
+ }
+ }
+
+ /* We know that we are dealing with a single screen line here */
+ if (_rl_quick_redisplay)
+ {
+ nfd = new;
+ nfdf = new_face;
+ ofd = old;
+ ofdf = old_face;
+ for (od = 0, oe = ofd; od < omax && *oe; oe++, od++);
+ for (nd = 0, ne = nfd; nd < nmax && *ne; ne++, nd++);
+ od = nd = 0;
+ _rl_move_cursor_relative (0, old, old_face);
+
+ bytes_to_insert = ne - nfd;
+ if (bytes_to_insert < local_prompt_len) /* ??? */
+ goto dumb_update;
+
+ /* output the prompt, output the line contents, clear the rest */
+ _rl_output_some_chars (nfd, local_prompt_len);
+ if (mb_cur_max > 1 && rl_byte_oriented == 0)
+ _rl_last_c_pos = prompt_physical_chars;
+ else
+ _rl_last_c_pos = local_prompt_len;
+
+ bytes_to_insert -= local_prompt_len;
+ if (bytes_to_insert > 0)
+ {
+ puts_face (new+local_prompt_len, nfdf+local_prompt_len, bytes_to_insert);
+ if (mb_cur_max > 1 && rl_byte_oriented)
+ _rl_last_c_pos += _rl_col_width (new, local_prompt_len, ne-new, 1);
+ else
+ _rl_last_c_pos += bytes_to_insert;
}
+
+ /* See comments at dumb_update: for an explanation of this heuristic */
+ if (nmax < omax)
+ goto clear_rest_of_line;
+ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset)))
+ goto clear_rest_of_line;
+ else
+ return;
}
/* Find first difference. */
@@ -1659,11 +1887,13 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
/* See if the old line is a subset of the new line, so that the
only change is adding characters. */
temp = (omax < nmax) ? omax : nmax;
- if (memcmp (old, new, temp) == 0) /* adding at the end */
+ if (memcmp (old, new, temp) == 0 && memcmp (old_face, new_face, temp) == 0)
{
- new_offset = old_offset = temp;
+ new_offset = old_offset = temp; /* adding at the end */
ofd = old + temp;
+ ofdf = old_face + temp;
nfd = new + temp;
+ nfdf = new_face + temp;
}
else
{
@@ -1671,36 +1901,42 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
memset (&ps_old, 0, sizeof(mbstate_t));
/* Are the old and new lines the same? */
- if (omax == nmax && STREQN (new, old, omax))
+ if (omax == nmax && memcmp (new, old, omax) == 0 && memcmp (new_face, old_face, omax) == 0)
{
old_offset = omax;
new_offset = nmax;
ofd = old + omax;
+ ofdf = old_face + omax;
nfd = new + nmax;
+ nfdf = new_face + nmax;
}
else
{
/* Go through the line from the beginning and find the first
- difference. */
+ difference. We assume that faces change at (possibly multi-
+ byte) character boundaries. */
new_offset = old_offset = 0;
- for (ofd = old, nfd = new;
+ for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
(ofd - old < omax) && *ofd &&
- _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); )
+ _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new) &&
+ *ofdf == *nfdf; )
{
old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
ofd = old + old_offset;
+ ofdf = old_face + old_offset;
nfd = new + new_offset;
+ nfdf = new_face + new_offset;
}
}
}
}
else
#endif
- for (ofd = old, nfd = new;
- (ofd - old < omax) && *ofd && (*ofd == *nfd);
- ofd++, nfd++)
+ for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
+ (ofd - old < omax) && *ofd && (*ofd == *nfd) && (*ofdf == *nfdf);
+ ofd++, nfd++, ofdf++, nfdf++)
;
/* Move to the end of the screen line. ND and OD are used to keep track
@@ -1729,7 +1965,9 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY);
new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY);
ofd = old + old_offset; /* equal by definition */
+ ofdf = old_face + old_offset;
nfd = new + new_offset;
+ nfdf = new_face + new_offset;
}
}
#endif
@@ -1742,40 +1980,41 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY);
+ olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY);
+ nlsf = new_face + (nls - new);
while ((ols > ofd) && (nls > nfd))
{
memset (&ps_old, 0, sizeof (mbstate_t));
memset (&ps_new, 0, sizeof (mbstate_t));
-#if 0
- /* On advice from jir@yamato.ibm.com */
- _rl_adjust_point (old, ols - old, &ps_old);
- _rl_adjust_point (new, nls - new, &ps_new);
-#endif
-
- if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0)
+ if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0 ||
+ *olsf != *nlsf)
break;
if (*ols == ' ')
wsatend = 0;
ols = old + _rl_find_prev_mbchar (old, ols - old, MB_FIND_ANY);
+ olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, nls - new, MB_FIND_ANY);
+ nlsf = new_face + (nls - new);
}
}
else
{
#endif /* HANDLE_MULTIBYTE */
ols = oe - 1; /* find last same */
+ olsf = old_face + (ols - old);
nls = ne - 1;
- while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
+ nlsf = new_face + (nls - new);
+ while ((ols > ofd) && (nls > nfd) && (*ols == *nls) && (*olsf == *nlsf))
{
if (*ols != ' ')
wsatend = 0;
- ols--;
- nls--;
+ ols--; olsf--;
+ nls--; nlsf--;
}
#if defined (HANDLE_MULTIBYTE)
}
@@ -1784,15 +2023,17 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
if (wsatend)
{
ols = oe;
+ olsf = old_face + (ols - old);
nls = ne;
+ nlsf = new_face + (nls - new);
}
#if defined (HANDLE_MULTIBYTE)
/* This may not work for stateful encoding, but who cares? To handle
stateful encoding properly, we have to scan each string from the
beginning and compare. */
- else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0)
+ else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0 || *olsf != *nlsf)
#else
- else if (*ols != *nls)
+ else if (*ols != *nls || *olsf != *nlsf)
#endif
{
if (*ols) /* don't step past the NUL */
@@ -1809,6 +2050,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
else
nls++;
}
+ olsf = old_face + (ols - old);
+ nlsf = new_face + (nls - new);
}
/* count of invisible characters in the current invisible line. */
@@ -1821,6 +2064,10 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
visible_wrap_offset based on what we know. */
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)
+ visible_wrap_offset = wrap_offset - prompt_invis_chars_first_line
+#endif
if ((mb_cur_max == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset)
_rl_last_c_pos += visible_wrap_offset;
}
@@ -1858,19 +2105,21 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
- /* We take wrap_offset into account here so we can pass correct
- information to _rl_move_cursor_relative. */
- _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark;
+ /* If we just output the entire prompt string we can take advantage
+ of knowing the number of physical characters in the prompt. If
+ the prompt wraps lines (lendiff clamped at nmax), we can't. */
+ if (lendiff == local_prompt_len)
+ _rl_last_c_pos = prompt_physical_chars + modmark;
+ else
+ /* We take wrap_offset into account here so we can pass correct
+ information to _rl_move_cursor_relative. */
+ _rl_last_c_pos = _rl_col_width (local_prompt, 0, lendiff, 1) - wrap_offset + modmark;
cpos_adjusted = 1;
}
else
@@ -1891,10 +2140,11 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
to just output the prompt from the beginning of the line up to the
first difference, but you don't know the number of invisible
characters in that case.
- This needs a lot of work to be efficient. */
+ This needs a lot of work to be efficient, but it usually doesn't matter. */
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
{
nfd = new + lendiff; /* number of characters we output above */
+ nfdf = new_face + lendiff;
nd = lendiff;
/* Do a dumb update and return */
@@ -1902,7 +2152,7 @@ dumb_update:
temp = ne - nfd;
if (temp > 0)
{
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
@@ -1916,16 +2166,33 @@ dumb_update:
current_line == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
_rl_horizontal_scroll_mode == 0)
- {
- _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line);
+
+ /* If we just output a new line including the prompt, and
+ the prompt includes invisible characters, we need to
+ account for them in the _rl_last_c_pos calculation, since
+ _rl_col_width does not. This happens when other code does
+ a goto dumb_update; */
+ else if (current_line == 0 &&
+ nfd == new &&
+ prompt_invis_chars_first_line &&
+ local_prompt_len <= temp &&
+ wrap_offset >= prompt_invis_chars_first_line &&
+ _rl_horizontal_scroll_mode == 0)
+ ADJUST_CPOS (prompt_invis_chars_first_line);
}
else
_rl_last_c_pos += temp;
}
+ /* This is a useful heuristic, but what we really want is to clear
+ if the new number of visible screen characters is less than the
+ old number of visible screen characters. If the prompt has changed,
+ we don't really have enough information about the visible line to
+ know for sure, so we use another heuristic calclulation below. */
if (nmax < omax)
goto clear_rest_of_line; /* XXX */
+ else if ((nmax - W_OFFSET(current_line, wrap_offset)) < (omax - W_OFFSET (current_line, visible_wrap_offset)))
+ goto clear_rest_of_line;
else
return;
}
@@ -1936,7 +2203,7 @@ dumb_update:
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor position in multibyte mode, but a buffer index when not in a
multibyte locale. */
- _rl_move_cursor_relative (od, old);
+ _rl_move_cursor_relative (od, old, old_face);
#if defined (HANDLE_MULTIBYTE)
/* We need to indicate that the cursor position is correct in the presence of
@@ -1954,15 +2221,76 @@ dumb_update:
When not using multibyte characters, these are equal */
lendiff = (nls - nfd) - (ols - ofd);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
- col_lendiff = _rl_col_width (new, nfd - new, nls - new, 1) - _rl_col_width (old, ofd - old, ols - old, 1);
+ {
+ int newchars, newwidth, newind;
+ int oldchars, oldwidth, oldind;
+
+ newchars = nls - new;
+ oldchars = ols - old;
+
+ /* If we can do it, try to adjust nls and ols so that nls-new will
+ contain the entire new prompt string. That way we can use
+ prompt_physical_chars and not have to recompute column widths.
+ _rl_col_width adds wrap_offset and expects the caller to compensate,
+ which we do below, so we do the same thing if we don't call
+ _rl_col_width.
+ We don't have to compare, since we know the characters are the same.
+ The check of differing numbers of invisible chars may be extraneous.
+ XXX - experimental */
+ if (current_line == 0 && nfd == new && newchars > prompt_last_invisible &&
+ newchars <= local_prompt_len &&
+ local_prompt_len <= nmax &&
+ current_invis_chars != visible_wrap_offset)
+ {
+ while (newchars < nmax && oldchars < omax && newchars < local_prompt_len)
+ {
+#if defined (HANDLE_MULTIBYTE)
+ newind = _rl_find_next_mbchar (new, newchars, 1, MB_FIND_NONZERO);
+ oldind = _rl_find_next_mbchar (old, oldchars, 1, MB_FIND_NONZERO);
+
+ nls += newind - newchars;
+ ols += oldind - oldchars;
+
+ newchars = newind;
+ oldchars = oldind;
+#else
+ nls++; ols++;
+ newchars++; oldchars++;
+#endif
+ }
+ newwidth = (newchars == local_prompt_len) ? prompt_physical_chars + wrap_offset
+ : _rl_col_width (new, 0, nls - new, 1);
+ /* if we changed nls and ols, we need to recompute lendiff */
+ lendiff = (nls - nfd) - (ols - ofd);
+
+ nlsf = new_face + (nls - new);
+ olsf = old_face + (ols - old);
+ }
+ else
+ newwidth = _rl_col_width (new, nfd - new, nls - new, 1);
+
+ oldwidth = _rl_col_width (old, ofd - old, ols - old, 1);
+
+ col_lendiff = newwidth - oldwidth;
+ }
else
col_lendiff = lendiff;
+ /* col_lendiff uses _rl_col_width(), which doesn't know about whether or not
+ the multibyte characters it counts are invisible, so unless we're printing
+ the entire prompt string (in which case we can use prompt_physical_chars)
+ the count is short by the number of bytes in the invisible multibyte
+ characters - the number of multibyte characters.
+
+ We don't have a good way to solve this without moving to something like
+ a bitmap that indicates which characters are visible and which are
+ invisible. We fix it up (imperfectly) in the caller and by trying to use
+ the entire prompt string wherever we can. */
+
/* If we are changing the number of invisible characters in a line, and
the spot of first difference is before the end of the invisible chars,
lendiff needs to be adjusted. */
- if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */
- current_invis_chars != visible_wrap_offset)
+ if (current_line == 0 && current_invis_chars != visible_wrap_offset)
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
@@ -2004,16 +2332,13 @@ dumb_update:
only happen in a multibyte environment. */
if (lendiff < 0)
{
- _rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += col_temp; /* XXX - was _rl_col_width (nfd, 0, temp, 1); */
+ puts_face (nfd, nfdf, temp);
+ _rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
if (current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
- {
- _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
return;
}
/* Sometimes it is cheaper to print the characters rather than
@@ -2041,7 +2366,7 @@ dumb_update:
(visible_wrap_offset >= current_invis_chars))
{
open_some_spaces (col_lendiff);
- _rl_output_some_chars (nfd, bytes_to_insert);
+ puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
else
@@ -2051,22 +2376,19 @@ dumb_update:
{
/* At the end of a line the characters do not have to
be "inserted". They can just be placed on the screen. */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
return;
}
else /* just write from first difference to end of new line */
{
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
- {
- _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
return;
}
@@ -2076,16 +2398,13 @@ dumb_update:
prompt, adjust _rl_last_c_pos to account for wrap_offset
and set cpos_adjusted to let the caller know. */
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
- {
- _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
}
}
else
{
/* cannot insert chars, write to EOL */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If we're in a multibyte locale and were before the last invisible
char in the current line (which implies we just output some invisible
@@ -2100,10 +2419,11 @@ dumb_update:
displaying_prompt_first_line &&
wrap_offset != prompt_invis_chars_first_line &&
((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth+prompt_invis_chars_first_line))))
- {
- _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line);
+
+ /* XXX - what happens if wrap_offset == prompt_invis_chars_first_line
+ and we are drawing the first line (current_line == 0)? We should
+ adjust by _rl_last_c_pos -= prompt_invis_chars_first_line */
}
}
else /* Delete characters from line. */
@@ -2138,18 +2458,18 @@ dumb_update:
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
- _rl_output_some_chars (nfd, bytes_to_insert);
+ puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
+ /* This still doesn't take into account whether or not the
+ characters that this counts are invisible. */
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
if (current_line == 0 && wrap_offset &&
displaying_prompt_first_line &&
- _rl_last_c_pos >= wrap_offset && /* XXX was > */
+ prompt_invis_chars_first_line &&
+ _rl_last_c_pos >= prompt_invis_chars_first_line &&
((nfd - new) <= prompt_last_invisible))
- {
- _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (prompt_invis_chars_first_line);
#if 1
#ifdef HANDLE_MULTIBYTE
@@ -2172,7 +2492,7 @@ dumb_update:
so we move there with _rl_move_cursor_relative */
if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
{
- _rl_move_cursor_relative (ne-new, new);
+ _rl_move_cursor_relative (ne-new, new, new_face);
goto clear_rest_of_line;
}
}
@@ -2186,7 +2506,7 @@ dumb_update:
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp; /* XXX */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
@@ -2194,10 +2514,7 @@ dumb_update:
displaying_prompt_first_line &&
_rl_last_c_pos > wrap_offset &&
((nfd - new) <= prompt_last_invisible))
- {
- _rl_last_c_pos -= wrap_offset; /* XXX - prompt_invis_chars_first_line? */
- cpos_adjusted = 1;
- }
+ ADJUST_CPOS (wrap_offset); /* XXX - prompt_invis_chars_first_line? */
}
}
clear_rest_of_line:
@@ -2246,11 +2563,7 @@ rl_clear_visible_line (void)
int curr_line;
/* Make sure we move to column 0 so we clear the entire line */
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
/* Move to the last screen line of the current visible line */
@@ -2363,8 +2676,8 @@ rl_redraw_prompt_last_line (void)
DATA is the contents of the screen line of interest; i.e., where
the movement is being done.
DATA is always the visible line or the invisible line */
-void
-_rl_move_cursor_relative (int new, const char *data)
+static void
+_rl_move_cursor_relative (int new, const char *data, const char *dataf)
{
register int i;
int woff; /* number of invisible chars on current line */
@@ -2461,11 +2774,7 @@ _rl_move_cursor_relative (int new, const char *data)
if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
(_rl_term_autowrap && i == _rl_screenwidth))
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif /* !__MSDOS__ */
+ _rl_cr ();
cpos = _rl_last_c_pos = 0;
}
@@ -2497,14 +2806,12 @@ _rl_move_cursor_relative (int new, const char *data)
}
else
{
- tputs (_rl_term_cr, 1, _rl_output_character_function);
- for (i = 0; i < new; i++)
- putc (data[i], rl_outstream);
+ _rl_cr ();
+ puts_face (data, dataf, new);
}
}
else
- for (i = cpos; i < new; i++)
- putc (data[i], rl_outstream);
+ puts_face (data + cpos, dataf + cpos, new - cpos);
}
#if defined (HANDLE_MULTIBYTE)
@@ -2532,11 +2839,7 @@ _rl_move_vert (int to)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
}
else
@@ -2877,14 +3180,18 @@ space_to_eol (int count)
}
void
-_rl_clear_screen (void)
+_rl_clear_screen (int clrscr)
{
#if defined (__DJGPP__)
ScreenClear ();
ScreenSetCursor (0, 0);
#else
if (_rl_term_clrpag)
- tputs (_rl_term_clrpag, 1, _rl_output_character_function);
+ {
+ tputs (_rl_term_clrpag, 1, _rl_output_character_function);
+ if (clrscr && _rl_term_clrscroll)
+ tputs (_rl_term_clrscroll, 1, _rl_output_character_function);
+ }
else
rl_crlf ();
#endif /* __DJGPP__ */
@@ -2964,6 +3271,9 @@ _rl_update_final (void)
{
int full_lines, woff, botline_length;
+ if (line_structures_initialized == 0)
+ return;
+
full_lines = 0;
/* If the cursor is the only thing on an otherwise-blank last line,
compensate so we don't print an extra CRLF. */
@@ -2979,7 +3289,7 @@ _rl_update_final (void)
/* If we've wrapped lines, remove the final xterm line-wrap flag. */
if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth)
{
- char *last_line;
+ char *last_line, *last_face;
/* 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.
@@ -2987,10 +3297,12 @@ _rl_update_final (void)
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); */
+ last_face = &vis_face[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
cpos_buffer_position = -1; /* don't know where we are in buffer */
- _rl_move_cursor_relative (_rl_screenwidth - 1 + woff, last_line); /* XXX */
+ _rl_move_cursor_relative (_rl_screenwidth - 1 + woff, last_line, last_face); /* XXX */
_rl_clear_to_eol (0);
- putc (last_line[_rl_screenwidth - 1 + woff], rl_outstream);
+ puts_face (&last_line[_rl_screenwidth - 1 + woff],
+ &last_face[_rl_screenwidth - 1 + woff], 1);
}
_rl_vis_botlin = 0;
if (botline_length > 0 || _rl_last_c_pos > 0)
@@ -3003,15 +3315,8 @@ _rl_update_final (void)
static void
cr (void)
{
- if (_rl_term_cr)
- {
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
- _rl_last_c_pos = 0;
- }
+ _rl_cr ();
+ _rl_last_c_pos = 0;
}
/* Redraw the last line of a multi-line prompt that may possibly contain
@@ -3054,24 +3359,19 @@ _rl_redisplay_after_sigwinch (void)
{
_rl_move_vert (_rl_vis_botlin);
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
-#if defined (__MSDOS__)
- space_to_eol (_rl_screenwidth);
- putc ('\r', rl_outstream);
-#else
+
+#if !defined (__MSDOS__)
if (_rl_term_clreol)
tputs (_rl_term_clreol, 1, _rl_output_character_function);
else
+#endif
{
space_to_eol (_rl_screenwidth);
- tputs (_rl_term_cr, 1, _rl_output_character_function);
+ _rl_cr ();
}
-#endif
+
if (_rl_last_v_pos > 0)
_rl_move_vert (0);
}
@@ -3136,6 +3436,14 @@ _rl_current_display_line (void)
return ret;
}
+void
+_rl_refresh_line (void)
+{
+ rl_clear_visible_line ();
+ rl_redraw_prompt_last_line ();
+ rl_keep_mark_active ();
+}
+
#if defined (HANDLE_MULTIBYTE)
/* Calculate the number of screen columns occupied by STR from START to END.
In the case of multibyte characters with stateful encoding, we have to
diff --git a/readline/readline/doc/history.3 b/readline/readline/doc/history.3
index 8de64f6..df6cd37 100644
--- a/readline/readline/doc/history.3
+++ b/readline/readline/doc/history.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Sun Oct 8 11:43:43 EDT 2017
+.\" Last Change: Fri Jul 17 09:43:01 EDT 2020
.\"
-.TH HISTORY 3 "2017 October 8" "GNU History 6.3"
+.TH HISTORY 3 "2020 July 17" "GNU History 8.1"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -40,8 +40,8 @@
.SH NAME
history \- GNU History Library
.SH COPYRIGHT
-.if t The GNU History Library is Copyright \(co 1989-2017 by the Free Software Foundation, Inc.
-.if n The GNU History Library is Copyright (C) 1989-2017 by the Free Software Foundation, Inc.
+.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.
.SH DESCRIPTION
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
@@ -49,7 +49,6 @@ data with each line, and utilize information from previous lines in
composing new ones.
.PP
.SH "HISTORY EXPANSION"
-.PP
The history library supports a history expansion feature that
is identical to the history expansion in
.BR bash.
@@ -80,7 +79,6 @@ history expansion character, which is \^\fB!\fP\^ by default.
Only backslash (\^\fB\e\fP\^) and single quotes can quote
the history expansion character.
.SS Event Designators
-.PP
An event designator is a reference to a command line entry in the
history list.
Unless the reference is absolute, events are relative to the current
@@ -118,6 +116,8 @@ containing
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;
+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
@@ -125,14 +125,13 @@ Quick substitution. Repeat the last command, replacing
with
.IR string2 .
Equivalent to
-``!!:s/\fIstring1\fP/\fIstring2\fP/''
+``!!:s\d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u''
(see \fBModifiers\fP below).
.TP
.B !#
The entire command line typed so far.
.PD
.SS Word Designators
-.PP
Word designators are used to select desired words from the event.
A
.B :
@@ -165,7 +164,8 @@ The last word. This is usually the last argument, but will expand to the
zeroth word if there is only one word in the line.
.TP
.B %
-The word matched by the most recent `?\fIstring\fR?' search.
+The first word matched by the most recent `?\fIstring\fR?' search,
+if the search string begins with a character that is part of a word.
.TP
.I x\fB\-\fPy
A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'.
@@ -182,14 +182,15 @@ Abbreviates \fIx\-$\fP.
.TP
.B x\-
Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word.
+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.
.SS Modifiers
-.PP
After the optional word designator, there may appear a sequence of
one or more of the following modifiers, each preceded by a `:'.
+These modify, or edit, the word or words selected from the history event.
.PP
.PD 0
.PP
@@ -219,15 +220,19 @@ 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.
.TP
.B s/\fIold\fP/\fInew\fP/
Substitute
.I new
for the first occurrence of
.I old
-in the event line. Any delimiter can be used in place of /. The
-final delimiter is optional if it is the last character of the
-event line. The delimiter may be quoted in
+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
.I old
and
.I new
@@ -235,7 +240,8 @@ with a single backslash. If & appears in
.IR new ,
it is replaced by
.IR old .
-A single backslash will quote the &. If
+A single backslash will quote the &.
+If
.I old
is null, it is set to the last
.I old
@@ -245,6 +251,11 @@ the last
in a
.B !?\fIstring\fR\fB[?]\fR
search.
+If
+.I new
+is null, each matching
+.I old
+is deleted.
.TP
.B &
Repeat the previous substitution.
@@ -259,13 +270,13 @@ 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' modifier once to each word in the event line.
+Apply the following `\fBs\fP' or `\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
-.PP
-The programmer using the History library has available functions
+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
for a line containing an arbitrary text string, and referencing any line
@@ -280,7 +291,7 @@ in new commands. The basic history manipulation commands are
identical to
the history substitution provided by \fBbash\fP.
.PP
-If the programmer desires, he can use the Readline library, which
+The programmer can also use the Readline library, which
includes some history manipulation by default, and has the added
advantage of command line editing.
.PP
@@ -292,9 +303,7 @@ 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.
-
.SS History Storage
-.PP
The history list is an array of history entries. A history entry is
declared as follows:
.PP
@@ -330,7 +339,6 @@ typedef struct _hist_state {
If the flags member includes \fBHS_STIFLED\fP, the history has been
stifled.
.SH "History Functions"
-.PP
This section describes the calling sequence for the various functions
exported by the GNU History library.
.SS Initializing History and State Management
@@ -349,7 +357,6 @@ Return a structure describing the current state of the input history.
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.
@@ -545,7 +552,7 @@ if the returned line should be displayed, but not executed,
as with the \fB:p\fP modifier.
.PD
.RE
-If an error ocurred in expansion, then \fIoutput\fP contains a descriptive
+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"
@@ -583,7 +590,7 @@ The number of entries currently stored in the history list.
The maximum number of history entries. This must be changed using
\fBstifle_history()\fP.
-.Vb int history_wite_timestamps
+.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.
diff --git a/readline/readline/doc/history.texi b/readline/readline/doc/history.texi
index 98e2233..7a3a476 100644
--- a/readline/readline/doc/history.texi
+++ b/readline/readline/doc/history.texi
@@ -12,7 +12,7 @@ This document describes the GNU History library
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/readline/readline/doc/hstech.texi b/readline/readline/doc/hstech.texi
index dbc21c1..7ac1195 100644
--- a/readline/readline/doc/hstech.texi
+++ b/readline/readline/doc/hstech.texi
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988-2016 Free Software Foundation, Inc.
+Copyright (C) 1988-2020 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -48,7 +48,7 @@ History library is able to keep track of those lines, associate arbitrary
data with each line, and utilize information from previous lines in
composing new ones.
-The programmer using the History library has available functions
+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
for a line containing an arbitrary text string, and referencing any line
@@ -62,7 +62,7 @@ commands for manipulating the text of previous lines and using that text
in new commands. The basic history manipulation commands are similar to
the history substitution provided by @code{csh}.
-If the programmer desires, he can use the Readline library, which
+The programmer can also use the Readline library, which
includes some history manipulation by default, and has the added
advantage of command line editing.
diff --git a/readline/readline/doc/hsuser.texi b/readline/readline/doc/hsuser.texi
index e92c794..5e30ded 100644
--- a/readline/readline/doc/hsuser.texi
+++ b/readline/readline/doc/hsuser.texi
@@ -1,7 +1,7 @@
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988--2018 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@@ -151,7 +151,14 @@ Both @var{first} and
@var{last} may be specified as a string (to locate the most recent
command beginning with that string) or as a number (an index into the
history list, where a negative number is used as an offset from the
-current command number). If @var{last} is not specified, it is set to
+current command number).
+
+When listing, a @var{first} or @var{last} of 0 is equivalent to -1
+and -0 is equivalent to the current command (usually the @code{fc}
+command);
+otherwise 0 is equivalent to -1 and -0 is invalid.
+
+If @var{last} is not specified, it is set to
@var{first}. If @var{first} is not specified, it is set to the previous
command for editing and @minus{}16 for listing. If the @option{-l} flag is
given, the commands are listed on standard output. The @option{-n} flag
@@ -166,7 +173,7 @@ When editing is complete, the edited commands are echoed and executed.
In the second form, @var{command} is re-executed after each instance
of @var{pat} in the selected command is replaced by @var{rep}.
-@var{command} is intepreted the same as @var{first} above.
+@var{command} is interpreted the same as @var{first} above.
A useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
that typing @samp{r cc} runs the last command beginning with @code{cc}
@@ -372,11 +379,13 @@ containing @var{string}.
The trailing
@samp{?} may be omitted if the @var{string} is followed immediately by
a newline.
+If @var{string} is missing, the string from the most recent search is used;
+it is an error if there is no previous search string.
@item @code{^@var{string1}^@var{string2}^}
Quick Substitution. Repeat the last command, replacing @var{string1}
with @var{string2}. Equivalent to
-@code{!!:s/@var{string1}/@var{string2}/}.
+@code{!!:s^@var{string1}^@var{string2}^}.
@item @code{!#}
The entire command line typed so far.
@@ -428,7 +437,8 @@ The first argument; that is, word 1.
The last argument.
@item %
-The word matched by the most recent @samp{?@var{string}?} search.
+The first word matched by the most recent @samp{?@var{string}?} search,
+if the search string begins with a character that is part of a word.
@item @var{x}-@var{y}
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
@@ -443,6 +453,7 @@ Abbreviates @samp{@var{x}-$}
@item @var{x}-
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
+If @samp{x} is missing, it defaults to 0.
@end table
@@ -454,6 +465,7 @@ previous command is used as the event.
After the optional word designator, you can add a sequence of one or more
of the following modifiers, each preceded by a @samp{:}.
+These modify, or edit, the word or words selected from the history event.
@table @code
@@ -480,15 +492,25 @@ Quote the substituted words, escaping further substitutions.
@item x
Quote the substituted words as with @samp{q},
but break into words at spaces, tabs, and newlines.
+The @samp{q} and @samp{x} modifiers are mutually exclusive; the last one
+supplied is used.
@end ifset
@item s/@var{old}/@var{new}/
Substitute @var{new} for the first occurrence of @var{old} in the
-event line. Any delimiter may be used in place of @samp{/}.
+event line.
+Any character may be used as the delimiter in place of @samp{/}.
The delimiter may be quoted in @var{old} and @var{new}
with a single backslash. If @samp{&} appears in @var{new},
it is replaced by @var{old}. A single backslash will quote
-the @samp{&}. The final delimiter is optional if it is the last
+the @samp{&}.
+If @var{old} is null, it is set to the last @var{old}
+substituted, or, if no previous history substitutions took place,
+the last @var{string}
+in a !?@var{string}@code{[?]}
+search.
+If @var{new} is is null, each matching @var{old} is deleted.
+The final delimiter is optional if it is the last
character on the input line.
@item &
@@ -501,6 +523,7 @@ conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
or with @samp{&}.
@item G
-Apply the following @samp{s} modifier once to each word in the event.
+Apply the following @samp{s} or @samp{&} modifier once to each word
+in the event.
@end table
diff --git a/readline/readline/doc/readline.3 b/readline/readline/doc/readline.3
index be89c2d..179c781 100644
--- a/readline/readline/doc/readline.3
+++ b/readline/readline/doc/readline.3
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Thu Dec 28 14:49:51 EST 2017
+.\" Last Change: Tue Mar 24 09:27:30 EDT 2020
.\"
-.TH READLINE 3 "2017 December 28" "GNU Readline 7.0"
+.TH READLINE 3 "2020 October 29" "GNU Readline 8.1"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -34,8 +34,8 @@ readline \- get a line from a user with editing
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
-.if n Readline is Copyright (C) 1989\-2014 Free Software Foundation, Inc.
-.if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.
+.if n Readline is Copyright (C) 1989\-2020 Free Software Foundation, Inc.
+.if t Readline is Copyright \(co 1989\-2020 Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
@@ -163,7 +163,6 @@ In addition to command names, readline allows keys to be bound
to a string that is inserted when the key is pressed (a \fImacro\fP).
.PP
.SS Key Bindings
-.PP
The syntax for controlling key bindings in the
.I inputrc
file is simple. All that is required is the name of the
@@ -318,7 +317,6 @@ similar mechanisms. The
file may be edited and re-read if a program does not provide
any other means to incorporate new bindings.
.SS Variables
-.PP
Readline has variables that can be used to further customize its
behavior. A variable may be set in the
.I inputrc
@@ -405,10 +403,11 @@ replaced with an ellipsis when displaying possible completions.
This determines when the user is queried about viewing
the number of possible completions
generated by the \fBpossible\-completions\fP command.
-It may be set to any integer value greater than or equal to
-zero. If the number of possible completions is greater than
-or equal to the value of this variable, the user is asked whether
-or not he wishes to view them; otherwise they are simply listed
+It may be set to any integer value greater than or equal to zero.
+If the number of possible completions is greater than
+or equal to the value of this variable,
+readline will ask whether or not the user wishes to view them;
+otherwise they are simply listed
on the terminal. A negative value causes readline to never ask.
.TP
.B convert\-meta (On)
@@ -448,7 +447,7 @@ Use the \e1 and \e2 escapes to begin and end sequences of
non-printing characters, which can be used to embed a terminal control
sequence into the mode string.
.TP
-.B enable\-bracketed\-paste (Off)
+.B enable\-bracketed\-paste (On)
When set to \fBOn\fP, readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
@@ -488,6 +487,7 @@ the maximum number of history entries will be set to 500.
When set to \fBOn\fP, makes readline use a single line for display,
scrolling the input horizontally on a single screen line when it
becomes longer than the screen width rather than wrapping to a new line.
+This setting is automatically enabled for terminals of height 1.
.TP
.B input\-meta (Off)
If set to \fBOn\fP, readline will enable eight-bit input (that is,
@@ -633,7 +633,6 @@ by \fIstat\fP(2) is appended to the filename when listing possible
completions.
.PD
.SS Conditional Constructs
-.PP
Readline implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
@@ -731,7 +730,6 @@ would read \fI/etc/inputrc\fP:
.fi
.RE
.SH SEARCHING
-.PP
Readline provides commands for searching through the command history
for lines containing a specified string.
There are two search modes:
@@ -771,7 +769,6 @@ Non-incremental searches read the entire search string before starting
to search for matching history lines. The search string may be
typed by the user or be part of the contents of the current line.
.SH EDITING COMMANDS
-.PP
The following is a list of the names of the commands and the default
key sequences to which they are bound.
Command names without an accompanying key sequence are unbound by default.
@@ -781,7 +778,6 @@ position, and \fImark\fP refers to a cursor position saved by the
\fBset\-mark\fP command.
The text between the point and mark is referred to as the \fIregion\fP.
.SS Commands for Moving
-.PP
.PD 0
.TP
.B beginning\-of\-line (C\-a)
@@ -817,8 +813,15 @@ Readline line does not take up more than one physical line or if the length
of the current Readline line is not greater than the length of the prompt
plus the screen width.
.TP
+.B clear\-display (M\-C\-l)
+Clear the screen and, if possible, the terminal's scrollback buffer,
+then redraw the current line,
+leaving the current line at the top of the screen.
+.TP
.B clear\-screen (C\-l)
-Clear the screen leaving the current line at the top of the screen.
+Clear the screen,
+then redraw the current line,
+leaving the current line at the top of the screen.
With an argument, refresh the current line without clearing the
screen.
.TP
@@ -826,7 +829,6 @@ screen.
Refresh the current line.
.PD
.SS Commands for Manipulating the History
-.PP
.PD 0
.TP
.B accept\-line (Newline, Return)
@@ -917,9 +919,17 @@ the direction to move through the history. A negative argument switches
the direction through the history (back or forward).
The history expansion facilities are used to extract the last argument,
as if the "!$" history expansion had been specified.
+.TP
+.B
+operate\-and\-get\-next (C\-o)
+Accept the current line for return to the calling application as if a
+newline had been entered,
+and fetch the next line relative to the current line from the history
+for editing.
+A numeric argument, if supplied, specifies the history entry to use instead
+of the current line.
.PD
.SS Commands for Changing Text
-.PP
.PD 0
.TP
.B \fIend\-of\-file\fP (usually C\-d)
@@ -994,7 +1004,6 @@ Characters bound to \fBbackward\-delete\-char\fP replace the character
before point with a space. By default, this command is unbound.
.PD
.SS Killing and Yanking
-.PP
.PD 0
.TP
.B kill\-line (C\-k)
@@ -1057,7 +1066,6 @@ or
.BR yank\-pop .
.PD
.SS Numeric Arguments
-.PP
.PD 0
.TP
.B digit\-argument (M\-0, M\-1, ..., M\-\-)
@@ -1079,7 +1087,6 @@ first time makes the argument count four, a second time makes the
argument count sixteen, and so on.
.PD
.SS Completing
-.PP
.PD 0
.TP
.B complete (TAB)
@@ -1136,7 +1143,6 @@ If at the end of the line, behaves identically to
\fBpossible-completions\fP.
.PD
.SS Keyboard Macros
-.PP
.PD 0
.TP
.B start\-kbd\-macro (C\-x (\^)
@@ -1155,7 +1161,6 @@ Print the last keyboard macro defined in a format suitable for the
\fIinputrc\fP file.
.PD
.SS Miscellaneous
-.PP
.PD 0
.TP
.B re\-read\-init\-file (C\-x C\-r)
@@ -1331,6 +1336,7 @@ Emacs Meta bindings
"M-C-H" backward-kill-word
"M-C-I" tab-insert
"M-C-J" vi-editing-mode
+"M-C-L" clear-display
"M-C-M" vi-editing-mode
"M-C-R" revert-line
"M-C-Y" yank-nth-arg
@@ -1535,5 +1541,4 @@ Comments and bug reports concerning
this manual page should be directed to
.IR chet.ramey@case.edu .
.SH BUGS
-.PP
It's too big and too slow.
diff --git a/readline/readline/doc/rlman.texi b/readline/readline/doc/rlman.texi
index 737f971..ec7487b 100644
--- a/readline/readline/doc/rlman.texi
+++ b/readline/readline/doc/rlman.texi
@@ -13,7 +13,7 @@ This manual describes the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/readline/readline/doc/rltech.texi b/readline/readline/doc/rltech.texi
index 28a02d9..bbf57c2 100644
--- a/readline/readline/doc/rltech.texi
+++ b/readline/readline/doc/rltech.texi
@@ -7,7 +7,7 @@ This document describes the GNU Readline Library, a utility for aiding
in the consistency of user interface across discrete programs that need
to provide a command line interface.
-Copyright (C) 1988--2016 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -1342,6 +1342,29 @@ This differs from @code{clear_history} because it frees private data
Readline saves in the history list.
@end deftypefun
+@deftypefun {void} rl_activate_mark (void)
+Enable an @emph{active} mark.
+When this is enabled, the text between point and mark (the @var{region}) is
+displayed in the terminal's standout mode (a @var{face}).
+This is called by various readline functions that set the mark and insert
+text, and is available for applications to call.
+@end deftypefun
+
+@deftypefun {void} rl_deactivate_mark (void)
+Turn off the active mark.
+@end deftypefun
+
+@deftypefun {void} rl_keep_mark_active (void)
+Indicate that the mark should remain active when the current readline function
+completes and after redisplay occurs.
+In most cases, the mark remains active for only the duration of a single
+bindable readline function.
+@end deftypefun
+
+@deftypefun {int} rl_mark_active_p (void)
+Return a non-zero value if the mark is currently active; zero otherwise.
+@end deftypefun
+
@node Alternate Interface
@subsection Alternate Interface
@@ -1733,8 +1756,8 @@ to determine whether or not there are any pending signals.
If an application does not wish Readline to catch @code{SIGWINCH}, it may
call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force
-Readline to update its idea of the terminal size when a @code{SIGWINCH}
-is received.
+Readline to update its idea of the terminal size when it receives
+a @code{SIGWINCH}.
@deftypefun void rl_echo_signal_char (int sig)
If an application wishes to install its own signal handlers, but still
@@ -1751,11 +1774,14 @@ Update Readline's internal screen size by reading values from the kernel.
Set Readline's idea of the terminal size to @var{rows} rows and
@var{cols} columns. If either @var{rows} or @var{columns} is less than
or equal to 0, Readline's idea of that terminal dimension is unchanged.
+This is intended to tell Readline the physical dimensions of the terminal,
+and is used internally to calculate the maximum number of characters that
+may appear on a single line and on the screen.
@end deftypefun
If an application does not want to install a @code{SIGWINCH} handler, but
-is still interested in the screen dimensions, Readline's idea of the screen
-size may be queried.
+is still interested in the screen dimensions, it may query Readline's idea
+of the screen size.
@deftypefun void rl_get_screen_size (int *rows, int *cols)
Return Readline's idea of the terminal's size in the
@@ -2039,7 +2065,7 @@ remove any quote characters from the directory name, because its result will
be passed directly to @code{opendir()}.
The directory rewrite hook returns an integer that should be non-zero if
-the function modfies its directory argument.
+the function modifies its directory argument.
The function should not modify the directory argument if it returns 0.
@end deftypevar
@@ -2051,7 +2077,7 @@ is passed to @code{stat()} to determine the file's type and characteristics.
This function does not need to remove quote characters from the filename.
The stat hook returns an integer that should be non-zero if
-the function modfies its directory argument.
+the function modifies its directory argument.
The function should not modify the directory argument if it returns 0.
@end deftypevar
@@ -2645,7 +2671,7 @@ com_help (arg)
if (!printed)
@{
- printf ("No commands match `%s'. Possibilties are:\n", arg);
+ printf ("No commands match `%s'. Possibilities are:\n", arg);
for (i = 0; commands[i].name; i++)
@{
diff --git a/readline/readline/doc/rluser.texi b/readline/readline/doc/rluser.texi
index a59bd14..26b0ff0 100644
--- a/readline/readline/doc/rluser.texi
+++ b/readline/readline/doc/rluser.texi
@@ -9,7 +9,7 @@ use these features. There is a document entitled "readline.texinfo"
which contains both end-user and programmer documentation for the
GNU Readline Library.
-Copyright (C) 1988--2016 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
@@ -350,6 +350,11 @@ file is taken from the value of the environment variable @env{INPUTRC}. If
that variable is unset, the default is @file{~/.inputrc}. If that
file does not exist or cannot be read, the ultimate default is
@file{/etc/inputrc}.
+@ifset BashFeatures
+The @w{@code{bind}} builtin command can also be used to set Readline
+keybindings and variables.
+@xref{Bash Builtins}.
+@end ifset
When a program which uses the Readline library starts up, the
init file is read, and the key bindings are set.
@@ -488,9 +493,9 @@ replaced with an ellipsis when displaying possible completions.
@vindex completion-query-items
The number of possible completions that determines when the user is
asked whether the list of possibilities should be displayed.
-If the number of possible completions is greater than this value,
-Readline will ask the user whether or not he wishes to view
-them; otherwise, they are simply listed.
+If the number of possible completions is greater than or equal to this value,
+Readline will ask whether or not the user wishes to view them;
+otherwise, they are simply listed.
This variable must be set to an integer value greater than or equal to 0.
A negative value means Readline should never ask.
The default limit is @code{100}.
@@ -541,7 +546,7 @@ When set to @samp{On}, Readline will configure the terminal in a way
that will enable it to insert each paste into the editing buffer as a
single string of characters, instead of treating each character as if
it had been read from the keyboard. This can prevent pasted characters
-from being interpreted as editing commands. The default is @samp{off}.
+from being interpreted as editing commands. The default is @samp{On}.
@item enable-keypad
@vindex enable-keypad
@@ -583,8 +588,9 @@ the maximum number of history entries will be set to 500.
This variable can be set to either @samp{on} or @samp{off}. Setting it
to @samp{on} means that the text of the lines being edited will scroll
horizontally on a single screen line when they are longer than the width
-of the screen, instead of wrapping onto a new screen line. By default,
-this variable is set to @samp{off}.
+of the screen, instead of wrapping onto a new screen line.
+This variable is automatically set to @samp{on} for terminals of height 1.
+By default, this variable is set to @samp{off}.
@item input-meta
@vindex input-meta
@@ -1109,8 +1115,8 @@ set convert-meta off
# rather than as meta-prefixed characters
set output-meta on
-# if there are more than 150 possible completions for
-# a word, ask the user if he wants to see all of them
+# if there are 150 or more possible completions for a word,
+# ask whether or not the user wants to see all of them
set completion-query-items 150
# For FTP
@@ -1173,11 +1179,11 @@ Move back to the start of the current or previous word.
Words are composed of letters and digits.
@ifset BashFeatures
-@item shell-forward-word ()
+@item shell-forward-word (M-C-f)
Move forward to the end of the next word.
Words are delimited by non-quoted shell metacharacters.
-@item shell-backward-word ()
+@item shell-backward-word (M-C-b)
Move back to the start of the current or previous word.
Words are delimited by non-quoted shell metacharacters.
@end ifset
@@ -1195,8 +1201,14 @@ Readline line does not take up more than one physical line or if the length
of the current Readline line is not greater than the length of the prompt
plus the screen width.
+@item clear-display (M-C-l)
+Clear the screen and, if possible, the terminal's scrollback buffer,
+then redraw the current line,
+leaving the current line at the top of the screen.
+
@item clear-screen (C-l)
-Clear the screen and redraw the current line,
+Clear the screen,
+then redraw the current line,
leaving the current line at the top of the screen.
@item redraw-current-line ()
@@ -1242,10 +1254,12 @@ being entered.
@item reverse-search-history (C-r)
Search backward starting at the current line and moving `up' through
the history as necessary. This is an incremental search.
+This command sets the region to the matched text and activates the mark.
@item forward-search-history (C-s)
Search forward starting at the current line and moving `down' through
the history as necessary. This is an incremental search.
+This command sets the region to the matched text and activates the mark.
@item non-incremental-reverse-search-history (M-p)
Search backward starting at the current line and moving `up'
@@ -1310,6 +1324,14 @@ the direction through the history (back or forward).
The history expansion facilities are used to extract the last argument,
as if the @samp{!$} history expansion had been specified.
+@item operate-and-get-next (C-o)
+Accept the current line for return to the calling application as if a
+newline had been entered,
+and fetch the next line relative to the current line from the history
+for editing.
+A numeric argument, if supplied, specifies the history entry to use instead
+of the current line.
+
@end ftable
@node Commands For Text
@@ -1357,6 +1379,11 @@ each character as if it had been read from the keyboard. The characters
are inserted as if each one was bound to @code{self-insert} instead of
executing any editing commands.
+Bracketed paste sets the region (the characters between point and the mark)
+to the inserted text. It uses the concept of an @emph{active mark}: when the
+mark is active, Readline redisplay uses the terminal's standout mode to
+denote the region.
+
@item transpose-chars (C-t)
Drag the character before the cursor forward over
the character at the cursor, moving the
@@ -1406,9 +1433,13 @@ By default, this command is unbound.
@item kill-line (C-k)
Kill the text from point to the end of the line.
+With a negative numeric argument, kill backward from the cursor to the
+beginning of the current line.
@item backward-kill-line (C-x Rubout)
Kill backward from the cursor to the beginning of the current line.
+With a negative numeric argument, kill forward from the cursor to the
+end of the current line.
@item unix-line-discard (C-u)
Kill backward from the cursor to the beginning of the current line.
@@ -1427,7 +1458,7 @@ Kill the word behind point.
Word boundaries are the same as @code{backward-word}.
@ifset BashFeatures
-@item shell-kill-word ()
+@item shell-kill-word (M-C-d)
Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as @code{shell-forward-word}.
@@ -1437,6 +1468,14 @@ Kill the word behind point.
Word boundaries are the same as @code{shell-backward-word}.
@end ifset
+@item shell-transpose-words (M-C-t)
+Drag the word before point past the word after point,
+moving point past that word as well.
+If the insertion point is at the end of the line, this transposes
+the last two words on the line.
+Word boundaries are the same as @code{shell-forward-word} and
+@code{shell-backward-word}.
+
@item unix-word-rubout (C-w)
Kill the word behind point, using white space as a word boundary.
The killed text is saved on the kill-ring.
@@ -1774,12 +1813,6 @@ Perform history and alias expansion on the current line.
@item insert-last-argument (M-. or M-_)
A synonym for @code{yank-last-arg}.
-@item operate-and-get-next (C-o)
-Accept the current line for execution and fetch the next line
-relative to the current line from the history for editing.
-A numeric argument, if supplied, specifies the history entry to use instead
-of the current line.
-
@item edit-and-execute-command (C-x C-e)
Invoke an editor on the current command line, and execute the result as shell
commands.
@@ -2044,7 +2077,7 @@ The @option{-E} option indicates that other supplied options and actions should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options and actions should
-apply to completion on the inital non-assignment word on the line, or after a
+apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
If multiple options are supplied, the @option{-D} option takes precedence
@@ -2255,7 +2288,7 @@ The @option{-E} option indicates that other supplied options should
apply to ``empty'' command completion; that is, completion attempted on a
blank line.
The @option{-I} option indicates that other supplied options should
-apply to completion on the inital non-assignment word on the line, or after a
+apply to completion on the initial non-assignment word on the line, or after a
command delimiter such as @samp{;} or @samp{|}, which is usually command
name completion.
@@ -2370,7 +2403,7 @@ character to the directory name, in case we want to append to it.
The @option{-o bashdefault} option brings in the rest of the "Bash default"
completions -- possible completion that Bash adds to the default Readline
set. These include things like command name completion, variable completion
-for words beginning with @samp{@{}, completions containing pathname
+for words beginning with @samp{$} or @samp{$@{}, completions containing pathname
expansion patterns (@pxref{Filename Expansion}), and so on.
Once installed using @code{complete}, @code{_comp_cd} will be called every
@@ -2380,7 +2413,7 @@ Many more examples -- an extensive collection of completions for most of
the common GNU, Unix, and Linux commands -- are available as part of the
bash_completion project. This is installed by default on many GNU/Linux
distributions. Originally written by Ian Macdonald, the project now lives
-at @url{http://bash-completion.alioth.debian.org/}. There are ports for
+at @url{https://github.com/scop/bash-completion/}. There are ports for
other systems such as Solaris and Mac OS X.
An older version of the bash_completion package is distributed with bash
diff --git a/readline/readline/doc/rluserman.texi b/readline/readline/doc/rluserman.texi
index b575438..6e8e848 100644
--- a/readline/readline/doc/rluserman.texi
+++ b/readline/readline/doc/rluserman.texi
@@ -12,7 +12,7 @@ This manual describes the end user interface of the GNU Readline Library
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
diff --git a/readline/readline/doc/texi2dvi b/readline/readline/doc/texi2dvi
index 173e8ab..17f4355 100755
--- a/readline/readline/doc/texi2dvi
+++ b/readline/readline/doc/texi2dvi
@@ -1,10 +1,7 @@
#! /bin/sh
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources.
-# $Id: texi2dvi 5704 2014-07-07 17:45:16Z karl $
#
-# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
-# Free Software Foundation, Inc.
+# Copyright 1992-2019 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
@@ -36,20 +33,17 @@ set -e
# In case the default sed doesn't suffice.
: ${SED=sed}
-# This string is expanded automatically when this file is checked out.
-rcs_revision='$Revision: 5704 $'
-rcs_version=`set - $rcs_revision; echo $2`
program=`echo $0 | $SED -e 's!.*/!!'`
build_mode=${TEXI2DVI_BUILD_MODE:-local}
build_dir=${TEXI2DVI_BUILD_DIRECTORY:-.}
+orig_pwd=`pwd`
+
# Initialize variables for option overriding and otherwise.
# Don't use `unset' since old bourne shells don't have this command.
# Instead, assign them an empty value.
action=compile
-batch=false # interact normally
-catcode_special=maybe
debug=false
escape="\\"
expand=false # true for expansion via makeinfo
@@ -68,13 +62,11 @@ txiprereq=19990129 # minimum texinfo.tex version with macro expansion
verb=false # true for verbose mode
translate_file= # name of charset translation file
-orig_pwd=`pwd`
-
# We have to initialize IFS to space tab newline since we save and
# restore IFS and apparently POSIX allows stupid/broken behavior with
# empty-but-set IFS.
# http://lists.gnu.org/archive/html/automake-patches/2006-05/msg00008.html
-# We need space, tab and new line, in precisely that order. And don't leave
+# We need space, tab and newline, in precisely that order. And don't leave
# trailing blanks.
space=' '
tab=' '
@@ -82,70 +74,176 @@ newline='
'
IFS="$space$tab$newline"
-# In case someone pedantic insists on using grep -E.
: ${EGREP=egrep}
# Systems which define $COMSPEC or $ComSpec use semicolons to separate
-# directories in TEXINPUTS -- except for Cygwin et al., where COMSPEC
+# directories in TEXINPUTS -- except for Cygwin and Msys, where COMSPEC
# might be inherited, but : is used.
+
+# In the case of Msys, uname returns a value derived from MSYSTEM, as
+# MSYSTEM is user configurable, it is not so safe to use it to detect
+# Msys. It is safer to use OSTYPE, this is why we set MSYSTEM to
+# $OSTYPE before calling uname
if test -n "$COMSPEC$ComSpec" \
- && uname | $EGREP -iv 'cygwin|mingw|djgpp' >/dev/null; then
+ && MSYSTEM=$OSTYPE uname | $EGREP -iv 'cygwin|msys' >/dev/null; then
path_sep=";"
else
path_sep=":"
fi
+
# Pacify verbose cds.
CDPATH=${ZSH_VERSION+.}$path_sep
-# If $TEX is set to a directory, don't use it.
-test -n "$TEX" && test -d "$TEX" && unset TEX
-#
-## --------------------- ##
-## Auxiliary functions. ##
-## --------------------- ##
-
-# In case `local' is not supported by the shell, provide a function
-# that simulates it by simply performing the assignments. This means
-# that we must not expect `local' to work, i.e., we must not (i) rely
-# on it during recursion, and (ii) have two local declarations of the
-# same variable. (ii) is easy to check statically, and our test suite
-# does make sure there is never twice a static local declaration of a
-# variable. (i) cannot be checked easily, so just be careful.
-#
-# Note that since we might use a function simulating `local', we can
-# no longer rely on the fact that no IFS-splitting is performed. So,
-# while
-#
-# foo=$bar
-#
-# is fine (no IFS-splitting), never write
-#
-# local foo=$bar
-#
-# but rather
+# Now we define numerous functions, with no other executable code.
+# The main program is at the end of the file.
+
+
+# Standard help and version functions.
#
-# local foo="$bar"
-(
- foo=bar
- test_local () {
- local foo=foo
- }
- test_local >/dev/null 2>&1
- test $foo = bar
-) || eval '
-local () {
+# usage - display usage and exit successfully.
+usage ()
+{
+ cat <<EOF
+Usage: $program [OPTION]... FILE...
+ or: texi2pdf [OPTION]... FILE...
+ or: pdftexi2dvi [OPTION]... FILE...
+
+Run each Texinfo or (La)TeX FILE through TeX in turn until all
+cross-references are resolved, building all indices. The directory
+containing each FILE is searched for included files. The suffix of FILE
+is used to determine its language ((La)TeX or Texinfo). To process
+(e)plain TeX files, set the environment variable LATEX=tex.
+
+When invoked as \`texi2pdf' or given the option --pdf generate PDF output.
+Otherwise, generate DVI.
+
+General options:
+ -D, --debug turn on shell debugging (set -x)
+ -h, --help display this help and exit successfully
+ -o, --output=OFILE leave output in OFILE; only one input FILE is allowed
+ -q, --quiet no output unless errors
+ -v, --version display version information and exit successfully
+ -V, --verbose report on what is done
+ --max-iterations=N don't process files more than N times [$max_iters]
+ --mostly-clean remove auxiliary files or directories from
+ previous runs (but not the output)
+
+Output format:
+ --dvi output a DVI file [default]
+ --dvipdf output a PDF file via DVI (using a dvi-to-pdf program)
+ --html output an HTML file from LaTeX, using HeVeA
+ --info output an Info file from LaTeX, using HeVeA
+ -p, --pdf use pdftex or pdflatex for processing
+ --ps output a PostScript file via DVI (using dvips)
+ --text output a plain text file from LaTeX, using HeVeA
+
+TeX tuning:
+ -E, --expand macro expansion using makeinfo
+ -I DIR search DIR for Texinfo files
+ -l, --language=LANG specify LANG for FILE, either latex or texinfo
+ --no-line-error do not pass --file-line-error to TeX
+ --shell-escape pass --shell-escape to TeX
+ --src-specials pass --src-specials to TeX
+ --translate-file=FILE use given charset translation file for TeX
+ -t, --command=CMD insert CMD in copy of input file
+
+Build modes:
+ --build=MODE specify the treatment of auxiliary files [$build_mode]
+ --tidy same as --build=tidy
+ -c, --clean same as --build=clean
+ --build-dir=DIR specify where the tidy compilation is performed;
+ implies --tidy;
+ defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir]
+
+The MODE specifies where the TeX compilation takes place, and, as a
+consequence, how auxiliary files are treated. The build mode can also
+be set using the environment variable TEXI2DVI_BUILD_MODE.
+
+Valid values of MODE are:
+ \`local' compile in the current directory, leaving all the auxiliary
+ files around. This is the traditional TeX use.
+ \`tidy' compile in a local *.t2d directory, where the auxiliary files
+ are left. Output files are copied back to the original file.
+ \`clean' same as \`tidy', but remove the auxiliary directory afterwards.
+ Every compilation therefore requires the full cycle.
+
+The values of these environment variables are used to run the
+corresponding commands, if they are set:
+
+ BIBER BIBTEX DVIPDF DVIPS EGREP HEVEA LATEX MAKEINDEX MAKEINFO
+ PDFLATEX PDFTEX SED T4HT TEX TEX4HT TEXINDEX TEXINDY THUMBPDF_CMD
+
+Regarding --dvipdf, if DVIPDF is not set in the environment, the
+following programs are looked for (in this order): dvipdfmx dvipdfm
+dvipdf dvi2pdf dvitopdf.
+
+If Texinfo is installed on your site, then the command
+
+ info texi2dvi
+
+should give you access to more documentation.
+
+Report bugs to bug-texinfo@gnu.org,
+general questions and discussion to help-texinfo@gnu.org.
+GNU Texinfo home page: <http://www.gnu.org/software/texinfo/>
+General help using GNU software: <http://www.gnu.org/gethelp/>
+EOF
+ exit 0
+}
+
+
+# version - Display version info and exit successfully.
+version ()
+{
+ cat <<EOF
+texi2dvi (GNU Texinfo 6.7)
+
+Copyright (C) 2019 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+EOF
+ exit 0
+}
+
+
+# Generic auxiliary functions.
+
+# Used to access files and directories after we have changed directory
+# (for --tidy).
+rel=
+
+# Change directory, updating some relative paths.
+cd_dir ()
+{
+ cd "$1"
+
+ # Check if argument or input file is absolute, and if so, make all the path
+ # variables absolute.
+ use_absolute=false
case $1 in
- *=*) eval "$1";;
+ [\\/]* | ?:[\\/]*) # absolute path
+ use_absolute=true ;;
+ esac
+ case $in_input in
+ [\\/]* | ?:[\\/]*)
+ use_absolute=true ;;
esac
-}
-'
+ if $use_absolute ; then
+ for cdd_dir in work_build workdir t2ddir work_bak in_input in_dir; do
+ eval "$cdd_dir=\`absolute \$$cdd_dir\`"
+ done
+ return
+ fi
+
+ # Replace each path component with ".." and add a single trailing slash.
+ rel=`echo "$1" | \$SED -e 's/[^/\\][^/\\]*/../g' -e 's/[/\\]*$/\//'`
+}
-# cd_orig
-# -------
-# Return to the original directory.
+# cd_orig - Return to the original directory.
cd_orig ()
{
# In case $orig_pwd is on a different drive (for DOS).
@@ -155,11 +253,12 @@ cd_orig ()
# - the next file is processed in correct conditions
# - the temporary file can be removed
cd "$orig_pwd" || exit 1
+
+ rel=
}
-# func_dirname FILE
-# -----------------
-# Return the directory part of FILE.
+
+# func_dirname FILE - Return the directory part of FILE.
func_dirname ()
{
dirname "$1" 2>/dev/null \
@@ -167,18 +266,15 @@ func_dirname ()
}
-# noexit FILE
-# -----------
-# Return FILE with one extension remove. foo.bar.baz -> foo.bar.
+# noext FILE - Return FILE with one extension removed:
+# foo.bar.baz -> foo.bar
noext ()
{
echo "$1" | $SED -e 's/\.[^/.][^/.]*$//'
}
-# absolute NAME -> ABS-NAME
-# -------------------------
-# Return an absolute path to NAME.
+# absolute NAME - Return an absolute path to NAME.
absolute ()
{
case $1 in
@@ -186,26 +282,21 @@ absolute ()
# Absolute paths don't need to be expanded.
echo "$1"
;;
- *) local slashes
- slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'`
- local rel
- rel=$orig_pwd/`func_dirname "$1"`
- if test -d "$rel"; then
- (cd "$rel" 2>/dev/null \
- && local n
- n=`pwd`/`basename "$1"`"$slashes"
- echo "$n")
+ *) absolute_slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'`
+ absolute_rel=$orig_pwd/`func_dirname "$1"`
+ if test -d "$absolute_rel"; then
+ (cd "$absolute_rel" 2>/dev/null \
+ && absolute_name=`pwd`/`basename "$1"`"$absolute_slashes"
+ echo "$absolute_name")
else
- error 1 "not a directory: $rel"
+ error 1 "not a directory: $absolute_rel"
fi
;;
esac
}
-# ensure_dir DIR1 DIR2...
-# -----------------------
-# Make sure the directories exist.
+# ensure_dir DIR1 DIR2... - Make sure given directories exist.
ensure_dir ()
{
for dir
@@ -221,26 +312,23 @@ ensure_dir ()
}
-# error EXIT_STATUS LINE1 LINE2...
-# --------------------------------
-# Report an error and exit with failure if EXIT_STATUS is non-null.
+# error EXIT_STATUS LINE1 LINE2... - Report an error and exit with
+# failure if EXIT_STATUS is non-null.
error ()
{
- local s="$1"
+ error_status="$1"
shift
report "$@"
- if test "$s" != 0; then
- exit $s
+ if test "$error_status" != 0; then
+ exit $error_status
fi
}
-# findprog PROG
-# -------------
-# Return true if PROG is somewhere in PATH, else false.
+# findprog PROG - Return true if PROG is somewhere in PATH, else false.
findprog ()
{
- local saveIFS="$IFS"
+ saveIFS="$IFS"
IFS=$path_sep # break path components at the path separator
for dir in $PATH; do
IFS=$saveIFS
@@ -261,9 +349,7 @@ findprog ()
return 1
}
-# report LINE1 LINE2...
-# ---------------------
-# Report some information on stderr.
+# report LINE1 LINE2... - Echo each argument to stderr.
report ()
{
for i in "$@"
@@ -273,9 +359,7 @@ report ()
}
-# run COMMAND-LINE
-# ----------------
-# Run the COMMAND-LINE verbosely, and catching errors as failures.
+# run COMMAND-LINE - Run COMMAND-LINE verbosely, catching errors as failures.
run ()
{
verbose "Running $@"
@@ -284,135 +368,7 @@ run ()
}
-# usage
-# -----
-# Display usage and exit successfully.
-usage ()
-{
- # We used to simply have `echo "$usage"', but coping with the
- # changing behavior of `echo' is much harder than simply using a
- # here-doc.
- #
- # echo '\noto' echo '\\noto' echo -e '\\noto'
- # bash 3.1 \noto \\noto \noto
- # bash 3.2 %oto \noto -e \noto
- #
- # where % denotes the eol character.
- cat <<EOF
-Usage: $program [OPTION]... FILE...
- or: texi2pdf [OPTION]... FILE...
- or: pdftexi2dvi [OPTION]... FILE...
-
-Run each Texinfo or (La)TeX FILE through TeX in turn until all
-cross-references are resolved, building all indices. The directory
-containing each FILE is searched for included files. The suffix of FILE
-is used to determine its language ((La)TeX or Texinfo). To process
-(e)plain TeX files, set the environment variable LATEX=tex.
-
-In order to make texi2dvi a drop-in replacement of TeX/LaTeX in AUC-TeX,
-the FILE may also be composed of the following simple TeX commands.
- \`\\input{FILE}' the actual file to compile
- \`\\nonstopmode' same as --batch
-
-When invoked as \`texi2pdf' or \`pdftexi2dvi', or given the option --pdf
-or --dvipdf, generate PDF output. Otherwise, generate DVI.
-
-General options:
- -b, --batch no interaction
- -D, --debug turn on shell debugging (set -x)
- -h, --help display this help and exit successfully
- -o, --output=OFILE leave output in OFILE; only one input FILE is allowed
- -q, --quiet no output unless errors (implies --batch)
- -s, --silent same as --quiet
- -v, --version display version information and exit successfully
- -V, --verbose report on what is done
-
-Output format:
- --dvi output a DVI file [default]
- --dvipdf output a PDF file via DVI (using a dvi-to-pdf program)
- --html output an HTML file from LaTeX, using HeVeA
- --info output an Info file from LaTeX, using HeVeA
- -p, --pdf use pdftex or pdflatex for processing
- --ps output a PostScript file via DVI (using dvips)
- --text output a plain text file from LaTeX, using HeVeA
-
-TeX tuning:
- -@ use @input instead of \input for preloaded Texinfo
- -e, -E, --expand force macro expansion using makeinfo
- -I DIR search DIR for Texinfo files
- -l, --language=LANG specify LANG for FILE, either latex or texinfo
- --no-line-error do not pass --file-line-error to TeX
- --shell-escape pass --shell-escape to TeX
- --src-specials pass --src-specials to TeX
- -t, --command=CMD insert CMD in copy of input file
- or --texinfo=CMD multiple values accumulate
- --translate-file=FILE use given charset translation file for TeX
-
-Build modes:
- --build=MODE specify the treatment of auxiliary files [$build_mode]
- --tidy same as --build=tidy
- -c, --clean same as --build=clean
- --build-dir=DIR specify where the tidy compilation is performed;
- implies --tidy;
- defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir]
- --mostly-clean remove the auxiliary files and directories
- but not the output
- --max-iterations=N don't process files more than N times [$max_iters]
-
-The MODE specifies where the TeX compilation takes place, and, as a
-consequence, how auxiliary files are treated. The build mode
-can also be set using the environment variable TEXI2DVI_BUILD_MODE.
-
-Valid MODEs are:
- \`local' compile in the current directory, leaving all the auxiliary
- files around. This is the traditional TeX use.
- \`tidy' compile in a local *.t2d directory, where the auxiliary files
- are left. Output files are copied back to the original file.
- \`clean' same as \`tidy', but remove the auxiliary directory afterwards.
- Every compilation therefore requires the full cycle.
-
-Using the \`tidy' mode brings several advantages:
- - the current directory is not cluttered with plethora of temporary files.
- - clutter can be even further reduced using --build-dir=dir: all the *.t2d
- directories are stored there.
- - clutter can be reduced to zero using, e.g., --build-dir=/tmp/\$USER.t2d
- or --build-dir=\$HOME/.t2d.
- - the output file is updated after every successful TeX run, for
- sake of concurrent visualization of the output. In a \`local' build
- the viewer stops during the whole TeX run.
- - if the compilation fails, the previous state of the output file
- is preserved.
- - PDF and DVI compilation are kept in separate subdirectories
- preventing any possibility of auxiliary file incompatibility.
-
-On the other hand, because \`tidy' compilation takes place in another
-directory, occasionally TeX won't be able to find some files (e.g., when
-using \\graphicspath): in that case, use -I to specify the additional
-directories to consider.
-
-The values of the BIBER, BIBTEX, DVIPDF, DVIPS, HEVEA, LATEX, MAKEINDEX,
-MAKEINFO, PDFLATEX, PDFTEX, SED, T4HT, TEX, TEX4HT, TEXINDEX, and THUMBPDF_CMD
-environment variables are used to run those commands, if they are set.
-
-Regarding --dvipdf, if DVIPDF is not set in the environment, the
-following programs are looked for (in this order): dvipdfmx dvipdfm
-dvipdf dvi2pdf dvitopdf.
-
-Any CMD strings are added after @setfilename for Texinfo input, or in
-the first line for LaTeX input.
-
-Report bugs to bug-texinfo@gnu.org,
-general questions and discussion to help-texinfo@gnu.org.
-GNU Texinfo home page: <http://www.gnu.org/software/texinfo/>
-General help using GNU software: <http://www.gnu.org/gethelp/>
-EOF
- exit 0
-}
-
-
-# verbose WORD1 WORD2
-# -------------------
-# Report some verbose information.
+# verbose WORD1 WORD2... - Echo concatenated WORDs to stderr, if $verb.
verbose ()
{
if $verb; then
@@ -421,69 +377,45 @@ verbose ()
}
-# version
-# -------
-# Display version info and exit successfully.
-version ()
-{
- cat <<EOF
-texi2dvi (GNU Texinfo 5.2) $rcs_version
-
-Copyright (C) 2014 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-EOF
- exit 0
-}
-
-
-## ---------------- ##
-## Handling lists. ##
-## ---------------- ##
-
-
-# list_append LIST-NAME ELEM
-# --------------------------
-# Set LIST-NAME to its former contents, with ELEM appended.
+# Handling lists.
+#
+# list_append LIST-NAME ELEM - Append ELEM to (the contents of) LIST-NAME.
list_append ()
{
- local la_l="$1"
+ list_name="$1"
shift
- eval set X \$$la_l "$@"
+ eval set X \$$list_name "$@"
shift
- eval $la_l=\""$@"\"
+ eval $list_name=\""$@"\"
}
-# list_concat_dirs LIST-NAME DIR-LIST
-# -----------------------------------
-# Append to LIST-NAME all the components (included empty) from
-# the $path_sep separated list DIR-LIST. Make the paths absolute.
+# list_concat_dirs LIST-NAME DIR-LIST - Append to LIST-NAME all the
+# components (including empty ones) from the $path_sep-separated list
+# DIR-LIST. Make the paths absolute.
list_concat_dirs ()
{
- local lcd_list="$1"
+ lcd_list="$1"
# Empty path components are meaningful to tex. We rewrite them as
# `EMPTY' so they don't get lost when we split on $path_sep.
# Hopefully no one will have an actual directory named EMPTY.
- local replace_EMPTY="-e 's/^$path_sep/EMPTY$path_sep/g' \
- -e 's/$path_sep\$/${path_sep}EMPTY/g' \
- -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
+ lcd_replace_EMPTY="-e 's/^$path_sep/EMPTY$path_sep/g' \
+ -e 's/$path_sep\$/${path_sep}EMPTY/g' \
+ -e 's/$path_sep$path_sep/${path_sep}EMPTY${path_sep}/g'"
save_IFS=$IFS
IFS=$path_sep
- set x `echo "$2" | eval $SED $replace_EMPTY`; shift
+ set x `echo "$2" | eval $SED $lcd_replace_EMPTY`; shift
IFS=$save_IFS
- local dir
- for dir
+ for lcd_dir
do
- case $dir in
+ case $lcd_dir in
EMPTY)
list_append $lcd_list ""
;;
*)
- if test -d $dir; then
- dir=`absolute "$dir"`
- list_append $lcd_list "$dir"
+ if test -d $lcd_dir; then
+ dir=`absolute "$lcd_dir"`
+ list_append $lcd_list "$lcd_dir"
fi
;;
esac
@@ -491,64 +423,54 @@ list_concat_dirs ()
}
-# list_prefix LIST-NAME SEP -> STRING
-# -----------------------------------
-# Return a string that is composed of the LIST-NAME with each item
-# preceded by SEP.
+# list_prefix LIST-NAME SEP -> STRING - Return string with each element
+# of LIST-NAME preceded by SEP.
list_prefix ()
{
- local lp_p="$2"
+ lp_separator="$2"
eval set X \$$1
shift
- local lp_res
+ lp_result=''
for i
do
- lp_res="$lp_res \"$lp_p\" \"$i\""
+ lp_result="$lp_result \"$lp_separator\" \"$i\""
done
- echo "$lp_res"
+ echo "$lp_result"
}
-# list_infix LIST-NAME SEP -> STRING
-# ----------------------------------
-# Same as list_prefix, but a separator.
+# list_infix LIST-NAME SEP -> STRING - Same as list_prefix, but a separator.
list_infix ()
{
eval set X \$$1
shift
- local la_IFS="$IFS"
+ save_IFS="$IFS"
IFS=$path_sep
echo "$*"
- IFS=$la_IFS
+ IFS=$save_IFS
}
-# list_dir_to_abs LIST-NAME
-# -------------------------
-# Convert the list to using only absolute dir names.
+# list_dir_to_abs LIST-NAME - Convert list to using only absolute dir names.
# Currently unused, but should replace absolute_filenames some day.
list_dir_to_abs ()
{
- local ld_l="$1"
- eval set X \$$ld_l
+ ldta_list="$1"
+ eval set X \$$ldta_list
shift
- local ld_res
+ ldta_result=''
for dir
do
dir=`absolute "$dir"`
test -d "$dir" || continue
- ld_res="$ld_res \"$dir\""
+ ldta_result="$ldata_result \"$dir\""
done
- set X $ld_res; shift
- eval $ld_l=\"$@\"
+ set X $ldta_result; shift
+ eval $ldta_list=\"$@\"
}
-## ------------------------------ ##
-## Language auxiliary functions. ##
-## ------------------------------ ##
-
-
-# out_lang_set LANG
-# -----------------
+# Language auxiliary functions.
+#
+# out_lang_set LANG - set $out_lang to LANG (dvi, pdf, etc.), or error.
out_lang_set ()
{
case $1 in
@@ -557,10 +479,7 @@ out_lang_set ()
esac
}
-
-# out_lang_tex
-# ------------
-# Return the tex output language (DVI or PDF) for $OUT_LANG.
+# out_lang_tex - Return the tex output language (DVI or PDF) for $out_lang.
out_lang_tex ()
{
case $out_lang in
@@ -571,10 +490,7 @@ out_lang_tex ()
esac
}
-
-# out_lang_ext
-# ------------
-# Return the extension for $OUT_LANG.
+# out_lang_ext - Return the extension for $out_lang (pdf, dvi, etc.).
out_lang_ext ()
{
case $out_lang in
@@ -585,83 +501,64 @@ out_lang_ext ()
}
-## ------------------------- ##
-## TeX auxiliary functions. ##
-## ------------------------- ##
-
-# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
-# Likewise for bibtex and makeindex.
-tex_envvars="BIBINPUTS BSTINPUTS DVIPSHEADERS INDEXSTYLE MFINPUTS MPINPUTS \
-TEXINPUTS TFMFONTS"
-for var in $tex_envvars; do
- eval ${var}_orig=\$$var
- export $var
-done
-
-
-# absolute_filenames TEX-PATH -> TEX-PATH
-# ---------------------------------------
-# Convert relative paths to absolute paths, so we can run in another
-# directory (e.g., in tidy build mode, or during the macro-support
-# detection). Prepend ".".
+# TeX file auxiliary functions.
+#
+# absolute_filenames TEX-PATH -> TEX-PATH - Convert relative paths to
+# absolute, so we can run in another directory (e.g., in tidy build
+# mode, or during the macro-support detection).
absolute_filenames ()
{
# Empty path components are meaningful to tex. We rewrite them as
# `EMPTY' so they don't get lost when we split on $path_sep.
# Hopefully no one will have an actual directory named EMPTY.
- local replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \
- -e 's/$path_sep\$/${path_sep}EMPTY/g' \
- -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
- local res
- res=`echo "$1" | eval $SED $replace_empty`
+ af_replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \
+ -e 's/$path_sep\$/${path_sep}EMPTY/g' \
+ -e 's/$path_sep$path_sep/${path_sep}EMPTY${path_sep}/g'"
+ af_result=`echo "$1" | eval $SED $af_replace_empty`
save_IFS=$IFS
IFS=$path_sep
- set x $res; shift
- res=.
+ set x $af_result; shift
+ af_result=
+ af_path_sep=
for dir
do
case $dir in
EMPTY)
- res=$res$path_sep
+ af_result=$af_result$af_path_sep
;;
*)
if test -d "$dir"; then
- res=$res$path_sep`absolute "$dir"`
+ af_result=$af_result$af_path_sep`absolute "$dir"`
else
# Even if $dir is not a directory, preserve it in the path.
# It might contain metacharacters that TeX will expand in
# turn, e.g., /some/path/{a,b,c}. This will not get the
# implicit absolutification of the path, but we can't help that.
- res=$res$path_sep$dir
+ af_result=$af_result$af_path_sep$dir
fi
;;
esac
+ af_path_sep=$path_sep
done
- echo "$res"
+ echo "$af_result"
}
-# output_base_name FILE
-# ---------------------
-# The name of FILE, possibly renamed to satisfy --output.
-# FILE is local, there is no directory part.
+# output_base_name FILE - Return the name of FILE, possibly renamed to
+# satisfy --output. FILE is local, i.e., without any directory part.
output_base_name ()
{
case $oname in
'') echo "$1";;
- *) local out_noext
- out_noext=`noext "$oname"`
- local file_ext
- file_ext=`echo "$1" | $SED 's/^.*\.//'`
- echo "$out_noext.$file_ext"
+ *) obn_out_noext=`noext "$oname"`
+ obn_file_ext=`echo "$1" | $SED 's/^.*\.//'`
+ echo "$obn_out_noext.$obn_file_ext"
;;
esac
}
-# destdir
-# -------
-# Return the name of the directory where the output is expected.
+# destdir - Return the directory where the output is expected.
destdir ()
{
case $oname in
@@ -671,15 +568,13 @@ destdir ()
}
-# move_to_dest FILE...
-# --------------------
-# Move FILE to the place where the user expects it. Truly move it, that
-# is, it must not remain in its build location unless that is also the
-# output location. (Otherwise it might appear as an extra file in make
-# distcheck.)
+# move_to_dest FILE... - Move FILE(s) to the place where the user expects.
+# Truly move it, that is, it must not remain in its build location
+# unless that is also the output location. (Otherwise it might appear
+# as an extra file in make distcheck.)
#
-# FILE can be the principal output (in which case -o directly applies), or
-# an auxiliary file with the same base name.
+# FILE can be the principal output (in which case -o directly applies),
+# or an auxiliary file with the same base name.
move_to_dest ()
{
# echo "move_to_dest $*, tidy=$tidy, oname=$oname"
@@ -690,23 +585,17 @@ move_to_dest ()
false:) return;;
esac
- local destfile
- local destdir
- local destbase
- local sourcedir
- local sourcebase
-
for file
do
test -f "$file" \
|| error 1 "no such file or directory: $file"
case $tidy:$oname in
- true:) destdir=$orig_pwd
- destfile=$destdir/$file;;
- true:*) destfile=`output_base_name "$file"`
- destdir=`dirname "$destfile"`;;
- false:*) destfile=$oname
- destdir=`dirname "$destfile"`;;
+ true:) mtd_destdir=$orig_pwd
+ mtd_destfile=$mtd_destdir/$file;;
+ true:*) mtd_destfile=`output_base_name "$file"`
+ mtd_destdir=`dirname "$mtd_destfile"`;;
+ false:*) mtd_destfile=$oname
+ mtd_destdir=`dirname "$mtd_destfile"`;;
esac
# We want to compare the source location and the output location,
@@ -716,45 +605,39 @@ move_to_dest ()
# directory names, canonicalized with pwd. We can't use cmp -s
# since the output file might not actually change from run to run;
# e.g., TeX DVI output is timestamped to only the nearest minute.
- destdir=`cd "$destdir" && pwd`
- destbase=`basename "$destfile"`
-
- sourcedir=`dirname "$file"`
- sourcedir=`cd "$sourcedir" && pwd`
- sourcebase=`basename "$file"`
-
- if test "$sourcedir/$sourcebase" != "$destdir/$destbase"; then
- verbose "Moving $file to $destfile"
- rm -f "$destfile"
- mv "$file" "$destfile"
+ mtd_destdir=`cd "$mtd_destdir" && pwd`
+ mtd_destbase=`basename "$mtd_destfile"`
+
+ mtd_sourcedir=`dirname "$file"`
+ mtd_sourcedir=`cd "$mtd_sourcedir" && pwd`
+ mtd_sourcebase=`basename "$file"`
+
+ if test "$mtd_sourcedir/$mtd_sourcebase" != "$mtd_destdir/$mtd_destbase"
+ then
+ verbose "Moving $file to $mtd_destfile"
+ rm -f "$mtd_destfile"
+ mv "$file" "$mtd_destfile"
fi
done
}
-## --------------------- ##
-## Managing xref files. ##
-## --------------------- ##
-
-# aux_file_p FILE
-# ---------------
-# Return with success if FILE is an aux file.
+# Managing xref files.
+#
+# aux_file_p FILE - Echo FILE if FILE is an aux file.
aux_file_p ()
{
- test -f "$1" || return 1
+ test -f "$1" || return 0
case $1 in
- *.aux) return 0;;
- *) return 1;;
+ *.aux) echo "$1";;
+ *) return 0;;
esac
}
-# bibaux_file_p FILE
-# ------------------
-# Return with success if FILE is an aux file containing citation
-# requests.
+# bibaux_file_p FILE - Echo FILE if FILE contains citation requests.
bibaux_file_p ()
{
- test -s "$1" || return 1
+ test -s "$1" || return 0
if (grep '^\\bibstyle[{]' "$1" \
&& grep '^\\bibdata[{]' "$1" \
## The following line is suspicious: fails when there
@@ -763,17 +646,15 @@ bibaux_file_p ()
## && grep '^\\citation[{]' "$f"
) >&6 2>&1;
then
- return 0
+ echo "$1"
fi
- return 1
+ return 0
}
-# index_file_p FILE
-# -----------------
-# Return with success if FILE is an index file.
+# index_file_p FILE - Echo FILE if FILE is an index file.
index_file_p ()
{
- test -f "$1" || return 1
+ test -f "$1" || return 0
case $in_lang:$latex2html:`out_lang_tex`:`$SED '1q' "$1"` in
# When working with TeX4HT, *.idx are created by LaTeX. They must
# be processed to produce *.4ix, *.4dx files. The *.4dx file is
@@ -781,20 +662,21 @@ index_file_p ()
# handled by run_index, so we are only interested in the *.idx
# files, which have each "\indexentry" preceded by a
# "\beforeentry".
- latex:tex4ht:html:"\\beforeentry {"*) return 0;;
+ latex:tex4ht:html:"\\beforeentry {"*) echo $1;;
# When index.sty is used, there is a space before the brace.
- latex:*:*:"\\indexentry{"*|latex:*:*:"\\indexentry {"*) return 0;;
-
- texinfo:*:*:"\\entry{"*) return 0;;
+ latex:*:*:"\\indexentry{"*|latex:*:*:"\\indexentry {"*) echo $1;;
- *) return 1;;
+ texinfo:*:*:"\\entry{"*) echo $1;;
+ texinfo:*:*:"@entry{"*) echo $1;;
+ # @entry is output from newer versions of texinfo.tex
esac
+ return 0
}
-# xref_file_p FILE
-# ----------------
-# Return with success if FILE is an xref file (indexes, tables and lists).
+########### not used currently
+# xref_file_p FILE - Return success if FILE is an xref file (indexes,
+# tables and lists).
xref_file_p ()
{
test -f "$1" || return 1
@@ -810,67 +692,52 @@ xref_file_p ()
}
-# generated_files_get FILENAME-NOEXT [PREDICATE-FILTER]
-# -----------------------------------------------------
-# Return the list of files generated by the TeX compilation of FILENAME-NOEXT.
-generated_files_get ()
+# Used in generated_files_get
+generated_files_get_from_log ()
{
- local filter=true
- if test -n "$2"; then
- filter=$2
+ if test -f "$1.log"; then
+ # Usually the output is like: \openout1 = `foobar.tex'.
+ # (including the final period)
+ # but luatex outputs: \openout1 = foobar.tex
+ # (no quotes, no period).
+ # So we have to make the punctuation optional.
+ grep '^\\openout[0-9]' "$1.log" \
+ | $SED -e "s/\\\\openout[^=]*= *[\`']*//" \
+ -e "s/'\.$//"
fi
+}
- # Gather the files created by TeX.
- (
- if test -f "$1.log"; then
- $SED -n -e "s,^\\\\openout.* = \`\\(.*\\)'\\.,\\1,p" "$1.log"
- fi
- echo "$1.log"
- ) |
- # Depending on these files, infer outputs from other tools.
- while read file; do
- echo $file
- case $in_lang in
- texinfo)
- # texindex: texinfo.cp -> texinfo.cps
- if index_file_p $file; then
- echo ${file}s
- fi
- ;;
- latex)
- if aux_file_p $file; then
- # bibtex: *.aux -> *.bbl and *.blg.
- echo $file | $SED 's/^\(.*\)\.aux$/\1.bbl/'
- echo $file | $SED 's/^\(.*\)\.aux$/\1.blg/'
- # -recorder: .fls
- echo $file | $SED 's/^\(.*\)\.aux$/\1.fls/'
- fi
- ;;
- esac
- done |
- # Filter existing files matching the criterion.
- #
- # With an input file name containing a space, this produces a
- # "command not found" message (and filtering is ineffective).
- # The situation with a newline is presumably even worse.
- while read file; do
- if $filter "$file"; then
- echo $file
+# Used in generated_files_get
+generated_files_get_from_fls ()
+{
+ if test -f "$1.fls"; then
+ grep '^OUTPUT ' "$1.fls" | cut -b 8- \
+ | grep -v '\.dvi$' | grep -v '\.log$' | grep -v '\.pdf$' || true
+ fi
+}
+
+# generated_files_get - Output the list of files generated by the TeX
+# compilation.
+generated_files_get ()
+{
+ $generated_files_get_method "$in_noext"
+ if test $generated_files_get_method = generated_files_get_from_fls; then
+ if test -r "$in_noext.fl"; then
+ report 'WARNING!! The fl index may typeset as garbage!' # goes to stderr
+ report 'Try upgrading your version of texinfo.tex, or else try setting'
+ report 'the environment variable TEXI2DVI_USE_RECORDER to '\''no'\''.'
+report 'Once you'\''ve done that, delete the file with an '\''fl'\'' extension.'
fi
- done |
- sort |
- # Some files are opened several times, e.g., listings.sty's *.vrb.
- uniq
+ fi
}
-# xref_files_save
-# ---------------
-# Save the xref files.
+# xref_files_save - set xref_files_orig from xref_files_new, and save xref
+# files in $work_bak.
xref_files_save ()
{
# Save copies of auxiliary files for later comparison.
- xref_files_orig=`generated_files_get "$in_noext" xref_file_p`
+ xref_files_orig=$xref_files_new
if test -n "$xref_files_orig"; then
verbose "Backing up xref files: $xref_files_orig"
# The following line improves `cp $xref_files_orig "$work_bak"'
@@ -880,14 +747,24 @@ xref_files_save ()
# Users may have, e.g., --keep-old-files. Don't let this interfere.
# (Don't use unset for the sake of ancient shells.)
TAR_OPTIONS=; export TAR_OPTIONS
- tar cf - $xref_files_orig | (cd "$work_bak" && tar xf -)
+ tar cf - $xref_files_orig | (cd "$rel$work_bak" && tar xf -)
+ fi
+
+ # Remove auxiliary files in same directory as main input file. Otherwise,
+ # these will likely be read instead of those in the build dir.
+ if $tidy ; then
+ secondary_xref_files=`sorted_index_files`
+ for f in $xref_files_new $secondary_xref_files ; do
+ if test -f "$rel$in_dir/$f" ; then
+ remove $rel$in_dir/$f
+ fi
+ done
fi
}
-# xref_files_changed
-# ------------------
-# Whether the xref files were changed since the previous run.
+# xref_files_changed - Return success if the xref files have changed
+# since the previous run.
xref_files_changed ()
{
# LaTeX (and the package changebar) report in the LOG file if it
@@ -898,14 +775,14 @@ xref_files_changed ()
if grep "Rerun to get" "$in_noext.log" >&6 2>&1; then
return 0
fi
- # biblatex report of whether rerunning is needed.
+ # Similarly, check for biblatex report of whether rerunning is needed.
if grep "biblatex.*(re)run" "$in_noext.log" >&6 2>&1; then
return 0
fi
# If old and new lists don't have the same file list,
# then something has definitely changed.
- xref_files_new=`generated_files_get "$in_noext" xref_file_p`
+ xref_files_new=`generated_files_get`
verbose "Original xref files = $xref_files_orig"
verbose "New xref files = $xref_files_new"
if test "x$xref_files_orig" != "x$xref_files_new"; then
@@ -916,31 +793,32 @@ xref_files_changed ()
for this_file in $xref_files_new; do
verbose "Comparing xref file `echo $this_file | $SED 's|\./||g'` ..."
# cmp -s returns nonzero exit status if files differ.
- if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
+ if cmp -s "$this_file" "$rel$work_bak/$this_file"; then :; else
verbose "xref file `echo $this_file | $SED 's|\./||g'` differed ..."
if $debug; then
- diff -u "$work_bak/$this_file" "$this_file"
+ diff -u "$rel$work_bak/$this_file" "$this_file"
fi
return 0
fi
done
+ secondary_xref_files=`sorted_index_files`
+ verbose "Secondary xref files = $secondary_xref_files"
+ for this_file in $secondary_xref_files; do
+ if test -f $this_file; then :; else
+ verbose "$this_file missing ..."
+ return 0
+ fi
+ done
+
# No change.
return 1
}
-
-
-## ----------------------- ##
-## Running the TeX suite. ##
-## ----------------------- ##
-
-
-
-# run_tex ()
-# ----------
-# Run TeX as "$tex $in_input", taking care of errors and logs.
-run_tex ()
+# Running the TeX suite.
+#
+# Set tex_cmd variable, for running TeX.
+make_tex_cmd ()
{
case $in_lang:$latex2html:`out_lang_tex` in
latex:*:dvi|latex:tex4ht:html)
@@ -955,18 +833,9 @@ run_tex ()
*) tex=$TEX
esac;;
texinfo:*:pdf) tex=$PDFTEX;;
-
*) error 1 "$out_lang not supported for $in_lang";;
esac
- # do the special catcode trick for ~ in filenames only for Texinfo,
- # not LaTeX.
- if test x"$in_lang" = xtexinfo && test $catcode_special = maybe; then
- catcode_special=true
- else
- catcode_special=false
- fi
-
# Beware of aux files in subdirectories that require the
# subdirectory to exist.
case $in_lang:$tidy in
@@ -981,7 +850,7 @@ run_tex ()
esac
# Note that this will be used via an eval: quote properly.
- local cmd="$tex"
+ tex_cmd="$tex"
# If possible, make TeX report error locations in GNU format.
if $line_error; then
@@ -995,98 +864,90 @@ run_tex ()
# The mk program and perhaps others want to parse TeX's
# original error messages.
case $tex_help in
- *file-line-error*) cmd="$cmd --file-line-error";;
+ *file-line-error*) tex_cmd="$tex_cmd --file-line-error";;
esac
fi
+ # Tell TeX about -recorder option, if specified
+ # recorder_option_maybe is in { " -recorder", "" }
+ tex_cmd="$tex_cmd$recorder_option_maybe"
+
+
# Tell TeX about TCX file, if specified.
- test -n "$translate_file" && cmd="$cmd --translate-file=$translate_file"
+ test -n "$translate_file" \
+ && tex_cmd="$tex_cmd --translate-file=$translate_file"
# Tell TeX to make source specials (for backtracking from output to
# source, given a sufficiently smart editor), if specified.
- test -n "$src_specials" && cmd="$cmd $src_specials"
+ test -n "$src_specials" && tex_cmd="$tex_cmd $src_specials"
# Tell TeX to allow running external executables
- test -n "$shell_escape" && cmd="$cmd $shell_escape"
-
- # Tell TeX to be batch if requested.
- if $batch; then
- # \batchmode does not show terminal output at all, so we don't
- # want that. And even in batch mode, TeX insists on having input
- # from the user. Close its stdin to make it impossible.
- cmd="$cmd </dev/null '${escape}nonstopmode'"
- fi
+ test -n "$shell_escape" && tex_cmd="$tex_cmd $shell_escape"
- # we'd like to handle arbitrary input file names, especially
- # foo~bar/a~b.tex, since Debian likes ~ characters.
- if $catcode_special; then
- # $normaltilde is just to reduce line length in this source file.
- # The idea is to define \normaltilde as a catcode other ~ character,
- # then make the active ~ be equivalent to that, instead of the plain
- # TeX tie. Then when the active ~ appears in the filename, it will
- # be expanded to itself, as far as \input will see. (This is the
- # same thing that texinfo.tex does in general, BTW.)
- normaltilde="${escape}catcode126=12 ${escape}def${escape}normaltilde{~}"
- cmd="$cmd '$normaltilde${escape}catcode126=13 ${escape}let~\normaltilde '"
- fi
- # Other special (non-active) characters could be supported by
- # resetting their catcodes to other on the command line and changing
- # texinfo.tex to initialize everything to plain catcodes. Maybe someday.
-
- # append the \input command.
- cmd="$cmd '${escape}input'"
-
- # TeX's \input does not (easily or reliably) support whitespace
- # characters or other special characters in file names. Our intensive
- # use of absolute file names makes this worse: the enclosing directory
- # names may include white spaces. Improve the situation using a
- # symbolic link to the filename in the current directory, in tidy mode
- # only. Do not alter in_input.
- #
- # The filename is almost always tokenized using plain TeX conventions
- # (the exception would be if the user made a texinfo.fmt file). Not
- # all the plain TeX special characters cause trouble, but there's no
- # harm in making the link.
- #
- case $tidy:`func_dirname "$in_input"` in
- true:*["$space$tab$newline\"#\$%\\^_{}~"]*)
- _run_tex_file_name=`basename "$in_input"`
- if test ! -f "$_run_tex_file_name"; then
- # It might not be a file, clear it.
- run rm -f "$_run_tex_file_name"
- run ln -s "$in_input"
- fi
- cmd="$cmd '$_run_tex_file_name'"
- ;;
+ # Run without interaction.
+ # \batchmode does not show terminal output at all, so we don't
+ # want that. And even in batch mode, TeX insists on having input
+ # from the user. Close its stdin to make it impossible.
+ tex_cmd="$tex_cmd </dev/null '${escape}nonstopmode'"
+}
- *)
- cmd="$cmd '$in_input'"
- ;;
- esac
- verbose "$0: Running $cmd ..."
- if eval "$cmd" >&5; then
+# run_tex - Run TeX, taking care of errors and logs.
+run_tex ()
+{
+ # Check for any unusual characters in the filename.
+ # However, >, \ and any whitespace characters are not supported
+ # filenames.
+ in_input_funnies=`echo "$in_input" \
+ | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\''
+!g' | uniq`
+
+ if test -n "$in_input_funnies" ; then
+ # Make > an end group character, as it's unlikely to appear in
+ # a filename.
+ tex_cmd="$tex_cmd '${escape}bgroup${escape}catcode62=2${escape}relax'"
+
+ # If the filename has funny characters, change the TeX category codes of
+ # some characters within a group, and use \expandafter to input the file
+ # outside of the group.
+ for w in $in_input_funnies ; do
+ tex_cmd="$tex_cmd '${escape}catcode\`${escape}$w=12${escape}relax'"
+ done
+
+ # Set \toks0 to "\input FILENAME\relax"
+ tex_cmd="$tex_cmd '${escape}toks0${escape}bgroup${escape}input' '$rel$in_input' '${escape}relax>"
+
+ # Expand \toks0 after the end of the group
+ tex_cmd="$tex_cmd${escape}expandafter${escape}egroup"
+ tex_cmd="$tex_cmd${escape}the${escape}toks0${escape}relax'"
+ else
+ # In the case of a simple filename, just pass the filename
+ # with no funny tricks.
+ tex_cmd="$tex_cmd '${escape}input' '$rel$in_input'"
+ fi
+
+ verbose "$0: Running $tex_cmd ..."
+ if (eval "$tex_cmd" >&5); then
case $out_lang in
dvi | pdf ) move_to_dest "$in_noext.$out_lang";;
esac
else
- error 1 "$tex exited with bad status, quitting."
+ tex_failed=true
fi
}
-# run_bibtex ()
-# -------------
-# Run bibtex on (or biber) current file.
-# - If its input (AUX) exists.
-# - If some citations are missing (LOG contains `Citation').
-# or the LOG complains of a missing .bbl
+
+# run_bibtex - Run bibtex (or biber) on current file
+# - if its input (AUX) exists,
+# - or if some citations are missing (LOG contains `Citation'),
+# - or if the LOG complains of a missing .bbl.
#
# Don't try to be too smart:
# 1. Running bibtex only if the bbl file exists and is older than
# the LaTeX file is wrong, since the document might include files
# that have changed.
#
-# 3. Because there can be several AUX (if there are \include's),
+# 2. Because there can be several AUX (if there are \include's),
# but a single LOG, looking for missing citations in LOG is
# easier, though we take the risk of matching false messages.
run_bibtex ()
@@ -1109,7 +970,7 @@ run_bibtex ()
&& grep '^\\bibdata' "$in_noext.aux") ) \
>&6 2>&1; \
then
- bibtex_aux=`generated_files_get "$in_noext" bibaux_file_p`
+ bibtex_aux=`filter_files bibaux_file_p`
for f in $bibtex_aux; do
run $bibtex "$f"
done
@@ -1122,16 +983,31 @@ run_bibtex ()
fi
}
-# run_index ()
-# ------------
-# Run texindex (or makeindex or texindy) on current index files. If
-# they already exist, and after running TeX a first time the index
-# files don't change, then there's no reason to run TeX again. But we
-# won't know that if the index files are out of date or nonexistent.
+
+# filter_file PREDICATE - Go through the list of files in xref_files_new
+# and use PREDICATE on each one to optionally print it or print other files
+# based on the filename.
+filter_files ()
+{
+ test -n "$xref_files_new" || return 0
+ echo "$xref_files_new" |
+ # Filter existing files matching the criterion.
+ #
+ while read file; do
+ $1 "$file"
+ done |
+ sort |
+ # Some files are opened several times, e.g., listings.sty's *.vrb.
+ uniq
+}
+
+# run_index - Run texindex (or makeindex or texindy) on current index
+# files. If they already exist, and after running TeX a first time the
+# index files don't change, then there's no reason to run TeX again.
+# But we won't know that if the index files are out of date or nonexistent.
run_index ()
{
- local index_files
- index_files=`generated_files_get $in_noext index_file_p`
+ index_files=`filter_files index_file_p`
test -n "$index_files" \
|| return 0
@@ -1139,8 +1015,6 @@ run_index ()
: ${TEXINDEX:=texindex}
: ${TEXINDY:=texindy}
- local index_file
- local index_noext
case $in_lang:$latex2html:`out_lang_tex` in
latex:tex4ht:html)
for index_file in $index_files
@@ -1168,16 +1042,14 @@ run_index ()
}
-# run_tex4ht ()
-# -------------
-# Run the last two phases of TeX4HT: tex4ht extracts the HTML from the
-# instrumented DVI file, and t4ht converts the figures and installs
-# the files when given -d.
+# run_tex4ht - Run the last two phases of TeX4HT: tex4ht extracts the
+# HTML from the instrumented DVI file, and t4ht converts the figures and
+# installs the files when given -d.
#
# Because knowing exactly which files are created is complex (in
# addition the names are not simple to compute), which makes it
-# difficult to install the output files in a second step, it is much
-# simpler to install directly the output files.
+# difficult to install the output files in a second step, we
+# tell t4ht to install the output files.
run_tex4ht ()
{
case $in_lang:$latex2html:`out_lang_tex` in
@@ -1191,8 +1063,7 @@ run_tex4ht ()
}
-# run_thumbpdf ()
-# ---------------
+# run_thumbpdf - Run thumbpdf.
run_thumbpdf ()
{
if test `out_lang_tex` = pdf \
@@ -1212,14 +1083,15 @@ run_thumbpdf ()
}
-# run_dvipdf FILE.dvi
-# -------------------
-# Convert FILE.dvi to FILE.pdf.
+# run_dvipdf FILE.dvi - Convert FILE.dvi to FILE.pdf.
run_dvipdf ()
{
# Find which dvi->pdf program is available.
- if test -z "$dvipdf"; then
- for i in "$DVIPDF" dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; do
+ if test -n "$DVIPDF"; then
+ dvipdf=$DVIPDF # user envvar, use it without checking
+
+ elif test -z "$dvipdf"; then
+ for i in dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; do
if findprog $i; then
dvipdf=$i
fi
@@ -1234,31 +1106,39 @@ run_dvipdf ()
fi
}
-# run_tex_suite ()
-# ----------------
-# Run the TeX tools until a fix point is reached.
+# run_tex_suite - Run the TeX tools until a stable point is reached.
run_tex_suite ()
{
+ make_tex_cmd
+
# Move to the working directory.
if $tidy; then
verbose "cd $work_build"
- cd "$work_build" || exit 1
+ cd_dir "$work_build" || exit 1
fi
# Count the number of cycles.
- local cycle=0
+ suite_cycle=0
+
+ # Start by checking the log files for what files were created last
+ # time. This will mean that if they don't change, we finish in 1 cycle.
+ xref_files_new=`generated_files_get`
+ xref_files_save
while :; do
- # check for probably LaTeX loop (e.g. varioref)
- if test $cycle -eq "$max_iters"; then
+ # check for (probably) LaTeX loop (e.g. varioref)
+ if test $suite_cycle -eq "$max_iters"; then
error 0 "Maximum of $max_iters cycles exceeded"
break
fi
# report progress
- cycle=`expr $cycle + 1`
- verbose "Cycle $cycle for $command_line_filename"
+ suite_cycle=`expr $suite_cycle + 1`
+ verbose "Cycle $suite_cycle for $command_line_filename"
+ tex_failed=false
+ run_core_conversion
+ xref_files_changed || break
xref_files_save
# We run bibtex first, because it's more likely for the indexes
@@ -1266,11 +1146,13 @@ run_tex_suite ()
# would be rare.
run_bibtex
run_index
- run_core_conversion
-
- xref_files_changed || break
done
+ if $tex_failed ; then
+ # TeX failed, and the xref files did not change.
+ error 1 "$tex exited with bad status, quitting."
+ fi
+
# If we were using thumbpdf and producing PDF, then run thumbpdf
# and TeX one last time.
run_thumbpdf
@@ -1295,53 +1177,11 @@ run_tex_suite ()
cd_orig
}
-## -------------------------------- ##
-## TeX processing auxiliary tools. ##
-## -------------------------------- ##
-
-# A sed script that preprocesses Texinfo sources in order to keep the
-# iftex sections only. We want to remove non-TeX sections, and comment
-# (with `@c _texi2dvi') TeX sections so that makeinfo does not try to
-# parse them. Nevertheless, while commenting TeX sections, don't
-# comment @macro/@end macro so that makeinfo does propagate them.
-# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
-# (yet), makeinfo can't parse the TeX commands, so work around with sed.
-#
-# We assume that `@c _texi2dvi' starting a line is not present in the
-# document.
+# TeX processing auxiliary tools.
#
-comment_iftex=\
-'/^@tex/,/^@end tex/{
- s/^/@c _texi2dvi/
-}
-/^@iftex/,/^@end iftex/{
- s/^/@c _texi2dvi/
- /^@c _texi2dvi@macro/,/^@c _texi2dvi@end macro/{
- s/^@c _texi2dvi//
- }
-}
-/^@ifnottex/,/^@end ifnottex/{
- s/^/@c (_texi2dvi)/
-}
-/^@ifinfo/,/^@end ifinfo/{
- /^@node/p
- /^@menu/,/^@end menu/p
- t
- s/^/@c (_texi2dvi)/
-}
-s/^@ifnotinfo/@c _texi2dvi@ifnotinfo/
-s/^@end ifnotinfo/@c _texi2dvi@end ifnotinfo/'
-
-# Uncommenting is simpler: remove any leading `@c texi2dvi'; repeated
-# copies can sneak in via macro invocations.
-uncomment_iftex='s/^@c _texi2dvi\(@c _texi2dvi\)*//'
-
-
-# run_makeinfo ()
-# ---------------
-# Expand macro commands in the original source file using Makeinfo.
-# Always use `end' footnote style, since the `separate' style
+# run_makeinfo - Expand macro commands in the original source file using
+# Makeinfo. Always use `end' footnote style, since the `separate' style
# generates different output (arguably this is a bug in -E). Discard
# main info output, the user asked to run TeX, not makeinfo.
run_makeinfo ()
@@ -1395,15 +1235,14 @@ to tex itself simply not working."
work_src=$workdir/src
ensure_dir "$work_src"
in_src=$work_src/$in_base
- local miincludes
- miincludes=`list_prefix includes -I`
+ run_mi_includes=`list_prefix includes -I`
verbose "Macro-expanding $command_line_filename to $in_src ..."
# eval $makeinfo because it might be defined as something complex
# (running missing) and then we end up with things like '"-I"',
# and "-I" (including the quotes) is not an option name. This
# happens with gettext 0.14.5, at least.
$SED "$comment_iftex" "$command_line_filename" \
- | eval $makeinfo --footnote-style=end -I "$in_dir" $miincludes \
+ | eval $makeinfo --footnote-style=end -I "$in_dir" $run_mi_includes \
-o /dev/null --macro-expand=- \
| $SED "$uncomment_iftex" >"$in_src"
# Continue only if everything succeeded.
@@ -1416,9 +1255,62 @@ to tex itself simply not working."
fi
}
-# insert_commands ()
-# ------------------
-# Used most commonly for @finalout, @smallbook, etc.
+# Unfortunately, makeinfo --iftex --no-ifinfo doesn't work well enough
+# in versions before 5.0, as makeinfo can't parse the TeX commands
+# inside @tex blocks, so work around with sed.
+#
+# This sed script preprocesses Texinfo sources in order to keep the
+# iftex sections only. We want to remove non-TeX sections, and comment
+# (with `@c _texi2dvi') TeX sections so that makeinfo does not try to
+# parse them. Nevertheless, while commenting TeX sections, don't
+# comment @macro/@end macro so that makeinfo does propagate them.
+# Similarly, preserve the @top node to avoid makeinfo complaining about
+# it being missed. Comment it out after preprocessing, so that it does
+# not appear in the generated document.
+#
+# We assume that `@c _texi2dvi' or `@c (_texi2dvi)' starting a line is
+# not present in the document. Additionally, conditionally defined
+# macros inside the @top node may end up with the wrong value, although
+# this is unlikely in practice.
+#
+comment_iftex=\
+'/^@tex/,/^@end tex/{
+ s/^/@c _texi2dvi/
+}
+/^@iftex/,/^@end iftex/{
+ s/^/@c _texi2dvi/
+ /^@c _texi2dvi@macro/,/^@c _texi2dvi@end macro/{
+ s/^@c _texi2dvi//
+ }
+}
+/^@ifnottex/,/^@end ifnottex/{
+ s/^/@c (_texi2dvi)/
+ /^@c (_texi2dvi)@node Top/,/^@c (_texi2dvi)@end ifnottex/ {
+ /^@c (_texi2dvi)@end ifnottex/b
+ s/^@c (_texi2dvi)//
+ }
+}
+/^@ifinfo/,/^@end ifinfo/{
+ /^@node/p
+ /^@menu/,/^@end menu/p
+ t
+ s/^/@c (_texi2dvi)/
+}
+s/^@ifnotinfo/@c _texi2dvi@ifnotinfo/
+s/^@end ifnotinfo/@c _texi2dvi@end ifnotinfo/'
+
+# Uncomment @iftex blocks by removing any leading `@c texi2dvi' (repeated
+# copies can sneak in via macro invocations). Likewise, comment out
+# the @top node inside a @ifnottex block.
+uncomment_iftex=\
+'s/^@c _texi2dvi\(@c _texi2dvi\)*//
+/^@c (_texi2dvi)@ifnottex/,/^@c (_texi2dvi)@end ifnottex/{
+ s/^/@c (_texi2dvi)/
+}'
+
+
+# insert_commands - Insert $textra commands at the beginning of the file.
+# Recommended to be used for @finalout, @smallbook, etc.
insert_commands ()
{
if test -n "$textra"; then
@@ -1427,10 +1319,15 @@ insert_commands ()
in_xtr=$work_xtr/$in_base
ensure_dir "$work_xtr"
verbose "Inserting extra commands: $textra"
- local textra_cmd
case $in_lang in
latex) textra_cmd=1i;;
- texinfo) textra_cmd='/^@setfilename/a';;
+ texinfo)
+ textra_cmd='/^\\input texinfo/a'
+ # insert after @setfilename line if present
+ if head -n 10 $in_input | grep '^@setfilename' ; then
+ textra_cmd='/^@setfilename/a'
+ fi
+ ;;
*) error 1 "internal error, unknown language: $in_lang";;
esac
$SED "$textra_cmd\\
@@ -1453,10 +1350,9 @@ $textra" "$in_input" >"$in_xtr"
esac
}
-# compute_language FILENAME
-# -------------------------
-# Return the short string describing the language in which FILENAME
-# is written: `texinfo' or `latex'.
+
+# compute_language FILENAME - Return the short string for the language
+# in which FILENAME is written: `texinfo' or `latex'.
compute_language ()
{
# If the user explicitly specified the language, use that.
@@ -1477,9 +1373,7 @@ compute_language ()
}
-# run_hevea (MODE)
-# ----------------
-# Convert to HTML/INFO/TEXT.
+# run_hevea (MODE) - Convert to HTML/INFO/TEXT.
#
# Don't pass `-noiso' to hevea: it's useless in HTML since anyway the
# charset is set to latin1, and troublesome in other modes since
@@ -1490,27 +1384,27 @@ compute_language ()
# to handle images some day.
run_hevea ()
{
- local hevea="${HEVEA:-hevea}"
- local run_hevea="$hevea"
+ run_hevea_name="${HEVEA:-hevea}"
+ run_hevea_cmd="$run_hevea_name"
case $1 in
html) ;;
- text|info) run_hevea="$run_hevea -$1";;
- *) error 1 "run_hevea: invalid argument: $1";;
+ text|info) run_hevea_cmd="$run_hevea_cmd -$1";;
+ *) error 1 "run_hevea_cmd: invalid argument: $1";;
esac
# Compiling to the tmp directory enables to preserve a previous
# successful compilation.
- run_hevea="$run_hevea -fix -O -o '$out_base'"
- run_hevea="$run_hevea `list_prefix includes -I` -I '$orig_pwd' "
- run_hevea="$run_hevea '$in_input'"
+ run_hevea_cmd="$run_hevea_cmd -fix -O -o '$out_base'"
+ run_hevea_cmd="$run_hevea_cmd `list_prefix includes -I` -I '$orig_pwd' "
+ run_hevea_cmd="$run_hevea_cmd '$rel$in_input'"
if $debug; then
- run_hevea="$run_hevea -v -v"
+ run_hevea_cmd="$run_hevea_cmd -v -v"
fi
- verbose "running $run_hevea"
- if eval "$run_hevea" >&5; then
+ verbose "running $run_hevea_cmd"
+ if eval "$run_hevea_cmd" >&5; then
# hevea leaves trailing white spaces, this is annoying.
case $1 in text|info)
perl -pi -e 's/[ \t]+$//g' "$out_base"*;;
@@ -1521,14 +1415,12 @@ run_hevea ()
move_to_dest "$out_base"*;;
esac
else
- error 1 "$hevea exited with bad status, quitting."
+ error 1 "$run_hevea_name exited with bad status, quitting."
fi
}
-# run_core_conversion ()
-# ----------------------
-# Run the TeX (or HeVeA).
+# run_core_conversion - Run TeX (or HeVeA).
run_core_conversion ()
{
case $in_lang:$latex2html:`out_lang_tex` in
@@ -1542,23 +1434,22 @@ run_core_conversion ()
}
-# compile ()
-# ----------
-# Run the full compilation chain, from pre-processing to installation
-# of the output at its expected location.
+# compile - Run the full compilation chain, from pre-processing to
+# installation of the output at its expected location.
compile ()
{
- # Source file might include additional sources.
- # We want `.:$orig_pwd' before anything else. (We'll add `.:' later
- # after all other directories have been turned into absolute paths.)
- # `.' goes first to ensure that any old .aux, .cps,
- # etc. files in ${directory} don't get used in preference to fresher
- # files in `.'. Include orig_pwd in case we are in clean build mode, where
- # we have cd'd to a temp directory.
+ # Set include path for tools:
+ # . Include current directory in case there are files there already, so
+ # we don't have more TeX runs than necessary. orig_pwd is used in case
+ # we are in clean build mode, where we have cd'd to a temp directory.
+ # . Include directory containing file, in case there are other
+ # files @include'd.
+ # . Keep a final path_sep to get the default (system) TeX
+ # directories included.
+ # . If we have any includes, put those at the end.
+
common="$orig_pwd$path_sep$in_dir$path_sep"
#
- # If we have any includes, put those at the end.
- # Keep a final path_sep to get the default (system) TeX directories included.
txincludes=`list_infix includes $path_sep`
test -n "$txincludes" && common="$common$txincludes$path_sep"
#
@@ -1566,7 +1457,7 @@ compile ()
eval val="\$common\$${var}_orig"
# Convert relative paths to absolute paths, so we can run in another
# directory (e.g., in clean build mode, or during the macro-support
- # detection). ".:" is added here.
+ # detection).
val=`absolute_filenames "$val"`
eval $var="\"$val\""
export $var
@@ -1579,13 +1470,137 @@ compile ()
# --command, --texinfo
insert_commands
- # Run until a fix point is reached.
+ # Run until a fixed point is reached.
run_tex_suite
}
+# make_openout_test FLAGS EXTENSION
+# - Run TeX with an input file that performs an \openout. Pass FLAGS to TeX.
+#
+make_openout_test ()
+{
+ recorder_option_maybe="$1"
+ make_tex_cmd
+
+ ensure_dir "$workdir"/check_recorder
+ cd_dir "$workdir"/check_recorder
+
+ cat > openout.tex <<EOF
+\newwrite\ourwrite
+\immediate\openout\ourwrite dum.dum
+\bye
+EOF
+ # \bye doesn't work for LaTeX, but it will cause latex
+ # to exit with an input error.
+ tex_cmd="$tex_cmd '${escape}input' ./openout.tex"
+ # ./ in case . isn't in path
+ verbose "$0: running $tex_cmd ..."
+ rm -fr "openout.$2"
+ (eval "$tex_cmd" >/dev/null 2>&1)
+}
+
+# Check tex supports -recorder option
+check_recorder_support ()
+{
+ verbose "Checking TeX recorder support..."
+ make_openout_test " -recorder" fls
+ if test -f openout.fls && grep '^OUTPUT dum.dum$' openout.fls > /dev/null
+ then
+ cd_orig
+ verbose "Checking TeX recorder support... yes"
+ return 0
+ else
+ cd_orig
+ verbose "Checking TeX recorder support... no"
+ return 1
+ fi
+}
+
+# Check tex supports \openout traces in log
+check_openout_in_log_support ()
+{
+ verbose "Checking TeX \openout in log support..."
+ make_openout_test "" log
+ if test -f openout.log \
+ && grep '^\\openout..\? *= *`\?dum\.dum'\''\?' openout.log >/dev/null
+ then
+ cd_orig
+ verbose "Checking TeX \openout in log support... yes"
+ return 0
+ else
+ cd_orig
+ verbose "Checking TeX \openout in log support... no"
+ return 1
+ fi
+}
+
+# Set that output auxiliary files are detected with the -recorder option,
+# which creates a file JOBNAME.fls which is a machine-readable listing of
+# files read and written during the job.
+set_aux_files_from_fls ()
+{
+ recorder_option_maybe=" -recorder"
+ generated_files_get_method=generated_files_get_from_fls
+}
+
+# Set that output auxiliary files are detected with searching for \openout
+# in the log file.
+set_aux_files_from_log ()
+{
+ recorder_option_maybe=''
+ generated_files_get_method=generated_files_get_from_log
+}
+
+# Decide whether output auxiliary files are detected with the -recorder
+# option, or by searching for \openout in the log file.
+decide_aux_files_method ()
+{
+ # Select output file detection method
+ # Valid values of TEXI2DVI_USE_RECORDER are:
+ # yes use the -recorder option, no checks.
+ # no scan for \openout in the log file, no checks.
+ # yesmaybe check whether -recorder option is supported, and if yes
+ # use it, otherwise check for tracing \openout in the
+ # log file is supported, and if yes use it, else it is an
+ # error.
+ # nomaybe same as `yesmaybe', except that the \openout trace in
+ # log file is checked first.
+ #
+ # The default behaviour is `nomaybe'.
+
+ test -n "$TEXI2DVI_USE_RECORDER" || TEXI2DVI_USE_RECORDER=nomaybe
+
+ case $TEXI2DVI_USE_RECORDER in
+ yes) set_aux_files_from_fls;;
+
+ no) set_aux_files_from_log;;
+
+ yesmaybe)
+ if check_recorder_support; then
+ set_aux_files_from_fls
+ elif check_openout_in_log_support; then
+ set_aux_files_from_log
+ else
+ error 1 "TeX neither supports -recorder nor outputs \\openout lines in its log file"
+ fi
+ ;;
+
+ nomaybe)
+ if check_openout_in_log_support; then
+ set_aux_files_from_log
+ elif check_recorder_support; then
+ set_aux_files_from_fls
+ else
+ error 1 "TeX neither supports -recorder nor outputs \\openout lines in its log file"
+ fi
+ ;;
+
+ *) error 1 "Invalid value of TEXI2DVI_USE_RECORDER environment variable : $TEXI2DVI_USE_RECORDER.";;
-# remove FILES
-# ------------
+ esac
+}
+
+# remove FILE...
remove ()
{
verbose "Removing" "$@"
@@ -1593,42 +1608,154 @@ remove ()
}
-# mostly_clean
-# ------------
-# Remove auxiliary files and directories. Changes the current directory.
+# all_files - Echo the names of all files generated, including those by
+# auxiliary tools like texindex.
+all_files ()
+{
+ echo $in_noext.log
+ echo $in_noext.fls
+ echo $xref_files_new
+ echo `sorted_index_files`
+}
+
+sorted_index_files ()
+{
+ filter_files sorted_index_filter
+}
+
+# Print the name of a generated file based on FILE if there is one.
+sorted_index_filter ()
+{
+ case $in_lang in
+ texinfo)
+ # texindex: texinfo.cp -> texinfo.cps
+ if test -n "`index_file_p $1`" ; then
+ echo $1s
+ fi
+ ;;
+ esac
+}
+
+
+# Not currently used - use with filter_files to add secondary files created by
+# bibtex
+bibtex_secondary_files ()
+{
+ case $in_lang in
+ latex)
+ if test -n "`aux_file_p $1`"; then
+ # bibtex: *.aux -> *.bbl and *.blg.
+ echo $1 | $SED 's/^\(.*\)\.aux$/\1.bbl/'
+ echo $1 | $SED 's/^\(.*\)\.aux$/\1.blg/'
+ fi
+ ;;
+ esac
+}
+
+# mostly_clean - Remove auxiliary files and directories. Changes back to
+# the original directory.
mostly_clean ()
{
cd_orig
set X "$t2ddir"
shift
$tidy || {
- local log="$work_build/$in_noext.log"
- set X ${1+"$@"} "$log" `generated_files_get "$work_build/$in_noext"`
+ set X ${1+"$@"} `all_files`
shift
}
remove ${1+"$@"}
}
-# cleanup ()
-# ----------
-# Remove what should be removed according to options.
+# cleanup - Remove what should be removed according to options.
# Called at the end of each compilation cycle, and at the end of
# the script. Changes the current directory.
cleanup ()
{
- case $build_mode in
- local) cd_orig; remove "$t2ddir";;
- clean) mostly_clean;;
- tidy) ;;
+ case $clean:$tidy in
+ true:true) mostly_clean ;; # build mode is "clean"
+ false:false) cd_orig; remove "$t2ddir";; # build mode is "local"
esac
}
+# input_file_name_decode - Decode COMMAND_LINE_FILENAME, and set the
+# following shell variables:
+#
+# - COMMAND_LINE_FILENAME
+# The filename given on the commmand line, but cleaned of TeX commands.
+# - IN_DIR
+# The directory containing the input file.
+# - IN_BASE
+# The input file base name (no directory part).
+# - IN_NOEXT
+# The input file name with neither file extensions nor directory part.
+# - IN_INPUT
+# The path to the input file for passing as a command-line argument
+# to TeX. Defaults to COMMAND_LINE_FILENAME, but might change if the
+# input is preprocessed.
+input_file_name_decode ()
+{
+ case $command_line_filename in
+ *\\input{*}*)
+ # Let AUC-TeX error parser deal with line numbers.
+ line_error=false
+ command_line_filename=`\
+ expr X"$command_line_filename" : X'.*input{\([^}]*\)}'`
+ ;;
+ esac
+
+ # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
+ # prepend `./' in order to avoid that the tools take it as an option.
+ echo "$command_line_filename" | LC_ALL=C $EGREP '^(/|[A-Za-z]:/)' >&6 \
+ || command_line_filename="./$command_line_filename"
+
+ # See if the file exists. If it doesn't we're in trouble since, even
+ # though the user may be able to reenter a valid filename at the tex
+ # prompt (assuming they're attending the terminal), this script won't
+ # be able to find the right xref files and so forth.
+ test -r "$command_line_filename" \
+ || error 1 "cannot read $command_line_filename, skipping."
+
+ # Get the name of the current directory.
+ in_dir=`func_dirname "$command_line_filename"`
+
+ # Strip directory part but leave extension.
+ in_base=`basename "$command_line_filename"`
+ # Strip extension.
+ in_noext=`noext "$in_base"`
+
+ # The normalized file name to compile. Must always point to the
+ # file to actually compile (in case of recoding, macro-expansion etc.).
+ in_input=$in_dir/$in_base
+
+
+ # Compute the output file name.
+ if test x"$oname" != x; then
+ out_name=$oname
+ else
+ out_name=$in_noext.`out_lang_ext`
+ fi
+ out_dir=`func_dirname "$out_name"`
+ out_dir_abs=`absolute "$out_dir"`
+ out_base=`basename "$out_name"`
+ out_noext=`noext "$out_base"`
+}
+
+
+#
+#################### Main program starts ##########################
-## ---------------------- ##
-## Command line parsing. ##
-## ---------------------- ##
+# Initialize more variables.
+#
+# Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
+# Likewise for bibtex and makeindex.
+tex_envvars="BIBINPUTS BSTINPUTS DVIPSHEADERS INDEXSTYLE MFINPUTS MPINPUTS \
+TEXINPUTS TFMFONTS"
+for var in $tex_envvars; do
+ eval ${var}_orig=\$$var
+ export $var
+done
# Push a token among the arguments that will be used to notice when we
# ended options/arguments parsing.
@@ -1640,10 +1767,7 @@ cleanup ()
arg_sep="$$--$$"
set dummy ${1+"$@"} "$arg_sep"; shift
-#
-# Parse command line arguments.
while test x"$1" != x"$arg_sep"; do
-
# Handle --option=value by splitting apart and putting back on argv.
case "$1" in
--*=*)
@@ -1656,9 +1780,8 @@ while test x"$1" != x"$arg_sep"; do
case "$1" in
-@ ) escape=@;;
- -~ ) catcode_special=false;;
- # Silently and without documentation accept -b and --b[atch] as synonyms.
- -b | --batch) batch=true;;
+ -~ ) verbose "Option -~ is obsolete: texi2dvi ignores it.";;
+ -b | --batch) ;; # Obsolete
--build) shift; build_mode=$1;;
--build-dir) shift; build_dir=$1; build_mode=tidy;;
-c | --clean) build_mode=clean;;
@@ -1681,7 +1804,7 @@ while test x"$1" != x"$arg_sep"; do
out_lang_set `echo "x$1" | $SED 's/^x--//'`;;
-p) out_lang_set pdf;;
- -q | -s | --quiet | --silent) quiet=true; batch=true;;
+ -q | -s | --quiet | --silent) quiet=true;;
--src-specials) src_specials=--src-specials;;
--shell-escape) shell_escape=--shell-escape;;
--tex4ht) latex2html=tex4ht;;
@@ -1733,9 +1856,15 @@ esac
# We can't do much without tex.
+# End up with the TEX and PDFTEX variables set to what we are going to use.
#
-if findprog ${TEX:-tex}; then :; else cat <<EOM
-You don't have a working TeX binary (${TEX:-tex}) installed anywhere in
+# If $TEX is set to a directory, don't use it.
+test -n "$TEX" && test -d "$TEX" && unset TEX
+
+# But otherwise, use $TEX if it is set.
+if test -z "$TEX"; then
+ if findprog tex; then :; else cat <<EOM >&2
+You don't have a working TeX binary (tex) installed anywhere in
your PATH, and texi2dvi cannot proceed without one. If you want to use
this script, you'll need to install TeX (if you don't have it) or change
your PATH or TEX environment variable (if you do). See the --help
@@ -1744,20 +1873,19 @@ output for more details.
For information about obtaining TeX, please see http://tug.org/texlive,
or do a web search for TeX and your operating system or distro.
EOM
- exit 1
-fi
-
+ exit 1
+ fi
-# We want to use etex (or pdftex) if they are available, and the user
-# didn't explicitly specify. We don't check for elatex and pdfelatex
-# because (as of 2003), the LaTeX team has asked that new distributions
-# use etex by default anyway.
-#
-# End up with the TEX and PDFTEX variables set to what we are going to use.
-if test -z "$TEX"; then
+ # We want to use etex (or pdftex) if they are available, and the user
+ # didn't explicitly specify. We don't check for elatex and pdfelatex
+ # because (as of 2003), the LaTeX team has asked that new distributions
+ # use etex by default anyway.
+ #
if findprog etex; then TEX=etex; else TEX=tex; fi
fi
-#
+
+# For many years, the pdftex binary has included the e-tex extensions,
+# but for those people with ancient TeX distributions ...
if test -z "$PDFTEX"; then
if findprog pdfetex; then PDFTEX=pdfetex; else PDFTEX=pdftex; fi
fi
@@ -1767,12 +1895,9 @@ fi
# 0 standard input
# 1 standard output (--verbose messages)
# 2 standard error
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
# 5 tools output (turned off by --quiet)
# 6 tracing/debugging (set -x output, etc.)
-
# Main tools' output (TeX, etc.) that TeX users are used to seeing.
#
# If quiet, discard, else redirect to the message flow.
@@ -1797,87 +1922,8 @@ else
exec 6>/dev/null
fi
-#
-
-# input_file_name_decode
-# ----------------------
-# Decode COMMAND_LINE_FILENAME, and compute:
-# - COMMAND_LINE_FILENAME clean of TeX commands
-# - IN_DIR
-# The directory to the input file, possibly absolute if needed.
-# - IN_DIR_ABS
-# The absolute directory of the input file.
-# - IN_BASE
-# The input file base name (no directory part).
-# - IN_NOEXT
-# The input file name without extensions (nor directory part).
-# - IN_INPUT
-# Defaults to COMMAND_LINE_FILENAME, but might change if the
-# input is preprocessed. With directory, possibly absolute.
-input_file_name_decode ()
-{
- # See if we are run from within AUC-Tex, in which case we are
- # passed `\input{FOO.tex}' or even `\nonstopmode\input{FOO.tex}'.
- case $command_line_filename in
- *\\nonstopmode*)
- batch=true;;
- esac
- case $command_line_filename in
- *\\input{*}*)
- # Let AUC-TeX error parser deal with line numbers.
- line_error=false
- command_line_filename=`\
- expr X"$command_line_filename" : X'.*input{\([^}]*\)}'`
- ;;
- esac
-
- # If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex),
- # prepend `./' in order to avoid that the tools take it as an option.
- echo "$command_line_filename" | LC_ALL=C $EGREP '^(/|[A-Za-z]:/)' >&6 \
- || command_line_filename="./$command_line_filename"
-
- # See if the file exists. If it doesn't we're in trouble since, even
- # though the user may be able to reenter a valid filename at the tex
- # prompt (assuming they're attending the terminal), this script won't
- # be able to find the right xref files and so forth.
- test -r "$command_line_filename" \
- || error 1 "cannot read $command_line_filename, skipping."
-
- # Get the name of the current directory.
- in_dir=`func_dirname "$command_line_filename"`
- in_dir_abs=`absolute "$in_dir"`
- # In a clean build, we `cd', so get an absolute file name.
- if $tidy; then
- in_dir=$in_dir_abs
- fi
-
- # Strip directory part but leave extension.
- in_base=`basename "$command_line_filename"`
- # Strip extension.
- in_noext=`noext "$in_base"`
-
- # The normalized file name to compile. Must always point to the
- # file to actually compile (in case of recoding, macro-expansion etc.).
- in_input=$in_dir/$in_base
-
-
- # Compute the output file name.
- if test x"$oname" != x; then
- out_name=$oname
- else
- out_name=$in_noext.`out_lang_ext`
- fi
- out_dir=`func_dirname "$out_name"`
- out_dir_abs=`absolute "$out_dir"`
- out_base=`basename "$out_name"`
- out_noext=`noext "$out_base"`
-}
-
-
-## -------------- ##
-## TeXify files. ##
-## -------------- ##
+# Main program main loop - TeXify each file in turn.
for command_line_filename
do
verbose "Processing $command_line_filename ..."
@@ -1905,8 +1951,6 @@ do
ensure_dir "$build_dir" "$t2ddir"
- # We will change directory, better work with an absolute path...
- t2ddir=`absolute "$t2ddir"`
# Sometimes there are incompatibilities between auxiliary files for
# DVI and PDF. The contents can also change whether we work on PDF
# and/or DVI. So keep separate spaces for each.
@@ -1927,6 +1971,9 @@ do
# Make those directories.
ensure_dir "$work_build" "$work_bak"
+ # Decide how to find auxiliary files created by TeX.
+ decide_aux_files_method
+
case $action in
compile)
# Compile the document.
@@ -1935,6 +1982,7 @@ do
;;
mostly-clean)
+ xref_files_new=`generated_files_get`
mostly_clean
;;
esac
@@ -1942,3 +1990,7 @@ done
verbose "done."
exit 0 # exit successfully, not however we ended the loop.
+# Local Variables:
+# sh-basic-offset: 2
+# sh-indentation: 2
+# End:
diff --git a/readline/readline/doc/version.texi b/readline/readline/doc/version.texi
index 576c35c..abb9cb6 100644
--- a/readline/readline/doc/version.texi
+++ b/readline/readline/doc/version.texi
@@ -1,10 +1,10 @@
@ignore
-Copyright (C) 1988-2018 Free Software Foundation, Inc.
+Copyright (C) 1988-2020 Free Software Foundation, Inc.
@end ignore
-@set EDITION 8.0
-@set VERSION 8.0
-@set UPDATED 30 November 2018
-@set UPDATED-MONTH November 2018
+@set EDITION 8.1
+@set VERSION 8.1
+@set UPDATED 29 October 2020
+@set UPDATED-MONTH October 2020
-@set LASTCHANGE Fri Nov 30 22:50:53 EST 2018
+@set LASTCHANGE Thu Oct 29 16:49:01 EDT 2020
diff --git a/readline/readline/emacs_keymap.c b/readline/readline/emacs_keymap.c
index b5e53f4..02597da 100644
--- a/readline/readline/emacs_keymap.c
+++ b/readline/readline/emacs_keymap.c
@@ -47,7 +47,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
{ ISFUNC, rl_clear_screen }, /* Control-l */
{ ISFUNC, rl_newline }, /* Control-m */
{ ISFUNC, rl_get_next_history }, /* Control-n */
- { ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
+ { ISFUNC, rl_operate_and_get_next }, /* Control-o */
{ ISFUNC, rl_get_previous_history }, /* Control-p */
{ ISFUNC, rl_quoted_insert }, /* Control-q */
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
@@ -327,7 +327,7 @@ KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
{ ISFUNC, rl_tab_insert }, /* Meta-Control-i */
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-k */
- { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-l */
+ { ISFUNC, rl_clear_display }, /* Meta-Control-l */
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-n */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-o */
diff --git a/readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP b/readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP
index 5e89551..0a09883 100644
--- a/readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP
+++ b/readline/readline/examples/autoconf/BASH_CHECK_LIB_TERMCAP
@@ -12,7 +12,8 @@ AC_CACHE_VAL(bash_cv_termcap_lib,
[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,
- bash_cv_termcap_lib=gnutermcap)])])])])])
+ [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw,
+ bash_cv_termcap_lib=gnutermcap)])])])])])])
if test "X$_bash_needmsg" = "Xyes"; then
AC_MSG_CHECKING(which library has the termcap functions)
fi
diff --git a/readline/readline/examples/autoconf/RL_LIB_READLINE_VERSION b/readline/readline/examples/autoconf/RL_LIB_READLINE_VERSION
index 883942c..cc158a8 100644
--- a/readline/readline/examples/autoconf/RL_LIB_READLINE_VERSION
+++ b/readline/readline/examples/autoconf/RL_LIB_READLINE_VERSION
@@ -35,6 +35,7 @@ AC_CACHE_VAL(ac_cv_rl_version,
[AC_TRY_RUN([
#include <stdio.h>
#include <readline/readline.h>
+#include <stdlib.h>
extern int rl_gnu_readline_p;
diff --git a/readline/readline/examples/fileman.c b/readline/readline/examples/fileman.c
index c821df0..f8d0be7 100644
--- a/readline/readline/examples/fileman.c
+++ b/readline/readline/examples/fileman.c
@@ -377,11 +377,11 @@ com_stat (arg)
printf ("Statistics for `%s':\n", arg);
- printf ("%s has %d link%s, and is %d byte%s in length.\n",
+ printf ("%s has %d link%s, and is %lu byte%s in length.\n",
arg,
finfo.st_nlink,
(finfo.st_nlink == 1) ? "" : "s",
- finfo.st_size,
+ (unsigned long)finfo.st_size,
(finfo.st_size == 1) ? "" : "s");
printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
printf (" Last access at: %s", ctime (&finfo.st_atime));
diff --git a/readline/readline/funmap.c b/readline/readline/funmap.c
index aaf144d..eca49a3 100644
--- a/readline/readline/funmap.c
+++ b/readline/readline/funmap.c
@@ -1,6 +1,6 @@
/* funmap.c -- attach names to functions. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -73,6 +73,7 @@ static const FUNMAP default_funmap[] = {
{ "capitalize-word", rl_capitalize_word },
{ "character-search", rl_char_search },
{ "character-search-backward", rl_backward_char_search },
+ { "clear-display", rl_clear_display },
{ "clear-screen", rl_clear_screen },
{ "complete", rl_complete },
{ "copy-backward-word", rl_copy_backward_word },
@@ -116,6 +117,7 @@ static const FUNMAP default_funmap[] = {
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
{ "old-menu-complete", rl_old_menu_complete },
+ { "operate-and-get-next", rl_operate_and_get_next },
{ "overwrite-mode", rl_overwrite_mode },
#if defined (_WIN32)
{ "paste-from-clipboard", rl_paste_from_clipboard },
@@ -157,7 +159,7 @@ static const FUNMAP default_funmap[] = {
{ "vi-backward-bigword", rl_vi_bWord },
{ "vi-backward-word", rl_vi_bword },
{ "vi-bWord", rl_vi_bWord },
- { "vi-bword", rl_vi_bword },
+ { "vi-bword", rl_vi_bword }, /* BEWARE: name matching is case insensitive */
{ "vi-change-case", rl_vi_change_case },
{ "vi-change-char", rl_vi_change_char },
{ "vi-change-to", rl_vi_change_to },
@@ -171,13 +173,13 @@ static const FUNMAP default_funmap[] = {
{ "vi-end-bigword", rl_vi_eWord },
{ "vi-end-word", rl_vi_end_word },
{ "vi-eof-maybe", rl_vi_eof_maybe },
- { "vi-eword", rl_vi_eword },
+ { "vi-eword", rl_vi_eword }, /* BEWARE: name matching is case insensitive */
{ "vi-fWord", rl_vi_fWord },
{ "vi-fetch-history", rl_vi_fetch_history },
{ "vi-first-print", rl_vi_first_print },
{ "vi-forward-bigword", rl_vi_fWord },
{ "vi-forward-word", rl_vi_fword },
- { "vi-fword", rl_vi_fword },
+ { "vi-fword", rl_vi_fword }, /* BEWARE: name matching is case insensitive */
{ "vi-goto-mark", rl_vi_goto_mark },
{ "vi-insert-beg", rl_vi_insert_beg },
{ "vi-insertion-mode", rl_vi_insert_mode },
diff --git a/readline/readline/histexpand.c b/readline/readline/histexpand.c
index adcf5dc..b986dba 100644
--- a/readline/readline/histexpand.c
+++ b/readline/readline/histexpand.c
@@ -89,7 +89,7 @@ char history_expansion_char = '!';
char history_subst_char = '^';
/* During tokenization, if this character is seen as the first character
- of a word, then it, and all subsequent characters upto a newline are
+ of a word, then it, and all subsequent characters up to a newline are
ignored. For a Bourne shell, this should be '#'. Bash special cases
the interactive comment character to not be a comment delimiter. */
char history_comment_char = '\0';
@@ -180,7 +180,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
}
/* Hack case of numeric line specification. */
- if (string[i] == '-')
+ if (string[i] == '-' && _rl_digit_p (string[i+1]))
{
sign = -1;
i++;
@@ -230,10 +230,12 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
}
#endif /* HANDLE_MULTIBYTE */
- if ((!substring_okay && (whitespace (c) || c == ':' ||
- (history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
- (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
- string[i] == delimiting_quote)) ||
+ if ((!substring_okay &&
+ (whitespace (c) || c == ':' ||
+ (i > local_index && history_event_delimiter_chars && c == '-') ||
+ (c != '-' && history_event_delimiter_chars && member (c, history_event_delimiter_chars)) ||
+ (history_search_delimiter_chars && member (c, history_search_delimiter_chars)) ||
+ string[i] == delimiting_quote)) ||
string[i] == '\n' ||
(substring_okay && string[i] == '?'))
break;
@@ -409,7 +411,10 @@ hist_error(char *s, int start, int current, int errtype)
}
temp = (char *)xmalloc (ll + elen + 3);
- strncpy (temp, s + start, ll);
+ if (s[start])
+ strncpy (temp, s + start, ll);
+ else
+ ll = 0;
temp[ll] = ':';
temp[ll + 1] = ' ';
strcpy (temp + ll + 2, emsg);
@@ -624,7 +629,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
return an error state after adding this line to the
history. */
case 'p':
- print_only++;
+ print_only = 1;
break;
/* :t discards all but the last part of the pathname. */
@@ -1356,6 +1361,11 @@ get_history_word_specifier (char *spec, char *from, int *caller_index)
i++;
last = '$';
}
+ else if (spec[i] == '^')
+ {
+ i++;
+ last = 1;
+ }
#if 0
else if (!spec[i] || spec[i] == ':')
/* check against `:' because there could be a modifier separator */
diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c
index 8eb3496..f0fa5ce 100644
--- a/readline/readline/histfile.c
+++ b/readline/readline/histfile.c
@@ -1,6 +1,6 @@
/* histfile.c - functions to manipulate the history file. */
-/* Copyright (C) 1989-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2019 Free Software Foundation, Inc.
This file contains the GNU History Library (History), a set of
routines for managing the text of previously typed lines.
@@ -26,6 +26,8 @@
#define READLINE_LIBRARY
#if defined (__TANDEM)
+# define _XOPEN_SOURCE_EXTENDED 1
+# include <unistd.h>
# include <floss.h>
#endif
@@ -79,6 +81,11 @@
#endif /* HISTORY_USE_MMAP */
+#if defined(_WIN32)
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
/* If we're compiling for __EMX__ (OS/2) or __CYGWIN__ (cygwin32 environment
on win 95/98/nt), we want to open files with O_BINARY mode so that there
is no \n -> \r\n conversion performed. On other systems, we don't want to
@@ -138,6 +145,7 @@ static char *history_backupfile PARAMS((const char *));
static char *history_tempfile PARAMS((const char *));
static int histfile_backup PARAMS((const char *, const char *));
static int histfile_restore PARAMS((const char *, const char *));
+static int history_rename PARAMS((const char *, const char *));
/* Return the string that should be used in the place of this
filename. This only matters when you don't specify the
@@ -449,6 +457,18 @@ read_history_range (const char *filename, int from, int to)
return (0);
}
+/* We need a special version for WIN32 because Windows rename() refuses to
+ overwrite an existing file. */
+static int
+history_rename (const char *old, const char *new)
+{
+#if defined (_WIN32)
+ return (MoveFileEx (old, new, MOVEFILE_REPLACE_EXISTING) == 0 ? -1 : 0);
+#else
+ return (rename (old, new));
+#endif
+}
+
/* Save FILENAME to BACK, handling case where FILENAME is a symlink
(e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
static int
@@ -462,10 +482,10 @@ histfile_backup (const char *filename, const char *back)
if ((n = readlink (filename, linkbuf, sizeof (linkbuf) - 1)) > 0)
{
linkbuf[n] = '\0';
- return (rename (linkbuf, back));
+ return (history_rename (linkbuf, back));
}
#endif
- return (rename (filename, back));
+ return (history_rename (filename, back));
}
/* Restore ORIG from BACKUP handling case where ORIG is a symlink
@@ -481,12 +501,18 @@ histfile_restore (const char *backup, const char *orig)
if ((n = readlink (orig, linkbuf, sizeof (linkbuf) - 1)) > 0)
{
linkbuf[n] = '\0';
- return (rename (backup, linkbuf));
+ return (history_rename (backup, linkbuf));
}
#endif
- return (rename (backup, orig));
+ return (history_rename (backup, orig));
}
+/* Should we call chown, based on whether finfo and nfinfo describe different
+ files with different owners? */
+
+#define SHOULD_CHOWN(finfo, nfinfo) \
+ (finfo.st_uid != nfinfo.st_uid || finfo.st_gid != nfinfo.st_gid)
+
/* Truncate the history file FNAME, leaving only LINES trailing lines.
If FNAME is NULL, then use ~/.history. Writes a new file and renames
it to the original name. Returns 0 on success, errno on failure. */
@@ -495,7 +521,7 @@ history_truncate_file (const char *fname, int lines)
{
char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
int file, chars_read, rv, orig_lines, exists, r;
- struct stat finfo;
+ struct stat finfo, nfinfo;
size_t file_size;
history_lines_written_to_file = 0;
@@ -516,6 +542,9 @@ history_truncate_file (const char *fname, int lines)
}
exists = 1;
+ nfinfo.st_uid = finfo.st_uid;
+ nfinfo.st_gid = finfo.st_gid;
+
if (S_ISREG (finfo.st_mode) == 0)
{
close (file);
@@ -604,6 +633,9 @@ history_truncate_file (const char *fname, int lines)
if (write (file, bp, chars_read - (bp - buffer)) < 0)
rv = errno;
+ if (fstat (file, &nfinfo) < 0 && rv == 0)
+ rv = errno;
+
if (close (file) < 0 && rv == 0)
rv = errno;
}
@@ -631,7 +663,7 @@ history_truncate_file (const char *fname, int lines)
user is running this, it's a no-op. If the shell is running after sudo
with a shared history file, we don't want to leave the history file
owned by root. */
- if (rv == 0 && exists)
+ if (rv == 0 && exists && SHOULD_CHOWN (finfo, nfinfo))
r = chown (filename, finfo.st_uid, finfo.st_gid);
#endif
@@ -650,7 +682,7 @@ history_do_write (const char *filename, int nelements, int overwrite)
register int i;
char *output, *tempname, *histname;
int file, mode, rv, exists;
- struct stat finfo;
+ struct stat finfo, nfinfo;
#ifdef HISTORY_USE_MMAP
size_t cursize;
@@ -695,15 +727,11 @@ history_do_write (const char *filename, int nelements, int overwrite)
the_history = history_list ();
/* Calculate the total number of bytes to write. */
for (buffer_size = 0, i = history_length - nelements; i < history_length; i++)
-#if 0
- buffer_size += 2 + HISTENT_BYTES (the_history[i]);
-#else
{
if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0])
buffer_size += strlen (the_history[i]->timestamp) + 1;
buffer_size += strlen (the_history[i]->line) + 1;
}
-#endif
/* Allocate the buffer, and fill it. */
#ifdef HISTORY_USE_MMAP
diff --git a/readline/readline/input.c b/readline/readline/input.c
index d4d57a8..61b0fde 100644
--- a/readline/readline/input.c
+++ b/readline/readline/input.c
@@ -22,6 +22,8 @@
#define READLINE_LIBRARY
#if defined (__TANDEM)
+# define _XOPEN_SOURCE_EXTENDED 1
+# define _TANDEM_SOURCE 1
# include <floss.h>
#endif
@@ -347,8 +349,7 @@ _rl_input_available (void)
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
- timeout.tv_sec = 0;
- timeout.tv_usec = _keyboard_input_timeout;
+ USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
#else
@@ -368,6 +369,24 @@ _rl_input_available (void)
}
int
+_rl_nchars_available ()
+{
+ int chars_avail, fd, result;
+
+ chars_avail = 0;
+
+#if defined (FIONREAD)
+ fd = fileno (rl_instream);
+ errno = 0;
+ result = ioctl (fd, FIONREAD, &chars_avail);
+ if (result == -1 && errno == EIO)
+ return -1;
+#endif
+
+ return chars_avail;
+}
+
+int
_rl_input_queued (int t)
{
int old_timeout, r;
@@ -493,7 +512,7 @@ rl_read_key (void)
{
if (rl_get_char (&c) == 0)
c = (*rl_getc_function) (rl_instream);
-/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d", _rl_caught_signal); */
+/* fprintf(stderr, "rl_read_key: calling RL_CHECK_SIGNALS: _rl_caught_signal = %d\r\n", _rl_caught_signal); */
RL_CHECK_SIGNALS ();
}
}
@@ -596,6 +615,10 @@ handle_error:
else if (_rl_caught_signal == SIGINT)
#endif
RL_CHECK_SIGNALS ();
+#if defined (SIGTSTP)
+ else if (_rl_caught_signal == SIGTSTP)
+ RL_CHECK_SIGNALS ();
+#endif
/* non-keyboard-generated signals of interest */
#if defined (SIGWINCH)
else if (_rl_caught_signal == SIGWINCH)
@@ -631,9 +654,7 @@ _rl_read_mbchar (char *mbchar, int size)
mb_len = 0;
while (mb_len < size)
{
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ c = (mb_len == 0) ? _rl_bracketed_read_key () : rl_read_key ();
if (c < 0)
break;
diff --git a/readline/readline/isearch.c b/readline/readline/isearch.c
index d6c5904..080ba3c 100644
--- a/readline/readline/isearch.c
+++ b/readline/readline/isearch.c
@@ -6,7 +6,7 @@
/* */
/* **************************************************************** */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -185,11 +185,13 @@ rl_display_search (char *search_string, int flags, int where)
strcpy (message + msglen, "i-search)`");
msglen += 10;
- if (search_string)
+ if (search_string && *search_string)
{
strcpy (message + msglen, search_string);
msglen += searchlen;
}
+ else
+ _rl_optimize_redisplay ();
strcpy (message + msglen, "': ");
@@ -255,6 +257,9 @@ _rl_isearch_init (int direction)
_rl_iscxt = cxt; /* save globally */
+ /* experimental right now */
+ _rl_init_executing_keyseq ();
+
return cxt;
}
@@ -287,16 +292,22 @@ _rl_isearch_fini (_rl_search_cxt *cxt)
else
cxt->sline_index = strlen (rl_line_buffer);
rl_mark = cxt->save_mark;
+ rl_deactivate_mark ();
}
rl_point = cxt->sline_index;
/* Don't worry about where to put the mark here; rl_get_previous_history
- and rl_get_next_history take care of it. */
+ and rl_get_next_history take care of it.
+ If we want to highlight the search string, this is where to set the
+ point and mark to do it. */
_rl_fix_point (0);
+ rl_deactivate_mark ();
+/* _rl_optimize_redisplay (); */
rl_clear_message ();
}
+/* XXX - we could use _rl_bracketed_read_mbstring () here. */
int
_rl_search_getchar (_rl_search_cxt *cxt)
{
@@ -342,6 +353,24 @@ _rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
return -1;
}
+ _rl_add_executing_keyseq (c);
+
+ /* XXX - experimental code to allow users to bracketed-paste into the search
+ string even when ESC is one of the isearch-terminators. Not perfect yet. */
+ if (_rl_enable_bracketed_paste && c == ESC && strchr (cxt->search_terminators, c) && (n = _rl_nchars_available ()) > (BRACK_PASTE_SLEN-1))
+ {
+ j = _rl_read_bracketed_paste_prefix (c);
+ if (j == 1)
+ {
+ cxt->lastc = -7; /* bracketed paste, see below */
+ goto opcode_dispatch;
+ }
+ else if (_rl_pushed_input_available ()) /* eat extra char we pushed back */
+ c = cxt->lastc = rl_read_key ();
+ else
+ c = cxt->lastc; /* last ditch */
+ }
+
/* If we are moving into a new keymap, modify cxt->keymap and go on.
This can be a problem if c == ESC and we want to terminate the
incremental search, so we check */
@@ -387,7 +416,18 @@ add_character:
/* Translate the keys we do something with to opcodes. */
if (c >= 0 && cxt->keymap[c].type == ISFUNC)
{
- f = cxt->keymap[c].function;
+ /* If we have a multibyte character, see if it's bound to something that
+ affects the search. */
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && cxt->mb[1])
+ f = rl_function_of_keyseq (cxt->mb, cxt->keymap, (int *)NULL);
+ else
+#endif
+ {
+ f = cxt->keymap[c].function;
+ if (f == rl_do_lowercase_version)
+ f = cxt->keymap[_rl_to_lower (c)].function;
+ }
if (f == rl_reverse_search_history)
cxt->lastc = (cxt->sflags & SF_REVERSE) ? -1 : -2;
@@ -454,9 +494,14 @@ add_character:
}
else if (cxt->lastc > 0 && cxt->prevc > 0 && f && f != rl_insert)
{
- rl_stuff_char (cxt->lastc);
- rl_execute_next (cxt->prevc);
- /* XXX - do we insert everything in cxt->pmb? */
+ _rl_term_executing_keyseq (); /* should this go in the caller? */
+
+ _rl_pending_command.map = cxt->keymap;
+ _rl_pending_command.count = 1; /* XXX */
+ _rl_pending_command.key = cxt->lastc;
+ _rl_pending_command.func = f;
+ _rl_command_to_execute = &_rl_pending_command;
+
return (0);
}
}
@@ -502,6 +547,9 @@ add_character:
return (0);
}
+ _rl_init_executing_keyseq ();
+
+opcode_dispatch:
/* Now dispatch on the character. `Opcodes' affect the search string or
state. Other characters are added to the string. */
switch (cxt->lastc)
@@ -519,6 +567,7 @@ add_character:
rl_display_search (cxt->search_string, cxt->sflags, -1);
break;
}
+ /* XXX - restore keymap here? */
return (1);
}
else if ((cxt->sflags & SF_REVERSE) && cxt->sline_index >= 0)
@@ -566,9 +615,11 @@ add_character:
rl_replace_line (cxt->lines[cxt->save_line], 0);
rl_point = cxt->save_point;
rl_mark = cxt->save_mark;
+ rl_deactivate_mark ();
rl_restore_prompt();
rl_clear_message ();
+ _rl_fix_point (1); /* in case save_line and save_point are out of sync */
return -1;
case -5: /* C-W */
@@ -632,6 +683,8 @@ add_character:
free (paste);
break;
}
+ if (_rl_enable_active_region)
+ rl_activate_mark ();
if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size)
{
cxt->search_string_size += pastelen + 2;
@@ -736,11 +789,15 @@ add_character:
cxt->sline_index = (cxt->sflags & SF_REVERSE) ? cxt->sline_len - cxt->search_string_index : 0;
}
+ /* reset the keymaps for the next time through the loop */
+ cxt->keymap = cxt->okeymap = _rl_keymap;
+
if (cxt->sflags & SF_FAILED)
{
/* We cannot find the search string. Ding the bell. */
rl_ding ();
cxt->history_pos = cxt->last_found_line;
+ rl_deactivate_mark ();
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
return 1;
}
@@ -752,7 +809,11 @@ add_character:
{
cxt->prev_line_found = cxt->lines[cxt->history_pos];
rl_replace_line (cxt->lines[cxt->history_pos], 0);
+ if (_rl_enable_active_region)
+ rl_activate_mark ();
rl_point = cxt->sline_index;
+ if (rl_mark_active_p () && cxt->search_string_index > 0)
+ rl_mark = rl_point + cxt->search_string_index;
cxt->last_found_line = cxt->history_pos;
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
}
diff --git a/readline/readline/kill.c b/readline/readline/kill.c
index cf8ca93..50c3fde 100644
--- a/readline/readline/kill.c
+++ b/readline/readline/kill.c
@@ -1,6 +1,6 @@
/* kill.c -- kill ring management. */
-/* Copyright (C) 1994-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2020 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.
@@ -408,6 +408,7 @@ region_kill_internal (int delete)
_rl_copy_to_kill_ring (text, rl_point < rl_mark);
}
+ _rl_fix_point (1);
_rl_last_command_was_kill++;
return 0;
}
@@ -427,8 +428,8 @@ rl_kill_region (int count, int key)
npoint = (rl_point < rl_mark) ? rl_point : rl_mark;
r = region_kill_internal (1);
- _rl_fix_point (1);
rl_point = npoint;
+ _rl_fix_point (1);
return r;
}
@@ -605,7 +606,7 @@ rl_yank_nth_arg_internal (int count, int key, int history_skip)
#if defined (VI_MODE)
/* Vi mode always inserts a space before yanking the argument, and it
inserts it right *after* rl_point. */
- if (rl_editing_mode == vi_mode)
+ if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
{
rl_vi_append_mode (1, key);
rl_insert_text (" ");
@@ -668,8 +669,7 @@ rl_yank_last_arg (int count, int key)
/* Having read the special escape sequence denoting the beginning of a
`bracketed paste' sequence, read the rest of the pasted input until the
- closing sequence and insert the pasted text as a single unit without
- interpretation. */
+ closing sequence and return the pasted text. */
char *
_rl_bracketed_text (size_t *lenp)
{
@@ -715,6 +715,10 @@ _rl_bracketed_text (size_t *lenp)
return (buf);
}
+/* Having read the special escape sequence denoting the beginning of a
+ `bracketed paste' sequence, read the rest of the pasted input until the
+ closing sequence and insert the pasted text as a single unit without
+ interpretation. Temporarily highlight the inserted text. */
int
rl_bracketed_paste_begin (int count, int key)
{
@@ -723,12 +727,108 @@ rl_bracketed_paste_begin (int count, int key)
char *buf;
buf = _rl_bracketed_text (&len);
+ rl_mark = rl_point;
retval = rl_insert_text (buf) == len ? 0 : 1;
+ if (_rl_enable_active_region)
+ rl_activate_mark ();
xfree (buf);
return (retval);
}
+int
+_rl_read_bracketed_paste_prefix (int c)
+{
+ char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
+ int key, ind, j;
+
+ pbpref = BRACK_PASTE_PREF; /* XXX - debugging */
+ if (c != pbpref[0])
+ return (0);
+ pbuf[ind = 0] = c;
+ while (ind < BRACK_PASTE_SLEN-1 &&
+ (RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
+ _rl_pushed_input_available () == 0 &&
+ _rl_input_queued (0))
+ {
+ key = rl_read_key (); /* XXX - for now */
+ if (key < 0)
+ break;
+ pbuf[++ind] = key;
+ if (pbuf[ind] != pbpref[ind])
+ break;
+ }
+
+ if (ind < BRACK_PASTE_SLEN-1) /* read incomplete sequence */
+ {
+ while (ind >= 0)
+ _rl_unget_char (pbuf[ind--]);
+ return (key < 0 ? key : 0);
+ }
+ return (key < 0 ? key : 1);
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+ paste mode. If we don't have or use bracketed paste mode, this can be
+ used in place of rl_read_key(). */
+int
+_rl_bracketed_read_key ()
+{
+ int c, r;
+ char *pbuf;
+ size_t pblen;
+
+ RL_SETSTATE(RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (c < 0)
+ return -1;
+
+ /* read pasted data with bracketed-paste mode enabled. */
+ if (_rl_enable_bracketed_paste && c == ESC && (r = _rl_read_bracketed_paste_prefix (c)) == 1)
+ {
+ pbuf = _rl_bracketed_text (&pblen);
+ if (pblen == 0)
+ {
+ xfree (pbuf);
+ return 0; /* XXX */
+ }
+ c = (unsigned char)pbuf[0];
+ if (pblen > 1)
+ {
+ while (--pblen > 0)
+ _rl_unget_char ((unsigned char)pbuf[pblen]);
+ }
+ xfree (pbuf);
+ }
+
+ return c;
+}
+
+/* Get a character from wherever we read input, handling input in bracketed
+ paste mode. If we don't have or use bracketed paste mode, this can be
+ used in place of rl_read_key(). */
+int
+_rl_bracketed_read_mbstring (char *mb, int mlen)
+{
+ int c, r;
+
+ c = _rl_bracketed_read_key ();
+ if (c < 0)
+ return -1;
+
+#if defined (HANDLE_MULTIBYTE)
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ c = _rl_read_mbstring (c, mb, mlen);
+ else
+#endif
+ mb[0] = c;
+ mb[mlen] = '\0'; /* just in case */
+
+ return c;
+}
+
/* A special paste command for Windows users. */
#if defined (_WIN32)
#include <windows.h>
diff --git a/readline/readline/mbutil.c b/readline/readline/mbutil.c
index 1771635..dc62b4c 100644
--- a/readline/readline/mbutil.c
+++ b/readline/readline/mbutil.c
@@ -1,6 +1,6 @@
/* mbutil.c -- readline multibyte character utility functions */
-/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2020 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.
@@ -86,7 +86,7 @@ int _rl_utf8locale = 0;
static int
_rl_utf8_mblen (const char *s, size_t n)
{
- unsigned char c, c1;
+ unsigned char c, c1, c2, c3;
if (s == 0)
return (0); /* no shift states */
@@ -101,25 +101,46 @@ _rl_utf8_mblen (const char *s, size_t n)
c1 = (unsigned char)s[1];
if (c < 0xe0)
{
- if (n >= 2 && (s[1] ^ 0x80) < 0x40)
+ if (n == 1)
+ return -2;
+ if (n >= 2 && (c1 ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
- if (n >= 3
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
+ if (n == 1)
+ return -2;
+ if ((c1 ^ 0x80) < 0x40
&& (c >= 0xe1 || c1 >= 0xa0)
&& (c != 0xed || c1 < 0xa0))
- return 3;
+ {
+ if (n == 2)
+ return -2;
+ c2 = (unsigned char)s[2];
+ if ((c2 ^ 0x80) < 0x40)
+ return 3;
+ }
}
- else if (c < 0xf8)
+ else if (c < 0xf4)
{
- if (n >= 4
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40
+ if (n == 1)
+ return -2;
+ if (((c1 ^ 0x80) < 0x40)
&& (c >= 0xf1 || c1 >= 0x90)
&& (c < 0xf4 || (c == 0xf4 && c1 < 0x90)))
- return 4;
+ {
+ if (n == 2)
+ return -2;
+ c2 = (unsigned char)s[2];
+ if ((c2 ^ 0x80) < 0x40)
+ {
+ if (n == 3)
+ return -2;
+ c3 = (unsigned char)s[3];
+ if ((c3 ^ 0x80) < 0x40)
+ return 4;
+ }
+ }
}
}
/* invalid or incomplete multibyte character */
@@ -206,6 +227,66 @@ _rl_find_next_mbchar_internal (char *string, int seed, int count, int find_non_z
return point;
}
+static inline int
+_rl_test_nonzero (char *string, int ind, int len)
+{
+ size_t tmp;
+ wchar_t wc;
+ mbstate_t ps;
+
+ memset (&ps, 0, sizeof (mbstate_t));
+ tmp = mbrtowc (&wc, string + ind, len - ind, &ps);
+ /* treat invalid multibyte sequences as non-zero-width */
+ return (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp) || WCWIDTH (wc) > 0);
+}
+
+/* experimental -- needs to handle zero-width characters better */
+static int
+_rl_find_prev_utf8char (char *string, int seed, int find_non_zero)
+{
+ char *s;
+ unsigned char b;
+ int save, prev;
+ size_t len;
+
+ if (find_non_zero)
+ len = RL_STRLEN (string);
+
+ prev = seed - 1;
+ while (prev >= 0)
+ {
+ b = (unsigned char)string[prev];
+ if (UTF8_SINGLEBYTE (b))
+ return (prev);
+
+ save = prev;
+
+ /* Move back until we're not in the middle of a multibyte char */
+ if (UTF8_MBCHAR (b))
+ {
+ while (prev > 0 && (b = (unsigned char)string[--prev]) && UTF8_MBCHAR (b))
+ ;
+ }
+
+ if (UTF8_MBFIRSTCHAR (b))
+ {
+ if (find_non_zero)
+ {
+ if (_rl_test_nonzero (string, prev, len))
+ return (prev);
+ else /* valid but WCWIDTH (wc) == 0 */
+ prev = prev - 1;
+ }
+ else
+ return (prev);
+ }
+ else
+ return (save); /* invalid utf-8 multibyte sequence */
+ }
+
+ return ((prev < 0) ? 0 : prev);
+}
+
/*static*/ int
_rl_find_prev_mbchar_internal (char *string, int seed, int find_non_zero)
{
@@ -214,6 +295,9 @@ _rl_find_prev_mbchar_internal (char *string, int seed, int find_non_zero)
size_t tmp;
wchar_t wc;
+ if (_rl_utf8locale)
+ return (_rl_find_prev_utf8char (string, seed, find_non_zero));
+
memset(&ps, 0, sizeof(mbstate_t));
length = strlen(string);
diff --git a/readline/readline/misc.c b/readline/readline/misc.c
index 42005b0..3d9a674 100644
--- a/readline/readline/misc.c
+++ b/readline/readline/misc.c
@@ -1,6 +1,6 @@
/* misc.c -- miscellaneous bindable readline functions. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 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.
@@ -138,9 +138,7 @@ _rl_arg_dispatch (_rl_arg_cxt cxt, int c)
}
else
{
- RL_SETSTATE(RL_STATE_MOREINPUT);
- key = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ key = _rl_bracketed_read_key ();
rl_restore_prompt ();
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
@@ -435,7 +433,7 @@ rl_replace_from_history (HIST_ENTRY *entry, int flags)
intended to be called while actively editing, and the current line is
not assumed to have been added to the history list. */
void
-_rl_revert_all_lines (void)
+_rl_revert_previous_lines (void)
{
int hpos;
HIST_ENTRY *entry;
@@ -479,6 +477,19 @@ _rl_revert_all_lines (void)
xfree (lbuf);
}
+/* Revert all lines in the history by making sure we are at the end of the
+ history before calling _rl_revert_previous_lines() */
+void
+_rl_revert_all_lines (void)
+{
+ int pos;
+
+ pos = where_history ();
+ using_history ();
+ _rl_revert_previous_lines ();
+ history_set_pos (pos);
+}
+
/* Free the history list, including private readline data and take care
of pointer aliases to history data. Resets rl_undo_list if it points
to an UNDO_LIST * saved as some history entry's data member. This
@@ -626,6 +637,48 @@ rl_get_previous_history (int count, int key)
return 0;
}
+/* The equivalent of the Korn shell C-o operate-and-get-next-history-line
+ editing command. */
+
+/* This could stand to be global to the readline library */
+static rl_hook_func_t *_rl_saved_internal_startup_hook = 0;
+static int saved_history_logical_offset = -1;
+
+#define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries)
+
+static int
+set_saved_history ()
+{
+ int absolute_offset, count;
+
+ if (saved_history_logical_offset >= 0)
+ {
+ absolute_offset = saved_history_logical_offset - history_base;
+ count = where_history () - absolute_offset;
+ rl_get_previous_history (count, 0);
+ }
+ saved_history_logical_offset = -1;
+ _rl_internal_startup_hook = _rl_saved_internal_startup_hook;
+
+ return (0);
+}
+
+int
+rl_operate_and_get_next (count, c)
+ int count, c;
+{
+ /* Accept the current line. */
+ rl_newline (1, c);
+
+ saved_history_logical_offset = rl_explicit_arg ? count : where_history () + history_base + 1;
+
+
+ _rl_saved_internal_startup_hook = _rl_internal_startup_hook;
+ _rl_internal_startup_hook = set_saved_history;
+
+ return 0;
+}
+
/* **************************************************************** */
/* */
/* Editing Modes */
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index 626a945..d8c9df7 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-4
+0
diff --git a/readline/readline/posixdir.h b/readline/readline/posixdir.h
index 0921c5d..af5be80 100644
--- a/readline/readline/posixdir.h
+++ b/readline/readline/posixdir.h
@@ -46,7 +46,7 @@
# define D_NAMLEN(d) ((d)->d_namlen)
#endif /* !HAVE_DIRENT_H */
-/* The bash code fairly consistenly uses d_fileno; make sure it's available */
+/* The bash code fairly consistently uses d_fileno; make sure it's available */
#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO)
# define d_fileno d_ino
#endif
diff --git a/readline/readline/posixstat.h b/readline/readline/posixstat.h
index b9d8eb3..b607786 100644
--- a/readline/readline/posixstat.h
+++ b/readline/readline/posixstat.h
@@ -1,7 +1,7 @@
/* posixstat.h -- Posix stat(2) definitions for systems that
don't have them. */
-/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -132,9 +132,9 @@
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-#else /* !S_IRWXU */
- /* S_IRWXU is defined, but "group" and "other" bits might not be
- (happens in certain versions of MinGW). */
+#else /* !S_IRWXU */
+ /* S_IRWXU is defined, but "group" and "other" bits might not be
+ (happens in certain versions of MinGW). */
# if !defined (S_IRGRP)
# define S_IRGRP (S_IREAD >> 3) /* read, group */
# define S_IWGRP (S_IWRITE >> 3) /* write, group */
diff --git a/readline/readline/readline.c b/readline/readline/readline.c
index 678f989..e61d188 100644
--- a/readline/readline/readline.c
+++ b/readline/readline/readline.c
@@ -1,7 +1,7 @@
/* readline.c -- a general facility for reading lines of input
with emacs style editing and completion. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -73,11 +73,11 @@ extern int errno;
#include "xmalloc.h"
#ifndef RL_LIBRARY_VERSION
-# define RL_LIBRARY_VERSION "5.1"
+# define RL_LIBRARY_VERSION "8.0"
#endif
#ifndef RL_READLINE_VERSION
-# define RL_READLINE_VERSION 0x0501
+# define RL_READLINE_VERSION 0x0800
#endif
extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
@@ -199,6 +199,10 @@ int rl_key_sequence_length = 0;
before readline_internal_setup () prints the first prompt. */
rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL;
+/* Any readline function can set this and have it run just before the user's
+ rl_startup_hook. */
+rl_hook_func_t *_rl_internal_startup_hook = (rl_hook_func_t *)NULL;
+
/* If non-zero, this is the address of a function to call just before
readline_internal_setup () returns and readline_internal starts
reading input characters. */
@@ -258,6 +262,9 @@ int rl_executing_key;
char *rl_executing_keyseq = 0;
int _rl_executing_keyseq_size = 0;
+struct _rl_cmd _rl_pending_command;
+struct _rl_cmd *_rl_command_to_execute = (struct _rl_cmd *)NULL;
+
/* Timeout (specified in milliseconds) when reading characters making up an
ambiguous multiple-key sequence */
int _rl_keyseq_timeout = 500;
@@ -314,7 +321,8 @@ int _rl_show_mode_in_prompt = 0;
/* Non-zero means to attempt to put the terminal in `bracketed paste mode',
where it will prefix pasted text with an escape sequence and send
another to mark the end of the paste. */
-int _rl_enable_bracketed_paste = 0;
+int _rl_enable_bracketed_paste = BRACKETED_PASTE_DEFAULT;
+int _rl_enable_active_region = BRACKETED_PASTE_DEFAULT;
/* **************************************************************** */
/* */
@@ -417,6 +425,11 @@ readline_internal_setup (void)
if (rl_startup_hook)
(*rl_startup_hook) ();
+ if (_rl_internal_startup_hook)
+ (*_rl_internal_startup_hook) ();
+
+ rl_deactivate_mark ();
+
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
@@ -632,12 +645,34 @@ readline_internal_charloop (void)
r = _rl_dispatch ((unsigned char)c, _rl_keymap);
RL_CHECK_SIGNALS ();
+ if (_rl_command_to_execute)
+ {
+ (*rl_redisplay_function) ();
+
+ rl_executing_keymap = _rl_command_to_execute->map;
+ rl_executing_key = _rl_command_to_execute->key;
+
+ rl_dispatching = 1;
+ RL_SETSTATE(RL_STATE_DISPATCHING);
+ r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
+ _rl_command_to_execute = 0;
+ RL_UNSETSTATE(RL_STATE_DISPATCHING);
+ rl_dispatching = 0;
+
+ RL_CHECK_SIGNALS ();
+ }
+
/* If there was no change in _rl_last_command_was_kill, then no kill
has taken place. Note that if input is pending we are reading
a prefix command, so nothing has changed yet. */
if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
_rl_last_command_was_kill = 0;
+ if (_rl_keep_mark_active)
+ _rl_keep_mark_active = 0;
+ else if (rl_mark_active_p ())
+ rl_deactivate_mark ();
+
_rl_internal_char_cleanup ();
#if defined (READLINE_CALLBACKS)
@@ -856,7 +891,11 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
/* If we have input pending, then the last command was a prefix
command. Don't change the state of rl_last_func. Otherwise,
remember the last command executed in this variable. */
+#if defined (VI_MODE)
+ if (rl_pending_input == 0 && map[key].function != rl_digit_argument && map[key].function != rl_vi_arg_digit)
+#else
if (rl_pending_input == 0 && map[key].function != rl_digit_argument)
+#endif
rl_last_func = map[key].function;
RL_CHECK_SIGNALS ();
@@ -870,6 +909,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
_rl_prev_macro_key ();
else
_rl_unget_char (key);
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
return -2;
}
else if (got_subseq)
@@ -882,6 +923,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
_rl_prev_macro_key ();
else
_rl_unget_char (key);
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
return -1;
}
else
@@ -974,7 +1017,11 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
_rl_pushed_input_available () == 0 &&
_rl_dispatching_keymap[ANYOTHERKEY].function &&
_rl_input_queued (_rl_keyseq_timeout*1000) == 0)
- return (_rl_subseq_result (-2, map, key, got_subseq));
+ {
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
+ return (_rl_subseq_result (-2, map, key, got_subseq));
+ }
newkey = _rl_subseq_getchar (key);
if (newkey < 0)
@@ -1065,6 +1112,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
_rl_prev_macro_key ();
else
_rl_unget_char (key);
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
_rl_dispatching_keymap = map;
return -2;
}
@@ -1075,6 +1124,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
_rl_prev_macro_key ();
else
_rl_unget_char (key);
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
_rl_dispatching_keymap = map;
return -1;
}
@@ -1241,7 +1292,7 @@ readline_initialize_everything (void)
rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16);
if (rl_executing_keyseq)
- rl_executing_keyseq[0] = '\0';
+ rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
}
/* If this system allows us to look at the values of the regular
@@ -1356,9 +1407,12 @@ bind_bracketed_paste_prefix (void)
_rl_keymap = emacs_standard_keymap;
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
-
+
+#if defined (VI_MODE)
_rl_keymap = vi_insertion_keymap;
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
+ /* XXX - is there a reason to do this in the vi command keymap? */
+#endif
_rl_keymap = xkeymap;
}
@@ -1446,5 +1500,35 @@ rl_restore_state (struct readline_state *sp)
rl_attempted_completion_function = sp->attemptfunc;
rl_completer_word_break_characters = sp->wordbreakchars;
+ rl_deactivate_mark ();
+
return (0);
}
+
+/* Functions to manage the string that is the current key sequence. */
+
+void
+_rl_init_executing_keyseq (void)
+{
+ rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
+}
+
+void
+_rl_term_executing_keyseq (void)
+{
+ rl_executing_keyseq[rl_key_sequence_length] = '\0';
+}
+
+void
+_rl_end_executing_keyseq (void)
+{
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
+}
+
+void
+_rl_add_executing_keyseq (int key)
+{
+ RESIZE_KEYSEQ_BUFFER ();
+ rl_executing_keyseq[rl_key_sequence_length++] = key;
+}
diff --git a/readline/readline/readline.h b/readline/readline/readline.h
index da78271..78fa39d 100644
--- a/readline/readline/readline.h
+++ b/readline/readline/readline.h
@@ -1,6 +1,6 @@
/* Readline.h -- the names of functions callable from within readline. */
-/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
@@ -39,9 +39,9 @@ extern "C" {
#endif
/* Hex-encoded Readline version number. */
-#define RL_READLINE_VERSION 0x0800 /* Readline 8.0 */
+#define RL_READLINE_VERSION 0x0801 /* Readline 8.0 */
#define RL_VERSION_MAJOR 8
-#define RL_VERSION_MINOR 0
+#define RL_VERSION_MINOR 1
/* Readline data structures. */
@@ -95,6 +95,7 @@ extern int rl_forward_word PARAMS((int, int));
extern int rl_backward_word PARAMS((int, int));
extern int rl_refresh_line PARAMS((int, int));
extern int rl_clear_screen PARAMS((int, int));
+extern int rl_clear_display PARAMS((int, int));
extern int rl_skip_csi_sequence PARAMS((int, int));
extern int rl_arrow_keys PARAMS((int, int));
@@ -132,6 +133,7 @@ extern int rl_beginning_of_history PARAMS((int, int));
extern int rl_end_of_history PARAMS((int, int));
extern int rl_get_next_history PARAMS((int, int));
extern int rl_get_previous_history PARAMS((int, int));
+extern int rl_operate_and_get_next PARAMS((int, int));
/* Bindable commands for managing the mark and region. */
extern int rl_set_mark PARAMS((int, int));
@@ -392,6 +394,14 @@ extern int rl_clear_message PARAMS((void));
extern int rl_reset_line_state PARAMS((void));
extern int rl_crlf PARAMS((void));
+/* Functions to manage the mark and region, especially the notion of an
+ active mark and an active region. */
+extern void rl_keep_mark_active PARAMS((void));
+
+extern void rl_activate_mark PARAMS((void));
+extern void rl_deactivate_mark PARAMS((void));
+extern int rl_mark_active_p PARAMS((void));
+
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
diff --git a/readline/readline/readline.pc.in b/readline/readline/readline.pc.in
index a7f2cf3..ff79d71 100644
--- a/readline/readline/readline.pc.in
+++ b/readline/readline/readline.pc.in
@@ -9,4 +9,4 @@ URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
Version: @LIBVERSION@
Requires.private: @TERMCAP_PKG_CONFIG_LIB@
Libs: -L${libdir} -lreadline
-Cflags: -I${includedir}/readline
+Cflags: -I${includedir}
diff --git a/readline/readline/rlmbutil.h b/readline/readline/rlmbutil.h
index 6fd03f6..4d3e907 100644
--- a/readline/readline/rlmbutil.h
+++ b/readline/readline/rlmbutil.h
@@ -28,7 +28,7 @@
/* check multibyte capability for I18N code */
/************************************************/
-/* For platforms which support the ISO C amendement 1 functionality we
+/* For platforms which support the ISO C amendment 1 functionality we
support user defined character classes. */
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
#if defined (HAVE_WCTYPE_H) && defined (HAVE_WCHAR_H) && defined (HAVE_LOCALE_H)
diff --git a/readline/readline/rlprivate.h b/readline/readline/rlprivate.h
index e85e4d8..23ab2d8 100644
--- a/readline/readline/rlprivate.h
+++ b/readline/readline/rlprivate.h
@@ -1,7 +1,7 @@
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
-/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 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,7 +65,8 @@
#define SF_FOUND 0x02
#define SF_FAILED 0x04
#define SF_CHGKMAP 0x08
-#define SF_PATTERN 0x10 /* unused so far */
+#define SF_PATTERN 0x10
+#define SF_NOCASE 0x20 /* unused so far */
typedef struct __rl_search_context
{
@@ -109,6 +110,15 @@ typedef struct __rl_search_context
char *search_terminators;
} _rl_search_cxt;
+struct _rl_cmd {
+ Keymap map;
+ int count;
+ int key;
+ rl_command_func_t *func;
+};
+extern struct _rl_cmd _rl_pending_command;
+extern struct _rl_cmd *_rl_command_to_execute;
+
/* Callback data for reading numeric arguments */
#define NUM_SAWMINUS 0x01
#define NUM_SAWDIGITS 0x02
@@ -267,23 +277,25 @@ extern void _rl_free_match_list PARAMS((char **));
/* display.c */
extern char *_rl_strip_prompt PARAMS((char *));
extern void _rl_reset_prompt PARAMS((void));
-extern void _rl_move_cursor_relative PARAMS((int, const char *));
extern void _rl_move_vert PARAMS((int));
extern void _rl_save_prompt PARAMS((void));
extern void _rl_restore_prompt PARAMS((void));
extern char *_rl_make_prompt_for_search PARAMS((int));
extern void _rl_erase_at_end_of_line PARAMS((int));
extern void _rl_clear_to_eol PARAMS((int));
-extern void _rl_clear_screen PARAMS((void));
+extern void _rl_clear_screen PARAMS((int));
extern void _rl_update_final PARAMS((void));
+extern void _rl_optimize_redisplay PARAMS((void));
extern void _rl_redisplay_after_sigwinch PARAMS((void));
extern void _rl_clean_up_for_exit PARAMS((void));
extern void _rl_erase_entire_line PARAMS((void));
extern int _rl_current_display_line PARAMS((void));
+extern void _rl_refresh_line PARAMS((void));
/* input.c */
extern int _rl_any_typein PARAMS((void));
extern int _rl_input_available PARAMS((void));
+extern int _rl_nchars_available PARAMS((void));
extern int _rl_input_queued PARAMS((int));
extern void _rl_insert_typein PARAMS((int));
extern int _rl_unget_char PARAMS((int));
@@ -300,6 +312,10 @@ extern int _rl_isearch_cleanup PARAMS((_rl_search_cxt *, int));
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
/* kill.c */
+#ifndef BRACKETED_PASTE_DEFAULT
+# define BRACKETED_PASTE_DEFAULT 1 /* XXX - for now */
+#endif
+
#define BRACK_PASTE_PREF "\033[200~"
#define BRACK_PASTE_SUFF "\033[201~"
@@ -309,7 +325,10 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
#define BRACK_PASTE_INIT "\033[?2004h"
#define BRACK_PASTE_FINI "\033[?2004l\r"
+extern int _rl_read_bracketed_paste_prefix PARAMS((int));
extern char *_rl_bracketed_text PARAMS((size_t *));
+extern int _rl_bracketed_read_key PARAMS((void));
+extern int _rl_bracketed_read_mbstring PARAMS((char *, int));
/* macro.c */
extern void _rl_with_macro_input PARAMS((char *));
@@ -332,6 +351,7 @@ extern void _rl_start_using_history PARAMS((void));
extern int _rl_free_saved_history_line PARAMS((void));
extern void _rl_set_insert_mode PARAMS((int, int));
+extern void _rl_revert_previous_lines PARAMS((void));
extern void _rl_revert_all_lines PARAMS((void));
/* nls.c */
@@ -348,6 +368,11 @@ extern int _rl_dispatch PARAMS((int, Keymap));
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
extern void _rl_internal_char_cleanup PARAMS((void));
+extern void _rl_init_executing_keyseq PARAMS((void));
+extern void _rl_term_executing_keyseq PARAMS((void));
+extern void _rl_end_executing_keyseq PARAMS((void));
+extern void _rl_add_executing_keyseq PARAMS((int));
+
/* rltty.c */
extern int _rl_disable_tty_signals PARAMS((void));
extern int _rl_restore_tty_signals PARAMS((void));
@@ -373,15 +398,19 @@ extern void _rl_output_character_function PARAMS((int));
#else
extern int _rl_output_character_function PARAMS((int));
#endif
+extern void _rl_cr PARAMS((void));
extern void _rl_output_some_chars PARAMS((const char *, int));
extern int _rl_backspace PARAMS((int));
extern void _rl_enable_meta_key PARAMS((void));
extern void _rl_disable_meta_key PARAMS((void));
extern void _rl_control_keypad PARAMS((int));
extern void _rl_set_cursor PARAMS((int, int));
+extern void _rl_standout_on PARAMS((void));
+extern void _rl_standout_off PARAMS((void));
/* text.c */
extern void _rl_fix_point PARAMS((int));
+extern void _rl_fix_mark PARAMS((void));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_backward_char_internal PARAMS((int));
@@ -507,6 +536,7 @@ extern int _rl_revert_all_at_newline;
extern int _rl_echo_control_chars;
extern int _rl_show_mode_in_prompt;
extern int _rl_enable_bracketed_paste;
+extern int _rl_enable_active_region;
extern char *_rl_comment_begin;
extern unsigned char _rl_parsing_conditionalized_out;
extern Keymap _rl_keymap;
@@ -521,11 +551,12 @@ extern int _rl_keyseq_timeout;
extern int _rl_executing_keyseq_size;
+extern rl_hook_func_t *_rl_internal_startup_hook;
+
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* signals.c */
-extern int _rl_interrupt_immediately;
extern int volatile _rl_caught_signal;
extern _rl_sigcleanup_func_t *_rl_sigcleanup;
@@ -560,6 +591,7 @@ extern int _rl_term_autowrap;
/* text.c */
extern int _rl_optimize_typeahead;
+extern int _rl_keep_mark_active;
/* undo.c */
extern int _rl_doing_an_undo;
diff --git a/readline/readline/search.c b/readline/readline/search.c
index c9c1f5d..38a2936 100644
--- a/readline/readline/search.c
+++ b/readline/readline/search.c
@@ -1,6 +1,6 @@
/* search.c - code for non-incremental searching in emacs and vi modes. */
-/* Copyright (C) 1992-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 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.
@@ -159,7 +159,7 @@ noninc_search_from_pos (char *string, int pos, int dir, int flags, int *ncp)
static int
noninc_dosearch (char *string, int dir, int flags)
{
- int oldpos, pos;
+ int oldpos, pos, ind;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
@@ -168,7 +168,7 @@ noninc_dosearch (char *string, int dir, int flags)
return 0;
}
- pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir, flags, (int *)0);
+ pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir, flags, &ind);
if (pos == -1)
{
/* Search failed, current history position unchanged. */
@@ -192,8 +192,19 @@ noninc_dosearch (char *string, int dir, int flags)
make_history_line_current (entry);
- rl_point = 0;
- rl_mark = rl_end;
+ if (_rl_enable_active_region && ((flags & SF_PATTERN) == 0) && ind > 0 && ind < rl_end)
+ {
+ rl_point = ind;
+ rl_mark = ind + strlen (string);
+ if (rl_mark > rl_end)
+ rl_mark = rl_end; /* can't happen? */
+ rl_activate_mark ();
+ }
+ else
+ {
+ rl_point = 0;
+ rl_mark = rl_end;
+ }
rl_clear_message ();
return 1;
@@ -256,6 +267,7 @@ _rl_nsearch_abort (_rl_search_cxt *cxt)
rl_clear_message ();
rl_point = cxt->save_point;
rl_mark = cxt->save_mark;
+ _rl_fix_point (1);
rl_restore_prompt ();
RL_UNSETSTATE (RL_STATE_NSEARCH);
@@ -267,6 +279,8 @@ _rl_nsearch_abort (_rl_search_cxt *cxt)
static int
_rl_nsearch_dispatch (_rl_search_cxt *cxt, int c)
{
+ int n;
+
if (c < 0)
c = CTRL ('C');
@@ -300,6 +314,28 @@ _rl_nsearch_dispatch (_rl_search_cxt *cxt, int c)
_rl_nsearch_abort (cxt);
return -1;
+ case ESC:
+ /* XXX - experimental code to allow users to bracketed-paste into the
+ search string. Similar code is in isearch.c:_rl_isearch_dispatch().
+ The difference here is that the bracketed paste sometimes doesn't
+ paste everything, so checking for the prefix and the suffix in the
+ input queue doesn't work well. We just have to check to see if the
+ number of chars in the input queue is enough for the bracketed paste
+ prefix and hope for the best. */
+ if (_rl_enable_bracketed_paste && ((n = _rl_nchars_available ()) >= (BRACK_PASTE_SLEN-1)))
+ {
+ if (_rl_read_bracketed_paste_prefix (c) == 1)
+ rl_bracketed_paste_begin (1, c);
+ else
+ {
+ c = rl_read_key (); /* get the ESC that got pushed back */
+ _rl_insert_char (1, c);
+ }
+ }
+ else
+ _rl_insert_char (1, c);
+ break;
+
default:
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
@@ -311,6 +347,7 @@ _rl_nsearch_dispatch (_rl_search_cxt *cxt, int c)
}
(*rl_redisplay_function) ();
+ rl_deactivate_mark ();
return 1;
}
diff --git a/readline/readline/shlib/Makefile.in b/readline/readline/shlib/Makefile.in
index f2ec3e4..d138524 100644
--- a/readline/readline/shlib/Makefile.in
+++ b/readline/readline/shlib/Makefile.in
@@ -64,7 +64,7 @@ localedir = @localedir@
DESTDIR =
CFLAGS = @CFLAGS@
-LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
+LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"' @BRACKETED_PASTE@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@
diff --git a/readline/readline/signals.c b/readline/readline/signals.c
index 76c5c47..f9174ab8a 100644
--- a/readline/readline/signals.c
+++ b/readline/readline/signals.c
@@ -99,7 +99,6 @@ int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
#endif
/* Private variables. */
-int _rl_interrupt_immediately = 0;
int volatile _rl_caught_signal = 0; /* should be sig_atomic_t, but that requires including <signal.h> everywhere */
/* If non-zero, print characters corresponding to received signals as long as
@@ -136,7 +135,7 @@ void *_rl_sigcleanarg;
/* Readline signal handler functions. */
-/* Called from RL_CHECK_SIGNALS() macro */
+/* Called from RL_CHECK_SIGNALS() macro to run signal handling code. */
RETSIGTYPE
_rl_signal_handler (int sig)
{
@@ -145,6 +144,8 @@ _rl_signal_handler (int sig)
#if defined (SIGWINCH)
if (sig == SIGWINCH)
{
+ RL_SETSTATE(RL_STATE_SIGHANDLER);
+
rl_resize_terminal ();
/* XXX - experimental for now */
/* Call a signal hook because though we called the original signal handler
@@ -152,6 +153,8 @@ _rl_signal_handler (int sig)
ourselves. */
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
+
+ RL_UNSETSTATE(RL_STATE_SIGHANDLER);
}
else
#endif
@@ -163,22 +166,20 @@ _rl_signal_handler (int sig)
static RETSIGTYPE
rl_signal_handler (int sig)
{
- if (_rl_interrupt_immediately)
- {
- _rl_interrupt_immediately = 0;
- _rl_handle_signal (sig);
- }
- else
- _rl_caught_signal = sig;
-
+ _rl_caught_signal = sig;
SIGHANDLER_RETURN;
}
+/* This is called to handle a signal when it is safe to do so (out of the
+ signal handler execution path). Called by _rl_signal_handler for all the
+ signals readline catches except SIGWINCH. */
static RETSIGTYPE
_rl_handle_signal (int sig)
{
+ int block_sig;
+
#if defined (HAVE_POSIX_SIGNALS)
- sigset_t set;
+ sigset_t set, oset;
#else /* !HAVE_POSIX_SIGNALS */
# if defined (HAVE_BSD_SIGNALS)
long omask;
@@ -208,7 +209,16 @@ _rl_handle_signal (int sig)
_rl_sigcleanup = 0;
_rl_sigcleanarg = 0;
}
-
+
+#if defined (HAVE_POSIX_SIGNALS)
+ /* Get the current set of blocked signals. If we want to block a signal for
+ the duration of the cleanup functions, make sure to add it to SET and
+ set block_sig = 1 (see the SIGHUP case below). */
+ block_sig = 0; /* sentinel to block signals with sigprocmask */
+ sigemptyset (&set);
+ sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
+#endif
+
switch (sig)
{
case SIGINT:
@@ -223,38 +233,60 @@ _rl_handle_signal (int sig)
#if defined (SIGTSTP)
case SIGTSTP:
case SIGTTIN:
+ case SIGTTOU:
# if defined (HAVE_POSIX_SIGNALS)
/* Block SIGTTOU so we can restore the terminal settings to something
sane without stopping on SIGTTOU if we have been placed into the
background. Even trying to get the current terminal pgrp with
- tcgetpgrp() will generate SIGTTOU, so we don't bother. Don't bother
- doing this if we've been stopped on SIGTTOU; it's aready too late. */
- sigemptyset (&set);
+ tcgetpgrp() will generate SIGTTOU, so we don't bother. We still do
+ this even if we've been stopped on SIGTTOU, since we handle signals
+ when we have returned from the signal handler and the signal is no
+ longer blocked. */
sigaddset (&set, SIGTTOU);
- sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL);
+ block_sig = 1;
# endif
- case SIGTTOU:
#endif /* SIGTSTP */
- case SIGTERM:
+ /* Any signals that should be blocked during cleanup should go here. */
#if defined (SIGHUP)
case SIGHUP:
-#endif
+# if defined (_AIX)
+ if (block_sig == 0)
+ {
+ sigaddset (&set, sig);
+ block_sig = 1;
+ }
+# endif // _AIX
+#endif
+ /* Signals that don't require blocking during cleanup should go here. */
+ case SIGTERM:
#if defined (SIGALRM)
case SIGALRM:
#endif
#if defined (SIGQUIT)
case SIGQUIT:
#endif
+
+ if (block_sig)
+ sigprocmask (SIG_BLOCK, &set, &oset);
+
rl_echo_signal_char (sig);
rl_cleanup_after_signal ();
+ /* At this point, the application's signal handler, if any, is the
+ current handler. */
+
#if defined (HAVE_POSIX_SIGNALS)
-# if defined (SIGTSTP)
- /* Unblock SIGTTOU blocked above */
- if (sig == SIGTTIN || sig == SIGTSTP)
- sigprocmask (SIG_UNBLOCK, &set, (sigset_t *)NULL);
-# endif
+ /* Unblock any signal(s) blocked above */
+ if (block_sig)
+ sigprocmask (SIG_UNBLOCK, &oset, (sigset_t *)NULL);
+#endif
+ /* We don't have to bother unblocking the signal because we are not
+ running in a signal handler context. */
+#if 0
+#if defined (HAVE_POSIX_SIGNALS)
+ /* Make sure this signal is not blocked when we resend it to the
+ calling application. */
sigemptyset (&set);
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
sigdelset (&set, sig);
@@ -263,6 +295,7 @@ _rl_handle_signal (int sig)
omask = sigblock (0);
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#endif
#if defined (__EMX__)
signal (sig, SIG_ACK);
@@ -274,7 +307,10 @@ _rl_handle_signal (int sig)
raise (sig); /* assume we have raise */
#endif
- /* Let the signal that we just sent through. */
+ /* We don't need to modify the signal mask now that this is not run in
+ a signal handler context. */
+#if 0
+ /* Let the signal that we just sent through if it is blocked. */
#if defined (HAVE_POSIX_SIGNALS)
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
#else /* !HAVE_POSIX_SIGNALS */
@@ -282,6 +318,7 @@ _rl_handle_signal (int sig)
sigsetmask (omask & ~(sigmask (sig)));
# endif /* HAVE_BSD_SIGNALS */
#endif /* !HAVE_POSIX_SIGNALS */
+#endif
rl_reset_after_signal ();
}
diff --git a/readline/readline/support/config.guess b/readline/readline/support/config.guess
index 15c6cbf..0fc11ed 100755
--- a/readline/readline/support/config.guess
+++ b/readline/readline/support/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2019-08-04'
+timestamp='2020-11-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ timestamp='2019-08-04'
# Please send patches to <config-patches@gnu.org>.
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
usage="\
Usage: $0 [OPTION]
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -99,9 +99,11 @@ tmp=
trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
: "${TMPDIR=/tmp}"
# shellcheck disable=SC2039
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
@@ -129,10 +131,10 @@ if test -f /.attbin/uname ; then
PATH=$PATH:/.attbin ; export PATH
fi
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
+UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
+UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
+UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
case "$UNAME_SYSTEM" in
Linux|GNU|GNU/*)
@@ -148,17 +150,15 @@ Linux|GNU|GNU/*)
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
+ #include <stdarg.h>
+ #ifdef __DEFINED_va_list
+ LIBC=musl
+ #else
LIBC=gnu
#endif
+ #endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
-
- # If ldd exists, use it to detect musl libc.
- if command -v ldd >/dev/null && \
- ldd --version 2>&1 | grep -q ^musl
- then
- LIBC=musl
- fi
+ eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
;;
esac
@@ -177,19 +177,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+ UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
"/sbin/$sysctl" 2>/dev/null || \
"/usr/sbin/$sysctl" 2>/dev/null || \
- echo unknown)`
+ echo unknown))
case "$UNAME_MACHINE_ARCH" in
+ aarch64eb) machine=aarch64_be-unknown ;;
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
- arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+ arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
+ endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
machine="${arch}${endian}"-unknown
;;
*) machine="$UNAME_MACHINE_ARCH"-unknown ;;
@@ -220,7 +221,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
case "$UNAME_MACHINE_ARCH" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
+ abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
;;
esac
# The OS release
@@ -233,7 +234,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
release='-gnu'
;;
*)
- release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
+ release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
@@ -242,19 +243,15 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo "$machine-${os}${release}${abi-}"
exit ;;
*:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
exit ;;
*:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
exit ;;
*:LibertyBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+ UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
exit ;;
*:MidnightBSD:*:*)
@@ -266,6 +263,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:SolidBSD:*:*)
echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
exit ;;
+ *:OS108:*:*)
+ echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
+ exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
exit ;;
@@ -275,26 +275,29 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:Sortix:*:*)
echo "$UNAME_MACHINE"-unknown-sortix
exit ;;
+ *:Twizzler:*:*)
+ echo "$UNAME_MACHINE"-unknown-twizzler
+ exit ;;
*:Redox:*:*)
echo "$UNAME_MACHINE"-unknown-redox
exit ;;
mips:OSF1:*.*)
- echo mips-dec-osf1
- exit ;;
+ echo mips-dec-osf1
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
;;
*5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1)
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE=alpha ;;
@@ -332,7 +335,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
+ echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
@@ -366,7 +369,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ if test "$( (/bin/universe) 2>/dev/null)" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
@@ -379,20 +382,17 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
+ case $(/usr/bin/uname -p) in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
- echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
+ echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
exit ;;
sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux"$UNAME_RELEASE"
+ echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux"$UNAME_RELEASE"
@@ -403,7 +403,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
@@ -411,30 +411,30 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
SUN_ARCH=x86_64
fi
fi
- echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;;
sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
+ case "$(/usr/bin/arch -k)" in
Series*|S4*)
- UNAME_RELEASE=`uname -v`
+ UNAME_RELEASE=$(uname -v)
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
+ echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos"$UNAME_RELEASE"
exit ;;
sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
- case "`/bin/arch`" in
+ case "$(/bin/arch)" in
sun3)
echo m68k-sun-sunos"$UNAME_RELEASE"
;;
@@ -514,8 +514,8 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
}
EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
- dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
+ dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
+ SYSTEM_NAME=$("$dummy" "$dummyarg") &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos"$UNAME_RELEASE"
exit ;;
@@ -542,11 +542,11 @@ EOF
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+ UNAME_PROCESSOR=$(/usr/bin/uname -p)
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
then
- if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
- [ "$TARGET_BINARY_INTERFACE"x = x ]
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
then
echo m88k-dg-dgux"$UNAME_RELEASE"
else
@@ -570,17 +570,17 @@ EOF
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
- echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
+ echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
+ if test -x /usr/bin/oslevel ; then
+ IBM_REV=$(/usr/bin/oslevel)
else
IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi
@@ -600,7 +600,7 @@ EOF
exit(0);
}
EOF
- if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
then
echo "$SYSTEM_NAME"
else
@@ -613,15 +613,15 @@ EOF
fi
exit ;;
*:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')
if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/lslpp ] ; then
- IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
- awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+ if test -x /usr/bin/lslpp ; then
+ IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
else
IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi
@@ -649,14 +649,14 @@ EOF
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
case "$UNAME_MACHINE" in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ if test -x /usr/bin/getconf; then
+ sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
+ sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
case "$sc_cpu_version" in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
@@ -668,7 +668,7 @@ EOF
esac ;;
esac
fi
- if [ "$HP_ARCH" = "" ]; then
+ if test "$HP_ARCH" = ""; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
@@ -703,11 +703,11 @@ EOF
exit (0);
}
EOF
- (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ "$HP_ARCH" = hppa2.0w ]
+ if test "$HP_ARCH" = hppa2.0w
then
set_cc_for_build
@@ -731,7 +731,7 @@ EOF
echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
exit ;;
ia64:HP-UX:*:*)
- HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
echo ia64-hp-hpux"$HPUX_REV"
exit ;;
3050*:HI-UX:*:*)
@@ -761,7 +761,7 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
@@ -781,7 +781,7 @@ EOF
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
+ if test -x /usr/sbin/sysversion ; then
echo "$UNAME_MACHINE"-unknown-osf1mk
else
echo "$UNAME_MACHINE"-unknown-osf1
@@ -830,14 +830,14 @@ EOF
echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+ FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
+ FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+ FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+ FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
+ FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -850,25 +850,25 @@ EOF
echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
exit ;;
arm:FreeBSD:*:*)
- UNAME_PROCESSOR=`uname -p`
+ UNAME_PROCESSOR=$(uname -p)
set_cc_for_build
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
+ echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
else
- echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
+ echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
fi
exit ;;
*:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
+ UNAME_PROCESSOR=$(/usr/bin/uname -p)
case "$UNAME_PROCESSOR" in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
- echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
+ echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
exit ;;
i*:CYGWIN*:*)
echo "$UNAME_MACHINE"-pc-cygwin
@@ -876,9 +876,6 @@ EOF
*:MINGW64*:*)
echo "$UNAME_MACHINE"-pc-mingw64
exit ;;
- *:MINGW64*:*)
- echo "$UNAME_MACHINE"-pc-mingw64
- exit ;;
*:MINGW*:*)
echo "$UNAME_MACHINE"-pc-mingw32
exit ;;
@@ -907,15 +904,15 @@ EOF
echo x86_64-pc-cygwin
exit ;;
prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
+ echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
exit ;;
*:GNU:*:*)
# the GNU system
- echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
+ echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
+ echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
exit ;;
*:Minix:*:*)
echo "$UNAME_MACHINE"-unknown-minix
@@ -928,31 +925,7 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- aarch64:Linux:*:*)
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -1061,7 +1034,7 @@ EOF
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
+ eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
@@ -1081,7 +1054,7 @@ EOF
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
*) echo hppa-unknown-linux-"$LIBC" ;;
@@ -1121,7 +1094,17 @@ EOF
echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
exit ;;
x86_64:Linux:*:*)
- echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+ set_cc_for_build
+ LIBCABI=$LIBC
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_X32 >/dev/null
+ then
+ LIBCABI="$LIBC"x32
+ fi
+ fi
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
exit ;;
xtensa*:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
@@ -1161,7 +1144,7 @@ EOF
echo "$UNAME_MACHINE"-pc-msdosdjgpp
exit ;;
i*86:*:4.*:*)
- UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
+ UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
else
@@ -1170,7 +1153,7 @@ EOF
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
+ case $(/bin/uname -X | grep "^Machine") in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
@@ -1179,10 +1162,10 @@ EOF
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
@@ -1232,7 +1215,7 @@ EOF
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1243,7 +1226,7 @@ EOF
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1276,7 +1259,7 @@ EOF
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=$( (uname -p) 2>/dev/null)
echo "$UNAME_MACHINE"-sni-sysv4
else
echo ns32k-sni-sysv
@@ -1310,7 +1293,7 @@ EOF
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
+ if test -d /usr/nec; then
echo mips-nec-sysv"$UNAME_RELEASE"
else
echo mips-unknown-sysv"$UNAME_RELEASE"
@@ -1358,44 +1341,48 @@ EOF
*:Rhapsody:*:*)
echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
exit ;;
+ arm64:Darwin:*:*)
+ echo aarch64-apple-darwin"$UNAME_RELEASE"
+ exit ;;
*:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
+ UNAME_PROCESSOR=$(uname -p)
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
fi
- if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
- if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_PPC >/dev/null
- then
- UNAME_PROCESSOR=powerpc
- fi
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
fi
echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
+ UNAME_PROCESSOR=$(uname -p)
if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
@@ -1463,10 +1450,10 @@ EOF
echo mips-sei-seiux"$UNAME_RELEASE"
exit ;;
*:DragonFly:*:*)
- echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
+ echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
exit ;;
*:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=$( (uname -p) 2>/dev/null)
case "$UNAME_MACHINE" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1476,7 +1463,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
- echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
+ echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"
exit ;;
i*86:rdos:*:*)
echo "$UNAME_MACHINE"-pc-rdos
@@ -1493,15 +1480,6 @@ EOF
*:Unleashed:*:*)
echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
exit ;;
- i*86:AROS:*:*)
- echo "$UNAME_MACHINE"-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo "$UNAME_MACHINE"-unknown-esx
- exit ;;
- amd64:Isilon\ OneFS:*:*)
- echo x86_64-unknown-onefs
- exit ;;
esac
# No uname command or uname output not recognized.
@@ -1543,7 +1521,7 @@ main ()
#define __ARCHITECTURE__ "m68k"
#endif
int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null);
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
@@ -1627,16 +1605,15 @@ main ()
#endif
#endif
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
- mips:Linux | mips64:Linux)
- # If we got here on MIPS GNU/Linux, output extra information.
- cat >&2 <<EOF
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
-NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
-the system type. Please install a C compiler and try again.
+ exit (1);
+}
EOF
-$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
@@ -1664,6 +1641,12 @@ copies of config.guess and config.sub with the latest versions from:
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+EOF
+
+year=$(echo $timestamp | sed 's,-.*,,')
+# shellcheck disable=SC2003
+if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
@@ -1671,26 +1654,27 @@ provide the necessary information to handle your system.
config.guess timestamp = $timestamp
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+uname -m = $( (uname -m) 2>/dev/null || echo unknown)
+uname -r = $( (uname -r) 2>/dev/null || echo unknown)
+uname -s = $( (uname -s) 2>/dev/null || echo unknown)
+uname -v = $( (uname -v) 2>/dev/null || echo unknown)
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
+/bin/uname -X = $( (/bin/uname -X) 2>/dev/null)
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+hostinfo = $( (hostinfo) 2>/dev/null)
+/bin/universe = $( (/bin/universe) 2>/dev/null)
+/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null)
+/bin/arch = $( (/bin/arch) 2>/dev/null)
+/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null)
+/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
UNAME_MACHINE = "$UNAME_MACHINE"
UNAME_RELEASE = "$UNAME_RELEASE"
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
diff --git a/readline/readline/support/config.sub b/readline/readline/support/config.sub
index 22d774e..c874b7a 100755
--- a/readline/readline/support/config.sub
+++ b/readline/readline/support/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2019 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2019-08-04'
+timestamp='2020-11-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ timestamp='2019-08-04'
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
-me=`echo "$0" | sed -e 's,.*/,,'`
+me=$(echo "$0" | sed -e 's,.*/,,')
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@@ -67,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2019 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -124,28 +124,27 @@ case $1 in
;;
*-*-*-*)
basic_machine=$field1-$field2
- os=$field3-$field4
+ basic_os=$field3-$field4
;;
*-*-*)
# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two
# parts
maybe_os=$field2-$field3
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \
- | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \
+ nto-qnx* | linux-* | uclinux-uclibc* \
| uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \
| netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \
| storm-chaos* | os2-emx* | rtmk-nova*)
basic_machine=$field1
- os=$maybe_os
+ basic_os=$maybe_os
;;
android-linux)
basic_machine=$field1-unknown
- os=linux-android
+ basic_os=linux-android
;;
*)
basic_machine=$field1-$field2
- os=$field3
+ basic_os=$field3
;;
esac
;;
@@ -154,7 +153,7 @@ case $1 in
case $field1-$field2 in
decstation-3100)
basic_machine=mips-dec
- os=
+ basic_os=
;;
*-*)
# Second component is usually, but not always the OS
@@ -162,7 +161,7 @@ case $1 in
# Prevent following clause from handling this valid os
sun*os*)
basic_machine=$field1
- os=$field2
+ basic_os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
@@ -175,11 +174,11 @@ case $1 in
| microblaze* | sim | cisco \
| oki | wec | wrs | winbond)
basic_machine=$field1-$field2
- os=
+ basic_os=
;;
*)
basic_machine=$field1
- os=$field2
+ basic_os=$field2
;;
esac
;;
@@ -191,450 +190,451 @@ case $1 in
case $field1 in
386bsd)
basic_machine=i386-pc
- os=bsd
+ basic_os=bsd
;;
a29khif)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
adobe68k)
basic_machine=m68010-adobe
- os=scout
+ basic_os=scout
;;
alliant)
basic_machine=fx80-alliant
- os=
+ basic_os=
;;
altos | altos3068)
basic_machine=m68k-altos
- os=
+ basic_os=
;;
am29k)
basic_machine=a29k-none
- os=bsd
+ basic_os=bsd
;;
amdahl)
basic_machine=580-amdahl
- os=sysv
+ basic_os=sysv
;;
amiga)
basic_machine=m68k-unknown
- os=
+ basic_os=
;;
amigaos | amigados)
basic_machine=m68k-unknown
- os=amigaos
+ basic_os=amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
- os=sysv4
+ basic_os=sysv4
;;
apollo68)
basic_machine=m68k-apollo
- os=sysv
+ basic_os=sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
- os=bsd
+ basic_os=bsd
;;
aros)
basic_machine=i386-pc
- os=aros
+ basic_os=aros
;;
aux)
basic_machine=m68k-apple
- os=aux
+ basic_os=aux
;;
balance)
basic_machine=ns32k-sequent
- os=dynix
+ basic_os=dynix
;;
blackfin)
basic_machine=bfin-unknown
- os=linux
+ basic_os=linux
;;
cegcc)
basic_machine=arm-unknown
- os=cegcc
+ basic_os=cegcc
;;
convex-c1)
basic_machine=c1-convex
- os=bsd
+ basic_os=bsd
;;
convex-c2)
basic_machine=c2-convex
- os=bsd
+ basic_os=bsd
;;
convex-c32)
basic_machine=c32-convex
- os=bsd
+ basic_os=bsd
;;
convex-c34)
basic_machine=c34-convex
- os=bsd
+ basic_os=bsd
;;
convex-c38)
basic_machine=c38-convex
- os=bsd
+ basic_os=bsd
;;
cray)
basic_machine=j90-cray
- os=unicos
+ basic_os=unicos
;;
crds | unos)
basic_machine=m68k-crds
- os=
+ basic_os=
;;
da30)
basic_machine=m68k-da30
- os=
+ basic_os=
;;
decstation | pmax | pmin | dec3100 | decstatn)
basic_machine=mips-dec
- os=
+ basic_os=
;;
delta88)
basic_machine=m88k-motorola
- os=sysv3
+ basic_os=sysv3
;;
dicos)
basic_machine=i686-pc
- os=dicos
+ basic_os=dicos
;;
djgpp)
basic_machine=i586-pc
- os=msdosdjgpp
+ basic_os=msdosdjgpp
;;
ebmon29k)
basic_machine=a29k-amd
- os=ebmon
+ basic_os=ebmon
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
- os=ose
+ basic_os=ose
;;
gmicro)
basic_machine=tron-gmicro
- os=sysv
+ basic_os=sysv
;;
go32)
basic_machine=i386-pc
- os=go32
+ basic_os=go32
;;
h8300hms)
basic_machine=h8300-hitachi
- os=hms
+ basic_os=hms
;;
h8300xray)
basic_machine=h8300-hitachi
- os=xray
+ basic_os=xray
;;
h8500hms)
basic_machine=h8500-hitachi
- os=hms
+ basic_os=hms
;;
harris)
basic_machine=m88k-harris
- os=sysv3
+ basic_os=sysv3
;;
- hp300)
+ hp300 | hp300hpux)
basic_machine=m68k-hp
+ basic_os=hpux
;;
hp300bsd)
basic_machine=m68k-hp
- os=bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=hpux
+ basic_os=bsd
;;
hppaosf)
basic_machine=hppa1.1-hp
- os=osf
+ basic_os=osf
;;
hppro)
basic_machine=hppa1.1-hp
- os=proelf
+ basic_os=proelf
;;
i386mach)
basic_machine=i386-mach
- os=mach
- ;;
- vsta)
- basic_machine=i386-pc
- os=vsta
+ basic_os=mach
;;
isi68 | isi)
basic_machine=m68k-isi
- os=sysv
+ basic_os=sysv
;;
m68knommu)
basic_machine=m68k-unknown
- os=linux
+ basic_os=linux
;;
magnum | m3230)
basic_machine=mips-mips
- os=sysv
+ basic_os=sysv
;;
merlin)
basic_machine=ns32k-utek
- os=sysv
+ basic_os=sysv
;;
mingw64)
basic_machine=x86_64-pc
- os=mingw64
+ basic_os=mingw64
;;
mingw32)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
mingw32ce)
basic_machine=arm-unknown
- os=mingw32ce
+ basic_os=mingw32ce
;;
monitor)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
morphos)
basic_machine=powerpc-unknown
- os=morphos
+ basic_os=morphos
;;
moxiebox)
basic_machine=moxie-unknown
- os=moxiebox
+ basic_os=moxiebox
;;
msdos)
basic_machine=i386-pc
- os=msdos
+ basic_os=msdos
;;
msys)
basic_machine=i686-pc
- os=msys
+ basic_os=msys
;;
mvs)
basic_machine=i370-ibm
- os=mvs
+ basic_os=mvs
;;
nacl)
basic_machine=le32-unknown
- os=nacl
+ basic_os=nacl
;;
ncr3000)
basic_machine=i486-ncr
- os=sysv4
+ basic_os=sysv4
;;
netbsd386)
basic_machine=i386-pc
- os=netbsd
+ basic_os=netbsd
;;
netwinder)
basic_machine=armv4l-rebel
- os=linux
+ basic_os=linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
- os=newsos
+ basic_os=newsos
;;
news1000)
basic_machine=m68030-sony
- os=newsos
+ basic_os=newsos
;;
necv70)
basic_machine=v70-nec
- os=sysv
+ basic_os=sysv
;;
nh3000)
basic_machine=m68k-harris
- os=cxux
+ basic_os=cxux
;;
nh[45]000)
basic_machine=m88k-harris
- os=cxux
+ basic_os=cxux
;;
nindy960)
basic_machine=i960-intel
- os=nindy
+ basic_os=nindy
;;
mon960)
basic_machine=i960-intel
- os=mon960
+ basic_os=mon960
;;
nonstopux)
basic_machine=mips-compaq
- os=nonstopux
+ basic_os=nonstopux
;;
os400)
basic_machine=powerpc-ibm
- os=os400
+ basic_os=os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
- os=ose
+ basic_os=ose
;;
os68k)
basic_machine=m68k-none
- os=os68k
+ basic_os=os68k
;;
paragon)
basic_machine=i860-intel
- os=osf
+ basic_os=osf
;;
parisc)
basic_machine=hppa-unknown
- os=linux
+ basic_os=linux
+ ;;
+ psp)
+ basic_machine=mipsallegrexel-sony
+ basic_os=psp
;;
pw32)
basic_machine=i586-unknown
- os=pw32
+ basic_os=pw32
;;
rdos | rdos64)
basic_machine=x86_64-pc
- os=rdos
+ basic_os=rdos
;;
rdos32)
basic_machine=i386-pc
- os=rdos
+ basic_os=rdos
;;
rom68k)
basic_machine=m68k-rom68k
- os=coff
+ basic_os=coff
;;
sa29200)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
sei)
basic_machine=mips-sei
- os=seiux
+ basic_os=seiux
;;
sequent)
basic_machine=i386-sequent
- os=
+ basic_os=
;;
sps7)
basic_machine=m68k-bull
- os=sysv2
+ basic_os=sysv2
;;
st2000)
basic_machine=m68k-tandem
- os=
+ basic_os=
;;
stratus)
basic_machine=i860-stratus
- os=sysv4
+ basic_os=sysv4
;;
sun2)
basic_machine=m68000-sun
- os=
+ basic_os=
;;
sun2os3)
basic_machine=m68000-sun
- os=sunos3
+ basic_os=sunos3
;;
sun2os4)
basic_machine=m68000-sun
- os=sunos4
+ basic_os=sunos4
;;
sun3)
basic_machine=m68k-sun
- os=
+ basic_os=
;;
sun3os3)
basic_machine=m68k-sun
- os=sunos3
+ basic_os=sunos3
;;
sun3os4)
basic_machine=m68k-sun
- os=sunos4
+ basic_os=sunos4
;;
sun4)
basic_machine=sparc-sun
- os=
+ basic_os=
;;
sun4os3)
basic_machine=sparc-sun
- os=sunos3
+ basic_os=sunos3
;;
sun4os4)
basic_machine=sparc-sun
- os=sunos4
+ basic_os=sunos4
;;
sun4sol2)
basic_machine=sparc-sun
- os=solaris2
+ basic_os=solaris2
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
- os=
+ basic_os=
;;
sv1)
basic_machine=sv1-cray
- os=unicos
+ basic_os=unicos
;;
symmetry)
basic_machine=i386-sequent
- os=dynix
+ basic_os=dynix
;;
t3e)
basic_machine=alphaev5-cray
- os=unicos
+ basic_os=unicos
;;
t90)
basic_machine=t90-cray
- os=unicos
+ basic_os=unicos
;;
toad1)
basic_machine=pdp10-xkl
- os=tops20
+ basic_os=tops20
;;
tpf)
basic_machine=s390x-ibm
- os=tpf
+ basic_os=tpf
;;
udi29k)
basic_machine=a29k-amd
- os=udi
+ basic_os=udi
;;
ultra3)
basic_machine=a29k-nyu
- os=sym1
+ basic_os=sym1
;;
v810 | necv810)
basic_machine=v810-nec
- os=none
+ basic_os=none
;;
vaxv)
basic_machine=vax-dec
- os=sysv
+ basic_os=sysv
;;
vms)
basic_machine=vax-dec
- os=vms
+ basic_os=vms
+ ;;
+ vsta)
+ basic_machine=i386-pc
+ basic_os=vsta
;;
vxworks960)
basic_machine=i960-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks68)
basic_machine=m68k-wrs
- os=vxworks
+ basic_os=vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
- os=vxworks
+ basic_os=vxworks
;;
xbox)
basic_machine=i686-pc
- os=mingw32
+ basic_os=mingw32
;;
ymp)
basic_machine=ymp-cray
- os=unicos
+ basic_os=unicos
;;
*)
basic_machine=$1
- os=
+ basic_os=
;;
esac
;;
@@ -686,17 +686,17 @@ case $basic_machine in
bluegene*)
cpu=powerpc
vendor=ibm
- os=cnk
+ basic_os=cnk
;;
decsystem10* | dec10*)
cpu=pdp10
vendor=dec
- os=tops10
+ basic_os=tops10
;;
decsystem20* | dec20*)
cpu=pdp10
vendor=dec
- os=tops20
+ basic_os=tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
@@ -706,7 +706,7 @@ case $basic_machine in
dpx2*)
cpu=m68k
vendor=bull
- os=sysv3
+ basic_os=sysv3
;;
encore | umax | mmax)
cpu=ns32k
@@ -715,7 +715,7 @@ case $basic_machine in
elxsi)
cpu=elxsi
vendor=elxsi
- os=${os:-bsd}
+ basic_os=${basic_os:-bsd}
;;
fx2800)
cpu=i860
@@ -728,7 +728,7 @@ case $basic_machine in
h3050r* | hiux*)
cpu=hppa1.1
vendor=hitachi
- os=hiuxwe2
+ basic_os=hiuxwe2
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
cpu=hppa1.0
@@ -769,38 +769,38 @@ case $basic_machine in
vendor=hp
;;
i*86v32)
- cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ cpu=$(echo "$1" | sed -e 's/86.*/86/')
vendor=pc
- os=sysv32
+ basic_os=sysv32
;;
i*86v4*)
- cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ cpu=$(echo "$1" | sed -e 's/86.*/86/')
vendor=pc
- os=sysv4
+ basic_os=sysv4
;;
i*86v)
- cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ cpu=$(echo "$1" | sed -e 's/86.*/86/')
vendor=pc
- os=sysv
+ basic_os=sysv
;;
i*86sol2)
- cpu=`echo "$1" | sed -e 's/86.*/86/'`
+ cpu=$(echo "$1" | sed -e 's/86.*/86/')
vendor=pc
- os=solaris2
+ basic_os=solaris2
;;
j90 | j90-cray)
cpu=j90
vendor=cray
- os=${os:-unicos}
+ basic_os=${basic_os:-unicos}
;;
iris | iris4d)
cpu=mips
vendor=sgi
- case $os in
+ case $basic_os in
irix*)
;;
*)
- os=irix4
+ basic_os=irix4
;;
esac
;;
@@ -811,26 +811,26 @@ case $basic_machine in
*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*)
cpu=m68k
vendor=atari
- os=mint
+ basic_os=mint
;;
news-3600 | risc-news)
cpu=mips
vendor=sony
- os=newsos
+ basic_os=newsos
;;
next | m*-next)
cpu=m68k
vendor=next
- case $os in
+ case $basic_os in
openstep*)
;;
nextstep*)
;;
ns2*)
- os=nextstep2
+ basic_os=nextstep2
;;
*)
- os=nextstep3
+ basic_os=nextstep3
;;
esac
;;
@@ -841,12 +841,12 @@ case $basic_machine in
op50n-* | op60c-*)
cpu=hppa1.1
vendor=oki
- os=proelf
+ basic_os=proelf
;;
pa-hitachi)
cpu=hppa1.1
vendor=hitachi
- os=hiuxwe2
+ basic_os=hiuxwe2
;;
pbd)
cpu=sparc
@@ -883,12 +883,12 @@ case $basic_machine in
sde)
cpu=mipsisa32
vendor=sde
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
simso-wrs)
cpu=sparclite
vendor=wrs
- os=vxworks
+ basic_os=vxworks
;;
tower | tower-32)
cpu=m68k
@@ -905,7 +905,7 @@ case $basic_machine in
w89k-*)
cpu=hppa1.1
vendor=winbond
- os=proelf
+ basic_os=proelf
;;
none)
cpu=none
@@ -917,7 +917,7 @@ case $basic_machine in
;;
leon-*|leon[3-9]-*)
cpu=sparc
- vendor=`echo "$basic_machine" | sed 's/-.*//'`
+ vendor=$(echo "$basic_machine" | sed 's/-.*//')
;;
*-*)
@@ -958,11 +958,11 @@ case $cpu-$vendor in
# some cases the only manufacturer, in others, it is the most popular.
craynv-unknown)
vendor=cray
- os=${os:-unicosmp}
+ basic_os=${basic_os:-unicosmp}
;;
c90-unknown | c90-cray)
vendor=cray
- os=${os:-unicos}
+ basic_os=${Basic_os:-unicos}
;;
fx80-unknown)
vendor=alliant
@@ -1006,7 +1006,7 @@ case $cpu-$vendor in
dpx20-unknown | dpx20-bull)
cpu=rs6000
vendor=bull
- os=${os:-bosx}
+ basic_os=${basic_os:-bosx}
;;
# Here we normalize CPU types irrespective of the vendor
@@ -1015,7 +1015,7 @@ case $cpu-$vendor in
;;
blackfin-*)
cpu=bfin
- os=linux
+ basic_os=linux
;;
c54x-*)
cpu=tic54x
@@ -1028,7 +1028,7 @@ case $cpu-$vendor in
;;
e500v[12]-*)
cpu=powerpc
- os=$os"spe"
+ basic_os=${basic_os}"spe"
;;
mips3*-*)
cpu=mips64
@@ -1038,7 +1038,7 @@ case $cpu-$vendor in
;;
m68knommu-*)
cpu=m68k
- os=linux
+ basic_os=linux
;;
m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*)
cpu=s12z
@@ -1048,7 +1048,7 @@ case $cpu-$vendor in
;;
parisc-*)
cpu=hppa
- os=linux
+ basic_os=linux
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
cpu=i586
@@ -1084,7 +1084,7 @@ case $cpu-$vendor in
cpu=mipsisa64sb1el
;;
sh5e[lb]-*)
- cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
+ cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
;;
spur-*)
cpu=spur
@@ -1102,13 +1102,16 @@ case $cpu-$vendor in
cpu=x86_64
;;
xscale-* | xscalee[bl]-*)
- cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
+ cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
+ ;;
+ arm64-*)
+ cpu=aarch64
;;
# Recognize the canonical CPU Types that limit and/or modify the
# company names they are paired with.
cr16-*)
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
crisv32-* | etraxfs*-*)
cpu=crisv32
@@ -1119,7 +1122,7 @@ case $cpu-$vendor in
vendor=axis
;;
crx-*)
- os=${os:-elf}
+ basic_os=${basic_os:-elf}
;;
neo-tandem)
cpu=neo
@@ -1141,16 +1144,12 @@ case $cpu-$vendor in
cpu=nsx
vendor=tandem
;;
- s390-*)
- cpu=s390
- vendor=ibm
- ;;
- s390x-*)
- cpu=s390x
- vendor=ibm
+ mipsallegrexel-sony)
+ cpu=mipsallegrexel
+ vendor=sony
;;
tile*-*)
- os=${os:-linux-gnu}
+ basic_os=${basic_os:-linux-gnu}
;;
*)
@@ -1167,7 +1166,7 @@ case $cpu-$vendor in
| am33_2.0 \
| amdgcn \
| arc | arceb \
- | arm | arm[lb]e | arme[lb] | armv* \
+ | arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \
| asmjs \
| ba \
@@ -1232,6 +1231,7 @@ case $cpu-$vendor in
| pyramid \
| riscv | riscv32 | riscv64 \
| rl78 | romp | rs6000 | rx \
+ | s390 | s390x \
| score \
| sh | shl \
| sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
@@ -1278,8 +1278,47 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
-if [ x$os != x ]
+if test x$basic_os != x
then
+
+# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
+# set os.
+case $basic_os in
+ gnu/linux*)
+ kernel=linux
+ os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+ ;;
+ os2-emx)
+ kernel=os2
+ os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
+ ;;
+ nto-qnx*)
+ kernel=nto
+ os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
+ ;;
+ *-*)
+ # shellcheck disable=SC2162
+ IFS="-" read kernel os <<EOF
+$basic_os
+EOF
+ ;;
+ # Default OS when just kernel was specified
+ nto*)
+ kernel=nto
+ os=$(echo $basic_os | sed -e 's|nto|qnx|')
+ ;;
+ linux*)
+ kernel=linux
+ os=$(echo $basic_os | sed -e 's|linux|gnu|')
+ ;;
+ *)
+ kernel=
+ os=$basic_os
+ ;;
+esac
+
+# Now, normalize the OS (knowing we just have one component, it's not a kernel,
+# etc.)
case $os in
# First match some system type aliases that might get confused
# with valid system types.
@@ -1291,7 +1330,7 @@ case $os in
os=cnk
;;
solaris1 | solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ os=$(echo $os | sed -e 's|solaris1|sunos4|')
;;
solaris)
os=solaris2
@@ -1299,9 +1338,6 @@ case $os in
unixware*)
os=sysv4.2uw
;;
- gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
# es1800 is here to avoid being matched by es* (a different OS)
es1800*)
os=ose
@@ -1323,12 +1359,9 @@ case $os in
os=sco3.2v4
;;
sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- ;;
- sco3.2v[4-9]* | sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
+ os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
;;
- scout)
+ sco*v* | scout)
# Don't match below
;;
sco*)
@@ -1337,78 +1370,26 @@ case $os in
psos*)
os=psos
;;
- # Now accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST end in a * to match a version number.
- # sysv* is not here because it comes later, after sysvr4.
- gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
- | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\
- | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
- | sym* | kopensolaris* | plan9* \
- | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* \
- | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
- | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
- | knetbsd* | mirbsd* | netbsd* \
- | bitrig* | openbsd* | solidbsd* | libertybsd* \
- | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
- | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
- | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
- | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \
- | chorusrdb* | cegcc* | glidix* \
- | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
- | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \
- | linux-newlib* | linux-musl* | linux-uclibc* \
- | uxpv* | beos* | mpeix* | udk* | moxiebox* \
- | interix* | uwin* | mks* | rhapsody* | darwin* \
- | openstep* | oskit* | conix* | pw32* | nonstopux* \
- | storm-chaos* | tops10* | tenex* | tops20* | its* \
- | os2* | vos* | palmos* | uclinux* | nucleus* \
- | morphos* | superux* | rtmk* | windiss* \
- | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
- | skyos* | haiku* | rdos* | toppers* | drops* | es* \
- | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
qnx*)
- case $cpu in
- x86 | i*86)
- ;;
- *)
- os=nto-$os
- ;;
- esac
+ os=qnx
;;
hiux*)
os=hiuxwe2
;;
- nto-qnx*)
- ;;
- nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- sim | xray | os68k* | v88r* \
- | windows* | osx | abug | netware* | os9* \
- | macos* | mpw* | magic* | mmixware* | mon960* | lnews*)
- ;;
- linux-dietlibc)
- os=linux-dietlibc
- ;;
- linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
lynx*178)
os=lynxos178
;;
lynx*5)
os=lynxos5
;;
+ lynxos*)
+ # don't get caught up in next wildcard
+ ;;
lynx*)
os=lynxos
;;
- mac*)
- os=`echo "$os" | sed -e 's|mac|macos|'`
+ mac[0-9]*)
+ os=$(echo "$os" | sed -e 's|mac|macos|')
;;
opened*)
os=openedition
@@ -1417,10 +1398,10 @@ case $os in
os=os400
;;
sunos5*)
- os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
+ os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
;;
sunos6*)
- os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
+ os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
;;
wince*)
os=wince
@@ -1452,12 +1433,9 @@ case $os in
ns2)
os=nextstep2
;;
- nsk*)
- os=nsk
- ;;
# Preserve the version number of sinix5.
sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
+ os=$(echo $os | sed -e 's|sinix|sysv|')
;;
sinix*)
os=sysv4
@@ -1480,18 +1458,12 @@ case $os in
sysvr4)
os=sysv4
;;
- # This must come after sysvr4.
- sysv*)
- ;;
ose*)
os=ose
;;
*mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
os=mint
;;
- zvmoe)
- os=zvmoe
- ;;
dicos*)
os=dicos
;;
@@ -1508,19 +1480,11 @@ case $os in
;;
esac
;;
- nacl*)
- ;;
- ios)
- ;;
- none)
- ;;
- *-eabi)
- ;;
*)
- echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
- exit 1
+ # No normalization, but not necessarily accepted, that comes below.
;;
esac
+
else
# Here we handle the default operating systems that come with various machines.
@@ -1533,6 +1497,7 @@ else
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
+kernel=
case $cpu-$vendor in
score-*)
os=elf
@@ -1544,7 +1509,8 @@ case $cpu-$vendor in
os=riscix1.2
;;
arm*-rebel)
- os=linux
+ kernel=linux
+ os=gnu
;;
arm*-semi)
os=aout
@@ -1601,9 +1567,6 @@ case $cpu-$vendor in
mips*-*)
os=elf
;;
- or1k-*)
- os=-elf
- ;;
or32-*)
os=coff
;;
@@ -1713,84 +1676,173 @@ case $cpu-$vendor in
os=none
;;
esac
+
fi
+# Now, validate our (potentially fixed-up) OS.
+case $os in
+ # Sometimes we do "kernel-abi", so those need to count as OSes.
+ musl* | newlib* | uclibc*)
+ ;;
+ # Likewise for "kernel-libc"
+ eabi | eabihf | gnueabi | gnueabihf)
+ ;;
+ # Now accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \
+ | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \
+ | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
+ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
+ | hiux* | abug | nacl* | netware* | windows* \
+ | os9* | macos* | osx* | ios* \
+ | mpw* | magic* | mmixware* | mon960* | lnews* \
+ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
+ | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
+ | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
+ | mirbsd* | netbsd* | dicos* | openedition* | ose* \
+ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
+ | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
+ | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
+ | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
+ | udi* | lites* | ieee* | go32* | aux* | hcos* \
+ | chorusrdb* | cegcc* | glidix* \
+ | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
+ | midipix* | mingw32* | mingw64* | mint* \
+ | uxpv* | beos* | mpeix* | udk* | moxiebox* \
+ | interix* | uwin* | mks* | rhapsody* | darwin* \
+ | openstep* | oskit* | conix* | pw32* | nonstopux* \
+ | storm-chaos* | tops10* | tenex* | tops20* | its* \
+ | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \
+ | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \
+ | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
+ | skyos* | haiku* | rdos* | toppers* | drops* | es* \
+ | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
+ ;;
+ # This one is extra strict with allowed versions
+ sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ ;;
+ none)
+ ;;
+ *)
+ echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# As a final step for OS-related things, validate the OS-kernel combination
+# (given a valid OS), if there is a kernel.
+case $kernel-$os in
+ linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
+ ;;
+ uclinux-uclibc* )
+ ;;
+ -dietlibc* | -newlib* | -musl* | -uclibc* )
+ # These are just libc implementations, not actual OSes, and thus
+ # require a kernel.
+ echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2
+ exit 1
+ ;;
+ kfreebsd*-gnu* | kopensolaris*-gnu*)
+ ;;
+ nto-qnx*)
+ ;;
+ os2-emx)
+ ;;
+ *-eabi* | *-gnueabi*)
+ ;;
+ -*)
+ # Blank kernel with real OS is always fine.
+ ;;
+ *-*)
+ echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2
+ exit 1
+ ;;
+esac
+
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
case $vendor in
unknown)
- case $os in
- riscix*)
+ case $cpu-$os in
+ *-riscix*)
vendor=acorn
;;
- sunos*)
+ *-sunos*)
vendor=sun
;;
- cnk*|-aix*)
+ *-cnk* | *-aix*)
vendor=ibm
;;
- beos*)
+ *-beos*)
vendor=be
;;
- hpux*)
+ *-hpux*)
vendor=hp
;;
- mpeix*)
+ *-mpeix*)
vendor=hp
;;
- hiux*)
+ *-hiux*)
vendor=hitachi
;;
- unos*)
+ *-unos*)
vendor=crds
;;
- dgux*)
+ *-dgux*)
vendor=dg
;;
- luna*)
+ *-luna*)
vendor=omron
;;
- genix*)
+ *-genix*)
vendor=ns
;;
- clix*)
+ *-clix*)
vendor=intergraph
;;
- mvs* | opened*)
+ *-mvs* | *-opened*)
+ vendor=ibm
+ ;;
+ *-os400*)
vendor=ibm
;;
- os400*)
+ s390-* | s390x-*)
vendor=ibm
;;
- ptx*)
+ *-ptx*)
vendor=sequent
;;
- tpf*)
+ *-tpf*)
vendor=ibm
;;
- vxsim* | vxworks* | windiss*)
+ *-vxsim* | *-vxworks* | *-windiss*)
vendor=wrs
;;
- aux*)
+ *-aux*)
vendor=apple
;;
- hms*)
+ *-hms*)
vendor=hitachi
;;
- mpw* | macos*)
+ *-mpw* | *-macos*)
vendor=apple
;;
- *mint | mint[0-9]* | *MiNT | MiNT[0-9]*)
+ *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*)
vendor=atari
;;
- vos*)
+ *-vos*)
vendor=stratus
;;
esac
;;
esac
-echo "$cpu-$vendor-$os"
+echo "$cpu-$vendor-${kernel:+$kernel-}$os"
exit
# Local variables:
diff --git a/readline/readline/support/shlib-install b/readline/readline/support/shlib-install
index f4eea27..661355d 100755
--- a/readline/readline/support/shlib-install
+++ b/readline/readline/support/shlib-install
@@ -17,7 +17,7 @@ LDCONFIG=ldconfig
PROGNAME=`basename $0`
USAGE="$PROGNAME [-D] -O host_os [-V host_vendor] -d installation-dir [-b bin-dir] -i install-prog [-U] library"
-# process options
+# process options - should use getopts
while [ $# -gt 0 ]; do
case "$1" in
@@ -118,7 +118,7 @@ INSTALL_LINK2='${echo} cd $INSTALLDIR && ${echo} ${LN} $LIBNAME $LINK2'
# Create symlinks to the installed library. This section is incomplete.
#
case "$host_os-$host_vendor" in
-*linux*|freebsd*-gentoo)
+*linux*|freebsd*|dragonfly*)
# libname.so.M -> libname.so.M.N
${echo} ${RM} ${INSTALLDIR}/$LINK2
if [ -z "$uninstall" ]; then
@@ -154,38 +154,6 @@ solaris2*|aix4.[2-9]*|aix[5-9]*|osf*|irix[56]*|sysv[45]*|dgux*|interix*)
fi
;;
-
-# FreeBSD 3.x and above can have either a.out or ELF shared libraries
-freebsd3*|freebsdaout*)
- if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
- # libname.so -> libname.so.M
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
- if [ -z "$uninstall" ]; then
- eval $INSTALL_LINK1
- fi
- else
- # libname.so.M -> libname.so.M.N
- ${echo} ${RM} ${INSTALLDIR}/$LINK2
- if [ -z "$uninstall" ]; then
- eval $INSTALL_LINK2
- fi
-
- # libname.so -> libname.so.M.N
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
- if [ -z "$uninstall" ]; then
- eval $INSTALL_LINK1
- fi
- fi
- ;;
-
-freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
- # libname.so -> libname.so.M
- ${echo} ${RM} ${INSTALLDIR}/$LINK1
- if [ -z "$uninstall" ]; then
- eval $INSTALL_LINK1
- fi
- ;;
-
hpux1*)
# libname.sl -> libname.M
${echo} ${RM} ${INSTALLDIR}/$LINK1.sl
diff --git a/readline/readline/support/shobj-conf b/readline/readline/support/shobj-conf
index 7920f1b..5a3f977 100755
--- a/readline/readline/support/shobj-conf
+++ b/readline/readline/support/shobj-conf
@@ -10,7 +10,7 @@
# Chet Ramey
# chet@po.cwru.edu
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Bash, the Bourne Again SHell.
#
@@ -65,7 +65,7 @@ while [ $# -gt 0 ]; do
done
case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
-nsk-cc-tandem)
+nsk-cc-tandem|nsk-c99-tandem)
SHOBJ_CFLAGS=-Wglobalized
case `uname -m` in
NSR*)
@@ -123,7 +123,7 @@ sunos5*|solaris2*)
;;
# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
-linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
+linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*|dragonfly*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
@@ -132,44 +132,6 @@ linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
-freebsd2*)
- SHOBJ_CFLAGS=-fpic
- SHOBJ_LD=ld
- SHOBJ_LDFLAGS='-x -Bshareable'
-
- SHLIB_XLDFLAGS='-R$(libdir)'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
- ;;
-
-# FreeBSD-3.x ELF
-freebsd3*|freebsdaout*)
- SHOBJ_CFLAGS=-fPIC
- SHOBJ_LD='${CC}'
-
- if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
-
- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
- else
- SHOBJ_LDFLAGS='-shared'
-
- SHLIB_XLDFLAGS='-R$(libdir)'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
- fi
- ;;
-
-# FreeBSD-4.x and later have only ELF
-freebsd[4-9]*|freebsd1[0-9]*|freebsdelf*|dragonfly*)
- SHOBJ_CFLAGS=-fPIC
- SHOBJ_LD='${CC}'
-
- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
-
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
- ;;
-
# Darwin/MacOS X
darwin*)
# Common definitions for all darwin/mac os x versions
@@ -402,18 +364,15 @@ hpux11*)
SHLIB_STATUS=unsupported
# If you are using the HP ANSI C compiler, you can uncomment and use
- # this code (I have not tested it)
-# SHOBJ_STATUS=supported
-# SHLIB_STATUS=supported
-#
+ # this code from michael.osipov@siemens.com (I have not tested it)
# SHOBJ_CFLAGS='+z'
-# SHOBJ_LD='ld'
-# SHOBJ_LDFLAGS='-b +s +h $@'
+# SHOBJ_LD='$(CC)'
+# SHOBJ_LDFLAGS='-b -Wl,+s -Wl,+h,$@'
#
-# SHLIB_XLDFLAGS='+b $(libdir)'
-# SHLIB_LIBSUFF='sl'
+# SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
+# SHLIB_LIBSUFF='so'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
-
+# SHLIB_LIBS='$(TERMCAP_LIB)'
;;
sysv4*-*gcc*)
diff --git a/readline/readline/terminal.c b/readline/readline/terminal.c
index e557389..05415dc 100644
--- a/readline/readline/terminal.c
+++ b/readline/readline/terminal.c
@@ -152,6 +152,10 @@ static int term_has_meta;
static char *_rl_term_mm;
static char *_rl_term_mo;
+/* The sequences to enter and exit standout mode. */
+static char *_rl_term_so;
+static char *_rl_term_se;
+
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku;
static char *_rl_term_kd;
@@ -177,6 +181,19 @@ static char *_rl_term_kI;
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
+/* It's not clear how HPUX is so broken here. */
+#ifdef TGETENT_BROKEN
+# define TGETENT_SUCCESS 0
+#else
+# define TGETENT_SUCCESS 1
+#endif
+#ifdef TGETFLAG_BROKEN
+# define TGETFLAG_SUCCESS 0
+#else
+# define TGETFLAG_SUCCESS 1
+#endif
+#define TGETFLAG(cap) (tgetflag (cap) == TGETFLAG_SUCCESS)
+
static void bind_termcap_arrow_keys PARAMS((Keymap));
/* Variables that hold the screen dimensions, used by the display code. */
@@ -410,6 +427,8 @@ static const struct _tc_string tc_strings[] =
{ "mo", &_rl_term_mo },
{ "nd", &_rl_term_forward_char },
{ "pc", &_rl_term_pc },
+ { "se", &_rl_term_se },
+ { "so", &_rl_term_so },
{ "up", &_rl_term_up },
{ "vb", &_rl_visible_bell },
{ "vs", &_rl_term_vs },
@@ -437,7 +456,7 @@ _rl_init_terminal_io (const char *terminal_name)
{
const char *term;
char *buffer;
- int tty, tgetent_ret;
+ int tty, tgetent_ret, dumbterm;
term = terminal_name ? terminal_name : sh_get_env_value ("TERM");
_rl_term_clrpag = _rl_term_cr = _rl_term_clreol = _rl_term_clrscroll = (char *)NULL;
@@ -446,6 +465,8 @@ _rl_init_terminal_io (const char *terminal_name)
if (term == 0)
term = "dumb";
+ dumbterm = STREQ (term, "dumb");
+
#ifdef __MSDOS__
_rl_term_im = _rl_term_ei = _rl_term_ic = _rl_term_IC = (char *)NULL;
_rl_term_up = _rl_term_dc = _rl_term_DC = _rl_visible_bell = (char *)NULL;
@@ -457,6 +478,7 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
+ _rl_term_so = _rl_term_se = (char *)NULL;
#if defined(HACK_TERMCAP_MOTION)
_rl_term_forward_char = (char *)NULL;
#endif
@@ -483,7 +505,7 @@ _rl_init_terminal_io (const char *terminal_name)
tgetent_ret = tgetent (term_buffer, term);
}
- if (tgetent_ret <= 0)
+ if (tgetent_ret != TGETENT_SUCCESS)
{
FREE (term_string_buffer);
FREE (term_buffer);
@@ -521,8 +543,13 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
+ _rl_term_so = _rl_term_se = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = 0;
+ /* Assume generic unknown terminal can't handle the enable/disable
+ escape sequences */
+ _rl_enable_bracketed_paste = 0;
+
/* Reasonable defaults for tgoto(). Readline currently only uses
tgoto if _rl_term_IC or _rl_term_DC is defined, but just in case we
change that later... */
@@ -541,10 +568,10 @@ _rl_init_terminal_io (const char *terminal_name)
BC = _rl_term_backspace;
UP = _rl_term_up;
- if (!_rl_term_cr)
+ if (_rl_term_cr == 0)
_rl_term_cr = "\r";
- _rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
+ _rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
/* Allow calling application to set default height and width, using
rl_set_screen_size */
@@ -559,7 +586,7 @@ _rl_init_terminal_io (const char *terminal_name)
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
- term_has_meta = tgetflag ("km") != 0;
+ term_has_meta = TGETFLAG ("km");
if (term_has_meta == 0)
_rl_term_mm = _rl_term_mo = (char *)NULL;
#endif /* !__MSDOS__ */
@@ -574,6 +601,11 @@ _rl_init_terminal_io (const char *terminal_name)
bind_termcap_arrow_keys (vi_insertion_keymap);
#endif /* VI_MODE */
+ /* There's no way to determine whether or not a given terminal supports
+ bracketed paste mode, so we assume a terminal named "dumb" does not. */
+ if (dumbterm)
+ _rl_enable_bracketed_paste = 0;
+
return 0;
}
@@ -676,6 +708,16 @@ rl_crlf (void)
return 0;
}
+void
+_rl_cr (void)
+{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
+}
+
/* Ring the terminal bell. */
int
rl_ding (void)
@@ -710,6 +752,30 @@ rl_ding (void)
/* **************************************************************** */
/* */
+/* Entering and leaving terminal standout mode */
+/* */
+/* **************************************************************** */
+
+void
+_rl_standout_on (void)
+{
+#ifndef __MSDOS__
+ if (_rl_term_so && _rl_term_se)
+ tputs (_rl_term_so, 1, _rl_output_character_function);
+#endif
+}
+
+void
+_rl_standout_off (void)
+{
+#ifndef __MSDOS__
+ if (_rl_term_so && _rl_term_se)
+ tputs (_rl_term_se, 1, _rl_output_character_function);
+#endif
+}
+
+/* **************************************************************** */
+/* */
/* Controlling the Meta Key and Keypad */
/* */
/* **************************************************************** */
diff --git a/readline/readline/text.c b/readline/readline/text.c
index cddaeeb..2567dea 100644
--- a/readline/readline/text.c
+++ b/readline/readline/text.c
@@ -1,6 +1,6 @@
/* text.c -- text handling commands for readline. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -154,6 +154,7 @@ rl_delete_text (int from, int to)
rl_end -= diff;
rl_line_buffer[rl_end] = '\0';
+ _rl_fix_mark ();
return (diff);
}
@@ -176,6 +177,12 @@ _rl_fix_point (int fix_mark_too)
if (fix_mark_too)
_RL_FIX_POINT (rl_mark);
}
+
+void
+_rl_fix_mark (void)
+{
+ _RL_FIX_POINT (rl_mark);
+}
#undef _RL_FIX_POINT
/* Replace the contents of the line buffer between START and END with
@@ -479,6 +486,8 @@ rl_forward_word (int count, int key)
while (count)
{
+ if (rl_point > rl_end)
+ rl_point = rl_end;
if (rl_point == rl_end)
return 0;
@@ -498,6 +507,8 @@ rl_forward_word (int count, int key)
}
}
+ if (rl_point > rl_end)
+ rl_point = rl_end;
if (rl_point == rl_end)
return 0;
@@ -569,18 +580,8 @@ rl_backward_word (int count, int key)
int
rl_refresh_line (int ignore1, int ignore2)
{
- int curr_line;
-
- curr_line = _rl_current_display_line ();
-
- _rl_move_vert (curr_line);
- _rl_move_cursor_relative (0, rl_line_buffer); /* XXX is this right */
-
- _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
-
- rl_redraw_prompt_last_line ();
+ _rl_refresh_line ();
rl_display_fixed = 1;
-
return 0;
}
@@ -596,7 +597,18 @@ rl_clear_screen (int count, int key)
return 0;
}
- _rl_clear_screen (); /* calls termcap function to clear screen */
+ _rl_clear_screen (0); /* calls termcap function to clear screen */
+ rl_keep_mark_active ();
+ rl_forced_update_display ();
+ rl_display_fixed = 1;
+
+ return 0;
+}
+
+int
+rl_clear_display (int count, int key)
+{
+ _rl_clear_screen (1); /* calls termcap function to clear screen and scrollback buffer */
rl_forced_update_display ();
rl_display_fixed = 1;
@@ -1080,6 +1092,13 @@ rl_tab_insert (int count, int key)
int
rl_newline (int count, int key)
{
+ if (rl_mark_active_p ())
+ {
+ rl_deactivate_mark ();
+ (*rl_redisplay_function) ();
+ _rl_want_redisplay = 0;
+ }
+
rl_done = 1;
if (_rl_history_preserve_point)
@@ -1452,7 +1471,18 @@ rl_change_case (int count, int op)
if (nwc != wc) /* just skip unchanged characters */
{
char *s, *e;
- mlen = wcrtomb (mb, nwc, &mps);
+ mbstate_t ts;
+
+ memset (&ts, 0, sizeof (mbstate_t));
+ mlen = wcrtomb (mb, nwc, &ts);
+ if (mlen < 0)
+ {
+ nwc = wc;
+ memset (&ts, 0, sizeof (mbstate_t));
+ mlen = wcrtomb (mb, nwc, &ts);
+ if (mlen < 0) /* should not happen */
+ strncpy (mb, rl_line_buffer + start, mlen = m);
+ }
if (mlen > 0)
mb[mlen] = '\0';
/* what to do if m != mlen? adjust below */
@@ -1472,7 +1502,9 @@ rl_change_case (int count, int op)
}
else if (m < mlen)
{
- rl_extend_line_buffer (mlen - m + 1);
+ rl_extend_line_buffer (rl_end + mlen + (e - s) - m + 2);
+ s = rl_line_buffer + start; /* have to redo this */
+ e = rl_line_buffer + rl_end;
memmove (s + mlen, s + m, (e - s) - m);
memcpy (s, mb, mlen);
next += mlen - m; /* next char changes */
@@ -1711,10 +1743,7 @@ _rl_char_search (int count, int fdir, int bdir)
{
int c;
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
+ c = _rl_bracketed_read_key ();
if (c < 0)
return 1;
@@ -1809,7 +1838,43 @@ rl_exchange_point_and_mark (int count, int key)
return 1;
}
else
- SWAP (rl_point, rl_mark);
+ {
+ SWAP (rl_point, rl_mark);
+ rl_activate_mark ();
+ }
return 0;
}
+
+/* Active mark support */
+
+/* Is the region active? */
+static int mark_active = 0;
+
+/* Does the current command want the mark to remain active when it completes? */
+int _rl_keep_mark_active;
+
+void
+rl_keep_mark_active (void)
+{
+ _rl_keep_mark_active++;
+}
+
+void
+rl_activate_mark (void)
+{
+ mark_active = 1;
+ rl_keep_mark_active ();
+}
+
+void
+rl_deactivate_mark (void)
+{
+ mark_active = 0;
+}
+
+int
+rl_mark_active_p (void)
+{
+ return (mark_active);
+}
diff --git a/readline/readline/tilde.c b/readline/readline/tilde.c
index 9d0f296..d678a31 100644
--- a/readline/readline/tilde.c
+++ b/readline/readline/tilde.c
@@ -1,6 +1,6 @@
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
-/* Copyright (C) 1988-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1988-2020 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.
@@ -57,10 +57,10 @@ static void *xmalloc (), *xrealloc ();
#if !defined (HAVE_GETPW_DECLS)
# if defined (HAVE_GETPWUID)
-extern struct passwd *getpwuid PARAMS((uid_t));
+extern struct passwd *getpwuid (uid_t);
# endif
# if defined (HAVE_GETPWNAM)
-extern struct passwd *getpwnam PARAMS((const char *));
+extern struct passwd *getpwnam (const char *);
# endif
#endif /* !HAVE_GETPW_DECLS */
@@ -79,8 +79,8 @@ extern struct passwd *getpwnam PARAMS((const char *));
/* If being compiled as part of bash, these will be satisfied from
variables.o. If being compiled as part of readline, they will
be satisfied from shell.o. */
-extern char *sh_get_home_dir PARAMS((void));
-extern char *sh_get_env_value PARAMS((const char *));
+extern char *sh_get_home_dir (void);
+extern char *sh_get_env_value (const char *);
/* The default value of tilde_additional_prefixes. This is set to
whitespace preceding a tilde so that simple programs which do not
@@ -116,10 +116,10 @@ char **tilde_additional_prefixes = (char **)default_prefixes;
`:' and `=~'. */
char **tilde_additional_suffixes = (char **)default_suffixes;
-static int tilde_find_prefix PARAMS((const char *, int *));
-static int tilde_find_suffix PARAMS((const char *));
-static char *isolate_tilde_prefix PARAMS((const char *, int *));
-static char *glue_prefix_and_suffix PARAMS((char *, const char *, int));
+static int tilde_find_prefix (const char *, int *);
+static int tilde_find_suffix (const char *);
+static char *isolate_tilde_prefix (const char *, int *);
+static char *glue_prefix_and_suffix (char *, const char *, int);
/* Find the start of a tilde expansion in STRING, and return the index of
the tilde which starts the expansion. Place the length of the text
diff --git a/readline/readline/undo.c b/readline/readline/undo.c
index ae65d38..1479991 100644
--- a/readline/readline/undo.c
+++ b/readline/readline/undo.c
@@ -196,6 +196,7 @@ rl_do_undo (void)
/* Undoing deletes means inserting some text. */
case UNDO_DELETE:
rl_point = start;
+ _rl_fix_point (1);
rl_insert_text (rl_undo_list->text);
xfree (rl_undo_list->text);
break;
@@ -204,6 +205,7 @@ rl_do_undo (void)
case UNDO_INSERT:
rl_delete_text (start, end);
rl_point = start;
+ _rl_fix_point (1);
break;
/* Undoing an END means undoing everything 'til we get to a BEGIN. */
diff --git a/readline/readline/util.c b/readline/readline/util.c
index e8ae9d7..1576b55 100644
--- a/readline/readline/util.c
+++ b/readline/readline/util.c
@@ -102,10 +102,11 @@ _rl_abort_internal (void)
rl_clear_message ();
_rl_reset_argument ();
rl_clear_pending_input ();
+ rl_deactivate_mark ();
- RL_UNSETSTATE (RL_STATE_MACRODEF);
while (rl_executing_macro)
_rl_pop_executing_macro ();
+ _rl_kill_kbd_macro ();
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
@@ -502,17 +503,14 @@ _rl_tropen (void)
if (_rl_tracefp)
fclose (_rl_tracefp);
#if defined (_WIN32) && !defined (__CYGWIN__)
- /* Windows doesn't have /var/tmp, so open the trace file in the
- user's temporary directory instead. */
- snprintf (fnbuf, sizeof (fnbuf), "%s/rltrace.%ld",
- (sh_get_env_value ("TEMP")
- ? sh_get_env_value ("TEMP")
- : "."),
- getpid ());
+ x = sh_get_env_value ("TEMP");
+ if (x == 0)
+ x = ".";
#else
- sprintf (fnbuf, "/var/tmp/rltrace.%ld", (long) getpid ());
+ x = "/var/tmp";
#endif
- unlink (fnbuf);
+ snprintf (fnbuf, sizeof (fnbuf), "%s/rltrace.%ld", x, (long)getpid());
+ unlink(fnbuf);
_rl_tracefp = fopen (fnbuf, "w+");
return _rl_tracefp != 0;
}
diff --git a/readline/readline/vi_mode.c b/readline/readline/vi_mode.c
index 836371c..742341e 100644
--- a/readline/readline/vi_mode.c
+++ b/readline/readline/vi_mode.c
@@ -1,7 +1,7 @@
/* vi_mode.c -- A vi emulation mode for Bash.
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
-/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2020 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.
@@ -298,6 +298,11 @@ rl_vi_redo (int count, int c)
if (rl_point > 0)
_rl_vi_backup ();
}
+ else if (_rl_vi_last_command == '.' && _rl_keymap == vi_movement_keymap)
+ {
+ rl_ding ();
+ r = 0;
+ }
else
r = _rl_dispatch (_rl_vi_last_command, _rl_keymap);
@@ -320,9 +325,9 @@ rl_vi_yank_arg (int count, int key)
/* Readline thinks that the first word on a line is the 0th, while vi
thinks the first word on a line is the 1st. Compensate. */
if (rl_explicit_arg)
- rl_yank_nth_arg (count - 1, 0);
+ rl_yank_nth_arg (count - 1, key);
else
- rl_yank_nth_arg ('$', 0);
+ rl_yank_nth_arg ('$', key);
return (0);
}
@@ -837,6 +842,12 @@ _rl_vi_save_replace (void)
start = end - vi_replace_count + 1;
len = vi_replace_count + 1;
+ if (start < 0)
+ {
+ len = end + 1;
+ start = 0;
+ }
+
vi_save_insert_buffer (start, len);
}
@@ -864,8 +875,8 @@ _rl_vi_done_inserting (void)
{
if (_rl_vi_doing_insert)
{
- /* The `C', `s', and `S' commands set this. */
- rl_end_undo_group ();
+ /* The `c', `s', `S', and `R' commands set this. */
+ rl_end_undo_group (); /* for the group in rl_vi_start_inserting */
/* Now, the text between rl_undo_list->next->start and
rl_undo_list->next->end is what was inserted while in insert
mode. It gets copied to VI_INSERT_BUFFER because it depends
@@ -876,7 +887,9 @@ _rl_vi_done_inserting (void)
_rl_vi_save_replace (); /* Half the battle */
else
_rl_vi_save_insert (rl_undo_list->next);
- vi_continued_command = 1;
+ /* sanity check, should always be >= 1 here */
+ if (_rl_undo_group_level > 0)
+ rl_end_undo_group (); /* for the group in the command (change or replace) */
}
else
{
@@ -888,10 +901,12 @@ _rl_vi_done_inserting (void)
/* XXX - Other keys probably need to be checked. */
else if (_rl_vi_last_key_before_insert == 'C')
rl_end_undo_group ();
- while (_rl_undo_group_level > 0)
- rl_end_undo_group ();
- vi_continued_command = 0;
}
+
+ /* Sanity check, make sure all the undo groups are closed before we leave
+ insert mode */
+ while (_rl_undo_group_level > 0)
+ rl_end_undo_group ();
}
int
@@ -1162,6 +1177,7 @@ rl_domove_motion_callback (_rl_vimotion_cxt *m)
/* Append a blank character temporarily so that the motion routines
work right at the end of the line. Original value of rl_end is saved
as m->end. */
+ rl_extend_line_buffer (rl_end + 1);
rl_line_buffer[rl_end++] = ' ';
rl_line_buffer[rl_end] = '\0';
@@ -1193,12 +1209,15 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
/* Remove the blank that we added in rl_domove_motion_callback. */
rl_end = m->end;
rl_line_buffer[rl_end] = '\0';
- if (rl_point > rl_end)
- rl_point = rl_end;
+ _rl_fix_point (0);
/* No change in position means the command failed. */
if (rl_mark == rl_point)
{
+ /* 'c' and 'C' enter insert mode after the delete even if the motion
+ didn't delete anything, as long as the motion command is valid. */
+ if (_rl_to_upper (m->key) == 'C' && _rl_vi_motion_command (c))
+ return (vidomove_dispatch (m));
RL_UNSETSTATE (RL_STATE_VIMOTION);
return (-1);
}
@@ -1316,13 +1335,7 @@ rl_domove_read_callback (_rl_vimotion_cxt *m)
static int
rl_vi_domove_getchar (_rl_vimotion_cxt *m)
{
- int c;
-
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
- return c;
+ return (_rl_bracketed_read_key ());
}
#if defined (READLINE_CALLBACKS)
@@ -1377,7 +1390,11 @@ rl_vi_delete_to (int count, int key)
{
int c, r;
- _rl_vimvcxt = _rl_mvcxt_alloc (VIM_DELETE, key);
+ if (_rl_vimvcxt)
+ _rl_mvcxt_init (_rl_vimvcxt, VIM_DELETE, key);
+ else
+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_DELETE, key);
+
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -1465,7 +1482,10 @@ rl_vi_change_to (int count, int key)
{
int c, r;
- _rl_vimvcxt = _rl_mvcxt_alloc (VIM_CHANGE, key);
+ if (_rl_vimvcxt)
+ _rl_mvcxt_init (_rl_vimvcxt, VIM_CHANGE, key);
+ else
+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_CHANGE, key);
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -1524,6 +1544,8 @@ vi_yank_dispatch (_rl_vimotion_cxt *m)
rl_do_undo ();
rl_point = m->start;
+ _rl_fix_point (1);
+
return (0);
}
@@ -1532,7 +1554,10 @@ rl_vi_yank_to (int count, int key)
{
int c, r;
- _rl_vimvcxt = _rl_mvcxt_alloc (VIM_YANK, key);
+ if (_rl_vimvcxt)
+ _rl_mvcxt_init (_rl_vimvcxt, VIM_YANK, key);
+ else
+ _rl_vimvcxt = _rl_mvcxt_alloc (VIM_YANK, key);
_rl_vimvcxt->start = rl_point;
rl_mark = rl_point;
@@ -2000,21 +2025,7 @@ _rl_vi_change_char (int count, int c, char *mb)
static int
_rl_vi_callback_getchar (char *mb, int mlen)
{
- int c;
-
- RL_SETSTATE(RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE(RL_STATE_MOREINPUT);
-
- if (c < 0)
- return -1;
-
-#if defined (HANDLE_MULTIBYTE)
- if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- c = _rl_read_mbstring (c, mb, mlen);
-#endif
-
- return c;
+ return (_rl_bracketed_read_mbstring (mb, mlen));
}
#if defined (READLINE_CALLBACKS)
@@ -2026,10 +2037,11 @@ _rl_vi_callback_change_char (_rl_callback_generic_arg *data)
c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
#if defined (HANDLE_MULTIBYTE)
- strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
-#else
- _rl_vi_last_replacement[0] = c;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+ else
#endif
+ _rl_vi_last_replacement[0] = c;
_rl_vi_last_replacement[MB_LEN_MAX] = '\0'; /* XXX */
if (c < 0)
@@ -2066,10 +2078,11 @@ rl_vi_change_char (int count, int key)
{
c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
#ifdef HANDLE_MULTIBYTE
- strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
-#else
- _rl_vi_last_replacement[0] = c;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+ else
#endif
+ _rl_vi_last_replacement[0] = c;
_rl_vi_last_replacement[MB_LEN_MAX] = '\0'; /* just in case */
}
@@ -2122,7 +2135,7 @@ rl_vi_overstrike_delete (int count, int key)
s = rl_point;
if (rl_do_undo ())
- vi_replace_count--;
+ vi_replace_count--; /* XXX */
if (rl_point == s)
rl_backward_char (1, key);
@@ -2137,6 +2150,67 @@ rl_vi_overstrike_delete (int count, int key)
return (0);
}
+static int
+rl_vi_overstrike_kill_line (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_unix_line_discard (count, key);
+ vi_replace_count -= end - rl_end;
+ return r;
+}
+
+static int
+rl_vi_overstrike_kill_word (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_vi_unix_word_rubout (count, key);
+ vi_replace_count -= end - rl_end;
+ return r;
+}
+
+static int
+rl_vi_overstrike_yank (int count, int key)
+{
+ int r, end;
+
+ end = rl_end;
+ r = rl_yank (count, key);
+ vi_replace_count += rl_end - end;
+ return r;
+}
+
+/* Read bracketed paste mode pasted text and insert it in overwrite mode */
+static int
+rl_vi_overstrike_bracketed_paste (int count, int key)
+{
+ int r;
+ char *pbuf;
+ size_t pblen;
+
+ pbuf = _rl_bracketed_text (&pblen);
+ if (pblen == 0)
+ {
+ xfree (pbuf);
+ return 0;
+ }
+ r = pblen;
+ while (--r >= 0)
+ _rl_unget_char ((unsigned char)pbuf[r]);
+ xfree (pbuf);
+
+ while (_rl_pushed_input_available ())
+ {
+ key = rl_read_key ();
+ r = rl_vi_overstrike (1, key);
+ }
+
+ return r;
+}
+
int
rl_vi_replace (int count, int key)
{
@@ -2169,6 +2243,21 @@ rl_vi_replace (int count, int key)
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
+ /* Same for ^U and unix-line-discard. */
+ if (vi_insertion_keymap[CTRL ('U')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('U')].function == rl_unix_line_discard)
+ vi_replace_map[CTRL ('U')].function = rl_vi_overstrike_kill_line;
+
+ /* And for ^W and unix-word-rubout. */
+ if (vi_insertion_keymap[CTRL ('W')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('W')].function == rl_vi_unix_word_rubout)
+ vi_replace_map[CTRL ('W')].function = rl_vi_overstrike_kill_word;
+
+ /* And finally for ^Y and yank. */
+ if (vi_insertion_keymap[CTRL ('Y')].type == ISFUNC &&
+ vi_insertion_keymap[CTRL ('Y')].function == rl_yank)
+ vi_replace_map[CTRL ('Y')].function = rl_vi_overstrike_yank;
+
/* Make sure this is the value we need. */
vi_replace_map[ANYOTHERKEY].type = ISFUNC;
vi_replace_map[ANYOTHERKEY].function = (rl_command_func_t *)NULL;
@@ -2176,9 +2265,12 @@ rl_vi_replace (int count, int key)
rl_vi_start_inserting (key, 1, rl_arg_sign);
- _rl_vi_last_key_before_insert = key;
+ _rl_vi_last_key_before_insert = 'R'; /* in case someone rebinds it */
_rl_keymap = vi_replace_map;
+ if (_rl_enable_bracketed_paste)
+ rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_vi_overstrike_bracketed_paste);
+
return (0);
}
@@ -2268,6 +2360,7 @@ _rl_vi_goto_mark (void)
if (ch == '`')
{
rl_point = rl_mark;
+ _rl_fix_point (1);
return 0;
}
else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
@@ -2283,6 +2376,7 @@ _rl_vi_goto_mark (void)
return 1;
}
rl_point = vi_mark_chars[ch];
+ _rl_fix_point (1);
return 0;
}