summary refs log tree commit diff
diff options
context:
space:
mode:
authorherbert <herbert@gondor.apana.org.au>2005-03-25 23:39:14 +1100
committerHerbert Xu <herbert@gondor.apana.org.au>2005-09-26 18:33:05 +1000
commit4a7e4ba5cb8bfd267fee12a848bd3292580bcdfa (patch)
tree9834b4d48049cf5f6fb5debac80f5fdb2f3dfd62
parentEliminate first null termination in setvar. (diff)
downloaddash-4a7e4ba5cb8bfd267fee12a848bd3292580bcdfa.tar.gz
dash-4a7e4ba5cb8bfd267fee12a848bd3292580bcdfa.zip
Turn evalskip into a bit field.
This allows SKIPEVAL and SKIPFUNC to coexist which is needed for eval return 1.
-rw-r--r--ChangeLog1
-rw-r--r--src/eval.c10
-rw-r--r--src/eval.h10
3 files changed, 10 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1830be2..ca56f81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
 	* Cleaned up src/Makefile.am.
 	* Get rid of duplicate -g -O2 in CFLAGS.
 	* Eliminate first null termination in setvar.
+	* Turn evalskip into a bit field.
 
 2005-03-25  Gilles Chanteperdrix <gilles.chanteperdrix@laposte.net>
 
diff --git a/src/eval.c b/src/eval.c
index 7f00b21..793d4c9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -324,8 +324,8 @@ out:
 		dotrap();
 	if (flags & EV_EXIT)
 		exraise(EXEXIT);
-	if ((checkexit & exitstatus) && evalskip != SKIPFILE)
-		evalskip = SKIPEVAL;
+	if ((checkexit & exitstatus))
+		evalskip |= SKIPEVAL;
 }
 
 
@@ -931,8 +931,7 @@ cmddone:
 	commandname = savecmdname;
 	exsig = 0;
 	handler = savehandler;
-	if (evalskip == SKIPEVAL)
-		evalskip = 0;
+	evalskip &= ~SKIPEVAL;
 
 	return i;
 }
@@ -974,8 +973,7 @@ funcdone:
 	shellparam = saveparam;
 	handler = savehandler;
 	INTON;
-	if (evalskip == SKIPFUNC)
-		evalskip = 0;
+	evalskip &= ~SKIPFUNC;
 	return e;
 }
 
diff --git a/src/eval.h b/src/eval.h
index dc523e2..3d0a9a6 100644
--- a/src/eval.h
+++ b/src/eval.h
@@ -62,8 +62,8 @@ extern int funcnest;
 extern int evalskip;
 
 /* reasons for skipping commands (see comment on breakcmd routine) */
-#define SKIPBREAK	1
-#define SKIPCONT	2
-#define SKIPFUNC	3
-#define SKIPFILE	4
-#define SKIPEVAL	5
+#define SKIPBREAK	(1 << 0)
+#define SKIPCONT	(1 << 1)
+#define SKIPFUNC	(1 << 2)
+#define SKIPFILE	(1 << 3)
+#define SKIPEVAL	(1 << 4)