diff options
author | herbert <herbert@gondor.apana.org.au> | 2005-02-28 21:32:52 +1100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2005-09-26 18:33:04 +1000 |
commit | add99dd37b51b1585dc6ac8f65d592b9ddcf932b (patch) | |
tree | 48d3a962d6987a04078d995761578e57b04ce296 /src | |
parent | Update funcnest atomically. (diff) | |
download | dash-add99dd37b51b1585dc6ac8f65d592b9ddcf932b.tar.gz dash-add99dd37b51b1585dc6ac8f65d592b9ddcf932b.zip |
Only set skipcount for break and continue.
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; } |