diff options
author | Stefan Jahn <stefan@lkcc.org> | 2003-05-30 09:39:34 +0000 |
---|---|---|
committer | Stefan Jahn <stefan@lkcc.org> | 2003-05-30 09:39:34 +0000 |
commit | 1e498fbd0fffc1b9434ef0f5b1de75491a91883e (patch) | |
tree | 686dc9eb3df792133b112ff00ce61aa7f0792fc7 /libguile | |
parent | c47e2599cb0be58a4d4da737000ae05500e72aeb (diff) | |
download | guile-1e498fbd0fffc1b9434ef0f5b1de75491a91883e.tar.gz |
2003-05-30 Stefan Jahn <stefan@lkcc.org>
* configure.in: Checking for unsetenv().
2003-05-30 Stefan Jahn <stefan@lkcc.org>
* posix.c (s_scm_putenv): Use the new HAVE_UNSETENV
appropriately for mingw32 hosts.
* numbers.h: Defining copysign(), isnan() and finite() to
be prefixed by a single '_' for mingw32 hosts.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/ChangeLog | 8 | ||||
-rw-r--r-- | libguile/numbers.h | 7 | ||||
-rw-r--r-- | libguile/posix.c | 14 |
3 files changed, 26 insertions, 3 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 0fa3a937f..8335d136b 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,11 @@ +2003-05-30 Stefan Jahn <stefan@lkcc.org> + + * posix.c (s_scm_putenv): Use the new HAVE_UNSETENV + appropriately for mingw32 hosts. + + * numbers.h: Defining copysign(), isnan() and finite() to + be prefixed by a single '_' for mingw32 hosts. + 2003-05-30 Kevin Ryde <user42@zip.com.au> * numbers.c (z_negative_one): New variable. diff --git a/libguile/numbers.h b/libguile/numbers.h index c896d3e7a..8540d3585 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -88,7 +88,12 @@ #if SCM_HAVE_STDC_HEADERS # ifndef GO32 -# include <float.h> +# include <float.h> +# ifdef __MINGW32__ +# define copysign _copysign +# define isnan _isnan +# define finite _finite +# endif /* __MINGW32__ */ # endif /* ndef GO32 */ #endif /* def STDC_HEADERS */ diff --git a/libguile/posix.c b/libguile/posix.c index 2269bc365..4ae59a746 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1162,16 +1162,26 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0, SCM_VALIDATE_STRING (1, str); -#ifndef __MINGW32__ if (strchr (SCM_STRING_CHARS (str), '=') == NULL) { +#ifdef HAVE_UNSETENV /* No '=' in argument means we should remove the variable from the environment. Not all putenvs understand this. To be safe, we do it explicitely using unsetenv. */ unsetenv (SCM_STRING_CHARS (str)); +#else + /* On e.g. Win32 hosts putenv() called with 'name=' removes the + environment variable 'name'. */ + ptr = scm_malloc (SCM_STRING_LENGTH (str) + 2); + strncpy (ptr, SCM_STRING_CHARS (str), SCM_STRING_LENGTH (str)); + ptr[SCM_STRING_LENGTH (str)] = '='; + ptr[SCM_STRING_LENGTH (str) + 1] = 0; + rv = putenv (ptr); + if (rv < 0) + SCM_SYSERROR; +#endif } else -#endif { /* must make a new copy to be left in the environment, safe from gc. */ ptr = scm_malloc (SCM_STRING_LENGTH (str) + 1); |