From: mquinson Date: Fri, 3 Oct 2008 08:05:04 +0000 (+0000) Subject: Also add the variables defined in the script to the dict of variables to substitute X-Git-Tag: v3.3~151 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dacb236dc325c9d2c451900e98ef963f42a0eb7d?hp=6aee3c83262838c5202a1e013845242554b60db2 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 --- 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);