mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-19 18:20:22 +02:00
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.
This commit is contained in:
parent
c47e2599cb
commit
1e498fbd0f
5 changed files with 31 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue