1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Moved the environment variables config block out of the Telnet panel

into the Connection panel, and implemented support for the SSH2
"env" request. (I haven't yet found a server which accepts this
request, so although I've visually checked the packet log and it
looks OK, I haven't yet been able to do a full end-to-end test.)
Also, the `pty' backend reads this data and does a series of
`putenv' commands before launching the shell or application.

This is mostly because in last week's UTF-8 faffings I got
thoroughly sick of typing `export LANG=en_GB.UTF-8' every time I
started a new testing pterm, and it suddenly occurred to me that
this would be precisely the sort of thing you'd want to have pterm
set up for you, particularly since you can configure it alongside
the translation settings and so you can ensure they match up
properly.

[originally from svn r4645]
This commit is contained in:
Simon Tatham
2004-10-16 10:56:54 +00:00
parent 94546cdc2a
commit 859d92a577
4 changed files with 155 additions and 52 deletions

View File

@ -590,6 +590,29 @@ static const char *pty_init(void *frontend, void **backend_handle, Config *cfg,
sprintf(windowid_env_var, "WINDOWID=%ld", windowid);
putenv(windowid_env_var);
}
{
char *e = cfg->environmt;
char *var, *varend, *val, *varval;
while (*e) {
var = e;
while (*e && *e != '\t') e++;
varend = e;
if (*e == '\t') e++;
val = e;
while (*e) e++;
e++;
varval = dupprintf("%.*s=%s", varend-var, var, val);
putenv(varval);
/*
* We must not free varval, since putenv links it
* into the environment _in place_. Weird, but
* there we go. Memory usage will be rationalised
* as soon as we exec anyway.
*/
}
}
/*
* SIGINT and SIGQUIT may have been set to ignored by our
* parent, particularly by things like sh -c 'pterm &' and