mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-13 07:00:49 +02:00
commit bash-20160923 snapshot
This commit is contained in:
@@ -120,6 +120,13 @@ int
|
||||
local_builtin (list)
|
||||
register WORD_LIST *list;
|
||||
{
|
||||
/* Catch a straight `local --help' before checking function context */
|
||||
if (list && list->word && STREQ (list->word->word, "--help"))
|
||||
{
|
||||
builtin_help ();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
if (variable_context)
|
||||
return (declare_internal (list, 1));
|
||||
else
|
||||
|
||||
+5
-2
@@ -190,8 +190,11 @@ exec_builtin (list)
|
||||
|
||||
/* Decrement SHLVL by 1 so a new shell started here has the same value,
|
||||
preserving the appearance. After we do that, we need to change the
|
||||
exported environment to include the new value. */
|
||||
if (cleanenv == 0)
|
||||
exported environment to include the new value. If we've already forked
|
||||
and are in a subshell, we don't want to decrement the shell level,
|
||||
since we are `increasing' the level */
|
||||
|
||||
if (cleanenv == 0 && (subshell_environment & SUBSHELL_PAREN) == 0)
|
||||
adjust_shell_level (-1);
|
||||
|
||||
if (cleanenv)
|
||||
|
||||
@@ -59,7 +59,7 @@ $END
|
||||
|
||||
$BUILTIN readarray
|
||||
$FUNCTION mapfile_builtin
|
||||
$SHORT_DOC readarray [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
|
||||
$SHORT_DOC readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
|
||||
Read lines from a file into an array variable.
|
||||
|
||||
A synonym for `mapfile'.
|
||||
|
||||
+5
-3
@@ -711,8 +711,8 @@ printstr (fmt, string, len, fieldwidth, precision)
|
||||
int fw, pr; /* fieldwidth and precision */
|
||||
intmax_t mfw, mpr;
|
||||
|
||||
if (string == 0 || len == 0)
|
||||
return 0;
|
||||
if (string == 0)
|
||||
string = "";
|
||||
|
||||
#if 0
|
||||
s = fmt;
|
||||
@@ -955,7 +955,9 @@ bexpand (string, len, sawc, lenp)
|
||||
*sawc = 0;
|
||||
if (lenp)
|
||||
*lenp = 0;
|
||||
return ((char *)NULL);
|
||||
ret = (char *)xmalloc (1);
|
||||
ret[0] = '\0';
|
||||
return (ret);
|
||||
}
|
||||
|
||||
ret = (char *)xmalloc (len + 1);
|
||||
|
||||
+12
-4
@@ -859,7 +859,7 @@ unset_builtin (list)
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
unset_array = 0;
|
||||
if (!unset_function && nameref == 0 && valid_array_reference (name, 0))
|
||||
if (!unset_function && nameref == 0 && valid_array_reference (name, 1)) /* XXX valid array reference second arg was 0 */
|
||||
{
|
||||
t = strchr (name, '[');
|
||||
*t++ = '\0';
|
||||
@@ -916,7 +916,11 @@ 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);
|
||||
#if 0
|
||||
tem = unbind_array_element (var, t, 1); /* XXX new third arg */
|
||||
#else
|
||||
tem = unbind_array_element (var, t, 0); /* XXX new third arg */
|
||||
#endif
|
||||
if (tem == -2 && array_p (var) == 0 && assoc_p (var) == 0)
|
||||
{
|
||||
builtin_error (_("%s: not an array variable"), var->name);
|
||||
@@ -938,8 +942,12 @@ unset_builtin (list)
|
||||
if (valid_array_reference (nameref_cell (var), 0))
|
||||
{
|
||||
tname = savestring (nameref_cell (var));
|
||||
if (var = array_variable_part (tname, &t, 0))
|
||||
tem = unbind_array_element (var, t);
|
||||
if (var = array_variable_part (tname, &t, (int *)0))
|
||||
#if 0
|
||||
tem = unbind_array_element (var, t, 1); /* XXX new third arg */
|
||||
#else
|
||||
tem = unbind_array_element (var, t, 0); /* XXX new third arg */
|
||||
#endif
|
||||
free (tname);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user