mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-30 23:13:49 +02:00
commit bash-20180928 snapshot
This commit is contained in:
+6
-2
@@ -247,6 +247,9 @@ printf_builtin (list)
|
||||
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
|
||||
int mbind, mblen;
|
||||
#endif
|
||||
#if defined (ARRAY_VARS)
|
||||
int arrayflags;
|
||||
#endif
|
||||
|
||||
conversion_error = 0;
|
||||
retval = EXECUTION_SUCCESS;
|
||||
@@ -261,7 +264,8 @@ printf_builtin (list)
|
||||
case 'v':
|
||||
vname = list_optarg;
|
||||
#if defined (ARRAY_VARS)
|
||||
if (legal_identifier (vname) || valid_array_reference (vname, assoc_expand_once))
|
||||
arrayflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
|
||||
if (legal_identifier (vname) || valid_array_reference (vname, arrayflags))
|
||||
#else
|
||||
if (legal_identifier (vname))
|
||||
#endif
|
||||
@@ -1277,7 +1281,7 @@ bind_printf_variable (name, value, flags)
|
||||
SHELL_VAR *v;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (valid_array_reference (name, assoc_expand_once) == 0)
|
||||
if (valid_array_reference (name, assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0) == 0)
|
||||
v = bind_variable (name, value, flags);
|
||||
else
|
||||
v = assign_array_element (name, value, flags | (assoc_expand_once ? ASS_NOEXPAND : 0));
|
||||
|
||||
+8
-5
@@ -179,7 +179,8 @@ read_builtin (list)
|
||||
int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2, nflag;
|
||||
volatile int i;
|
||||
int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
|
||||
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;
|
||||
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd;
|
||||
int lastsig, t_errno;
|
||||
int mb_cur_max;
|
||||
unsigned int tmsec, tmusec;
|
||||
long ival, uval;
|
||||
@@ -192,6 +193,7 @@ read_builtin (list)
|
||||
TTYSTRUCT ttattrs, ttset;
|
||||
#if defined (ARRAY_VARS)
|
||||
WORD_LIST *alist;
|
||||
int vflags;
|
||||
#endif
|
||||
#if defined (READLINE)
|
||||
char *rlbuf, *itext;
|
||||
@@ -336,7 +338,8 @@ read_builtin (list)
|
||||
/* Convenience: check early whether or not the first of possibly several
|
||||
variable names is a valid identifier, and bail early if so. */
|
||||
#if defined (ARRAY_VARS)
|
||||
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, assoc_expand_once) == 0)
|
||||
vflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
|
||||
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, vflags) == 0)
|
||||
#else
|
||||
if (list && legal_identifier (list->word->word) == 0)
|
||||
#endif
|
||||
@@ -853,7 +856,7 @@ assign_vars:
|
||||
{
|
||||
varname = list->word->word;
|
||||
#if defined (ARRAY_VARS)
|
||||
if (legal_identifier (varname) == 0 && valid_array_reference (varname, assoc_expand_once) == 0)
|
||||
if (legal_identifier (varname) == 0 && valid_array_reference (varname, vflags) == 0)
|
||||
#else
|
||||
if (legal_identifier (varname) == 0)
|
||||
#endif
|
||||
@@ -901,7 +904,7 @@ assign_vars:
|
||||
|
||||
/* Now assign the rest of the line to the last variable argument. */
|
||||
#if defined (ARRAY_VARS)
|
||||
if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, assoc_expand_once) == 0)
|
||||
if (legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word, vflags) == 0)
|
||||
#else
|
||||
if (legal_identifier (list->word->word) == 0)
|
||||
#endif
|
||||
@@ -964,7 +967,7 @@ bind_read_variable (name, value)
|
||||
SHELL_VAR *v;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (valid_array_reference (name, assoc_expand_once) == 0)
|
||||
if (valid_array_reference (name, assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0) == 0)
|
||||
v = bind_variable (name, value, 0);
|
||||
else
|
||||
v = assign_array_element (name, value, assoc_expand_once ? ASS_NOEXPAND : 0);
|
||||
|
||||
+9
-4
@@ -800,7 +800,7 @@ unset_builtin (list)
|
||||
WORD_LIST *list;
|
||||
{
|
||||
int unset_function, unset_variable, unset_array, opt, nameref, any_failed;
|
||||
int global_unset_func, global_unset_var;
|
||||
int global_unset_func, global_unset_var, vflags;
|
||||
char *name, *tname;
|
||||
|
||||
unset_function = unset_variable = unset_array = nameref = any_failed = 0;
|
||||
@@ -837,6 +837,10 @@ unset_builtin (list)
|
||||
else if (unset_function && nameref)
|
||||
nameref = 0;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
vflags = assoc_expand_once ? (VA_NOEXPAND|VA_ONEWORD) : 0;
|
||||
#endif
|
||||
|
||||
while (list)
|
||||
{
|
||||
SHELL_VAR *var;
|
||||
@@ -852,7 +856,8 @@ unset_builtin (list)
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
unset_array = 0;
|
||||
if (!unset_function && nameref == 0 && valid_array_reference (name, assoc_expand_once)) /* XXX valid array reference second arg was 0 */
|
||||
/* XXX valid array reference second arg was 0 */
|
||||
if (!unset_function && nameref == 0 && valid_array_reference (name, vflags))
|
||||
{
|
||||
t = strchr (name, '[');
|
||||
*t++ = '\0';
|
||||
@@ -909,7 +914,7 @@ unset_builtin (list)
|
||||
if (var && unset_array)
|
||||
{
|
||||
/* Let unbind_array_element decide what to do with non-array vars */
|
||||
tem = unbind_array_element (var, t, assoc_expand_once); /* XXX new third arg */
|
||||
tem = unbind_array_element (var, t, vflags); /* XXX new third arg */
|
||||
if (tem == -2 && array_p (var) == 0 && assoc_p (var) == 0)
|
||||
{
|
||||
builtin_error (_("%s: not an array variable"), var->name);
|
||||
@@ -932,7 +937,7 @@ unset_builtin (list)
|
||||
{
|
||||
tname = savestring (nameref_cell (var));
|
||||
if (var = array_variable_part (tname, 0, &t, (int *)0))
|
||||
tem = unbind_array_element (var, t, assoc_expand_once); /* XXX new third arg */
|
||||
tem = unbind_array_element (var, t, vflags); /* XXX new third arg */
|
||||
free (tname);
|
||||
}
|
||||
else
|
||||
|
||||
+1
-3
@@ -1,7 +1,7 @@
|
||||
This file is shopt.def, from which is created shopt.c.
|
||||
It implements the Bash `shopt' builtin.
|
||||
|
||||
Copyright (C) 1994-2016 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -220,9 +220,7 @@ static struct {
|
||||
{ "lithist", &literal_history, (shopt_set_func_t *)NULL },
|
||||
#endif
|
||||
{ "localvar_inherit", &localvar_inherit, (shopt_set_func_t *)NULL },
|
||||
#if 0 /* bash-5.0-beta */
|
||||
{ "localvar_unset", &localvar_unset, (shopt_set_func_t *)NULL },
|
||||
#endif
|
||||
{ "login_shell", &shopt_login_shell, set_login_shell },
|
||||
{ "mailwarn", &mail_warning, (shopt_set_func_t *)NULL },
|
||||
#if defined (READLINE)
|
||||
|
||||
Reference in New Issue
Block a user