* Fixed environ detection under OS X.

git-svn-id: svn://svn.zoy.org/elk/trunk@204 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-09-26 16:23:47 +00:00
parent 6193f32c39
commit a107325247
1 changed files with 6 additions and 3 deletions

View File

@ -39,13 +39,16 @@
#ifndef WIN32 #ifndef WIN32
#ifndef ENVIRON_IN_UNISTD_H #if defined(__APPLE__)
# include <crt_externs.h>
# define environ (* _NSGetEnviron())
#elif !defined(ENVIRON_IN_UNISTD_H)
/* "extern" in front of the next declaration causes the Ultrix 4.2 linker /* "extern" in front of the next declaration causes the Ultrix 4.2 linker
* to fail, but omitting it no longer works with modern C compilers: */ * to fail, but omitting it no longer works with modern C compilers: */
extern char **environ; extern char **environ;
#endif #endif
#if defined(HAVE_ENVIRON) && !defined(SYS_DARWIN) #if defined(HAVE_ENVIRON)
static Object P_Environ() { static Object P_Environ() {
Object ret, cell, str; Object ret, cell, str;
char *p, **ep; char *p, **ep;
@ -361,7 +364,7 @@ err:
} }
void elk_init_unix_process() { void elk_init_unix_process() {
#if defined(HAVE_ENVIRON) && !defined(SYS_DARWIN) #if defined(HAVE_ENVIRON)
Def_Prim(P_Environ, "unix-environ", 0, 0, EVAL); Def_Prim(P_Environ, "unix-environ", 0, 0, EVAL);
#endif #endif
Def_Prim(P_Exec, "unix-exec", 2, 3, VARARGS); Def_Prim(P_Exec, "unix-exec", 2, 3, VARARGS);