diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eval.c | 23 |
1 files changed, 7 insertions, 16 deletions
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; } |