commit bash-20120606 snapshot

This commit is contained in:
Chet Ramey
2012-07-07 12:24:32 -04:00
parent 4e136352d0
commit 8360b906d6
36 changed files with 32277 additions and 45 deletions
+19 -3
View File
@@ -61,7 +61,7 @@ extern int errno;
#define IS_BUILTIN(s) (builtin_address_internal(s, 0) != (struct builtin *)NULL)
extern int indirection_level, subshell_environment;
extern int line_number;
extern int line_number, line_number_for_err_trap;
extern int current_token, shell_eof_token;
extern int last_command_exit_value;
extern int running_trap;
@@ -70,6 +70,7 @@ extern int executing_list;
extern int comsub_ignore_return;
extern int posixly_correct;
extern sh_builtin_func_t *this_shell_builtin;
extern char *the_printed_command_except_trap;
int parse_and_execute_level = 0;
@@ -86,6 +87,14 @@ set_history_remembering ()
}
#endif
static void
restore_lastcom (x)
char *x;
{
FREE (the_printed_command_except_trap);
the_printed_command_except_trap = x;
}
/* How to force parse_and_execute () to clean up after itself. */
void
parse_and_execute_cleanup ()
@@ -108,7 +117,7 @@ parse_prologue (string, flags, tag)
int flags;
char *tag;
{
char *orig_string;
char *orig_string, *lastcom;
int x;
orig_string = string;
@@ -118,6 +127,7 @@ parse_prologue (string, flags, tag)
unwind_protect_jmp_buf (top_level);
unwind_protect_int (indirection_level);
unwind_protect_int (line_number);
unwind_protect_int (line_number_for_err_trap);
unwind_protect_int (loop_level);
unwind_protect_int (executing_list);
unwind_protect_int (comsub_ignore_return);
@@ -140,7 +150,13 @@ parse_prologue (string, flags, tag)
x = get_current_prompt_level ();
add_unwind_protect (set_current_prompt_level, x);
}
if (the_printed_command_except_trap)
{
lastcom = savestring (the_printed_command_except_trap);
add_unwind_protect (restore_lastcom, lastcom);
}
add_unwind_protect (pop_stream, (char *)NULL);
if (orig_string && ((flags & SEVAL_NOFREE) == 0))
add_unwind_protect (xfree, orig_string);