alias expansion fix in case statements

This commit is contained in:
Chet Ramey
2021-03-29 10:25:18 -04:00
parent b37342db4f
commit 65822e5011
6 changed files with 46 additions and 9 deletions
+20
View File
@@ -9905,3 +9905,23 @@ execute_cmd.c
we're going to call shell_execve right away anyway, so we won't be
around to remove the FIFOs. From a report from
Michael Felt <aixtools@gmail.com>
3/22
----
parse.y
- alias_expand_token: slight tweak to check for alias expansion: perform
expansion unconditionally if PST_ALEXPNEXT is set, and disable it
in case statement pattern lists if the previous token indicates a
command name is acceptable.
From a report by Oguz <oguzismailuysal@gmail.com>
config-bot.h
- HAVE_MKDTEMP: fix typo
3/25
----
lib/readline/terminal.c
- look in terminfo for key sequences for page up (kP) and page down
(kN) and bind them to history-search-{backward,forward},
respectively. From a patch from Xose Vazquez Perez
<xose.vazquez@gmail.com>
+1 -1
View File
@@ -99,7 +99,7 @@
#endif
#if !HAVE_MKDTEMP
# undef USE_MKDTMP
# undef USE_MKDTEMP
#endif
/* If the shell is called by this name, it will become restricted. */
+5 -4
View File
@@ -1140,10 +1140,11 @@ quotes (see
.B PARAMETERS
below).
.PP
Words of the form \fB$\fP\(aq\fIstring\fP\(aq are treated specially. The
word expands to \fIstring\fP, with backslash-escaped characters replaced
as specified by the ANSI C standard. Backslash escape sequences, if
present, are decoded as follows:
Character sequences of the form \fB$\fP\(aq\fIstring\fP\(aq are treated
as a special variant of single quotes.
The sequence expands to \fIstring\fP, with backslash-escaped characters
in \fIstring\fP replaced as specified by the ANSI C standard.
Backslash escape sequences, if present, are decoded as follows:
.RS
.PD 0
.TP
+5 -4
View File
@@ -475,10 +475,11 @@ when in double quotes (@pxref{Shell Parameter Expansion}).
@subsubsection ANSI-C Quoting
@cindex quoting, ANSI
Words of the form $'@var{string}' are treated specially. The
word expands to @var{string}, with backslash-escaped characters replaced
as specified by the ANSI C standard. Backslash escape sequences, if
present, are decoded as follows:
Character sequences of the form $'@var{string}' are treated as a special
kind of single quotes.
The sequence expands to @var{string}, with backslash-escaped characters
in @var{string} replaced as specified by the ANSI C standard.
Backslash escape sequences, if present, are decoded as follows:
@table @code
@item \a
+11
View File
@@ -177,6 +177,10 @@ static char *_rl_term_kD;
/* Insert key */
static char *_rl_term_kI;
/* Page up and page down keys */
static char *_rl_term_kP;
static char *_rl_term_kN;
/* Cursor control */
static char *_rl_term_vs; /* very visible */
static char *_rl_term_ve; /* normal */
@@ -415,6 +419,8 @@ static const struct _tc_string tc_strings[] =
{ "kD", &_rl_term_kD }, /* delete */
{ "kH", &_rl_term_kH }, /* home down ?? */
{ "kI", &_rl_term_kI }, /* insert */
{ "kN", &_rl_term_kN }, /* page down */
{ "kN", &_rl_term_kP }, /* page up */
{ "kd", &_rl_term_kd },
{ "ke", &_rl_term_ke }, /* end keypad mode */
{ "kh", &_rl_term_kh }, /* home */
@@ -478,6 +484,7 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
_rl_term_kN = _rl_term_kP = (char *)NULL;
_rl_term_so = _rl_term_se = (char *)NULL;
#if defined(HACK_TERMCAP_MOTION)
_rl_term_forward_char = (char *)NULL;
@@ -540,6 +547,7 @@ _rl_init_terminal_io (const char *terminal_name)
_rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_kI = _rl_term_kD = (char *)NULL;
_rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
_rl_term_kN = _rl_term_kP = (char *)NULL;
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
@@ -629,6 +637,9 @@ bind_termcap_arrow_keys (Keymap map)
rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
rl_bind_keyseq_if_unbound (_rl_term_kI, rl_overwrite_mode); /* Insert */
rl_bind_keyseq_if_unbound (_rl_term_kN, rl_history_search_forward); /* Page Down */
rl_bind_keyseq_if_unbound (_rl_term_kP, rl_history_search_backward); /* Page Up */
_rl_keymap = xkeymap;
}
+4
View File
@@ -2975,8 +2975,12 @@ alias_expand_token (tokstr)
char *expanded;
alias_t *ap;
#if 0
if (((parser_state & PST_ALEXPNEXT) || command_token_position (last_read_token)) &&
(parser_state & PST_CASEPAT) == 0)
#else
if ((parser_state & PST_ALEXPNEXT) || assignment_acceptable (last_read_token))
#endif
{
ap = find_alias (tokstr);