summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--src/error.h1
-rw-r--r--src/eval.c15
-rw-r--r--src/eval.h1
-rw-r--r--src/main.c3
5 files changed, 10 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index bff943a..a2c06ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-02-28  Herbert Xu <herbert@gondor.apana.org.au>
+
+	* Replaced EXEVAL with SKIPEVAL.
+
 2005-02-28  A Costa <agcosta@gis.net>
 
 	* Corrected that/than typo in manual page.
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