1162 |
|
|
1163 |
SCM_VALIDATE_STRING (1, str); |
SCM_VALIDATE_STRING (1, str); |
1164 |
|
|
|
#ifndef __MINGW32__ |
|
1165 |
if (strchr (SCM_STRING_CHARS (str), '=') == NULL) |
if (strchr (SCM_STRING_CHARS (str), '=') == NULL) |
1166 |
{ |
{ |
1167 |
|
#ifdef HAVE_UNSETENV |
1168 |
/* No '=' in argument means we should remove the variable from |
/* No '=' in argument means we should remove the variable from |
1169 |
the environment. Not all putenvs understand this. To be |
the environment. Not all putenvs understand this. To be |
1170 |
safe, we do it explicitely using unsetenv. */ |
safe, we do it explicitely using unsetenv. */ |
1171 |
unsetenv (SCM_STRING_CHARS (str)); |
unsetenv (SCM_STRING_CHARS (str)); |
1172 |
|
#else |
1173 |
|
/* On e.g. Win32 hosts putenv() called with 'name=' removes the |
1174 |
|
environment variable 'name'. */ |
1175 |
|
ptr = scm_malloc (SCM_STRING_LENGTH (str) + 2); |
1176 |
|
strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str)); |
1177 |
|
ptr[SCM_STRING_LENGTH (str)] = '='; |
1178 |
|
ptr[SCM_STRING_LENGTH (str) + 1] = 0; |
1179 |
|
rv = putenv (ptr); |
1180 |
|
if (rv < 0) |
1181 |
|
SCM_SYSERROR; |
1182 |
|
#endif |
1183 |
} |
} |
1184 |
else |
else |
|
#endif |
|
1185 |
{ |
{ |
1186 |
/* must make a new copy to be left in the environment, safe from gc. */ |
/* must make a new copy to be left in the environment, safe from gc. */ |
1187 |
ptr = scm_malloc (SCM_STRING_LENGTH (str) + 1); |
ptr = scm_malloc (SCM_STRING_LENGTH (str) + 1); |