mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 20:00:49 +02:00
bash-5.2-alpha release
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* shell.c -- GNU's idea of the POSIX shell specification. */
|
||||
|
||||
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -72,6 +72,8 @@ extern int get_tty_state PARAMS((void));
|
||||
|
||||
#if defined (USING_BASH_MALLOC) && defined (DEBUG) && !defined (DISABLE_MALLOC_WRAPPERS)
|
||||
# include <malloc/shmalloc.h>
|
||||
#elif defined (MALLOC_DEBUG) && defined (USING_BASH_MALLOC)
|
||||
# include <malloc/shmalloc.h>
|
||||
#endif
|
||||
|
||||
#if defined (HISTORY)
|
||||
@@ -220,8 +222,10 @@ int no_line_editing = 0; /* non-zero -> don't do fancy line editing. */
|
||||
#else
|
||||
int no_line_editing = 1; /* can't have line editing without readline */
|
||||
#endif
|
||||
#if defined (TRANSLATABLE_STRINGS)
|
||||
int dump_translatable_strings; /* Dump strings in $"...", don't execute. */
|
||||
int dump_po_strings; /* Dump strings in $"..." in po format */
|
||||
#endif
|
||||
int wordexp_only = 0; /* Do word expansion only */
|
||||
int protected_mode = 0; /* No command substitution with --wordexp */
|
||||
|
||||
@@ -246,8 +250,10 @@ static const struct {
|
||||
#if defined (DEBUGGER)
|
||||
{ "debugger", Int, &debugging_mode, (char **)0x0 },
|
||||
#endif
|
||||
#if defined (TRANSLATABLE_STRINGS)
|
||||
{ "dump-po-strings", Int, &dump_po_strings, (char **)0x0 },
|
||||
{ "dump-strings", Int, &dump_translatable_strings, (char **)0x0 },
|
||||
#endif
|
||||
{ "help", Int, &want_initial_help, (char **)0x0 },
|
||||
{ "init-file", Charp, (int *)0x0, &bashrc_file },
|
||||
{ "login", Int, &make_login_shell, (char **)0x0 },
|
||||
@@ -496,11 +502,13 @@ main (argc, argv, env)
|
||||
|
||||
set_login_shell ("login_shell", login_shell != 0);
|
||||
|
||||
#if defined (TRANSLATABLE_STRINGS)
|
||||
if (dump_po_strings)
|
||||
dump_translatable_strings = 1;
|
||||
|
||||
if (dump_translatable_strings)
|
||||
read_but_dont_execute = 1;
|
||||
#endif
|
||||
|
||||
if (running_setuid && privileged_mode == 0)
|
||||
disable_priv_mode ();
|
||||
@@ -628,7 +636,7 @@ main (argc, argv, env)
|
||||
code = setjmp_sigs (top_level);
|
||||
if (code)
|
||||
{
|
||||
if (code == EXITPROG || code == ERREXIT)
|
||||
if (code == EXITPROG || code == ERREXIT || code == EXITBLTIN)
|
||||
exit_shell (last_command_exit_value);
|
||||
else
|
||||
{
|
||||
@@ -694,10 +702,24 @@ main (argc, argv, env)
|
||||
/* The startup files are run with `set -e' temporarily disabled. */
|
||||
if (locally_skip_execution == 0 && running_setuid == 0)
|
||||
{
|
||||
char *t;
|
||||
|
||||
old_errexit_flag = exit_immediately_on_error;
|
||||
exit_immediately_on_error = 0;
|
||||
|
||||
/* Temporarily set $0 while running startup files, then restore it so
|
||||
we get better error messages when trying to open script files. */
|
||||
if (shell_script_filename)
|
||||
{
|
||||
t = dollar_vars[0];
|
||||
dollar_vars[0] = exec_argv0 ? savestring (exec_argv0) : savestring (shell_script_filename);
|
||||
}
|
||||
run_startup_files ();
|
||||
if (shell_script_filename)
|
||||
{
|
||||
free (dollar_vars[0]);
|
||||
dollar_vars[0] = t;
|
||||
}
|
||||
exit_immediately_on_error += old_errexit_flag;
|
||||
}
|
||||
|
||||
@@ -939,7 +961,9 @@ parse_shell_options (argv, arg_start, arg_end)
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
#if defined (TRANSLATABLE_STRINGS)
|
||||
dump_translatable_strings = 1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1352,6 +1376,7 @@ run_wordexp (words)
|
||||
return last_command_exit_value = 127;
|
||||
case ERREXIT:
|
||||
case EXITPROG:
|
||||
case EXITBLTIN:
|
||||
return last_command_exit_value;
|
||||
case DISCARD:
|
||||
return last_command_exit_value = 1;
|
||||
@@ -1430,6 +1455,7 @@ run_one_command (command)
|
||||
return last_command_exit_value = 127;
|
||||
case ERREXIT:
|
||||
case EXITPROG:
|
||||
case EXITBLTIN:
|
||||
return last_command_exit_value;
|
||||
case DISCARD:
|
||||
return last_command_exit_value = 1;
|
||||
|
||||
Reference in New Issue
Block a user