Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: "continue -1" confuses zsh
- X-seq: zsh-users 13168
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: Daniel Qarras <dqarras@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: "continue -1" confuses zsh
- Date: Sat, 30 Aug 2008 21:25:35 +0200
- In-reply-to: <20080830191228.GQ6330@xxxxxxxxxxxxxxx>
- Mail-followup-to: Daniel Qarras <dqarras@xxxxxxxxx>, zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <430425.47097.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <20080830191228.GQ6330@xxxxxxxxxxxxxxx>
Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>:
[...]
> I don't know what the actual reason for this reaction is, but:
>
> As per SUSv3 for break and continue:
>
> EXIT STATUS
> 0 Successful completion.
> >0 The n value was not an unsigned decimal integer greater than or
> equal to 1.
>
> So, IMHO a trivial fix for this is:
> + if (num <= 0)
> + return 1;
> +
Which it obviously isn't, because bin_break() handles more than just
break and continue, so this should be better (and actually passes the
test suite this time - sorry for being too rash):
---
Src/builtin.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Src/builtin.c b/Src/builtin.c
index ee44b37..540b88b 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4443,6 +4443,9 @@ bin_break(char *name, char **argv, UNUSED(Options ops), int func)
nump = 1;
}
+ if (nump > 0 && (func == BIN_CONTINUE || func == BIN_BREAK) && num <= 0)
+ return 1;
+
switch (func) {
case BIN_CONTINUE:
if (!loops) { /* continue is only permitted in loops */
--
1.6.0.1.90.g27a6e
Messages sorted by:
Reverse Date,
Date,
Thread,
Author