Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: case $? fails
- X-seq: zsh-workers 2945
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: case $? fails
- Date: Fri, 28 Feb 1997 08:31:59 -0800
- In-reply-to: <hzoli@xxxxxxxxxxxx> (Zoltan T. Hidvegi) "Re: case $? fails" (Feb 27, 4:50pm)
- References: <9702272150.AA15381@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Feb 27, 4:50pm, (Zoltan T. Hidvegi) wrote:
} Subject: Re: case $? fails
}
} while has the same problem unfortunately. Similarily
} for ((i=$?;;)) do echo $i; break; done
} prints zero. The patch below fixes these. The for syntax is new in
} zsh-3.1 so the first two hunks should be removed if the patch is applied
} against zsh-3.0.3-test4.
Here's what I came up with as a patch for 3.0.3-test4 by manually applying
the patch from Zoltan. I *did* include the first two hunks (with one
additional change that moved the increment of the "loops" counter, to
match the context in the patch) -- so this patch may be flawed.
Can somebody tell me if this patch is correct? Or have I broken something
that I haven't encountered yet?
--- Src/loop.c.orig Fri Jan 31 21:24:10 1997
+++ Src/loop.c Fri Feb 28 08:25:09 1997
@@ -40,8 +40,6 @@
char *str;
LinkList args;
- loops++;
- lastval = 0;
node = cmd->u.forcmd;
args = cmd->args;
if (!node->inflag) {
@@ -51,6 +49,8 @@
for (x = pparams; *x; x++)
addlinknode(args, ztrdup(*x));
}
+ lastval = 0;
+ loops++;
pushheap();
while ((str = (char *)ugetnode(args))) {
setsparam(node->name, ztrdup(str));
@@ -168,11 +168,10 @@
olderrexit = noerrexit;
node = cmd->u.whilecmd;
- lastval = 0;
+ oldval = 0;
pushheap();
loops++;
for (;;) {
- oldval = lastval;
list = (List) dupstruct(node->cont);
noerrexit = 1;
execlist(list, 1, 0);
@@ -196,6 +195,7 @@
lastval = 1;
break;
}
+ oldval = lastval;
}
popheap();
loops--;
@@ -282,10 +282,10 @@
l = node->lists;
p = node->pats;
- lastval = 0;
word = *p++;
singsub(&word);
untokenize(word);
+ lastval = 0;
if (node) {
while (*p) {
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
Messages sorted by:
Reverse Date,
Date,
Thread,
Author