summary refs log tree commit diff
path: root/src/eval.c
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2011-03-15 15:44:47 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2011-03-15 15:44:47 +0800
commitaccde25e09f39d3aca64a50c72f23bf84d312757 (patch)
treee925e3d3adf92a853a2d4c56d7cf9b9b2ff22ee9 /src/eval.c
parent[SHELL] Port to Solaris (diff)
downloaddash-accde25e09f39d3aca64a50c72f23bf84d312757.tar.gz
dash-accde25e09f39d3aca64a50c72f23bf84d312757.zip
[EVAL] Let funcnode refer to a function definition, not its first command
It is not unrelated: I changed the meaning of struct funcnode's field n
to refer to the function definition, rather than the list of the
function's commands, because I needed to refer to the function
definition node from evalfun, which only gets passed a funcnode. But it
is something that could be applied independently (without being useful
by itself), so I've attached it as a separate patch for easier review.

Signed-off-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 6e5c43e..9f4388a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -296,7 +296,7 @@ calleval:
 		}
 		goto success;
 	case NDEFUN:
-		defun(n->narg.text, n->narg.next);
+		defun(n);
 success:
 		status = 0;
 setstatus:
@@ -954,7 +954,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
 	shellparam.optind = 1;
 	shellparam.optoff = -1;
 	pushlocalvars();
-	evaltree(&func->n, flags & EV_TESTED);
+	evaltree(func->n.narg.next, flags & EV_TESTED);
 	poplocalvars(0);
 funcdone:
 	INTOFF;