mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-23 13:00:34 +02:00
(environ): Use _NSGetEnviron in Darwin shared library, since environ
is not directly available there.
This commit is contained in:
parent
13aa46a9de
commit
3c14f331d6
3 changed files with 36 additions and 2 deletions
|
@ -159,6 +159,10 @@ extern char ** environ;
|
|||
# include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CRT_EXTERNS_H
|
||||
#include <crt_externs.h> /* for Darwin _NSGetEnviron */
|
||||
#endif
|
||||
|
||||
/* Some Unix systems don't define these. CPP hair is dangerous, but
|
||||
this seems safe enough... */
|
||||
#ifndef R_OK
|
||||
|
@ -196,6 +200,13 @@ extern char ** environ;
|
|||
above means that _POSIX_SOURCE may be #defined, which will
|
||||
encourage header files to do strange things. */
|
||||
|
||||
/* On Apple Darwin in a shared library there's no "environ" to access
|
||||
directly, instead the address of that variable must be obtained with
|
||||
_NSGetEnviron(). */
|
||||
#if HAVE__NSGETENVIRON && defined (PIC)
|
||||
#define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
|
||||
SCM_SYMBOL (sym_read_pipe, "read pipe");
|
||||
SCM_SYMBOL (sym_write_pipe, "write pipe");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1991, 2000, 2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 2000, 2001, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -73,12 +73,23 @@ char *malloc ();
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CRT_EXTERNS_H
|
||||
#include <crt_externs.h> /* for Darwin _NSGetEnviron */
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
extern char **environ;
|
||||
|
||||
/* On Apple Darwin in a shared library there's no "environ" to access
|
||||
directly, instead the address of that variable must be obtained with
|
||||
_NSGetEnviron(). */
|
||||
#if HAVE__NSGETENVIRON && defined (PIC)
|
||||
#define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
|
||||
int
|
||||
putenv (const char *string)
|
||||
|
|
|
@ -87,6 +87,10 @@
|
|||
# include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CRT_EXTERNS_H
|
||||
#include <crt_externs.h> /* for Darwin _NSGetEnviron */
|
||||
#endif
|
||||
|
||||
#ifndef tzname /* For SGI. */
|
||||
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
|
||||
#endif
|
||||
|
@ -112,6 +116,15 @@ extern char *strptime ();
|
|||
# define timet long
|
||||
#endif
|
||||
|
||||
extern char ** environ;
|
||||
|
||||
/* On Apple Darwin in a shared library there's no "environ" to access
|
||||
directly, instead the address of that variable must be obtained with
|
||||
_NSGetEnviron(). */
|
||||
#if HAVE__NSGETENVIRON && defined (PIC)
|
||||
#define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TIMES
|
||||
static
|
||||
timet mytime()
|
||||
|
@ -294,7 +307,6 @@ filltime (struct tm *bd_time, int zoff, char *zname)
|
|||
}
|
||||
|
||||
static char tzvar[3] = "TZ";
|
||||
extern char ** environ;
|
||||
|
||||
/* if zone is set, create a temporary environment with only a TZ
|
||||
string. other threads or interrupt handlers shouldn't be allowed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue