summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorherbert <herbert@gondor.apana.org.au>2005-02-28 21:06:29 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2005-09-26 18:33:03 +1000
commit3d47e34527bdc68c49eae6ee3b33506f8badbce5 (patch)
treeb595334e5c4c70aab576be4c00bfe1c70b32705d /src
parentCorrected that/than typo in manual page. (diff)
downloaddash-3d47e34527bdc68c49eae6ee3b33506f8badbce5.tar.gz
dash-3d47e34527bdc68c49eae6ee3b33506f8badbce5.zip
Replaced EXEVAL with SKIPEVAL.
Diffstat (limited to '')
-rw-r--r--src/error.h1
-rw-r--r--src/eval.c15
-rw-r--r--src/eval.h1
-rw-r--r--src/main.c3
4 files changed, 6 insertions, 14 deletions
diff --git a/src/error.h b/src/error.h
index 7b04634..4a793c5 100644
--- a/src/error.h
+++ b/src/error.h
@@ -74,7 +74,6 @@ extern int exception;
 #define EXEXEC 3	/* command execution failed */
 #define EXEXIT 4	/* exit the shell */
 #define EXSIG 5		/* trapped signal in wait(1) */
-#define EXEVAL 6	/* exit the shell due to set -e */
 
 
 /*
diff --git a/src/eval.c b/src/eval.c
index 29db5c1..3288837 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -325,8 +325,8 @@ out:
 		dotrap();
 	if (flags & EV_EXIT)
 		exraise(EXEXIT);
-	if (checkexit & exitstatus)
-		exraise(EXEVAL);
+	if ((checkexit & exitstatus) && evalskip != SKIPFILE)
+		evalskip = SKIPEVAL;
 }
 
 
@@ -711,14 +711,12 @@ evalcommand(union node *cmd, int flags)
 	int spclbltin;
 	int execcmd;
 	int status;
-	int oldlvl;
 	char **nargv;
 
 	/* First expand the arguments. */
 	TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags));
 	setstackmark(&smark);
 	back_exitstatus = 0;
-	oldlvl = shlvl;
 
 	cmdentry.cmdtype = CMDBUILTIN;
 	cmdentry.u.cmd = &bltin;
@@ -874,12 +872,6 @@ bail:
 			i = exception;
 			if (i == EXEXIT)
 				goto raise;
-			if (i == EXEVAL) {
-				if (oldlvl == shlvl)
-					goto trap;
-				else
-					goto raise;
-			}
 
 			status = 2;
 			j = 0;
@@ -895,7 +887,6 @@ bail:
 raise:
 				longjmp(handler->loc, 1);
 			}
-trap:
 			FORCEINTON;
 		}
 		break;
@@ -941,6 +932,8 @@ cmddone:
 	commandname = savecmdname;
 	exsig = 0;
 	handler = savehandler;
+	if (evalskip == SKIPEVAL)
+		evalskip = 0;
 
 	return i;
 }
diff --git a/src/eval.h b/src/eval.h
index 19bdb9a..dc523e2 100644
--- a/src/eval.h
+++ b/src/eval.h
@@ -66,3 +66,4 @@ extern int evalskip;
 #define SKIPCONT	2
 #define SKIPFUNC	3
 #define SKIPFILE	4
+#define SKIPEVAL	5
diff --git a/src/main.c b/src/main.c
index 6253010..3575ec4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -133,8 +133,7 @@ main(int argc, char **argv)
 			exitstatus = 2;
 
 		s = state;
-		if (e == EXEXIT || e == EXEVAL ||
-		    s == 0 || iflag == 0 || shlvl)
+		if (e == EXEXIT || s == 0 || iflag == 0 || shlvl)
 			exitshell();
 
 		if (e == EXINT