From: Chet Ramey Date: Fri, 10 Sep 2021 14:00:41 +0000 (-0400) Subject: changes to unix-filename-rubout, non-incremental history searching, some autoconf... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be7fa2a243809d4c60adcb181808620b500dffd7;p=thirdparty%2Freadline.git changes to unix-filename-rubout, non-incremental history searching, some autoconf updates --- diff --git a/CHANGELOG b/CHANGELOG index 3ccb28e..51b70df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -\[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 @@ -1414,3 +1414,20 @@ confiugre.ac - use `:+' when testing the value of $GCC, since autoconf seems to set it to the empty string if gcc isn't the compiler. Reported by Osipov, Michael (LDA IT PLM) + + 9/2 + --- +configure.ac + - AC_HELP_STRING -> AS_HELP_STRING + - AC_OUTPUT: split into AC_CONFIG_FILES and AC_CONFIG_COMMANDS, call + AC_OUTPUT without any parameters + + 9/3 + --- +configure.ac, config.h.in + - AC_TYPE_SIGNAL,BASH_TYPE_SIGHANDLER: remove calls, remove mention of + RETSIGTYPE and VOID_SIGHANDLER + - AC_HEADER_TIME: removed + - AC_USE_SYSTEM_EXTENSIONS: use instead of AC_AIX and AC_MINIX + - AC_HEADER_STDC: removed + - BASH_FUNC_CTYPE_NONASCII: removed diff --git a/aclocal.m4 b/aclocal.m4 index 6899e82..be478a2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -72,13 +72,14 @@ dnl dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) AC_DEFUN(BASH_CHECK_TYPE, [ -AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([BASH_HEADER_INTTYPES]) AC_MSG_CHECKING(for $1) AC_CACHE_VAL(bash_cv_type_$1, [AC_EGREP_CPP($1, [#include -#if STDC_HEADERS +#if HAVE_STDLIB_H #include +#endif +#if HAVE_STDDEF_H #include #endif #if HAVE_INTTYPES_H @@ -106,12 +107,11 @@ dnl AC_CHECK_DECL dnl AC_DEFUN(BASH_CHECK_DECL, [ -AC_REQUIRE([AC_HEADER_STDC]) AC_REQUIRE([BASH_HEADER_INTTYPES]) AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1, [AC_TRY_LINK( [ -#if STDC_HEADERS +#if HAVE_STDLIB_H # include #endif #if HAVE_INTTYPES_H @@ -216,8 +216,19 @@ AC_DEFINE(HAVE_UNDER_SYS_SIGLIST) fi ]) +dnl this defines HAVE_DECL_SYS_SIGLIST +AC_DEFUN([BASH_DECL_SYS_SIGLIST], +[AC_CHECK_DECLS([sys_siglist],,, +[#include +/* NetBSD declares sys_siglist in unistd.h. */ +#ifdef HAVE_UNISTD_H +# include +#endif +]) +]) + AC_DEFUN(BASH_SYS_SIGLIST, -[AC_REQUIRE([AC_DECL_SYS_SIGLIST]) +[AC_REQUIRE([BASH_DECL_SYS_SIGLIST]) AC_MSG_CHECKING([for sys_siglist in system C library]) AC_CACHE_VAL(bash_cv_sys_siglist, [AC_TRY_RUN([ @@ -645,12 +656,13 @@ fi # We should check for putenv before calling this AC_DEFUN(BASH_FUNC_STD_PUTENV, [ -AC_REQUIRE([AC_HEADER_STDC]) AC_REQUIRE([AC_C_PROTOTYPES]) AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv, [AC_TRY_LINK([ -#if STDC_HEADERS +#if HAVE_STDLIB_H #include +#endif +#if HAVE_STDDEF_H #include #endif #ifndef __STDC__ @@ -675,12 +687,13 @@ fi # We should check for unsetenv before calling this AC_DEFUN(BASH_FUNC_STD_UNSETENV, [ -AC_REQUIRE([AC_HEADER_STDC]) AC_REQUIRE([AC_C_PROTOTYPES]) AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv, [AC_TRY_LINK([ -#if STDC_HEADERS +#if HAVE_STDLIB_H #include +#endif +#if HAVE_STDDEF_H #include #endif #ifndef __STDC__ @@ -2060,7 +2073,7 @@ dnl AC_DEFUN([AM_PATH_LISPDIR], - [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]), + [AC_ARG_WITH(lispdir, AS_HELP_STRING([--with-lispdir], [override the default lisp directory]), [ lispdir="$withval" AC_MSG_CHECKING([where .elc files should go]) AC_MSG_RESULT([$lispdir])], diff --git a/chardefs.h b/chardefs.h index 3cf1326..dfbdf31 100644 --- a/chardefs.h +++ b/chardefs.h @@ -26,9 +26,6 @@ #if defined (HAVE_CONFIG_H) # if defined (HAVE_STRING_H) -# if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H) -# include -# endif # include # endif /* HAVE_STRING_H */ # if defined (HAVE_STRINGS_H) @@ -66,22 +63,26 @@ #define UNMETA(c) ((c) & (~meta_character_bit)) #define UNCTRL(c) _rl_to_upper(((c)|control_character_bit)) -#if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) +#ifndef UCHAR_MAX +# define UCHAR_MAX 255 #endif - -#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) -# define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) +#ifndef CHAR_MAX +# define CHAR_MAX 127 #endif -#if defined (CTYPE_NON_ASCII) +/* use this as a proxy for C89 */ +#if defined (HAVE_STDLIB_H) && defined (HAVE_STRING_H) +# define IN_CTYPE_DOMAIN(c) 1 # define NON_NEGATIVE(c) 1 #else +# define IN_CTYPE_DOMAIN(c) ((c) >= 0 && (c) <= CHAR_MAX) # define NON_NEGATIVE(c) ((unsigned char)(c) == (c)) #endif +#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) +# define isxdigit(c) (isdigit((unsigned char)(c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) +#endif + /* Some systems define these; we want our definitions. */ #undef ISPRINT @@ -99,12 +100,12 @@ #define _rl_uppercase_p(c) (NON_NEGATIVE(c) && ISUPPER(c)) #define _rl_digit_p(c) ((c) >= '0' && (c) <= '9') +#define _rl_alphabetic_p(c) (NON_NEGATIVE(c) && ISALNUM(c)) #define _rl_pure_alphabetic(c) (NON_NEGATIVE(c) && ISALPHA(c)) -#define ALPHABETIC(c) (NON_NEGATIVE(c) && ISALNUM(c)) #ifndef _rl_to_upper -# define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c)) -# define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c)) +# define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)(c)) : (c)) +# define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)(c)) : (c)) #endif #ifndef _rl_digit_value diff --git a/config.h.in b/config.h.in index bc6753f..ff2f811 100644 --- a/config.h.in +++ b/config.h.in @@ -1,6 +1,8 @@ /* config.h.in. Maintained by hand. */ /* Template definitions for autoconf */ + +/* These are set by AC_USE_SYSTEM_EXTENSIONS */ #undef __EXTENSIONS__ #undef _ALL_SOURCE #undef _GNU_SOURCE @@ -16,11 +18,6 @@ #undef _FILE_OFFSET_BITS -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE - -#undef VOID_SIGHANDLER - /* Characteristics of the compiler. */ #undef sig_atomic_t @@ -156,8 +153,6 @@ /* and whether it works */ #undef WCWIDTH_BROKEN -#undef STDC_HEADERS - /* Define if you have the header file. */ #undef HAVE_DIRENT_H @@ -268,11 +263,7 @@ /* Define if you have and it defines AUDIT_USER_TTY */ #undef HAVE_DECL_AUDIT_USER_TTY -#undef TIME_WITH_SYS_TIME - /* Definitions pulled in from aclocal.m4. */ -#undef VOID_SIGHANDLER - #undef GWINSZ_IN_SYS_IOCTL #undef STRUCT_WINSIZE_IN_SYS_IOCTL diff --git a/configure b/configure index e338be6..5ca5bd8 100644 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac for Readline 8.1, version 2.91. +# From configure.ac for Readline 8.1, version 2.92. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for readline 8.1. # @@ -7890,7 +7890,9 @@ CFLAGS="$CFLAGS $STYLE_CFLAGS" ac_config_files="$ac_config_files Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc" -ac_config_commands="$ac_config_commands default" + +ac_config_commands="$ac_config_commands stamp-h" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8587,7 +8589,7 @@ do "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "shlib/Makefile") CONFIG_FILES="$CONFIG_FILES shlib/Makefile" ;; "readline.pc") CONFIG_FILES="$CONFIG_FILES readline.pc" ;; - "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -9143,10 +9145,7 @@ printf "%s\n" "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in - "default":C) -# Makefile uses this timestamp file to record whether config.h is up to date. -echo > stamp-h - ;; + "stamp-h":C) echo > stamp-h ;; esac done # for ac_tag diff --git a/configure.ac b/configure.ac index 58217ad..13aa7c0 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl report bugs to chet@po.cwru.edu dnl dnl Process this file with autoconf to produce a configure script. -# Copyright (C) 1987-2020 Free Software Foundation, Inc. +# Copyright (C) 1987-2021 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,12 +20,12 @@ dnl Process this file with autoconf to produce a configure script. # You should have received a copy of the GNU General Public License # along with this program. If not, see . -AC_REVISION([for Readline 8.1, version 2.91]) +AC_REVISION([for Readline 8.1, version 2.94]) AC_INIT(readline, 8.1, bug-readline@gnu.org) dnl make sure we are using a recent autoconf version -AC_PREREQ(2.50) +AC_PREREQ(2.63) AC_CONFIG_SRCDIR(readline.h) AC_CONFIG_AUX_DIR(./support) @@ -41,7 +41,7 @@ dnl configure defaults opt_curses=no dnl arguments to configure -AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval) +AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval) if test "$opt_curses" = "yes"; then prefer_curses=yes @@ -54,12 +54,12 @@ opt_shared_libs=yes opt_install_examples=yes opt_bracketed_paste_default=yes -AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval) -AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval) -AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval) -AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval) +AC_ARG_ENABLE(multibyte, AS_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval) +AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval) +AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval) +AC_ARG_ENABLE(install-examples, AS_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) +AC_ARG_ENABLE(bracketed-paste-default, AS_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) @@ -111,13 +111,12 @@ test -z "$CFLAGS" && want_auto_cflags=1 AC_PROG_MAKE_SET AC_PROG_CC -dnl AC_AIX -AC_MINIX +AC_USE_SYSTEM_EXTENSIONS # If we're using gcc and the user hasn't specified CFLAGS, add -O2 to CFLAGS if test -n "$want_auto_cflags" ; then AUTO_CFLAGS="-g ${GCC:+-O2}" - STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security}" + STYLE_CFLAGS="${GCC:+-Wno-parentheses} ${GCC:+-Wno-format-security} ${GCC:+-Wno-tautological-constant-out-of-range-compare}" fi AC_PROG_GCC_TRADITIONAL @@ -136,16 +135,11 @@ AC_C_PROTOTYPES AC_C_CHAR_UNSIGNED AC_C_VOLATILE -AC_TYPE_SIGNAL - AC_TYPE_SIZE_T AC_CHECK_TYPE(ssize_t, int) -AC_HEADER_STDC - AC_HEADER_STAT AC_HEADER_DIRENT -AC_HEADER_TIME AC_CHECK_FUNCS(fcntl gettimeofday kill lstat pselect readlink select setitimer) AC_CHECK_FUNCS(fnmatch memmove putenv setenv setlocale \ @@ -177,14 +171,12 @@ BASH_SYS_REINSTALL_SIGHANDLERS BASH_FUNC_POSIX_SETJMP BASH_FUNC_LSTAT BASH_FUNC_STRCOLL -BASH_FUNC_CTYPE_NONASCII BASH_CHECK_GETPW_FUNCS AC_HEADER_TIOCGWINSZ BASH_TYPE_SIG_ATOMIC_T -BASH_TYPE_SIGHANDLER BASH_HAVE_TIOCSTAT BASH_HAVE_FIONREAD @@ -331,8 +323,9 @@ AC_SUBST(LIBVERSION) AC_SUBST(TERMCAP_LIB) AC_SUBST(TERMCAP_PKG_CONFIG_LIB) -AC_OUTPUT([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc], -[ -# Makefile uses this timestamp file to record whether config.h is up to date. -echo > stamp-h -]) +AC_CONFIG_FILES([Makefile doc/Makefile examples/Makefile shlib/Makefile readline.pc]) + +dnl Makefile uses this timestamp file to record whether config.h is up to date. +AC_CONFIG_COMMANDS([stamp-h], [echo > stamp-h]) + +AC_OUTPUT diff --git a/kill.c b/kill.c index 8a4ff34..61b744c 100644 --- a/kill.c +++ b/kill.c @@ -351,6 +351,30 @@ rl_unix_filename_rubout (int count, int key) while (count--) { c = rl_line_buffer[rl_point - 1]; + + /* First move backwards through whitespace */ + while (rl_point && whitespace (c)) + { + rl_point--; + c = rl_line_buffer[rl_point - 1]; + } + + /* Consume one or more slashes. */ + if (c == '/') + { + int i; + + i = rl_point - 1; + while (i > 0 && c == '/') + c = rl_line_buffer[--i]; + if (i == 0 || whitespace (c)) + { + rl_point = i + whitespace (c); + continue; /* slashes only */ + } + c = '/'; + } + while (rl_point && (whitespace (c) || c == '/')) { rl_point--; diff --git a/posixtime.h b/posixtime.h index 1d50ab6..3fbf178 100644 --- a/posixtime.h +++ b/posixtime.h @@ -25,16 +25,10 @@ /* Some systems require this, mostly for the definition of `struct timezone'. For example, Dynix/ptx has that definition in rather than sys/time.h */ -#if defined (TIME_WITH_SYS_TIME) +#if defined (HAVE_SYS_TIME_H) # include -# include -#else -# if defined (HAVE_SYS_TIME_H) -# include -# else -# include -# endif #endif +#include #if !defined (HAVE_SYSCONF) || !defined (_SC_CLK_TCK) # if !defined (CLK_TCK) diff --git a/search.c b/search.c index ea5b61b..325d51e 100644 --- a/search.c +++ b/search.c @@ -526,6 +526,9 @@ rl_history_search_internal (int count, int dir) char *t; rl_maybe_save_line (); + /* This will either be restored from the saved line or set from the + found history line. */ + rl_undo_list = 0; temp = (HIST_ENTRY *)NULL; /* Search COUNT times through the history for a line matching @@ -579,6 +582,11 @@ rl_history_search_internal (int count, int dir) /* Copy the line we found into the current line buffer. */ make_history_line_current (temp); + /* Make sure we set the current history position to the last line found so + we can do things like operate-and-get-next from here. This is similar to + how incremental search behaves. */ + history_set_pos (rl_history_search_pos); /* XXX */ + /* decide where to put rl_point -- need to change this for pattern search */ if (rl_history_search_flags & ANCHORED_SEARCH) rl_point = rl_history_search_len; /* easy case */ diff --git a/signals.c b/signals.c index 83cdc53..9df365e 100644 --- a/signals.c +++ b/signals.c @@ -48,23 +48,11 @@ #if defined (HANDLE_SIGNALS) -#if !defined (RETSIGTYPE) -# if defined (VOID_SIGHANDLER) -# define RETSIGTYPE void -# else -# define RETSIGTYPE int -# endif /* !VOID_SIGHANDLER */ -#endif /* !RETSIGTYPE */ - -#if defined (VOID_SIGHANDLER) -# define SIGHANDLER_RETURN return -#else -# define SIGHANDLER_RETURN return (0) -#endif +#define SIGHANDLER_RETURN return /* This typedef is equivalent to the one for Function; it allows us to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */ -typedef RETSIGTYPE SigHandler (int); +typedef void SigHandler (int); #if defined (HAVE_POSIX_SIGNALS) typedef struct sigaction sighandler_cxt; @@ -82,8 +70,8 @@ static SigHandler *rl_set_sighandler (int, SigHandler *, sighandler_cxt *); static void rl_maybe_set_sighandler (int, SigHandler *, sighandler_cxt *); static void rl_maybe_restore_sighandler (int, sighandler_cxt *); -static RETSIGTYPE rl_signal_handler (int); -static RETSIGTYPE _rl_handle_signal (int); +static void rl_signal_handler (int); +static void _rl_handle_signal (int); /* Exported variables for use by applications. */ @@ -136,7 +124,7 @@ void *_rl_sigcleanarg; /* Readline signal handler functions. */ /* Called from RL_CHECK_SIGNALS() macro to run signal handling code. */ -RETSIGTYPE +void _rl_signal_handler (int sig) { _rl_caught_signal = 0; /* XXX */ @@ -163,7 +151,7 @@ _rl_signal_handler (int sig) SIGHANDLER_RETURN; } -static RETSIGTYPE +static void rl_signal_handler (int sig) { _rl_caught_signal = sig; @@ -173,7 +161,7 @@ rl_signal_handler (int sig) /* 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 +static void _rl_handle_signal (int sig) { int block_sig; @@ -315,7 +303,7 @@ _rl_handle_signal (int sig) } #if defined (SIGWINCH) -static RETSIGTYPE +static void rl_sigwinch_handler (int sig) { SigHandler *oh; diff --git a/util.c b/util.c index f2b46c2..2e986db 100644 --- a/util.c +++ b/util.c @@ -72,7 +72,7 @@ static const char * const pathname_alphabetic_chars = "/-_=~.#$"; int rl_alphabetic (int c) { - if (ALPHABETIC (c)) + if (_rl_alphabetic_p (c)) return (1); return (_rl_allow_pathname_alphabetic_chars &&