Revert revisions 1.91 and 1.92. The POSIX spec about the correct behaviour

is contradictory at best. And these changes seem to cause more problems
that they are worth.
This commit is contained in:
tron 2008-05-26 14:55:17 +00:00
parent 8567cf00de
commit 9cae530b67
1 changed files with 6 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: eval.c,v 1.92 2008/05/24 22:24:32 tron Exp $ */
/* $NetBSD: eval.c,v 1.93 2008/05/26 14:55:17 tron Exp $ */
/*-
* Copyright (c) 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
#else
__RCSID("$NetBSD: eval.c,v 1.92 2008/05/24 22:24:32 tron Exp $");
__RCSID("$NetBSD: eval.c,v 1.93 2008/05/26 14:55:17 tron Exp $");
#endif
#endif /* not lint */
@ -238,14 +238,12 @@ evaltree(union node *n, int flags)
evaltree(n->nbinary.ch2, flags);
break;
case NAND:
do_etest = true;
evaltree(n->nbinary.ch1, EV_TESTED);
if (evalskip || exitstatus != 0)
goto out;
evaltree(n->nbinary.ch2, flags);
break;
case NOR:
do_etest = true;
evaltree(n->nbinary.ch1, EV_TESTED);
if (evalskip || exitstatus == 0)
goto out;
@ -258,8 +256,8 @@ evaltree(union node *n, int flags)
popredir();
break;
case NSUBSHELL:
do_etest = true;
evalsubshell(n, flags);
do_etest = !(flags & EV_TESTED);
break;
case NBACKGND:
evalsubshell(n, flags);
@ -291,17 +289,16 @@ evaltree(union node *n, int flags)
exitstatus = 0;
break;
case NNOT:
do_etest = true;
evaltree(n->nnot.com, EV_TESTED);
exitstatus = !exitstatus;
break;
case NPIPE:
do_etest = true;
evalpipe(n);
do_etest = !(flags & EV_TESTED);
break;
case NCMD:
do_etest = true;
evalcommand(n, flags, (struct backcmd *)NULL);
do_etest = !(flags & EV_TESTED);
break;
default:
out1fmt("Node type = %d\n", n->type);
@ -311,10 +308,8 @@ evaltree(union node *n, int flags)
out:
if (pendingsigs)
dotrap();
if ((flags & EV_EXIT) != 0 ||
(eflag && exitstatus != 0 && do_etest && !(flags & EV_TESTED))) {
if ((flags & EV_EXIT) != 0 || (eflag && exitstatus != 0 && do_etest))
exitshell(exitstatus);
}
}