diff options
author | herbert <herbert@gondor.apana.org.au> | 2005-03-28 20:28:01 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2005-09-26 18:33:05 +1000 |
commit | 71d448c29c85afd16a4feb68b23fde6c8cf02875 (patch) | |
tree | 2414dda91f580f2c124522b41c244f0eb528acfa /src/trap.c | |
parent | Removed unnecessary inclusion of eval.h from parser.c. (diff) | |
download | dash-71d448c29c85afd16a4feb68b23fde6c8cf02875.tar.gz dash-71d448c29c85afd16a4feb68b23fde6c8cf02875.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/trap.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/trap.c b/src/trap.c index 15ff49a..6264b5c 100644 --- a/src/trap.c +++ b/src/trap.c @@ -301,23 +301,34 @@ onsig(int signo) * handlers while we are executing a trap handler. */ -void +int dotrap(void) { char *p; char *q; + int i; int savestatus; + int skip = 0; savestatus = exitstatus; - q = gotsig; - while (pendingsigs = 0, barrier(), (p = memchr(q, 1, NSIG - 1))) { - *p = 0; - p = trap[p - q + 1]; + pendingsigs = 0; + barrier(); + + for (i = 0, q = gotsig; i < NSIG - 1; i++, q++) { + if (!*q) + continue; + *q = 0; + + p = trap[i + 1]; if (!p) continue; - evalstring(p); + skip = evalstring(p, SKIPEVAL); exitstatus = savestatus; + if (skip) + break; } + + return skip; } @@ -364,9 +375,9 @@ exitshell(void) goto out; } handler = &loc; - if ((p = trap[0]) != NULL && *p != '\0') { + if ((p = trap[0])) { trap[0] = NULL; - evalstring(p); + evalstring(p, 0); } flushall(); out: |