summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog1
-rw-r--r--src/eval.c23
2 files changed, 8 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 35bcdda..13fc33f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* Replaced EXEVAL with SKIPEVAL.
 	* Update funcnest atomically.
+	* Only set skipcount for break and continue.
 
 2005-02-28  A Costa <agcosta@gis.net>
 
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;
 }