/[guile]/guile/guile-core/libguile/posix.c
ViewVC logotype

Diff of /guile/guile-core/libguile/posix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.113 by ela, Thu May 29 14:39:13 2003 UTC revision 1.114 by ela, Fri May 30 09:39:34 2003 UTC
# Line 1162  SCM_DEFINE (scm_putenv, "putenv", 1, 0, Line 1162  SCM_DEFINE (scm_putenv, "putenv", 1, 0,
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);

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26