aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2015-02-25 10:33:04 +0000
committerScott Prager <splinterofchaos@gmail.com>2015-04-14 15:20:50 -0400
commit71487a935e658e2c193188d871a1c3a7a570dbc0 (patch)
tree459940111273bafd9e05bc2761660ea7dcc78900 /src
parenta9ee85b9fc2d4e3faa466e9c3062cd41315f8456 (diff)
downloadrneovim-71487a935e658e2c193188d871a1c3a7a570dbc0.tar.gz
rneovim-71487a935e658e2c193188d871a1c3a7a570dbc0.tar.bz2
rneovim-71487a935e658e2c193188d871a1c3a7a570dbc0.zip
Implement os_unsetenv()
- In UNIX systems where unsetenv() is available, it is used. Otherwise the variables are set with the empty string. - New check HAVE_UNSETENV for unsetenv() - Added unit test to env_spec.lua
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/env.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 37158f4d3c..be4b22de3a 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -37,6 +37,19 @@ int os_setenv(const char *name, const char *value, int overwrite)
return setenv(name, value, overwrite);
}
+/// Unset environment variable
+///
+/// For systems where unsetenv() is not available the value will be set as an
+/// empty string
+int os_unsetenv(const char *name)
+{
+#ifdef HAVE_UNSETENV
+ return unsetenv(name);
+#else
+ return os_setenv(name, "", 1);
+#endif
+}
+
char *os_getenvname_at_index(size_t index)
{
# if defined(HAVE__NSGETENVIRON)