|
Lines 208-214
Link Here
|
| 208 |
case NAND: |
208 |
case NAND: |
| 209 |
evaltree(n->nbinary.ch1, EV_TESTED); |
209 |
evaltree(n->nbinary.ch1, EV_TESTED); |
| 210 |
if (evalskip || exitstatus != 0) { |
210 |
if (evalskip || exitstatus != 0) { |
| 211 |
flags |= EV_TESTED; |
|
|
| 212 |
goto out; |
211 |
goto out; |
| 213 |
} |
212 |
} |
| 214 |
evaltree(n->nbinary.ch2, flags); |
213 |
evaltree(n->nbinary.ch2, flags); |
|
Lines 249-273
Link Here
|
| 249 |
break; |
248 |
break; |
| 250 |
case NFOR: |
249 |
case NFOR: |
| 251 |
evalfor(n); |
250 |
evalfor(n); |
| 252 |
/* |
|
|
| 253 |
* The 'for' command does not set exitstatus, so the value |
| 254 |
* now in exitstatus is from the last command executed in |
| 255 |
* the 'for' loop. That exit value had been tested (wrt |
| 256 |
* 'sh -e' checking) while processing that command, and |
| 257 |
* it should not be re-tested here. |
| 258 |
*/ |
| 259 |
flags |= EV_TESTED; |
| 260 |
break; |
251 |
break; |
| 261 |
case NCASE: |
252 |
case NCASE: |
| 262 |
evalcase(n, flags); |
253 |
evalcase(n, flags); |
| 263 |
/* |
|
|
| 264 |
* The 'case' command does not set exitstatus, so the value |
| 265 |
* now in exitstatus is from the last command executed in |
| 266 |
* the 'case' block. That exit value had been tested (wrt |
| 267 |
* 'sh -e' checking) while processing that command, and |
| 268 |
* it should not be re-tested here. |
| 269 |
*/ |
| 270 |
flags |= EV_TESTED; |
| 271 |
break; |
254 |
break; |
| 272 |
case NDEFUN: |
255 |
case NDEFUN: |
| 273 |
defun(n->narg.text, n->narg.next); |
256 |
defun(n->narg.text, n->narg.next); |
|
Lines 292-305
Link Here
|
| 292 |
out: |
275 |
out: |
| 293 |
if (pendingsigs) |
276 |
if (pendingsigs) |
| 294 |
dotrap(); |
277 |
dotrap(); |
| 295 |
/* |
|
|
| 296 |
* XXX - Like "!(n->type == NSEMI)", more types will probably |
| 297 |
* need to be excluded from this test. It's probably better |
| 298 |
* to set or unset EV_TESTED in the loop above than to bloat |
| 299 |
* the conditional here. |
| 300 |
*/ |
| 301 |
if ((flags & EV_EXIT) || (eflag && exitstatus |
278 |
if ((flags & EV_EXIT) || (eflag && exitstatus |
| 302 |
&& !(flags & EV_TESTED) && !(n->type == NSEMI))) |
279 |
&& !(flags & EV_TESTED) && (n->type == NCMD))) |
| 303 |
exitshell(exitstatus); |
280 |
exitshell(exitstatus); |
| 304 |
} |
281 |
} |