X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6aee3c83262838c5202a1e013845242554b60db2..dacb236dc325c9d2c451900e98ef963f42a0eb7d:/tools/tesh/run_context.c 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);