From add99dd37b51b1585dc6ac8f65d592b9ddcf932b Mon Sep 17 00:00:00 2001 From: herbert Date: Mon, 28 Feb 2005 21:32:52 +1100 Subject: Only set skipcount for break and continue. --- src/eval.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src/eval.c') diff --git a/src/eval.c b/src/eval.c index e833882..30c9c2a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -974,10 +974,8 @@ funcdone: shellparam = saveparam; handler = savehandler; INTON; - if (evalskip == SKIPFUNC) { + if (evalskip == SKIPFUNC) evalskip = 0; - skipcount = 0; - } return e; } @@ -1057,19 +1055,12 @@ breakcmd(int argc, char **argv) int returncmd(int argc, char **argv) { - int ret = argc > 1 ? number(argv[1]) : exitstatus; - - if (funcnest) { - evalskip = SKIPFUNC; - skipcount = 1; - return ret; - } - else { - /* Do what ksh does; skip the rest of the file */ - evalskip = SKIPFILE; - skipcount = 1; - return ret; - } + /* + * If called outside a function, do what ksh does; + * skip the rest of the file. + */ + evalskip = funcnest ? SKIPFUNC : SKIPFILE; + return argv[1] ? number(argv[1]) : exitstatus; } -- cgit 1.4.1