Branch: Tag:

1999-08-06

1999-08-06 22:04:35 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

added environment setting

Rev: NT/tools/sprshd:1.16

86:   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:       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:    }    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:    "stderr":p2,   #endif    "cwd":dir, +  "env":env,    ]));    };    destruct(p2);