From 3bd2e82dac075cd5a79a99e3ca31dc3f9a812b08 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 26 Dec 2020 00:43:14 -0600 Subject: toysh: fix break/continue --- toys/pending/sh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys') diff --git a/toys/pending/sh.c b/toys/pending/sh.c index 5bbe939d..14fb55cd 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -2337,7 +2337,6 @@ static int parse_line(char *line, struct sh_function *sp) // Ok, we have a word. What does it _mean_? // case/esac parsing is weird (unbalanced parentheses!), handle first - i = ex && !strcmp(ex, "esac") && ((pl->type && pl->type != 3) || (*start==';' && end-start>1)); if (i) { @@ -2850,7 +2849,8 @@ TODO: a | b | c needs subshell for builtins? } while (i && blk) - if (!--i && *s == 'c') pl = blk->start; + if (blk->middle && !strcmp(*blk->middle->arg->v, "do") + && !--i && *s=='c') pl = blk->start; else pl = pop_block(&blk, pipes); if (i) { syntax_err("break"); -- cgit v1.2.3