diff options
Diffstat (limited to 'Src/loop.c')
-rw-r--r-- | Src/loop.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Src/loop.c b/Src/loop.c index 94b61b7ed..b791a898d 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -584,7 +584,7 @@ execcase(Estate state, int do_exec) Wordcode end, next; wordcode code = state->pc[-1]; char *word, *pat; - int npat, save, nalts, ialt, patok; + int npat, save, nalts, ialt, patok, anypatok; Patprog *spprog, pprog; end = state->pc + WC_CASE_SKIP(code); @@ -592,6 +592,7 @@ execcase(Estate state, int do_exec) word = ecgetstr(state, EC_DUP, NULL); singsub(&word); untokenize(word); + anypatok = 0; cmdpush(CS_CASE); while (state->pc < end) { @@ -648,7 +649,7 @@ execcase(Estate state, int do_exec) *spprog = pprog; } if (pprog && pattry(pprog, word)) - patok = 1; + patok = anypatok = 1; state->pc += 2; nalts--; } @@ -679,6 +680,9 @@ execcase(Estate state, int do_exec) state->pc = end; + if (!anypatok) + lastval = 0; + return lastval; } |