mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-02 01:40:49 +02:00
commit bash-20050407 snapshot
This commit is contained in:
@@ -11280,3 +11280,50 @@ lib/readline/examples/rl.c
|
||||
subst.c
|
||||
- fix mbstrlen to treat invalid multibyte sequences as sequences of
|
||||
single-byte characters
|
||||
|
||||
4/8
|
||||
---
|
||||
configure.in
|
||||
- default SIZE to `:' if cross-compiling and an appropriate size for
|
||||
the target is not found
|
||||
|
||||
4/11
|
||||
----
|
||||
subst.c
|
||||
- change match_upattern and match_wpattern to check whether or not the
|
||||
supplied pattern matches anywhere in the supplied string, prefixing
|
||||
and appending the pattern with `*' if necessary. If it doesn't we
|
||||
can short-circuit immediately rather than waste time doing up to
|
||||
N-1 unsuccessful calls to strmatch/wcsmatch (which kills for long
|
||||
strings, even if the pattern is short)
|
||||
|
||||
4/12
|
||||
----
|
||||
configure.in
|
||||
- make sure the special case for MacOS X 10.4 only kicks in if the
|
||||
`--with-installed-readline' option isn't supplied
|
||||
|
||||
lib/readline/{callback,readline,signals}.c
|
||||
- make sure rl_prep_term_function and rl_deprep_term_function aren't
|
||||
dereferenced if NULL (as the documentation says)
|
||||
|
||||
builtins/mkbuiltins.c
|
||||
- don't bother with the special HAVE_BCOPY code; just use straight
|
||||
assignments
|
||||
|
||||
builtins/ulimit.def
|
||||
- use _POSIX_PIPE_BUF in pipesize() if it's defined and PIPE_BUF is
|
||||
not
|
||||
|
||||
4/13
|
||||
----
|
||||
execute_cmd.c
|
||||
- add cm_function_def to the list of control structures for which
|
||||
child processes are forked when pipes come in or out
|
||||
|
||||
4/14
|
||||
----
|
||||
builtins/read.def
|
||||
- make sure the ^As added for internal quoting are not counted as
|
||||
characters read when -n is supplied
|
||||
|
||||
|
||||
@@ -11276,3 +11276,47 @@ lib/readline/{complete,text}.c
|
||||
lib/readline/examples/rl.c
|
||||
- include <sys/stat.h> instead of posixstat.h if READLINE_LIBRARY not
|
||||
defined
|
||||
|
||||
subst.c
|
||||
- fix mbstrlen to treat invalid multibyte sequences as sequences of
|
||||
single-byte characters
|
||||
|
||||
4/8
|
||||
---
|
||||
configure.in
|
||||
- default SIZE to `:' if cross-compiling and an appropriate size for
|
||||
the target is not found
|
||||
|
||||
4/11
|
||||
----
|
||||
subst.c
|
||||
- change match_upattern and match_wpattern to check whether or not the
|
||||
supplied pattern matches anywhere in the supplied string, prefixing
|
||||
and appending the pattern with `*' if necessary. If it doesn't we
|
||||
can short-circuit immediately rather than waste time doing up to
|
||||
N-1 unsuccessful calls to strmatch/wcsmatch (which kills for long
|
||||
strings, even if the pattern is short)
|
||||
|
||||
4/12
|
||||
----
|
||||
configure.in
|
||||
- make sure the special case for MacOS X 10.4 only kicks in if the
|
||||
`--with-installed-readline' option isn't supplied
|
||||
|
||||
lib/readline/{callback,readline,signals}.c
|
||||
- make sure rl_prep_term_function and rl_deprep_term_function aren't
|
||||
dereferenced if NULL (as the documentation says)
|
||||
|
||||
builtins/mkbuiltins.c
|
||||
- don't bother with the special HAVE_BCOPY code; just use straight
|
||||
assignments
|
||||
|
||||
builtins/ulimit.def
|
||||
- use _POSIX_PIPE_BUF in pipesize() if it's defined and PIPE_BUF is
|
||||
not
|
||||
|
||||
4/13
|
||||
----
|
||||
execute_cmd.c
|
||||
- add cm_function_def to the list of control structures for which
|
||||
child processes are forked when pipes come in or out
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Makefile for bash-3.0, version 2.155
|
||||
# Makefile for bash-3.1, version 2.156
|
||||
#
|
||||
# Copyright (C) 1996-2005 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Makefile for bash-3.0, version 2.155
|
||||
#
|
||||
# Copyright (C) 1996-2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2005 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
-16
@@ -1,5 +1,5 @@
|
||||
@%:@! /bin/sh
|
||||
@%:@ From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
|
||||
@%:@ From configure.in for Bash 3.1, version 3.174, from autoconf version AC_ACVERSION.
|
||||
@%:@ Guess values for system-dependent variables and create Makefiles.
|
||||
@%:@ Generated by GNU Autoconf 2.59 for bash 3.1-devel.
|
||||
@%:@
|
||||
@@ -4832,13 +4832,6 @@ if test $opt_readline = yes; then
|
||||
@%:@define READLINE 1
|
||||
_ACEOF
|
||||
|
||||
# section for OS versions that ship readline as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no" ; then
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
@@ -4849,9 +4842,18 @@ _ACEOF
|
||||
;;
|
||||
esac
|
||||
READLINE_DEP=
|
||||
READLINE_LIB=-lreadline
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
READLINE_DEP='$(READLINE_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -4870,16 +4872,10 @@ _ACEOF
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
# section for OS versions that ship history as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no"; then
|
||||
HIST_LIBDIR=$RL_LIBDIR
|
||||
HISTORY_DEP=
|
||||
HISTORY_LIB=-lhistory
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
*) case "$RL_INCLUDEDIR" in
|
||||
@@ -4891,6 +4887,14 @@ _ACEOF
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
HISTORY_DEP='$(HISTORY_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -5193,7 +5197,7 @@ if test x$SIZE = x; then
|
||||
fi
|
||||
done
|
||||
if test $size_found -eq 0; then
|
||||
SIZE=size
|
||||
SIZE=:
|
||||
fi
|
||||
IFS=$save_IFS
|
||||
fi
|
||||
|
||||
+88
-88
@@ -15,101 +15,101 @@
|
||||
'configure.in'
|
||||
],
|
||||
{
|
||||
'AC_PROG_CPP' => 1,
|
||||
'AC_CHECK_TYPES' => 1,
|
||||
'AC_STRUCT_ST_BLOCKS' => 1,
|
||||
'AC_PROG_CC' => 1,
|
||||
'AC_TYPE_UID_T' => 1,
|
||||
'AC_PROG_MAKE_SET' => 1,
|
||||
'AC_C_VOLATILE' => 1,
|
||||
'AC_HEADER_SYS_WAIT' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AC_FUNC_CHOWN' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AC_HEADER_DIRENT' => 1,
|
||||
'AC_FUNC_REALLOC' => 1,
|
||||
'AC_PROG_YACC' => 1,
|
||||
'AC_FUNC_MALLOC' => 1,
|
||||
'AC_CHECK_FUNCS' => 1,
|
||||
'AC_TYPE_OFF_T' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_FUNC_ALLOCA' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_TYPE_SIZE_T' => 1,
|
||||
'AC_TYPE_SIGNAL' => 1,
|
||||
'AC_STRUCT_TM' => 1,
|
||||
'AC_STRUCT_TIMEZONE' => 1,
|
||||
'AC_FUNC_SELECT_ARGTYPES' => 1,
|
||||
'AC_TYPE_SIGNAL' => 1,
|
||||
'AC_HEADER_STAT' => 1,
|
||||
'AC_DECL_SYS_SIGLIST' => 1,
|
||||
'AC_FUNC_GETLOADAVG' => 1,
|
||||
'AC_FUNC_MKTIME' => 1,
|
||||
'AC_STRUCT_TM' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'AC_CHECK_LIB' => 1,
|
||||
'AC_HEADER_STDC' => 1,
|
||||
'AC_FUNC_WAIT3' => 1,
|
||||
'AC_PROG_RANLIB' => 1,
|
||||
'AC_FUNC_LSTAT' => 1,
|
||||
'AC_PROG_INSTALL' => 1,
|
||||
'AC_C_CONST' => 1,
|
||||
'AC_FUNC_MBRTOWC' => 1,
|
||||
'AC_FUNC_STRCOLL' => 1,
|
||||
'AC_FUNC_STRTOD' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AC_PROG_LN_S' => 1,
|
||||
'AC_FUNC_UTIME_NULL' => 1,
|
||||
'AC_FUNC_GETMNTENT' => 1,
|
||||
'AC_LIBSOURCE' => 1,
|
||||
'AC_FUNC_CLOSEDIR_VOID' => 1,
|
||||
'AC_FUNC_MMAP' => 1,
|
||||
'AC_FUNC_GETPGRP' => 1,
|
||||
'AC_TYPE_MODE_T' => 1,
|
||||
'AC_FUNC_OBSTACK' => 1,
|
||||
'AC_FUNC_VPRINTF' => 1,
|
||||
'AC_C_INLINE' => 1,
|
||||
'm4_pattern_allow' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AM_CONDITIONAL' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AC_PROG_CXX' => 1,
|
||||
'AC_FUNC_FORK' => 1,
|
||||
'AC_FUNC_FSEEKO' => 1,
|
||||
'AC_FUNC_MEMCMP' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AM_INIT_AUTOMAKE' => 1,
|
||||
'AC_HEADER_MAJOR' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_FUNC_ERROR_AT_LINE' => 1,
|
||||
'AC_FUNC_STRNLEN' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_CHECK_MEMBERS' => 1,
|
||||
'm4_pattern_forbid' => 1,
|
||||
'AC_TYPE_SIZE_T' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_PROG_GCC_TRADITIONAL' => 1,
|
||||
'sinclude' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AC_TYPE_PID_T' => 1,
|
||||
'AC_FUNC_SETVBUF_REVERSED' => 1,
|
||||
'AC_REPLACE_FNMATCH' => 1,
|
||||
'AC_FUNC_GETGROUPS' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_PROG_AWK' => 1,
|
||||
'AC_FUNC_STRFTIME' => 1,
|
||||
'AC_HEADER_TIME' => 1,
|
||||
'AM_MAINTAINER_MODE' => 1,
|
||||
'AC_FUNC_GETLOADAVG' => 1,
|
||||
'AC_FUNC_WAIT3' => 1,
|
||||
'AC_FUNC_STRERROR_R' => 1,
|
||||
'AC_PATH_X' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'include' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_FUNC_SETPGRP' => 1,
|
||||
'AC_FUNC_STAT' => 1,
|
||||
'AC_CHECK_HEADERS' => 1,
|
||||
'AC_PROG_LEX' => 1,
|
||||
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
|
||||
'AC_FUNC_MBRTOWC' => 1,
|
||||
'AC_CHECK_FUNCS' => 1,
|
||||
'AC_HEADER_TIME' => 1,
|
||||
'AC_PROG_CPP' => 1,
|
||||
'AC_CONFIG_LIBOBJ_DIR' => 1,
|
||||
'm4_include' => 1,
|
||||
'_m4_warn' => 1,
|
||||
'AC_C_VOLATILE' => 1,
|
||||
'AC_FUNC_CHOWN' => 1,
|
||||
'AC_CHECK_TYPES' => 1,
|
||||
'AC_HEADER_DIRENT' => 1,
|
||||
'm4_sinclude' => 1,
|
||||
'AC_CONFIG_SUBDIRS' => 1,
|
||||
'AC_FUNC_SETVBUF_REVERSED' => 1,
|
||||
'AC_FUNC_STRCOLL' => 1,
|
||||
'AC_CHECK_LIB' => 1,
|
||||
'AH_OUTPUT' => 1,
|
||||
'AC_FUNC_VPRINTF' => 1,
|
||||
'AC_TYPE_PID_T' => 1,
|
||||
'AC_CONFIG_AUX_DIR' => 1,
|
||||
'AC_FUNC_ALLOCA' => 1
|
||||
'AC_FUNC_UTIME_NULL' => 1,
|
||||
'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1,
|
||||
'AC_FUNC_SETPGRP' => 1,
|
||||
'AC_PROG_GCC_TRADITIONAL' => 1,
|
||||
'AC_HEADER_SYS_WAIT' => 1,
|
||||
'AC_HEADER_STAT' => 1,
|
||||
'AC_C_CONST' => 1,
|
||||
'AM_PROG_CC_C_O' => 1,
|
||||
'AC_FUNC_GETGROUPS' => 1,
|
||||
'AC_FUNC_FSEEKO' => 1,
|
||||
'AC_DECL_SYS_SIGLIST' => 1,
|
||||
'AC_FUNC_CLOSEDIR_VOID' => 1,
|
||||
'AC_REPLACE_FNMATCH' => 1,
|
||||
'AC_CONFIG_LINKS' => 1,
|
||||
'AC_PATH_X' => 1,
|
||||
'AC_FUNC_STRTOD' => 1,
|
||||
'AC_CHECK_MEMBERS' => 1,
|
||||
'AC_TYPE_UID_T' => 1,
|
||||
'AC_FUNC_MEMCMP' => 1,
|
||||
'AC_TYPE_OFF_T' => 1,
|
||||
'AC_STRUCT_ST_BLOCKS' => 1,
|
||||
'AM_AUTOMAKE_VERSION' => 1,
|
||||
'AC_FUNC_MKTIME' => 1,
|
||||
'AC_HEADER_STDC' => 1,
|
||||
'AC_PROG_RANLIB' => 1,
|
||||
'AC_PROG_LEX' => 1,
|
||||
'sinclude' => 1,
|
||||
'AC_FUNC_FORK' => 1,
|
||||
'AC_CONFIG_HEADERS' => 1,
|
||||
'AC_PROG_INSTALL' => 1,
|
||||
'AC_FUNC_STRNLEN' => 1,
|
||||
'AC_SUBST' => 1,
|
||||
'AC_FUNC_STAT' => 1,
|
||||
'AC_FUNC_GETPGRP' => 1,
|
||||
'AC_PROG_LIBTOOL' => 1,
|
||||
'AC_FUNC_LSTAT' => 1,
|
||||
'AC_C_INLINE' => 1,
|
||||
'AC_FUNC_ERROR_AT_LINE' => 1,
|
||||
'AC_CONFIG_FILES' => 1,
|
||||
'AM_GNU_GETTEXT' => 1,
|
||||
'AC_PROG_LN_S' => 1,
|
||||
'AC_PROG_AWK' => 1,
|
||||
'AC_CANONICAL_HOST' => 1,
|
||||
'AC_PROG_MAKE_SET' => 1,
|
||||
'AC_DEFINE_TRACE_LITERAL' => 1,
|
||||
'AC_PROG_YACC' => 1,
|
||||
'AC_PROG_CC' => 1,
|
||||
'AC_PROG_CXX' => 1,
|
||||
'AC_FUNC_STRFTIME' => 1,
|
||||
'AC_INIT' => 1,
|
||||
'AC_FUNC_REALLOC' => 1,
|
||||
'AC_CANONICAL_SYSTEM' => 1,
|
||||
'AC_FUNC_OBSTACK' => 1,
|
||||
'AC_FUNC_MALLOC' => 1,
|
||||
'AC_FUNC_MMAP' => 1,
|
||||
'AC_FUNC_GETMNTENT' => 1,
|
||||
'AC_TYPE_MODE_T' => 1,
|
||||
'include' => 1,
|
||||
'AC_HEADER_MAJOR' => 1,
|
||||
'AC_CHECK_HEADERS' => 1
|
||||
}
|
||||
], 'Autom4te::Request' )
|
||||
);
|
||||
|
||||
+853
-853
File diff suppressed because it is too large
Load Diff
@@ -381,14 +381,8 @@ array_add (element, array)
|
||||
array->array = (char **)xrealloc
|
||||
(array->array, (array->size += array->growth_rate) * array->width);
|
||||
|
||||
#if defined (HAVE_BCOPY)
|
||||
bcopy (&element, (char *) &(array->array[array->sindex]), array->width);
|
||||
array->sindex++;
|
||||
bzero ((char *) &(array->array[array->sindex]), array->width);
|
||||
#else
|
||||
array->array[array->sindex++] = element;
|
||||
array->array[array->sindex] = (char *)NULL;
|
||||
#endif /* !HAVE_BCOPY */
|
||||
}
|
||||
|
||||
/* Free an allocated array and data pointer. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+4
-3
@@ -124,7 +124,7 @@ read_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
register char *varname;
|
||||
int size, i, pass_next, saw_escape, eof, opt, retval, code;
|
||||
int size, i, nr, pass_next, saw_escape, eof, opt, retval, code;
|
||||
int input_is_tty, input_is_pipe, unbuffered_read;
|
||||
int raw, edit, nchars, silent, have_timeout, fd;
|
||||
unsigned int tmout;
|
||||
@@ -173,7 +173,7 @@ read_builtin (list)
|
||||
#endif
|
||||
|
||||
tmout = 0; /* no timeout */
|
||||
nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0;
|
||||
nr = nchars = input_is_tty = input_is_pipe = unbuffered_read = have_timeout = 0;
|
||||
delim = '\n'; /* read until newline */
|
||||
|
||||
reset_internal_getopt ();
|
||||
@@ -451,8 +451,9 @@ read_builtin (list)
|
||||
}
|
||||
|
||||
input_string[i++] = c;
|
||||
nr++;
|
||||
|
||||
if (nchars > 0 && i >= nchars)
|
||||
if (nchars > 0 && nr >= nchars)
|
||||
break;
|
||||
}
|
||||
input_string[i] = '\0';
|
||||
|
||||
+4
-4
@@ -131,7 +131,7 @@ read_builtin (list)
|
||||
intmax_t intval;
|
||||
char c;
|
||||
char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
|
||||
char *e, *t, *t1, *savei;
|
||||
char *e, *t, *t1;
|
||||
struct stat tsb;
|
||||
SHELL_VAR *var;
|
||||
#if defined (ARRAY_VARS)
|
||||
@@ -276,7 +276,7 @@ read_builtin (list)
|
||||
input_is_tty = isatty (fd);
|
||||
if (input_is_tty == 0)
|
||||
#ifndef __CYGWIN__
|
||||
input_is_pipe = (lseek (0, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
|
||||
input_is_pipe = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
|
||||
#else
|
||||
input_is_pipe = 1;
|
||||
#endif
|
||||
@@ -637,12 +637,12 @@ read_builtin (list)
|
||||
number of variables. */
|
||||
if (*input_string)
|
||||
{
|
||||
savei = input_string;
|
||||
t1 = input_string;
|
||||
t = get_word_from_string (&input_string, ifs_chars, &e);
|
||||
if (*input_string == 0)
|
||||
input_string = t;
|
||||
else
|
||||
input_string = strip_trailing_ifs_whitespace (savei, ifs_chars, saw_escape);
|
||||
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+8
-3
@@ -617,14 +617,19 @@ pipesize (valuep)
|
||||
*valuep = (RLIMTYPE) PIPE_BUF;
|
||||
return 0;
|
||||
#else
|
||||
# if defined (PIPESIZE)
|
||||
# if defined (_POSIX_PIPE_BUF)
|
||||
*valuep = (RLIMTYPE) _POSIX_PIPE_BUF;
|
||||
return 0;
|
||||
# else
|
||||
# if defined (PIPESIZE)
|
||||
/* This is defined by running a program from the Makefile. */
|
||||
*valuep = (RLIMTYPE) PIPESIZE;
|
||||
return 0;
|
||||
# else
|
||||
# else
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
# endif /* PIPESIZE */
|
||||
# endif /* PIPESIZE */
|
||||
# endif /* _POSIX_PIPE_BUF */
|
||||
#endif /* PIPE_BUF */
|
||||
}
|
||||
|
||||
|
||||
+17
-5
@@ -35,14 +35,17 @@ option is given, it is interpreted as follows:
|
||||
-c the maximum size of core files created
|
||||
-d the maximum size of a process's data segment
|
||||
-f the maximum size of files created by the shell
|
||||
-i the maximum number of pending signals
|
||||
-l the maximum size a process may lock into memory
|
||||
-m the maximum resident set size
|
||||
-n the maximum number of open file descriptors
|
||||
-p the pipe buffer size
|
||||
-q the maximum number of bytes in POSIX message queues
|
||||
-s the maximum stack size
|
||||
-t the maximum amount of cpu time in seconds
|
||||
-u the maximum number of user processes
|
||||
-v the size of virtual memory
|
||||
-v the size of virtual memory
|
||||
-x the maximum number of file locks
|
||||
|
||||
If LIMIT is given, it is the new value of the specified resource;
|
||||
the special LIMIT values `soft', `hard', and `unlimited' stand for
|
||||
@@ -200,6 +203,9 @@ static RESOURCE_LIMITS limits[] = {
|
||||
{ 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
|
||||
#endif
|
||||
{ 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
|
||||
#ifdef RLIMIT_SIGPENDING
|
||||
{ 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL },
|
||||
#endif
|
||||
#ifdef RLIMIT_MEMLOCK
|
||||
{ 'l', RLIMIT_MEMLOCK, 1024, "max locked memory", "kbytes" },
|
||||
#endif
|
||||
@@ -208,6 +214,9 @@ static RESOURCE_LIMITS limits[] = {
|
||||
#endif /* RLIMIT_RSS */
|
||||
{ 'n', RLIMIT_OPENFILES, 1, "open files", (char *)NULL},
|
||||
{ 'p', RLIMIT_PIPESIZE, 512, "pipe size", "512 bytes" },
|
||||
#ifdef RLIMIT_MSGQUEUE
|
||||
{ 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" },
|
||||
#endif
|
||||
#ifdef RLIMIT_STACK
|
||||
{ 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
|
||||
#endif
|
||||
@@ -220,6 +229,9 @@ static RESOURCE_LIMITS limits[] = {
|
||||
#endif
|
||||
#ifdef RLIMIT_SWAP
|
||||
{ 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" },
|
||||
#endif
|
||||
#ifdef RLIMIT_LOCKS
|
||||
{ 'w', RLIMIT_LOCKS, 1, "file locks", (char *)NULL },
|
||||
#endif
|
||||
{ -1, -1, -1, (char *)NULL, (char *)NULL }
|
||||
};
|
||||
@@ -647,11 +659,11 @@ print_all_limits (mode)
|
||||
|
||||
for (i = 0; limits[i].option > 0; i++)
|
||||
{
|
||||
if (get_limit (i, &softlim, &hardlim) < 0)
|
||||
if (get_limit (i, &softlim, &hardlim) == 0)
|
||||
printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
|
||||
else if (errno != EINVAL)
|
||||
builtin_error ("%s: cannot get limit: %s", limits[i].description,
|
||||
strerror (errno));
|
||||
else
|
||||
printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,7 +682,7 @@ printone (limind, curlim, pdesc)
|
||||
else
|
||||
sprintf (unitstr, "(-%c) ", limits[limind].option);
|
||||
|
||||
printf ("%-18s %16s", limits[limind].description, unitstr);
|
||||
printf ("%-20s %16s", limits[limind].description, unitstr);
|
||||
}
|
||||
if (curlim == RLIM_INFINITY)
|
||||
puts ("unlimited");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in for Bash 3.1, version 3.173, from autoconf version AC_ACVERSION.
|
||||
# From configure.in for Bash 3.1, version 3.174, from autoconf version AC_ACVERSION.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59 for bash 3.1-devel.
|
||||
#
|
||||
@@ -4832,13 +4832,6 @@ if test $opt_readline = yes; then
|
||||
#define READLINE 1
|
||||
_ACEOF
|
||||
|
||||
# section for OS versions that ship readline as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no" ; then
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
@@ -4849,9 +4842,18 @@ _ACEOF
|
||||
;;
|
||||
esac
|
||||
READLINE_DEP=
|
||||
READLINE_LIB=-lreadline
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
READLINE_DEP='$(READLINE_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -4870,16 +4872,10 @@ _ACEOF
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
# section for OS versions that ship history as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no"; then
|
||||
HIST_LIBDIR=$RL_LIBDIR
|
||||
HISTORY_DEP=
|
||||
HISTORY_LIB=-lhistory
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
*) case "$RL_INCLUDEDIR" in
|
||||
@@ -4891,6 +4887,14 @@ _ACEOF
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
HISTORY_DEP='$(HISTORY_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -5193,7 +5197,7 @@ if test x$SIZE = x; then
|
||||
fi
|
||||
done
|
||||
if test $size_found -eq 0; then
|
||||
SIZE=size
|
||||
SIZE=:
|
||||
fi
|
||||
IFS=$save_IFS
|
||||
fi
|
||||
|
||||
+20
-16
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl
|
||||
AC_REVISION([for Bash 3.1, version 3.174, from autoconf version] AC_ACVERSION)dnl
|
||||
|
||||
define(bashvers, 3.1)
|
||||
define(relstatus, devel)
|
||||
@@ -484,13 +484,6 @@ fi
|
||||
|
||||
if test $opt_readline = yes; then
|
||||
AC_DEFINE(READLINE)
|
||||
# section for OS versions that ship readline as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no" ; then
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
@@ -501,9 +494,18 @@ if test $opt_readline = yes; then
|
||||
;;
|
||||
esac
|
||||
READLINE_DEP=
|
||||
READLINE_LIB=-lreadline
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
READLINE_DEP='$(READLINE_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -516,16 +518,10 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
|
||||
if test $opt_bang_history = yes; then
|
||||
AC_DEFINE(BANG_HISTORY)
|
||||
fi
|
||||
# section for OS versions that ship history as a standard dynamic
|
||||
# library and don't allow a static version specified as -llibname
|
||||
# to override the dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
if test "$opt_with_installed_readline" != "no"; then
|
||||
HIST_LIBDIR=$RL_LIBDIR
|
||||
HISTORY_DEP=
|
||||
HISTORY_LIB=-lhistory
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
*) case "$RL_INCLUDEDIR" in
|
||||
@@ -537,6 +533,14 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
HISTORY_DEP='$(HISTORY_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -584,7 +588,7 @@ if test x$SIZE = x; then
|
||||
fi
|
||||
done
|
||||
if test $size_found -eq 0; then
|
||||
SIZE=size
|
||||
SIZE=:
|
||||
fi
|
||||
IFS=$save_IFS
|
||||
fi
|
||||
|
||||
+20
-5
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
AC_REVISION([for Bash 3.1, version 3.173, from autoconf version] AC_ACVERSION)dnl
|
||||
AC_REVISION([for Bash 3.1, version 3.174, from autoconf version] AC_ACVERSION)dnl
|
||||
|
||||
define(bashvers, 3.1)
|
||||
define(relstatus, devel)
|
||||
@@ -484,7 +484,6 @@ fi
|
||||
|
||||
if test $opt_readline = yes; then
|
||||
AC_DEFINE(READLINE)
|
||||
READLINE_LIB=-lreadline
|
||||
if test "$opt_with_installed_readline" != "no" ; then
|
||||
case "$opt_with_installed_readline" in
|
||||
yes) RL_INCLUDE= ;;
|
||||
@@ -498,6 +497,14 @@ if test $opt_readline = yes; then
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
READLINE_DEP='$(READLINE_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) READLINE_LIB='${READLINE_LIBRARY}' ;;
|
||||
*) READLINE_LIB=-lreadline ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
RL_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -510,7 +517,6 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
|
||||
if test $opt_bang_history = yes; then
|
||||
AC_DEFINE(BANG_HISTORY)
|
||||
fi
|
||||
HISTORY_LIB=-lhistory
|
||||
if test "$opt_with_installed_readline" != "no"; then
|
||||
HIST_LIBDIR=$RL_LIBDIR
|
||||
HISTORY_DEP=
|
||||
@@ -525,6 +531,14 @@ if test $opt_history = yes || test $opt_bang_history = yes; then
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
HISTORY_DEP='$(HISTORY_LIBRARY)'
|
||||
# section for OS versions that ship an older version of
|
||||
# readline as a standard dynamic library and don't allow a
|
||||
# static version specified as -llibname to override the
|
||||
# dynamic version
|
||||
case "${host_os}" in
|
||||
darwin8*) HISTORY_LIB='${HISTORY_LIBRARY}' ;;
|
||||
*) HISTORY_LIB=-lhistory ;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
HIST_LIBDIR='$(dot)/$(LIBSUBDIR)/readline'
|
||||
@@ -572,11 +586,12 @@ if test x$SIZE = x; then
|
||||
fi
|
||||
done
|
||||
if test $size_found -eq 0; then
|
||||
SIZE=size
|
||||
SIZE=:
|
||||
fi
|
||||
IFS=$save_IFS
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(SIZE)
|
||||
|
||||
dnl Turn on any extensions available in the GNU C library.
|
||||
AC_DEFINE(_GNU_SOURCE, 1)
|
||||
@@ -959,7 +974,7 @@ linux*) LOCAL_LDFLAGS=-rdynamic ;; # allow dynamic loading
|
||||
*qnx*) LOCAL_CFLAGS="-Dqnx -F -3s" LOCAL_LDFLAGS="-3s" LOCAL_LIBS="-lunix -lncurses" ;;
|
||||
powerux*) LOCAL_LIBS="-lgen" ;;
|
||||
cygwin*) LOCAL_CFLAGS=-DRECYCLES_PIDS ;;
|
||||
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO" ;;
|
||||
opennt*|interix*) LOCAL_CFLAGS="-DNO_MAIN_ENV_ARG -DBROKEN_DIRENT_D_INO -D_POSIX_SOURCE" ;;
|
||||
esac
|
||||
|
||||
dnl Stanza for OS/compiler pair-specific flags
|
||||
|
||||
+2
-1
@@ -369,7 +369,6 @@ shell_control_structure (type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case cm_for:
|
||||
#if defined (ARITH_FOR_COMMAND)
|
||||
case cm_arith_for:
|
||||
#endif
|
||||
@@ -386,7 +385,9 @@ shell_control_structure (type)
|
||||
case cm_while:
|
||||
case cm_until:
|
||||
case cm_if:
|
||||
case cm_for:
|
||||
case cm_group:
|
||||
case cm_function_def:
|
||||
return (1);
|
||||
|
||||
default:
|
||||
|
||||
+4
-1
@@ -245,6 +245,9 @@ int subshell_level = 0;
|
||||
/* Currently-executing shell function. */
|
||||
SHELL_VAR *this_shell_function;
|
||||
|
||||
/* If non-zero, matches in case and [[ ... ]] are case-insensitive */
|
||||
int match_ignore_case = 0;
|
||||
|
||||
struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
|
||||
|
||||
#define FD_BITMAP_DEFAULT_SIZE 32
|
||||
@@ -2223,7 +2226,7 @@ execute_case_command (case_command)
|
||||
/* Since the pattern does not undergo quote removal (as per
|
||||
Posix.2, section 3.9.4.3), the strmatch () call must be able
|
||||
to recognize backslashes as escape characters. */
|
||||
match = strmatch (pattern, word, FNMATCH_EXTFLAG) != FNM_NOMATCH;
|
||||
match = strmatch (pattern, word, FNMATCH_EXTFLAG|FNMATCH_IGNCASE) != FNM_NOMATCH;
|
||||
free (pattern);
|
||||
|
||||
dispose_words (es);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* callback.c -- functions to use readline as an X `callback' mechanism. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -72,7 +72,8 @@ _rl_callback_newline ()
|
||||
{
|
||||
in_handler = 1;
|
||||
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_set_signals ();
|
||||
@@ -115,7 +116,8 @@ rl_callback_read_char ()
|
||||
{
|
||||
line = readline_internal_teardown (eof);
|
||||
|
||||
(*rl_deprep_term_function) ();
|
||||
if (rl_deprep_term_function)
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
@@ -146,7 +148,8 @@ rl_callback_handler_remove ()
|
||||
if (in_handler)
|
||||
{
|
||||
in_handler = 0;
|
||||
(*rl_deprep_term_function) ();
|
||||
if (rl_deprep_term_function)
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/* callback.c -- functions to use readline as an X `callback' mechanism. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "rlconf.h"
|
||||
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
#include "rlprivate.h"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Callback Readline Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Allow using readline in situations where a program may have multiple
|
||||
things to handle at once, and dispatches them via select(). Call
|
||||
rl_callback_handler_install() with the prompt and a function to call
|
||||
whenever a complete line of input is ready. The user must then
|
||||
call rl_callback_read_char() every time some input is available, and
|
||||
rl_callback_read_char() will call the user's function with the complete
|
||||
text read in at each end of line. The terminal is kept prepped and
|
||||
signals handled all the time, except during calls to the user's function. */
|
||||
|
||||
rl_vcpfunc_t *rl_linefunc; /* user callback function */
|
||||
static int in_handler; /* terminal_prepped and signals set? */
|
||||
|
||||
/* Make sure the terminal is set up, initialize readline, and prompt. */
|
||||
static void
|
||||
_rl_callback_newline ()
|
||||
{
|
||||
rl_initialize ();
|
||||
|
||||
if (in_handler == 0)
|
||||
{
|
||||
in_handler = 1;
|
||||
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_set_signals ();
|
||||
#endif
|
||||
}
|
||||
|
||||
readline_internal_setup ();
|
||||
}
|
||||
|
||||
/* Install a readline handler, set up the terminal, and issue the prompt. */
|
||||
void
|
||||
rl_callback_handler_install (prompt, linefunc)
|
||||
const char *prompt;
|
||||
rl_vcpfunc_t *linefunc;
|
||||
{
|
||||
rl_set_prompt (prompt);
|
||||
rl_linefunc = linefunc;
|
||||
_rl_callback_newline ();
|
||||
}
|
||||
|
||||
/* Read one character, and dispatch to the handler if it ends the line. */
|
||||
void
|
||||
rl_callback_read_char ()
|
||||
{
|
||||
char *line;
|
||||
int eof;
|
||||
|
||||
if (rl_linefunc == NULL)
|
||||
{
|
||||
fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
eof = readline_internal_char ();
|
||||
|
||||
/* We loop in case some function has pushed input back with rl_execute_next. */
|
||||
for (;;)
|
||||
{
|
||||
if (rl_done)
|
||||
{
|
||||
line = readline_internal_teardown (eof);
|
||||
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
in_handler = 0;
|
||||
(*rl_linefunc) (line);
|
||||
|
||||
/* If the user did not clear out the line, do it for him. */
|
||||
if (rl_line_buffer[0])
|
||||
_rl_init_line_state ();
|
||||
|
||||
/* Redisplay the prompt if readline_handler_{install,remove}
|
||||
not called. */
|
||||
if (in_handler == 0 && rl_linefunc)
|
||||
_rl_callback_newline ();
|
||||
}
|
||||
if (rl_pending_input || _rl_pushed_input_available ())
|
||||
eof = readline_internal_char ();
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the handler, and make sure the terminal is in its normal state. */
|
||||
void
|
||||
rl_callback_handler_remove ()
|
||||
{
|
||||
rl_linefunc = NULL;
|
||||
if (in_handler)
|
||||
{
|
||||
in_handler = 0;
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
@ifinfo
|
||||
This document describes the GNU Readline Library, a utility for aiding
|
||||
in the consitency of user interface across discrete programs that need
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988-2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
||||
@@ -911,10 +911,14 @@ possibly containing conversion specifications such as @samp{%d}, and
|
||||
any additional arguments necessary to satisfy the conversion specifications.
|
||||
The resulting string is displayed in the @dfn{echo area}. The echo area
|
||||
is also used to display numeric arguments and search strings.
|
||||
You should call @code{rl_save_prompt} to save the prompt information
|
||||
before calling this function.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_clear_message (void)
|
||||
Clear the message in the echo area.
|
||||
Clear the message in the echo area. If the prompt was saved with a call to
|
||||
@code{rl_save_prompt} before the last call to @code{rl_message},
|
||||
call @code{rl_restore_prompt} before calling this function.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void rl_save_prompt (void)
|
||||
@@ -925,6 +929,9 @@ displaying a new message in the message area with @code{rl_message()}.
|
||||
@deftypefun void rl_restore_prompt (void)
|
||||
Restore the local Readline prompt display state saved by the most
|
||||
recent call to @code{rl_save_prompt}.
|
||||
if @code{rl_save_prompt} was called to save the prompt before a call
|
||||
to @code{rl_message}, this function should be called before the
|
||||
corresponding call to @coode{rl_clear_message}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_expand_prompt (char *prompt)
|
||||
|
||||
@@ -10,7 +10,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-2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1988-2005 Free Software Foundation, Inc.
|
||||
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
|
||||
@@ -404,6 +404,12 @@ If set to @samp{none}, Readline never rings the bell. If set to
|
||||
If set to @samp{audible} (the default), Readline attempts to ring
|
||||
the terminal's bell.
|
||||
|
||||
@item bind-tty-special-chars
|
||||
@vindex bind-tty-special-chars
|
||||
If set to @samp{on}, Readline attempts to bind the control characters
|
||||
treated specially by the kernel's terminal driver to their Readline
|
||||
equivalents.
|
||||
|
||||
@item comment-begin
|
||||
@vindex comment-begin
|
||||
The string to insert at the beginning of the line when the
|
||||
@@ -1012,6 +1018,8 @@ With an argument @var{n},
|
||||
insert the @var{n}th word from the previous command (the words
|
||||
in the previous command begin with word 0). A negative argument
|
||||
inserts the @var{n}th word from the end of the previous command.
|
||||
Once the argument @var{n} is computed, the argument is extracted
|
||||
as if the @samp{!@var{n}} history expansion had been specified.
|
||||
|
||||
@item yank-last-arg (M-. or M-_)
|
||||
Insert last argument to the previous command (the last word of the
|
||||
@@ -1019,6 +1027,8 @@ previous history entry). With an
|
||||
argument, behave exactly like @code{yank-nth-arg}.
|
||||
Successive calls to @code{yank-last-arg} move back through the history
|
||||
list, inserting the last argument of each line in turn.
|
||||
The history expansion facilities are used to extract the last argument,
|
||||
as if the @samp{!$} history expansion had been specified.
|
||||
|
||||
@end ftable
|
||||
|
||||
@@ -1530,7 +1540,7 @@ special variable as delimiters.
|
||||
Shell quoting is honored.
|
||||
Each word is then expanded using
|
||||
brace expansion, tilde expansion, parameter and variable expansion,
|
||||
command substitution, arithmetic expansion, and pathname expansion,
|
||||
command substitution, and arithmetic expansion,
|
||||
as described above (@pxref{Shell Expansions}).
|
||||
The results are split using the rules described above
|
||||
(@pxref{Word Splitting}).
|
||||
|
||||
@@ -14,7 +14,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-2004 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1988-2005 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename rluserman.info
|
||||
@settitle GNU Readline Library
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@setchapternewpage odd
|
||||
|
||||
@include version.texi
|
||||
|
||||
@copying
|
||||
This manual describes the end user interface of the GNU Readline Library
|
||||
(version @value{VERSION}, @value{UPDATED}), a library which aids in the
|
||||
consistency of user interface across discrete programs which provide
|
||||
a command line interface.
|
||||
|
||||
Copyright @copyright{} 1988-2004 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1 or
|
||||
any later version published by the Free Software Foundation; with no
|
||||
Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
|
||||
and with the Back-Cover Texts as in (a) below. A copy of the license is
|
||||
included in the section entitled ``GNU Free Documentation License.''
|
||||
|
||||
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
|
||||
this GNU Manual, like GNU software. Copies published by the Free
|
||||
Software Foundation raise funds for GNU development.''
|
||||
@end quotation
|
||||
@end copying
|
||||
|
||||
@dircategory Libraries
|
||||
@direntry
|
||||
* RLuserman: (rluserman). The GNU readline library User's Manual.
|
||||
@end direntry
|
||||
|
||||
@titlepage
|
||||
@title GNU Readline Library User Interface
|
||||
@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATED-MONTH}
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
@author Brian Fox, Free Software Foundation
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@insertcopying
|
||||
|
||||
@sp 1
|
||||
Published by the Free Software Foundation @*
|
||||
59 Temple Place, Suite 330, @*
|
||||
Boston, MA 02111-1307 @*
|
||||
USA @*
|
||||
|
||||
@end titlepage
|
||||
|
||||
@contents
|
||||
|
||||
@ifnottex
|
||||
@node Top
|
||||
@top GNU Readline Library
|
||||
|
||||
This document describes the end user interface of the GNU Readline Library,
|
||||
a utility which aids in the consistency of user interface across discrete
|
||||
programs which provide a command line interface.
|
||||
|
||||
@menu
|
||||
* Command Line Editing:: GNU Readline User's Manual.
|
||||
* Copying This Manual:: Copying This Manual.
|
||||
@end menu
|
||||
@end ifnottex
|
||||
|
||||
@include rluser.texi
|
||||
|
||||
@node Copying This Manual
|
||||
@appendix Copying This Manual
|
||||
|
||||
@menu
|
||||
* GNU Free Documentation License:: License for copying this manual.
|
||||
@end menu
|
||||
|
||||
@include fdl.texi
|
||||
|
||||
@bye
|
||||
@@ -295,14 +295,16 @@ readline (prompt)
|
||||
rl_set_prompt (prompt);
|
||||
|
||||
rl_initialize ();
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_set_signals ();
|
||||
#endif
|
||||
|
||||
value = readline_internal ();
|
||||
(*rl_deprep_term_function) ();
|
||||
if (rl_deprep_term_function)
|
||||
(*rl_deprep_term_function) ();
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* signals.c -- signal handling support for readline. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
@@ -368,7 +368,8 @@ void
|
||||
rl_cleanup_after_signal ()
|
||||
{
|
||||
_rl_clean_up_for_exit ();
|
||||
(*rl_deprep_term_function) ();
|
||||
if (rl_deprep_term_function)
|
||||
(*rl_deprep_term_function) ();
|
||||
rl_clear_signals ();
|
||||
rl_clear_pending_input ();
|
||||
}
|
||||
@@ -377,7 +378,8 @@ rl_cleanup_after_signal ()
|
||||
void
|
||||
rl_reset_after_signal ()
|
||||
{
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
rl_set_signals ();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,406 @@
|
||||
/* signals.c -- signal handling support for readline. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* Just for NULL. Yuck. */
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#include "rlprivate.h"
|
||||
|
||||
#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
|
||||
|
||||
/* This typedef is equivalent to the one for Function; it allows us
|
||||
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
|
||||
typedef RETSIGTYPE SigHandler ();
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
typedef struct sigaction sighandler_cxt;
|
||||
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
|
||||
#else
|
||||
typedef struct { SigHandler *sa_handler; int sa_mask, sa_flags; } sighandler_cxt;
|
||||
# define sigemptyset(m)
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#ifndef SA_RESTART
|
||||
# define SA_RESTART 0
|
||||
#endif
|
||||
|
||||
static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
||||
static void rl_maybe_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *));
|
||||
|
||||
/* Exported variables for use by applications. */
|
||||
|
||||
/* If non-zero, readline will install its own signal handlers for
|
||||
SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
|
||||
int rl_catch_signals = 1;
|
||||
|
||||
/* If non-zero, readline will install a signal handler for SIGWINCH. */
|
||||
#ifdef SIGWINCH
|
||||
int rl_catch_sigwinch = 1;
|
||||
#else
|
||||
int rl_catch_sigwinch = 0; /* for the readline state struct in readline.c */
|
||||
#endif
|
||||
|
||||
static int signals_set_flag;
|
||||
static int sigwinch_set_flag;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Signal Handling */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static sighandler_cxt old_int, old_term, old_alrm, old_quit;
|
||||
#if defined (SIGTSTP)
|
||||
static sighandler_cxt old_tstp, old_ttou, old_ttin;
|
||||
#endif
|
||||
#if defined (SIGWINCH)
|
||||
static sighandler_cxt old_winch;
|
||||
#endif
|
||||
|
||||
/* Readline signal handler functions. */
|
||||
|
||||
static RETSIGTYPE
|
||||
rl_signal_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigset_t set;
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
long omask;
|
||||
# else /* !HAVE_BSD_SIGNALS */
|
||||
sighandler_cxt dummy_cxt; /* needed for rl_set_sighandler call */
|
||||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
||||
|
||||
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
|
||||
/* Since the signal will not be blocked while we are in the signal
|
||||
handler, ignore it until rl_clear_signals resets the catcher. */
|
||||
if (sig == SIGINT || sig == SIGALRM)
|
||||
rl_set_sighandler (sig, SIG_IGN, &dummy_cxt);
|
||||
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
|
||||
|
||||
switch (sig)
|
||||
{
|
||||
case SIGINT:
|
||||
rl_free_line_state ();
|
||||
/* FALLTHROUGH */
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
case SIGTSTP:
|
||||
case SIGTTOU:
|
||||
case SIGTTIN:
|
||||
#endif /* SIGTSTP */
|
||||
case SIGALRM:
|
||||
case SIGTERM:
|
||||
case SIGQUIT:
|
||||
rl_cleanup_after_signal ();
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
|
||||
sigdelset (&set, sig);
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
omask = sigblock (0);
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if defined (__EMX__)
|
||||
signal (sig, SIG_ACK);
|
||||
#endif
|
||||
|
||||
kill (getpid (), sig);
|
||||
|
||||
/* Let the signal that we just sent through. */
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
sigsetmask (omask & ~(sigmask (sig)));
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
rl_reset_after_signal ();
|
||||
}
|
||||
|
||||
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
static RETSIGTYPE
|
||||
rl_sigwinch_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
SigHandler *oh;
|
||||
|
||||
#if defined (MUST_REINSTALL_SIGHANDLERS)
|
||||
sighandler_cxt dummy_winch;
|
||||
|
||||
/* We don't want to change old_winch -- it holds the state of SIGWINCH
|
||||
disposition set by the calling application. We need this state
|
||||
because we call the application's SIGWINCH handler after updating
|
||||
our own idea of the screen size. */
|
||||
rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch);
|
||||
#endif
|
||||
|
||||
RL_SETSTATE(RL_STATE_SIGHANDLER);
|
||||
rl_resize_terminal ();
|
||||
|
||||
/* If another sigwinch handler has been installed, call it. */
|
||||
oh = (SigHandler *)old_winch.sa_handler;
|
||||
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
|
||||
(*oh) (sig);
|
||||
|
||||
RL_UNSETSTATE(RL_STATE_SIGHANDLER);
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
/* Functions to manage signal handling. */
|
||||
|
||||
#if !defined (HAVE_POSIX_SIGNALS)
|
||||
static int
|
||||
rl_sigaction (sig, nh, oh)
|
||||
int sig;
|
||||
sighandler_cxt *nh, *oh;
|
||||
{
|
||||
oh->sa_handler = signal (sig, nh->sa_handler);
|
||||
return 0;
|
||||
}
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
/* Set up a readline-specific signal handler, saving the old signal
|
||||
information in OHANDLER. Return the old signal handler, like
|
||||
signal(). */
|
||||
static SigHandler *
|
||||
rl_set_sighandler (sig, handler, ohandler)
|
||||
int sig;
|
||||
SigHandler *handler;
|
||||
sighandler_cxt *ohandler;
|
||||
{
|
||||
sighandler_cxt old_handler;
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
struct sigaction act;
|
||||
|
||||
act.sa_handler = handler;
|
||||
act.sa_flags = (sig == SIGWINCH) ? SA_RESTART : 0;
|
||||
sigemptyset (&act.sa_mask);
|
||||
sigemptyset (&ohandler->sa_mask);
|
||||
sigaction (sig, &act, &old_handler);
|
||||
#else
|
||||
old_handler.sa_handler = (SigHandler *)signal (sig, handler);
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
/* XXX -- assume we have memcpy */
|
||||
/* If rl_set_signals is called twice in a row, don't set the old handler to
|
||||
rl_signal_handler, because that would cause infinite recursion. */
|
||||
if (handler != rl_signal_handler || old_handler.sa_handler != rl_signal_handler)
|
||||
memcpy (ohandler, &old_handler, sizeof (sighandler_cxt));
|
||||
|
||||
return (ohandler->sa_handler);
|
||||
}
|
||||
|
||||
static void
|
||||
rl_maybe_set_sighandler (sig, handler, ohandler)
|
||||
int sig;
|
||||
SigHandler *handler;
|
||||
sighandler_cxt *ohandler;
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
SigHandler *oh;
|
||||
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
oh = rl_set_sighandler (sig, handler, ohandler);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (sig, ohandler, &dummy);
|
||||
}
|
||||
|
||||
int
|
||||
rl_set_signals ()
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
SigHandler *oh;
|
||||
|
||||
if (rl_catch_signals && signals_set_flag == 0)
|
||||
{
|
||||
rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
|
||||
rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
|
||||
rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
|
||||
|
||||
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
|
||||
/* If the application using readline has already installed a signal
|
||||
handler with SA_RESTART, SIGALRM will cause reads to be restarted
|
||||
automatically, so readline should just get out of the way. Since
|
||||
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
|
||||
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#endif /* HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
rl_maybe_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
#if defined (SIGTTOU)
|
||||
rl_maybe_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
#if defined (SIGTTIN)
|
||||
rl_maybe_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
|
||||
#endif /* SIGTTIN */
|
||||
|
||||
signals_set_flag = 1;
|
||||
}
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
if (rl_catch_sigwinch && sigwinch_set_flag == 0)
|
||||
{
|
||||
rl_maybe_set_sighandler (SIGWINCH, rl_sigwinch_handler, &old_winch);
|
||||
sigwinch_set_flag = 1;
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_clear_signals ()
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
|
||||
if (rl_catch_signals && signals_set_flag == 1)
|
||||
{
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
|
||||
rl_sigaction (SIGINT, &old_int, &dummy);
|
||||
rl_sigaction (SIGTERM, &old_term, &dummy);
|
||||
rl_sigaction (SIGQUIT, &old_quit, &dummy);
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
#if defined (SIGTTOU)
|
||||
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
#if defined (SIGTTIN)
|
||||
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
|
||||
#endif /* SIGTTIN */
|
||||
|
||||
signals_set_flag = 0;
|
||||
}
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
if (rl_catch_sigwinch && sigwinch_set_flag == 1)
|
||||
{
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
rl_sigaction (SIGWINCH, &old_winch, &dummy);
|
||||
sigwinch_set_flag = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Clean up the terminal and readline state after catching a signal, before
|
||||
resending it to the calling application. */
|
||||
void
|
||||
rl_cleanup_after_signal ()
|
||||
{
|
||||
_rl_clean_up_for_exit ();
|
||||
if (rl_deprep_term_function)
|
||||
(*rl_deprep_term_function) ();
|
||||
rl_clear_signals ();
|
||||
rl_clear_pending_input ();
|
||||
}
|
||||
|
||||
/* Reset the terminal and readline state after a signal handler returns. */
|
||||
void
|
||||
rl_reset_after_signal ()
|
||||
{
|
||||
if (rl_prep_term_function)
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
rl_set_signals ();
|
||||
}
|
||||
|
||||
/* Free up the readline variable line state for the current line (undo list,
|
||||
any partial history entry, any keyboard macros in progress, and any
|
||||
numeric arguments in process) after catching a signal, before calling
|
||||
rl_cleanup_after_signal(). */
|
||||
void
|
||||
rl_free_line_state ()
|
||||
{
|
||||
register HIST_ENTRY *entry;
|
||||
|
||||
rl_free_undo_list ();
|
||||
|
||||
entry = current_history ();
|
||||
if (entry)
|
||||
entry->data = (char *)NULL;
|
||||
|
||||
_rl_kill_kbd_macro ();
|
||||
rl_clear_message ();
|
||||
_rl_init_argument ();
|
||||
}
|
||||
|
||||
#endif /* HANDLE_SIGNALS */
|
||||
@@ -785,11 +785,13 @@ _rl_insert_char (count, c)
|
||||
rl_insert_text (str);
|
||||
}
|
||||
}
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
else
|
||||
{
|
||||
rl_insert_text (incoming);
|
||||
stored_count = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3449,9 +3449,38 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
char **sp, **ep;
|
||||
{
|
||||
int c, len;
|
||||
register char *p, *p1;
|
||||
register char *p, *p1, *npat;
|
||||
char *end;
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
unnecessary calls to strmatch (up to N calls for a string of N
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = STRLEN (pat);
|
||||
if (pat[0] != '*' || pat[len - 1] != '*')
|
||||
{
|
||||
p = npat = xmalloc (len + 3);
|
||||
p1 = pat;
|
||||
if (*p1 != '*')
|
||||
*p++ = '*';
|
||||
while (*p1)
|
||||
*p++ = *p1++;
|
||||
if (p1[-1] != '*' || p[-2] == '\\')
|
||||
*p++ = '*';
|
||||
*p = '\0';
|
||||
}
|
||||
else
|
||||
npat = pat;
|
||||
c = strmatch (npat, string, FNMATCH_EXTFLAG);
|
||||
if (npat != pat)
|
||||
free (npat);
|
||||
if (c == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
len = STRLEN (string);
|
||||
end = string + len;
|
||||
|
||||
@@ -3559,7 +3588,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
int mtype;
|
||||
char **sp, **ep;
|
||||
{
|
||||
wchar_t wc;
|
||||
wchar_t wc, *wp, *nwpat, *wp1;
|
||||
int len;
|
||||
#if 0
|
||||
size_t n, n1; /* Apple's gcc seems to miscompile this badly */
|
||||
@@ -3567,6 +3596,35 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
int n, n1;
|
||||
#endif
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
unnecessary calls to strmatch (up to N calls for a string of N
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = wcslen (wpat);
|
||||
if (wpat[0] != L'*' || wpat[len - 1] != L'*')
|
||||
{
|
||||
wp = nwpat = xmalloc ((len + 3) * sizeof (wchar_t));
|
||||
wp1 = wpat;
|
||||
if (*wp1 != L'*')
|
||||
*wp++ = L'*';
|
||||
while (*wp1 != L'\0')
|
||||
*wp++ = *wp1++;
|
||||
if (wp1[-1] != L'*' || wp1[-2] == L'\\')
|
||||
*wp++ = L'*';
|
||||
*wp = '\0';
|
||||
}
|
||||
else
|
||||
nwpat = wpat;
|
||||
len = wcsmatch (nwpat, wstring, FNMATCH_EXTFLAG);
|
||||
if (nwpat != wpat)
|
||||
free (nwpat);
|
||||
if (len == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
|
||||
+606
-246
File diff suppressed because it is too large
Load Diff
+8000
File diff suppressed because it is too large
Load Diff
@@ -3449,9 +3449,38 @@ match_upattern (string, pat, mtype, sp, ep)
|
||||
char **sp, **ep;
|
||||
{
|
||||
int c, len;
|
||||
register char *p, *p1;
|
||||
register char *p, *p1, *npat;
|
||||
char *end;
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
unnecessary calls to strmatch (up to N calls for a string of N
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = STRLEN (pat);
|
||||
if (pat[0] != '*' || pat[len - 1] != '*')
|
||||
{
|
||||
p = npat = xmalloc (len + 3);
|
||||
p1 = pat;
|
||||
if (*p1 != '*')
|
||||
*p++ = '*';
|
||||
while (*p1)
|
||||
*p++ = *p1++;
|
||||
if (p1[-1] != '*' || p[-2] == '\\')
|
||||
*p++ = '*';
|
||||
*p = '\0';
|
||||
}
|
||||
else
|
||||
npat = pat;
|
||||
c = strmatch (npat, string, FNMATCH_EXTFLAG);
|
||||
if (npat != pat)
|
||||
free (npat);
|
||||
if (c == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
len = STRLEN (string);
|
||||
end = string + len;
|
||||
|
||||
@@ -3559,7 +3588,7 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
int mtype;
|
||||
char **sp, **ep;
|
||||
{
|
||||
wchar_t wc;
|
||||
wchar_t wc, *wp, *nwpat, *wp1;
|
||||
int len;
|
||||
#if 0
|
||||
size_t n, n1; /* Apple's gcc seems to miscompile this badly */
|
||||
@@ -3567,6 +3596,35 @@ match_wpattern (wstring, indices, wstrlen, wpat, mtype, sp, ep)
|
||||
int n, n1;
|
||||
#endif
|
||||
|
||||
/* If the pattern doesn't match anywhere in the string, go ahead and
|
||||
short-circuit right away. A minor optimization, saves a bunch of
|
||||
unnecessary calls to strmatch (up to N calls for a string of N
|
||||
characters) if the match is unsuccessful. To preserve the semantics
|
||||
of the substring matches below, we make sure that the pattern has
|
||||
`*' as first and last character, making a new pattern if necessary. */
|
||||
/* XXX - check this later if I ever implement `**' with special meaning,
|
||||
since this will potentially result in `**' at the beginning or end */
|
||||
len = wcslen (wpat);
|
||||
if (wpat[0] != L'*' || wpat[len - 1] != L'*')
|
||||
{
|
||||
wp = nwpat = xmalloc ((len + 3) * sizeof (wchar_t));
|
||||
wp1 = wpat;
|
||||
if (*wp1 != L'*')
|
||||
*wp++ = L'*';
|
||||
while (*wp1 != L'\0')
|
||||
*wp++ = *wp1++;
|
||||
if (wp1[-1] != L'*' || wp1[-2] == L'\\')
|
||||
*wp++ = L'*';
|
||||
*wp = '\0';
|
||||
}
|
||||
else
|
||||
wp = wpat;
|
||||
len = wcsmatch (wp, wstring, FNMATCH_EXTFLAG);
|
||||
if (wp != wpat)
|
||||
free (wp);
|
||||
if (len == FNM_NOMATCH)
|
||||
return (0);
|
||||
|
||||
switch (mtype)
|
||||
{
|
||||
case MATCH_ANY:
|
||||
@@ -4997,7 +5055,7 @@ mbstrlen (s)
|
||||
mbsbak = mbs;
|
||||
while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0)
|
||||
{
|
||||
if ((MB_INVALIDCH(clen) == 0)
|
||||
if (MB_INVALIDCH(clen))
|
||||
{
|
||||
clen = 1; /* assume single byte */
|
||||
mbs = mbsbak;
|
||||
|
||||
Reference in New Issue
Block a user