changes to documentation to reduce gender-specific language; fix a seg fault in `fc'

This commit is contained in:
Chet Ramey
2021-06-17 17:10:49 -04:00
parent da43077c47
commit 8d3cecab33
17 changed files with 1631 additions and 1574 deletions
+26
View File
@@ -1041,6 +1041,32 @@ builtin_unbind_variable (vname)
return (unbind_variable (vname));
}
int
builtin_arrayref_flags (w, baseflags)
WORD_DESC *w;
int baseflags;
{
char *t;
int vflags;
vflags = baseflags;
/* Don't require assoc_expand_once if we have an argument that's already
passed through valid_array_reference and been expanded once. That
doesn't protect it from normal expansions like word splitting, so
proper quoting is still required. */
if (w->flags & W_ARRAYREF)
vflags |= VA_ONEWORD|VA_NOEXPAND;
# if 0
/* This is a little sketchier but handles quoted arguments. */
if (assoc_expand_once && (t = strchr (w->word, '[')) && t[strlen(t) - 1] == ']')
vflags |= VA_ONEWORD|VA_NOEXPAND;
# endif
return vflags;
}
/* **************************************************************** */
/* */
/* External interface to manipulate shell options */
+2
View File
@@ -233,6 +233,8 @@ extern SHELL_VAR *builtin_bind_variable PARAMS((char *, char *, int));
extern SHELL_VAR *builtin_bind_var_to_int PARAMS((char *, intmax_t));
extern int builtin_unbind_variable PARAMS((const char *));
extern int builtin_arrayref_flags PARAMS((WORD_DESC *, int));
/* variables from evalfile.c */
extern int sourcelevel;
+5 -2
View File
@@ -1,7 +1,7 @@
This file is fc.def, from which is created fc.c.
It implements the builtin "fc" in Bash.
Copyright (C) 1987-2020 Free Software Foundation, Inc.
Copyright (C) 1987-2021 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -450,6 +450,8 @@ fc_builtin (list)
for (i = reverse ? histend : histbeg; reverse ? i >= histbeg : i <= histend; reverse ? i-- : i++)
{
QUIT;
if (hlist[i] == 0)
continue;
if (numbering)
fprintf (stream, "%d", i + history_base);
if (listing)
@@ -459,7 +461,8 @@ fc_builtin (list)
else
fprintf (stream, "\t%c", histdata (i) ? '*' : ' ');
}
fprintf (stream, "%s\n", histline (i));
if (histline (i))
fprintf (stream, "%s\n", histline (i));
}
if (listing)
+1 -7
View File
@@ -888,13 +888,7 @@ unset_builtin (list)
unset_variable = global_unset_var;
#if defined (ARRAY_VARS)
vflags = base_vflags;
/* Don't require assoc_expand_once if we have an argument that's already
passed through valid_array_reference and been expanded once. That
doesn't protect it from normal expansions like word splitting, so
proper quoting is still required. */
if (list->word->flags & W_ARRAYREF)
vflags |= VA_ONEWORD|VA_NOEXPAND;
vflags = builtin_arrayref_flags (list->word, base_vflags);
#endif
#if defined (ARRAY_VARS)