aboutsummaryrefslogtreecommitdiffstats
path: root/flags.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
committerChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
commitac50fbac377e32b98d2de396f016ea81e8ee9961 (patch)
treef71882366b98fedf1a88a063103219a4935de926 /flags.c
parent4539d736f1aff232857a854fd2a68df0c98d9f34 (diff)
downloadandroid_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.tar.gz
android_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.tar.bz2
android_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.zip
Bash-4.3 distribution sources and documentation
Diffstat (limited to 'flags.c')
-rw-r--r--flags.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/flags.c b/flags.c
index d3b38ad..eaec9aa 100644
--- a/flags.c
+++ b/flags.c
@@ -40,6 +40,7 @@ extern char *shell_name;
#endif
extern int shell_initialized;
+extern int builtin_ignoring_errexit;
/* -c, -s invocation options -- not really flags, but they show up in $- */
extern int want_pending_command, read_from_stdin;
@@ -59,7 +60,9 @@ int mark_modified_vars = 0;
int asynchronous_notification = 0;
/* Non-zero means exit immediately if a command exits with a non-zero
- exit status. */
+ exit status. The first is what controls set -e; the second is what
+ bash uses internally. */
+int errexit_flag = 0;
int exit_immediately_on_error = 0;
/* Non-zero means disable filename globbing. */
@@ -126,7 +129,11 @@ int hashing_enabled = 1;
#if defined (BANG_HISTORY)
/* Non-zero means that we are doing history expansion. The default.
This means !22 gets the 22nd line of history. */
+# if defined (STRICT_POSIX)
+int history_expansion = 0;
+# else
int history_expansion = 1;
+# endif
#endif /* BANG_HISTORY */
/* Non-zero means that we allow comments to appear in interactive commands. */
@@ -175,7 +182,7 @@ const struct flags_alist shell_flags[] = {
#if defined (JOB_CONTROL)
{ 'b', &asynchronous_notification },
#endif /* JOB_CONTROL */
- { 'e', &exit_immediately_on_error },
+ { 'e', &errexit_flag },
{ 'f', &disallow_filename_globbing },
{ 'h', &hashing_enabled },
{ 'i', &forced_interactive },
@@ -250,7 +257,6 @@ change_flag (flag, on_or_off)
return (FLAG_ERROR);
old_value = *value;
-
*value = (on_or_off == FLAG_ON) ? 1 : 0;
/* Special cases for a few flags. */
@@ -269,6 +275,11 @@ change_flag (flag, on_or_off)
break;
#endif /* JOB_CONTROL */
+ case 'e':
+ if (builtin_ignoring_errexit == 0)
+ exit_immediately_on_error = errexit_flag;
+ break;
+
case 'n':
if (interactive_shell)
read_but_dont_execute = 0;