From 3b0b56321fb1544c0a2282a11c5dc3171ce35fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Fri, 6 Aug 1999 15:04:35 -0700 Subject: [PATCH] added environment setting Rev: NT/tools/sprshd:1.16 --- NT/tools/sprshd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/NT/tools/sprshd b/NT/tools/sprshd index 180781369b..049e0cb7d9 100755 --- a/NT/tools/sprshd +++ b/NT/tools/sprshd @@ -86,6 +86,7 @@ void my_proxy(Stdio.File from, Stdio.File to) void handle_incoming_connection(object(Stdio.File) io) { object p; + mapping env=getenv(); sscanf(io->read(4),"%4c",int args); string *cmd=allocate(args); for(int e=0;e<args;e++) @@ -105,6 +106,12 @@ void handle_incoming_connection(object(Stdio.File) io) write("Doing %s in %s\n",cmd*" ",dir); + while(sscanf(cmd[0],"%s=%s",string key, string val)) + { + env[key]=val; + cmd=cmd[1..]; + } + switch(lower_case(cmd[0])) { case "mkdir": @@ -160,7 +167,7 @@ void handle_incoming_connection(object(Stdio.File) io) } case "getenv": { - string s=getenv(cmd[1])+"\n"; + string s=(env[cmd[1]] || "")+"\n"; io->write(sprintf("%4c%s",strlen(s),s)); io->write(sprintf("%4c",0)); io->write(sprintf("%4c",0)); @@ -191,6 +198,7 @@ void handle_incoming_connection(object(Stdio.File) io) "stderr":p2, #endif "cwd":dir, + "env":env, ])); }; destruct(p2); -- GitLab