From dacb236dc325c9d2c451900e98ef963f42a0eb7d Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 3 Oct 2008 08:05:04 +0000 Subject: [PATCH] Also add the variables defined in the script to the dict of variables to substitute git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5958 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- tools/tesh/run_context.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/tesh/run_context.c b/tools/tesh/run_context.c index abc6fad8e1..8e540b007e 100644 --- a/tools/tesh/run_context.c +++ b/tools/tesh/run_context.c @@ -254,10 +254,17 @@ void rctx_pushline(const char* filepos, char kind, char *line) { VERB1("[%s] (ignore output of next command)", filepos); } else if (!strncmp(line,"setenv ",strlen("setenv "))) { + int len = strlen("setenv "); + char *eq = strchr(line+len,'='); + char *key = bprintf("%.*s",(int)(eq-line-len),line+len); + xbt_dict_set(env,key,xbt_strdup(eq+1),xbt_free_f); + rctx->env = realloc(rctx->env,++(rctx->env_size)*sizeof(char*)); - rctx->env[rctx->env_size-2] = xbt_strdup(line+strlen("setenv ")); + rctx->env[rctx->env_size-2] = xbt_strdup(line+len); rctx->env[rctx->env_size-1] = NULL; - VERB2("[%s] setenv %s", filepos,line+strlen("setenv ")); + VERB2("[%s] setenv %s", filepos,line+len); + +// } else if (!strncmp(line,"file ",strlen("file "))) { } else { ERROR2("%s: Malformed metacommand: %s",filepos,line); -- 2.20.1