Bash-4.0 patchlevel 38
This commit is contained in:
parent
17345e5ad2
commit
89a92869e5
27 changed files with 490 additions and 164 deletions
|
|
@ -295,6 +295,13 @@ declare_internal (list, local_var)
|
|||
subscript_start = (char *)NULL;
|
||||
if (t = strchr (name, '[')) /* ] */
|
||||
{
|
||||
/* If offset != 0 we have already validated any array reference */
|
||||
if (offset == 0 && valid_array_reference (name) == 0)
|
||||
{
|
||||
sh_invalidid (name);
|
||||
assign_error++;
|
||||
NEXT_VARIABLE ();
|
||||
}
|
||||
subscript_start = t;
|
||||
*t = '\0';
|
||||
making_array_special = 1;
|
||||
|
|
@ -484,7 +491,7 @@ declare_internal (list, local_var)
|
|||
}
|
||||
/* declare -a name[[n]] or declare name[n] makes name an indexed
|
||||
array variable. */
|
||||
else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0)
|
||||
else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0 && assoc_p (var) == 0)
|
||||
var = convert_var_to_array (var);
|
||||
#endif /* ARRAY_VARS */
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ exit_or_logout (list)
|
|||
for (i = stopmsg = 0; i < js.j_jobslots; i++)
|
||||
if (jobs[i] && STOPPED (i))
|
||||
stopmsg = JSTOPPED;
|
||||
else if (check_jobs_at_exit && stopmsg == 0 && RUNNING (i))
|
||||
else if (check_jobs_at_exit && stopmsg == 0 && jobs[i] && RUNNING (i))
|
||||
stopmsg = JRUNNING;
|
||||
|
||||
if (stopmsg == JSTOPPED)
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ extern int errno;
|
|||
extern int current_command_line_count;
|
||||
extern int literal_history;
|
||||
extern int posixly_correct;
|
||||
extern int subshell_environment, interactive_shell;
|
||||
|
||||
extern int unlink __P((const char *));
|
||||
|
||||
|
|
@ -172,7 +173,7 @@ fc_builtin (list)
|
|||
register int i;
|
||||
register char *sep;
|
||||
int numbering, reverse, listing, execute;
|
||||
int histbeg, histend, last_hist, retval, opt;
|
||||
int histbeg, histend, last_hist, retval, opt, rh;
|
||||
FILE *stream;
|
||||
REPL *rlist, *rl;
|
||||
char *ename, *command, *newcom, *fcedit;
|
||||
|
|
@ -275,6 +276,8 @@ fc_builtin (list)
|
|||
|
||||
fprintf (stderr, "%s\n", command);
|
||||
fc_replhist (command); /* replace `fc -s' with command */
|
||||
/* Posix says that the re-executed commands should be entered into the
|
||||
history. */
|
||||
return (parse_and_execute (command, "fc", SEVAL_NOHIST));
|
||||
}
|
||||
|
||||
|
|
@ -293,7 +296,12 @@ fc_builtin (list)
|
|||
line was actually added (HISTIGNORE may have caused it to not be),
|
||||
so we check hist_last_line_added. */
|
||||
|
||||
last_hist = i - remember_on_history - hist_last_line_added;
|
||||
/* Even though command substitution through parse_and_execute turns off
|
||||
remember_on_history, command substitution in a shell when set -o history
|
||||
has been enabled (interactive or not) should use it in the last_hist
|
||||
calculation as if it were on. */
|
||||
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
|
||||
last_hist = i - rh - hist_last_line_added;
|
||||
|
||||
if (list)
|
||||
{
|
||||
|
|
@ -456,7 +464,7 @@ fc_gethnum (command, hlist)
|
|||
char *command;
|
||||
HIST_ENTRY **hlist;
|
||||
{
|
||||
int sign, n, clen;
|
||||
int sign, n, clen, rh;
|
||||
register int i, j;
|
||||
register char *s;
|
||||
|
||||
|
|
@ -472,7 +480,12 @@ fc_gethnum (command, hlist)
|
|||
line was actually added (HISTIGNORE may have caused it to not be),
|
||||
so we check hist_last_line_added. This needs to agree with the
|
||||
calculation of last_hist in fc_builtin above. */
|
||||
i -= remember_on_history + hist_last_line_added;
|
||||
/* Even though command substitution through parse_and_execute turns off
|
||||
remember_on_history, command substitution in a shell when set -o history
|
||||
has been enabled (interactive or not) should use it in the last_hist
|
||||
calculation as if it were on. */
|
||||
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
|
||||
i -= rh + hist_last_line_added;
|
||||
|
||||
/* No specification defaults to most recent command. */
|
||||
if (command == NULL)
|
||||
|
|
|
|||
|
|
@ -369,14 +369,14 @@ read_builtin (list)
|
|||
code = setjmp (alrmbuf);
|
||||
if (code)
|
||||
{
|
||||
#if 0
|
||||
/* Tricky. The top of the unwind-protect stack is the free of
|
||||
input_string. We want to run all the rest and use input_string,
|
||||
so we have to remove it from the stack. */
|
||||
remove_unwind_protect ();
|
||||
run_unwind_frame ("read_builtin");
|
||||
return (EXECUTION_FAILURE);
|
||||
#else
|
||||
input_string[i] = '\0'; /* make sure it's terminated */
|
||||
retval = 128+SIGALRM;;
|
||||
retval = 128+SIGALRM;
|
||||
goto assign_vars;
|
||||
#endif
|
||||
}
|
||||
old_alrm = set_signal_handler (SIGALRM, sigalrm);
|
||||
add_unwind_protect (reset_alarm, (char *)NULL);
|
||||
|
|
@ -601,14 +601,15 @@ add_char:
|
|||
if (unbuffered_read == 0)
|
||||
zsyncfd (fd);
|
||||
|
||||
interrupt_immediately--;
|
||||
terminate_immediately--;
|
||||
discard_unwind_frame ("read_builtin");
|
||||
|
||||
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
|
||||
|
||||
assign_vars:
|
||||
|
||||
interrupt_immediately--;
|
||||
terminate_immediately--;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
/* If -a was given, take the string read, break it into a list of words,
|
||||
an assign them to `arrayname' in turn. */
|
||||
|
|
@ -763,7 +764,10 @@ assign_vars:
|
|||
if (*input_string == 0)
|
||||
tofree = input_string = t;
|
||||
else
|
||||
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
|
||||
{
|
||||
input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape);
|
||||
tofree = t;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue