fixed the environ issue on macosx

This commit is contained in:
hyung-hwan 2020-12-18 17:57:59 +00:00
parent 3412108b75
commit 020f76ce1d

View File

@ -64,6 +64,10 @@
# else # else
# error UNSUPPORTED DYNAMIC LINKER # error UNSUPPORTED DYNAMIC LINKER
# endif # endif
# if defined(HAVE_CRT_EXTERNS_H)
# include <crt_externs.h> /* MacOSX/darwin. _NSGetEnviron() */
# endif
#endif #endif
#if !defined(HAWK_HAVE_CFG_H) #if !defined(HAWK_HAVE_CFG_H)
@ -2620,7 +2624,12 @@ static int build_argcv (hawk_rtx_t* rtx, int argc_id, int argv_id, const hawk_oo
/* TODO: use wenviron where it's available */ /* TODO: use wenviron where it's available */
typedef hawk_bch_t env_char_t; typedef hawk_bch_t env_char_t;
#define ENV_CHAR_IS_BCH #define ENV_CHAR_IS_BCH
extern char **environ;
#if defined(HAVE_CRT_EXTERNS_H)
#define environ (*(_NSGetEnviron()))
#else
extern char** environ;
#endif
static int build_environ (hawk_rtx_t* rtx, int gbl_id, env_char_t* envarr[]) static int build_environ (hawk_rtx_t* rtx, int gbl_id, env_char_t* envarr[])
{ {