summaryrefslogtreecommitdiffstats
path: root/sysif.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-10-16 07:28:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-10-16 07:28:07 -0700
commitfdec8e9d07ff614834c0f39ddd04513cc5648b9a (patch)
treeb3fec5d69e91d61039034238388a7b980d39c399 /sysif.c
parentac6a452df1c5c5c9d2fc3118278fddc913df1faa (diff)
downloadtxr-fdec8e9d07ff614834c0f39ddd04513cc5648b9a.tar.gz
txr-fdec8e9d07ff614834c0f39ddd04513cc5648b9a.tar.bz2
txr-fdec8e9d07ff614834c0f39ddd04513cc5648b9a.zip
sysif: respect HAVE_SETENV.
* sysif.c (setenv_wrap, unsetenv_wrap): Now surrounded with #if HAVE_SETENV ... #endif, an existing feature detection macro. (sysif_init): Only register setenv and unsetenv functions if HAVE_SETENV is true.
Diffstat (limited to 'sysif.c')
-rw-r--r--sysif.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysif.c b/sysif.c
index 6bf69715..45bbde17 100644
--- a/sysif.c
+++ b/sysif.c
@@ -1398,6 +1398,8 @@ val getenv_wrap(val name)
return result;
}
+#if HAVE_SETENV
+
static val setenv_wrap(val name, val value, val overwrite)
{
val self = lit("setenv");
@@ -1442,6 +1444,8 @@ static val unsetenv_wrap(val name)
return name;
}
+#endif
+
#if HAVE_POLL
static val poll_wrap(val poll_list, val timeout_in)
@@ -2861,8 +2865,10 @@ void sysif_init(void)
reg_fun(intern(lit("pipe"), user_package), func_n0(pipe_wrap));
#endif
reg_fun(intern(lit("getenv"), user_package), func_n1(getenv_wrap));
+#if HAVE_SETENV
reg_fun(intern(lit("setenv"), user_package), func_n3o(setenv_wrap, 2));
reg_fun(intern(lit("unsetenv"), user_package), func_n1(unsetenv_wrap));
+#endif
#if HAVE_GETEUID
reg_fun(intern(lit("getuid"), user_package), func_n0(getuid_wrap));