To remove an environment variable under Windows, one must do a setenv() with a null string

This commit is contained in:
jjgarcia 2005-05-02 12:50:47 +00:00
parent 996ff08c0a
commit 57ea34ce87
2 changed files with 7 additions and 1 deletions

View file

@ -167,7 +167,7 @@ typedef unsigned int cl_hashkey;
/* #undef HAVE_SYS_IOCTL_H */
/* putenv() or setenv() */
#undef HAVE_SETENV
#undef HAVE_PUTENV
#define HAVE_PUTENV 1
/* times() and sys/times.h */
/* #undef HAVE_TIMES */
/* user home directory, user name, etc... */

View file

@ -496,8 +496,12 @@ si_setenv(cl_object var, cl_object value)
* (si:setenv "foo" nil), then (si:getenv "foo) returns
* the right thing. */
unsetenv(var->string.self);
#else
#if defined(_MSC_VER) || defined(mingw32)
si_setenv(var, make_simple_string(""));
#else
putenv(var->string.self);
#endif
#endif
ret_val = 0;
} else {
@ -508,6 +512,8 @@ si_setenv(cl_object var, cl_object value)
cl_object temp =
cl_format(4, Cnil, make_constant_string("~A=~A"), var,
value);
if (temp->string.hasfillp && temp->string.fillp < temp->string.dim)
temp->string.self[temp->string.fillp] = '\0';
putenv(temp->string.self);
#endif
}