mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-05 03:10:50 +02:00
Bash-5.3-alpha release
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eval.c -- reading and evaluating commands. */
|
||||
|
||||
/* Copyright (C) 1996-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996-2024 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -48,13 +48,13 @@
|
||||
# include "bashhist.h"
|
||||
#endif
|
||||
|
||||
static void send_pwd_to_eterm PARAMS((void));
|
||||
static sighandler alrm_catcher PARAMS((int));
|
||||
static void send_pwd_to_eterm (void);
|
||||
static sighandler alrm_catcher (int);
|
||||
|
||||
/* Read and execute commands until EOF is reached. This assumes that
|
||||
the input source has already been initialized. */
|
||||
int
|
||||
reader_loop ()
|
||||
reader_loop (void)
|
||||
{
|
||||
int our_indirection_level;
|
||||
COMMAND * volatile current_command;
|
||||
@@ -153,14 +153,18 @@ reader_loop ()
|
||||
if (interactive && ps0_prompt)
|
||||
{
|
||||
char *ps0_string;
|
||||
int old_eof;
|
||||
|
||||
ps0_string = decode_prompt_string (ps0_prompt);
|
||||
old_eof = EOF_Reached;
|
||||
EOF_Reached = 0;
|
||||
ps0_string = decode_prompt_string (ps0_prompt, 1);
|
||||
if (ps0_string && *ps0_string)
|
||||
{
|
||||
fprintf (stderr, "%s", ps0_string);
|
||||
fflush (stderr);
|
||||
}
|
||||
free (ps0_string);
|
||||
EOF_Reached = old_eof;
|
||||
}
|
||||
|
||||
current_command_number++;
|
||||
@@ -179,6 +183,11 @@ reader_loop ()
|
||||
current_command = (COMMAND *)NULL;
|
||||
}
|
||||
}
|
||||
if (EOF_Reached && interactive && ignoreeof && parse_and_execute_level == 0 && code != EXITBLTIN)
|
||||
{
|
||||
if (handle_ignoreeof (1))
|
||||
EOF_Reached = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,7 +204,7 @@ reader_loop ()
|
||||
|
||||
/* Pretty print shell scripts */
|
||||
int
|
||||
pretty_print_loop ()
|
||||
pretty_print_loop (void)
|
||||
{
|
||||
COMMAND *current_command;
|
||||
char *command_to_print;
|
||||
@@ -204,6 +213,7 @@ pretty_print_loop ()
|
||||
|
||||
global_posix_mode = posixly_correct;
|
||||
last_was_newline = 0;
|
||||
unset_readahead_token ();
|
||||
while (EOF_Reached == 0)
|
||||
{
|
||||
code = setjmp_nosigs (top_level);
|
||||
@@ -235,8 +245,7 @@ pretty_print_loop ()
|
||||
}
|
||||
|
||||
static sighandler
|
||||
alrm_catcher(i)
|
||||
int i;
|
||||
alrm_catcher(int i)
|
||||
{
|
||||
char *msg;
|
||||
|
||||
@@ -251,7 +260,7 @@ alrm_catcher(i)
|
||||
/* Send an escape sequence to emacs term mode to tell it the
|
||||
current working directory. */
|
||||
static void
|
||||
send_pwd_to_eterm ()
|
||||
send_pwd_to_eterm (void)
|
||||
{
|
||||
char *pwd, *f;
|
||||
|
||||
@@ -266,9 +275,7 @@ send_pwd_to_eterm ()
|
||||
#if defined (ARRAY_VARS)
|
||||
/* Caller ensures that A has a non-zero number of elements */
|
||||
int
|
||||
execute_array_command (a, v)
|
||||
ARRAY *a;
|
||||
void *v;
|
||||
execute_array_command (ARRAY *a, void *v)
|
||||
{
|
||||
char *tag;
|
||||
char **argv;
|
||||
@@ -288,7 +295,7 @@ execute_array_command (a, v)
|
||||
#endif
|
||||
|
||||
static void
|
||||
execute_prompt_command ()
|
||||
execute_prompt_command (void)
|
||||
{
|
||||
char *command_to_execute;
|
||||
SHELL_VAR *pcv;
|
||||
@@ -320,12 +327,13 @@ execute_prompt_command ()
|
||||
leaves the parsed command in the global variable GLOBAL_COMMAND.
|
||||
This is where PROMPT_COMMAND is executed. */
|
||||
int
|
||||
parse_command ()
|
||||
parse_command (void)
|
||||
{
|
||||
int r;
|
||||
int r, old_parsing;
|
||||
|
||||
need_here_doc = 0;
|
||||
run_pending_traps ();
|
||||
if ((parser_state & (PST_CMDSUBST|PST_FUNSUBST)) == 0)
|
||||
run_pending_traps ();
|
||||
|
||||
/* Allow the execution of a random command just before the printing
|
||||
of each primary prompt. If the shell variable PROMPT_COMMAND
|
||||
@@ -344,11 +352,14 @@ parse_command ()
|
||||
send_pwd_to_eterm (); /* Yuck */
|
||||
}
|
||||
|
||||
old_parsing = parsing_command;
|
||||
parsing_command = 1;
|
||||
current_command_line_count = 0;
|
||||
r = yyparse ();
|
||||
|
||||
if (need_here_doc)
|
||||
gather_here_documents ();
|
||||
parsing_command = old_parsing;
|
||||
|
||||
return (r);
|
||||
}
|
||||
@@ -357,7 +368,7 @@ parse_command ()
|
||||
is left in the globval variable GLOBAL_COMMAND for use by reader_loop.
|
||||
This is where the shell timeout code is executed. */
|
||||
int
|
||||
read_command ()
|
||||
read_command (void)
|
||||
{
|
||||
SHELL_VAR *tmout_var;
|
||||
int tmout_len, result;
|
||||
|
||||
Reference in New Issue
Block a user