summaryrefslogtreecommitdiff
path: root/lua/local/lposix.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua/local/lposix.c')
-rw-r--r--lua/local/lposix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua/local/lposix.c b/lua/local/lposix.c
index 64b0301a3..5c1566f86 100644
--- a/lua/local/lposix.c
+++ b/lua/local/lposix.c
@@ -438,7 +438,12 @@ static int Pgetenv(lua_State *L) /** getenv([name]) */
if (lua_isnone(L, 1))
{
/*@-nestedextern -shadow@*/
+ #ifdef __APPLE__
+ #include <crt_externs.h>
+ #define environ (*_NSGetEnviron())
+ #else
extern char **environ;
+ #endif /* __APPLE__ */
/*@=nestedextern =shadow@*/
char **e;
if (*environ==NULL) lua_pushnil(L); else lua_newtable(L);