summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trip.rc6
-rw-r--r--walk.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/trip.rc b/trip.rc
index 5ffba5c..fb61afb 100644
--- a/trip.rc
+++ b/trip.rc
@@ -603,3 +603,9 @@ submatch 'echo foo = bar' 'foo = bar' 'unquoted equals 2'
submatch 'echo foo=bar' 'foo=bar' 'unquoted equals 2'
submatch 'echo foo=' 'foo=' 'unquoted equals 3'
submatch 'echo =bar; whatis -v echo' 'echo=bar' 'unquoted equals 4'
+###############################################################
+X=`{ $rc -ec 'b=true; while($b){b=false}; echo YYY' }
+if (! ~ $X YYY) {
+ fail '"rc -e" exits when condition in the while statement fails in the second iteration'
+}
+###############################################################
diff --git a/walk.c b/walk.c
index 984a68c..67fbb8e 100644
--- a/walk.c
+++ b/walk.c
@@ -110,6 +110,7 @@ top: sigchk();
cond = oldcond;
break;
}
+ cond = oldcond;
if (sigsetjmp(j.j, 1))
break;
jbreak.jb = &j;
@@ -117,12 +118,12 @@ top: sigchk();
do {
Edata block;
block.b = newblock();
- cond = oldcond;
except(eArena, block, &e2);
walk(n->u[1].p, TRUE);
+ cond = TRUE;
testtrue = walk(n->u[0].p, TRUE);
+ cond = oldcond;
unexcept(); /* eArena */
- cond = TRUE;
} while (testtrue);
cond = oldcond;
unexcept(); /* eBreak */