From 71d448c29c85afd16a4feb68b23fde6c8cf02875 Mon Sep 17 00:00:00 2001 From: herbert Date: Mon, 28 Mar 2005 20:28:01 +1000 Subject: Added eflag fixes for trap and minusc. Let evaltree handle traps from cmdloop. Reset evalskip after minusc is executed. Stop executing traps once SKIPEVAL is seen. --- src/eval.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index 31272da..ac4425c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -163,7 +163,8 @@ evalcmd(int argc, char **argv) STPUTC('\0', concat); p = grabstackstr(concat); } - evalstring(p); + evalstring(p, ~SKIPEVAL); + } return exitstatus; } @@ -173,23 +174,29 @@ evalcmd(int argc, char **argv) * Execute a command or commands contained in a string. */ -void -evalstring(char *s) +int +evalstring(char *s, int mask) { union node *n; struct stackmark smark; + int skip; - setstackmark(&smark); setinputstring(s); + setstackmark(&smark); + skip = 0; while ((n = parsecmd(0)) != NEOF) { evaltree(n, 0); popstackmark(&smark); - if (evalskip) + skip = evalskip; + if (skip) break; } popfile(); - popstackmark(&smark); + + skip &= mask; + evalskip = skip; + return skip; } @@ -319,12 +326,15 @@ setstatus: break; } out: - if (pendingsigs) - dotrap(); - if (flags & EV_EXIT) - exraise(EXEXIT); if ((checkexit & exitstatus)) evalskip |= SKIPEVAL; + else if (pendingsigs && dotrap()) + goto exexit; + + if (flags & EV_EXIT) { +exexit: + exraise(EXEXIT); + } } @@ -930,7 +940,6 @@ cmddone: commandname = savecmdname; exsig = 0; handler = savehandler; - evalskip &= ~SKIPEVAL; return i; } -- cgit 1.4.1