aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2014-02-28 05:33:31 -0500
committerThiago de Arruda <tpadilha84@gmail.com>2014-02-28 08:15:27 -0300
commitd2e567a8354573ec96c71eb490e7c991f55ac397 (patch)
tree1daf4d3a6cd72aec1be2d9602592cc7a8a252f49 /src
parent55e00334fb8056e9dbd54513e9052519581808fb (diff)
downloadrneovim-d2e567a8354573ec96c71eb490e7c991f55ac397.tar.gz
rneovim-d2e567a8354573ec96c71eb490e7c991f55ac397.tar.bz2
rneovim-d2e567a8354573ec96c71eb490e7c991f55ac397.zip
Use _NSGetEnviron on Mac OS X to gain access to environ.
When building nvim as a shared library for testing, environ is not exposed. In order to gain access to the environment variables, you must get a pointer to them from _NSGetEnviron(). It appears that this may affect the FreeBSD platform too.
Diffstat (limited to 'src')
-rw-r--r--src/misc1.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/misc1.c b/src/misc1.c
index b92d57a03a..47e8b19e24 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -45,6 +45,10 @@
#include "window.h"
#include "os/os.h"
+#ifdef HAVE_CRT_EXTERNS_H
+#include <crt_externs.h>
+#endif
+
static char_u *vim_version_dir __ARGS((char_u *vimdir));
static char_u *remove_tail __ARGS((char_u *p, char_u *pend, char_u *name));
static void init_users __ARGS((void));
@@ -3642,6 +3646,7 @@ void vim_setenv(char_u *name, char_u *val)
}
}
+
/*
* Function given to ExpandGeneric() to obtain an environment variable name.
*/
@@ -3653,9 +3658,11 @@ char_u *get_env_name(expand_T *xp, int idx)
*/
return NULL;
# else
-# ifndef __WIN32__
+# if !defined(__WIN32__) && !defined(HAVE__NSGETENVIRON)
/* Borland C++ 5.2 has this in a header file. */
extern char **environ;
+# else
+ char **environ = *_NSGetEnviron();
# endif
# define ENVNAMELEN 100
static char_u name[ENVNAMELEN];