klibc-bot for Herbert Xu
2012-Jul-02  09:12 UTC
[klibc] [klibc:master] [BUILTIN] Merge SKIPFUNC/ SKIPFILE and only clear SKIPFUNC when leaving dotcmd
Commit-ID:  21b878467fc1d46f8155e0f5ada315d741869262
Gitweb:    
http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=21b878467fc1d46f8155e0f5ada315d741869262
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Sat, 9 Jul 2011 22:05:22 +0800
Committer:  maximilian attems <max at stro.at>
CommitDate: Mon, 2 Jul 2012 10:45:36 +0200
[klibc] [BUILTIN] Merge SKIPFUNC/SKIPFILE and only clear SKIPFUNC when leaving
dotcmd
Currently upon leaving a dotcmd the evalskip state is reset so
if a continue/break statement is used within a dot script it would
have no effect outside of the dot script.
This is inconsistent with other shells.
This patch is based on one by Jilles Tjoelker and only clears
SKIPFUNC when leaving a dot script.  As a result continue/break
will remain in effect.
It also merges SKIPFUNC/SKIPFILE as they have no practical difference.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: maximilian attems <max at stro.at>
---
 usr/dash/eval.c |    2 +-
 usr/dash/eval.h |    1 -
 usr/dash/main.c |    2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 8dc84ce..ae83508 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -1043,7 +1043,7 @@ returncmd(int argc, char **argv)
 	 * If called outside a function, do what ksh does;
 	 * skip the rest of the file.
 	 */
-	evalskip = funcline ? SKIPFUNC : SKIPFILE;
+	evalskip = SKIPFUNC;
 	return argv[1] ? number(argv[1]) : exitstatus;
 }
 
diff --git a/usr/dash/eval.h b/usr/dash/eval.h
index ac394e8..5ccfa9f 100644
--- a/usr/dash/eval.h
+++ b/usr/dash/eval.h
@@ -57,4 +57,3 @@ extern int evalskip;
 #define SKIPBREAK	(1 << 0)
 #define SKIPCONT	(1 << 1)
 #define SKIPFUNC	(1 << 2)
-#define SKIPFILE	(1 << 3)
diff --git a/usr/dash/main.c b/usr/dash/main.c
index b38dc27..7df3c44 100644
--- a/usr/dash/main.c
+++ b/usr/dash/main.c
@@ -242,7 +242,7 @@ cmdloop(int top)
 
 		skip = evalskip;
 		if (skip) {
-			evalskip = 0;
+			evalskip &= ~SKIPFUNC;
 			break;
 		}
 	}
Possibly Parallel Threads
- 2.0.2 klibc release
 - [klibc:update-dash] [BUILTIN] Return without arguments in a trap should use status outside traps
 - [klibc:update-dash] dash: [BUILTIN] Return without arguments in a trap should use status outside traps
 - [klibc:update-dash] eval: Return status in eval functions
 - [klibc:update-dash] dash: eval: Return status in eval functions
 
