summaryrefslogtreecommitdiff
path: root/flags.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2004-07-27 13:29:18 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:56 +0000
commitb80f6443b6b7b620c7272664c66ecb0b120a0998 (patch)
tree9f71c98d8fe8fa0f41d95e1eb4227f32a09d43ca /flags.c
parent7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (diff)
downloadbash-b80f6443b6b7b620c7272664c66ecb0b120a0998.tar.gz
Imported from ../bash-3.0.tar.gz.
Diffstat (limited to 'flags.c')
-rw-r--r--flags.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/flags.c b/flags.c
index 8846ba30..0c0868bc 100644
--- a/flags.c
+++ b/flags.c
@@ -40,6 +40,8 @@ extern int set_job_control __P((int));
extern char *shell_name;
#endif
+extern int shell_initialized;
+
/* -c, -s invocation options -- not really flags, but they show up in $- */
extern int want_pending_command, read_from_stdin;
@@ -151,6 +153,17 @@ int privileged_mode = 0;
int brace_expansion = 1;
#endif
+/* Non-zero means that shell functions inherit the DEBUG trap. */
+int function_trace_mode = 0;
+
+/* Non-zero means that shell functions inherit the ERR trap. */
+int error_trace_mode = 0;
+
+/* Non-zero means that the rightmost non-zero exit status in a pipeline
+ is the exit status of the entire pipeline. If each processes exits
+ with a 0 status, the status of the pipeline is 0. */
+int pipefail_opt = 0;
+
/* **************************************************************** */
/* */
/* The Flags ALIST. */
@@ -180,24 +193,22 @@ struct flags_alist shell_flags[] = {
{ 'u', &unbound_vars_is_error },
{ 'v', &echo_input_at_read },
{ 'x', &echo_command_at_execute },
- { 'C', &noclobber },
/* New flags that control non-standard things. */
#if 0
{ 'l', &lexical_scoping },
#endif
- { 'I', &no_invisible_vars },
-
- { 'P', &no_symbolic_links },
-
#if defined (BRACE_EXPANSION)
{ 'B', &brace_expansion },
#endif
-
+ { 'C', &noclobber },
+ { 'E', &error_trace_mode },
#if defined (BANG_HISTORY)
{ 'H', &history_expansion },
#endif /* BANG_HISTORY */
-
+ { 'I', &no_invisible_vars },
+ { 'P', &no_symbolic_links },
+ { 'T', &function_trace_mode },
{0, (int *)NULL}
};
@@ -271,7 +282,7 @@ change_flag (flag, on_or_off)
#if defined (RESTRICTED_SHELL)
case 'r':
- if (on_or_off == FLAG_ON)
+ if (on_or_off == FLAG_ON && shell_initialized)
maybe_make_restricted (shell_name);
break;
#endif
@@ -310,7 +321,7 @@ reset_shell_flags ()
place_keywords_in_env = read_but_dont_execute = just_one_command = 0;
noclobber = unbound_vars_is_error = echo_input_at_read = 0;
echo_command_at_execute = jobs_m_flag = forced_interactive = 0;
- no_symbolic_links = no_invisible_vars = privileged_mode = 0;
+ no_symbolic_links = no_invisible_vars = privileged_mode = pipefail_opt = 0;
hashing_enabled = interactive_comments = 1;