diff --git a/msvc/h/config.h.msvc6 b/msvc/h/config.h.msvc6 index 95c07d412..5e0b6cb83 100644 --- a/msvc/h/config.h.msvc6 +++ b/msvc/h/config.h.msvc6 @@ -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... */ diff --git a/src/c/main.d b/src/c/main.d index 17e8a6693..ae8991ed1 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -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 }