commit bash-20200221 snapshot

This commit is contained in:
Chet Ramey
2020-02-24 10:41:37 -05:00
parent 89d788fb01
commit 0df4ddca3f
19 changed files with 412 additions and 109 deletions
+2
View File
@@ -187,8 +187,10 @@ extern int describe_command PARAMS((char *, int));
/* Functions from setattr.def */
extern int set_or_show_attributes PARAMS((WORD_LIST *, int, int));
extern int show_all_var_attributes PARAMS((int, int));
extern int show_local_var_attributes PARAMS((int, int));
extern int show_var_attributes PARAMS((SHELL_VAR *, int, int));
extern int show_name_attributes PARAMS((char *, int));
extern int show_localname_attributes PARAMS((char *, int));
extern int show_func_attributes PARAMS((char *, int));
extern void set_var_attribute PARAMS((char *, int, int));
extern int var_attribute_string PARAMS((SHELL_VAR *, int, char *));
+4 -15
View File
@@ -202,7 +202,7 @@ declare_internal (list, local_var)
return (EX_USAGE);
#endif
case 'p':
if (local_var == 0)
/* if (local_var == 0) */
pflag++;
break;
case 'F':
@@ -271,20 +271,7 @@ declare_internal (list, local_var)
/* Show local variables defined at this context level if this is
the `local' builtin. */
if (local_var)
{
register SHELL_VAR **vlist;
register int i;
vlist = all_local_variables ();
if (vlist)
{
for (i = 0; vlist[i]; i++)
print_assignment (vlist[i]);
free (vlist);
}
}
show_local_var_attributes (0, nodefs); /* XXX - fix up args later */
else if (pflag && (flags_on == 0 || flags_on == att_function))
show_all_var_attributes (flags_on == 0, nodefs);
else if (flags_on == 0)
@@ -301,6 +288,8 @@ declare_internal (list, local_var)
{
if (flags_on & att_function)
pflag = show_func_attributes (list->word->word, nodefs);
else if (local_var)
pflag = show_localname_attributes (list->word->word, nodefs);
else
pflag = show_name_attributes (list->word->word, nodefs);
if (pflag)
+43 -5
View File
@@ -371,6 +371,30 @@ show_all_var_attributes (v, nodefs)
return (any_failed == 0 ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
/* Show all local variable variables with their attributes. This shows unset
local variables (all_local_variables called with 0 argment). */
int
show_local_var_attributes (v, nodefs)
int v, nodefs;
{
SHELL_VAR **variable_list, *var;
int any_failed;
register int i;
variable_list = all_local_variables (0);
if (variable_list == 0)
return (EXECUTION_SUCCESS);
for (i = any_failed = 0; var = variable_list[i]; i++)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
if (any_failed = sh_chkwrite (any_failed))
break;
}
free (variable_list);
return (any_failed == 0 ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
}
int
var_attribute_string (var, pattr, flags)
SHELL_VAR *var;
@@ -504,13 +528,27 @@ show_name_attributes (name, nodefs)
{
SHELL_VAR *var;
#if 0
var = find_variable_tempenv (name);
#else
var = find_variable_noref (name);
#endif
if (var /* && invisible_p (var) == 0 */)
if (var) /* show every variable with attributes, even unset ones */
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
return (0);
}
else
return (1);
}
int
show_localname_attributes (name, nodefs)
char *name;
int nodefs;
{
SHELL_VAR *var;
var = find_variable_noref (name);
if (var && local_p (var) && var->context == variable_context) /* show every variable with attributes, even unset ones */
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
return (0);
+15
View File
@@ -176,6 +176,21 @@ wait_builtin (list)
WAIT_RETURN (status);
}
opt = first_pending_trap ();
#if defined (SIGCHLD)
/* We special case SIGCHLD when not in posix mode because we don't break
out of the wait even when the signal is trapped; we run the trap after
the wait completes. See how it's handled in jobs.c:waitchld(). */
if (opt == SIGCHLD && posixly_correct == 0)
opt = next_pending_trap (opt+1);
#endif
if (opt != -1)
{
last_command_exit_signal = wait_signal_received = opt;
status = opt + 128;
WAIT_RETURN (status);
}
/* We support jobs or pids.
wait <pid-or-job> [pid-or-job ...] */