From 3d47e34527bdc68c49eae6ee3b33506f8badbce5 Mon Sep 17 00:00:00 2001 From: herbert Date: Mon, 28 Feb 2005 21:06:29 +1100 Subject: Replaced EXEVAL with SKIPEVAL. --- src/error.h | 1 - src/eval.c | 15 ++++----------- src/eval.h | 1 + src/main.c | 3 +-- 4 files changed, 6 insertions(+), 14 deletions(-) (limited to 'src') 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 -- cgit 1.4.1