mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
commit bash-20120810 snapshot
This commit is contained in:
@@ -14291,3 +14291,39 @@ lib/malloc/getpagesize.h
|
||||
lib/sh/{clktck,fpurge,inet_aton,mailstat,oslib,pathcanon,pathphys,spell,strerror}.c
|
||||
- make inclusion of <sys/param.h> dependent on HAVE_SYS_PARAM_H
|
||||
consistently
|
||||
|
||||
8/6
|
||||
---
|
||||
lib/readline/histexpand.c
|
||||
- history_expand_internal: now takes an additional argument saying
|
||||
whether the history expansion occurs within a quoted string, set to
|
||||
the open quote character
|
||||
- history_expand_internal: use new argument instead of checking prev
|
||||
char and initializing quoted_search_delimiter, pass qc directly to
|
||||
get_history_event, where it allows a matching quote to terminate a
|
||||
string defining an event
|
||||
- history_expand: change single-quote handling code so that if
|
||||
history_quotes_inhibit_expansion is 0, single quotes are treated
|
||||
like double quotes
|
||||
- history_expand: change call to history_expand_internal to pass new
|
||||
argument of `"' if double-quoted string, `'' if single-quoted string;
|
||||
this lets history_expand decide what is a quoted string and what
|
||||
is not
|
||||
|
||||
8/7
|
||||
---
|
||||
configure.in
|
||||
- AC_CANONICAL_BUILD: invoke for later use
|
||||
|
||||
lib/readline/macro.c
|
||||
- _rl_prev_macro_key: new function, inverse of _rl_next_macro_key:
|
||||
backs up the index into the current macro by 1
|
||||
|
||||
lib/readline/rlprivate.h
|
||||
- _rl_prev_macro_key: extern declaration
|
||||
|
||||
|
||||
lib/readline/readline.c
|
||||
- _rl_dispatch_subseq, _rl_subseq_result: don't call _rl_unget_char
|
||||
if we're currently reading from a macro; call _rl_prev_macro_key
|
||||
instead. Fixes bug reported by Clark Wang <clark.wang@oracle.com>
|
||||
|
||||
@@ -49,6 +49,7 @@ esac
|
||||
dnl canonicalize the host and os so we can do some tricky things before
|
||||
dnl parsing options
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_BUILD
|
||||
|
||||
dnl configure defaults
|
||||
opt_bash_malloc=yes
|
||||
|
||||
+24
-35
@@ -1,6 +1,6 @@
|
||||
/* histexpand.c -- history expansion. */
|
||||
|
||||
/* Copyright (C) 1989-2010 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1989-2012 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (History), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
@@ -519,9 +519,9 @@ postproc_subst_rhs ()
|
||||
the returned string. Returns the new index into string in
|
||||
*END_INDEX_PTR, and the expanded specifier in *RET_STRING. */
|
||||
static int
|
||||
history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
||||
history_expand_internal (string, start, qc, end_index_ptr, ret_string, current_line)
|
||||
char *string;
|
||||
int start, *end_index_ptr;
|
||||
int start, qc, *end_index_ptr;
|
||||
char **ret_string;
|
||||
char *current_line; /* for !# */
|
||||
{
|
||||
@@ -557,30 +557,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
|
||||
event = current_line;
|
||||
}
|
||||
else
|
||||
{
|
||||
int quoted_search_delimiter = 0;
|
||||
|
||||
/* If the character before this `!' is a double or single
|
||||
quote, then this expansion takes place inside of the
|
||||
quoted string. If we have to search for some text ("!foo"),
|
||||
allow the delimiter to end the search string. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
int ch, l;
|
||||
l = _rl_find_prev_mbchar (string, i, MB_FIND_ANY);
|
||||
ch = string[l];
|
||||
/* XXX - original patch had i - 1 ??? If i == 0 it would fail. */
|
||||
if (i && (ch == '\'' || ch == '"'))
|
||||
quoted_search_delimiter = ch;
|
||||
}
|
||||
else
|
||||
#endif /* HANDLE_MULTIBYTE */
|
||||
if (i && (string[i - 1] == '\'' || string[i - 1] == '"'))
|
||||
quoted_search_delimiter = string[i - 1];
|
||||
|
||||
event = get_history_event (string, &i, quoted_search_delimiter);
|
||||
}
|
||||
event = get_history_event (string, &i, qc);
|
||||
|
||||
if (event == 0)
|
||||
{
|
||||
@@ -928,7 +905,7 @@ history_expand (hstring, output)
|
||||
char **output;
|
||||
{
|
||||
register int j;
|
||||
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, flag;
|
||||
int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag;
|
||||
char *string;
|
||||
|
||||
/* The output string, and its length. */
|
||||
@@ -991,7 +968,7 @@ history_expand (hstring, output)
|
||||
|
||||
/* `!' followed by one of the characters in history_no_expand_chars
|
||||
is NOT an expansion. */
|
||||
for (i = dquote = 0; string[i]; i++)
|
||||
for (i = dquote = squote = 0; string[i]; i++)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
@@ -1078,9 +1055,9 @@ history_expand (hstring, output)
|
||||
}
|
||||
|
||||
/* Extract and perform the substitution. */
|
||||
for (passc = dquote = i = j = 0; i < l; i++)
|
||||
for (passc = dquote = squote = i = j = 0; i < l; i++)
|
||||
{
|
||||
int tchar = string[i];
|
||||
int qc, tchar = string[i];
|
||||
|
||||
if (passc)
|
||||
{
|
||||
@@ -1137,8 +1114,14 @@ history_expand (hstring, output)
|
||||
case '\'':
|
||||
{
|
||||
/* If history_quotes_inhibit_expansion is set, single quotes
|
||||
inhibit history expansion. */
|
||||
if (dquote == 0 && history_quotes_inhibit_expansion)
|
||||
inhibit history expansion, otherwise they are treated like
|
||||
double quotes. */
|
||||
if (squote)
|
||||
{
|
||||
squote = 0;
|
||||
ADD_CHAR (tchar);
|
||||
}
|
||||
else if (dquote == 0 && history_quotes_inhibit_expansion)
|
||||
{
|
||||
int quote, slen;
|
||||
|
||||
@@ -1153,6 +1136,11 @@ history_expand (hstring, output)
|
||||
ADD_STRING (temp);
|
||||
xfree (temp);
|
||||
}
|
||||
else if (dquote == 0 && squote == 0 && history_quotes_inhibit_expansion == 0)
|
||||
{
|
||||
squote = 1;
|
||||
ADD_CHAR (string[i]);
|
||||
}
|
||||
else
|
||||
ADD_CHAR (string[i]);
|
||||
break;
|
||||
@@ -1178,6 +1166,7 @@ history_expand (hstring, output)
|
||||
characters in history_no_expand_chars, then it is not a
|
||||
candidate for expansion of any kind. */
|
||||
if (cc == 0 || member (cc, history_no_expand_chars) ||
|
||||
(dquote && cc == '"') ||
|
||||
(history_inhibit_expansion_function && (*history_inhibit_expansion_function) (string, i)))
|
||||
{
|
||||
ADD_CHAR (string[i]);
|
||||
@@ -1203,8 +1192,8 @@ history_expand (hstring, output)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
r = history_expand_internal (string, i, &eindex, &temp, result);
|
||||
qc = squote ? '\'' : (dquote ? '"' : 0);
|
||||
r = history_expand_internal (string, i, qc, &eindex, &temp, result);
|
||||
if (r < 0)
|
||||
{
|
||||
*output = temp;
|
||||
|
||||
@@ -121,6 +121,19 @@ _rl_next_macro_key ()
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
_rl_prev_macro_key ()
|
||||
{
|
||||
if (rl_executing_macro == 0)
|
||||
return (0);
|
||||
|
||||
if (executing_macro_index == 0)
|
||||
return (0);
|
||||
|
||||
executing_macro_index--;
|
||||
return (rl_executing_macro[executing_macro_index]);
|
||||
}
|
||||
|
||||
/* Save the currently executing macro on a stack of saved macros. */
|
||||
void
|
||||
_rl_push_executing_macro ()
|
||||
|
||||
+16
-4
@@ -830,7 +830,10 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
||||
/* OK, there's no function bound in this map, but there is a
|
||||
shadow function that was overridden when the current keymap
|
||||
was created. Return -2 to note that. */
|
||||
_rl_unget_char (key);
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
return -2;
|
||||
}
|
||||
else if (got_subseq)
|
||||
@@ -839,7 +842,10 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
||||
have a matching key, nor was one overridden. This means
|
||||
we need to back up the recursion chain and find the last
|
||||
subsequence that is bound to a function. */
|
||||
_rl_unget_char (key);
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -994,14 +1000,20 @@ _rl_subseq_result (r, map, key, got_subseq)
|
||||
/* We didn't match (r is probably -1), so return something to
|
||||
tell the caller that it should try ANYOTHERKEY for an
|
||||
overridden function. */
|
||||
_rl_unget_char (key);
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_dispatching_keymap = map;
|
||||
return -2;
|
||||
}
|
||||
else if (r && got_subseq)
|
||||
{
|
||||
/* OK, back up the chain. */
|
||||
_rl_unget_char (key);
|
||||
if (RL_ISSTATE (RL_STATE_MACROINPUT))
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
_rl_dispatching_keymap = map;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -292,6 +292,7 @@ extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
|
||||
/* macro.c */
|
||||
extern void _rl_with_macro_input PARAMS((char *));
|
||||
extern int _rl_next_macro_key PARAMS((void));
|
||||
extern int _rl_prev_macro_key PARAMS((void));
|
||||
extern void _rl_push_executing_macro PARAMS((void));
|
||||
extern void _rl_pop_executing_macro PARAMS((void));
|
||||
extern void _rl_add_macro_char PARAMS((int));
|
||||
|
||||
Reference in New Issue
Block a user