From 71487a935e658e2c193188d871a1c3a7a570dbc0 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Wed, 25 Feb 2015 10:33:04 +0000 Subject: 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 --- src/nvim/os/env.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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) -- cgit