aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2015-05-03 09:25:53 -0400
committerScott Prager <splinterofchaos@gmail.com>2015-05-29 13:12:12 -0400
commit412d246be71bd99cb4edde4e6f984b0b0d91bcd9 (patch)
tree01307051583b9cf2faf56778a9bd88e00d2a2122 /src/nvim/option.c
parentfa0f1222212704c93ab828b876bda5e9e1cb507e (diff)
downloadrneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.tar.gz
rneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.tar.bz2
rneovim-412d246be71bd99cb4edde4e6f984b0b0d91bcd9.zip
getenv: return NULL if empty #2574
Making an environment variable empty can be a way of unsetting it for platforms that don't support unsetenv(). In most cases, we treat empty variables as having been unset. For all others, use os_env_exists().
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b3789e0e5b..6fb661b6e2 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1727,7 +1727,7 @@ void set_init_1(void)
p_cp = FALSE;
/* Use POSIX compatibility when $VIM_POSIX is set. */
- if (os_getenv("VIM_POSIX") != NULL) {
+ if (os_env_exists("VIM_POSIX")) {
set_string_default("cpo", (char_u *)CPO_ALL);
set_string_default("shm", (char_u *)"A");
}
@@ -1736,8 +1736,7 @@ void set_init_1(void)
* Find default value for 'shell' option.
* Don't use it if it is empty.
*/
- if (((p = (char_u *)os_getenv("SHELL")) != NULL && *p != NUL)
- )
+ if ((p = (char_u *)os_getenv("SHELL")) != NULL)
set_string_default("sh", p);
/*
@@ -1926,7 +1925,7 @@ void set_init_1(void)
* NOTE: mlterm's author is being asked to 'set' a variable
* instead of an environment variable due to inheritance.
*/
- if (os_getenv("MLTERM") != NULL)
+ if (os_env_exists("MLTERM"))
set_option_value((char_u *)"tbidi", 1L, NULL, 0);
/* Parse default for 'fillchars'. */