aboutsummaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-03-03 20:02:32 +0100
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-06 13:38:45 -0300
commitf2433aedc86db171d5616410605cf0d398d8fdc2 (patch)
tree2df40baf1dce2b9e6e6dc175f66cfff41d7bd6ad /src/option.c
parentfc8686640250561156913387c62924d2bdb5e1ac (diff)
downloadrneovim-f2433aedc86db171d5616410605cf0d398d8fdc2.tar.gz
rneovim-f2433aedc86db171d5616410605cf0d398d8fdc2.tar.bz2
rneovim-f2433aedc86db171d5616410605cf0d398d8fdc2.zip
cleanup environment variable handling + unit tests
* removed a putenv() implementation which isn't needed anymore * mch_getenv() and mch_setenv() are now functions in src/os/env.c * removes direct calls to getenv() and setenv() outside of src/os/env.c * refactored the logic of get_env_name into mch_getenvname_at_index * added unittests for the functions in os/env.c
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/option.c b/src/option.c
index 8daac5b5e1..e257186cf2 100644
--- a/src/option.c
+++ b/src/option.c
@@ -67,6 +67,7 @@
#include "ui.h"
#include "undo.h"
#include "window.h"
+#include "os/os.h"
/*
* The options that are local to a window or buffer have "indir" set to one of
@@ -1961,7 +1962,7 @@ void set_init_1(void) {
p_cp = TRUE;
/* Use POSIX compatibility when $VIM_POSIX is set. */
- if (mch_getenv((char_u *)"VIM_POSIX") != NULL) {
+ if (mch_getenv("VIM_POSIX") != NULL) {
set_string_default("cpo", (char_u *)CPO_ALL);
set_string_default("shm", (char_u *)"A");
}
@@ -1970,7 +1971,7 @@ void set_init_1(void) {
* Find default value for 'shell' option.
* Don't use it if it is empty.
*/
- if (((p = mch_getenv((char_u *)"SHELL")) != NULL && *p != NUL)
+ if (((p = (char_u *)mch_getenv("SHELL")) != NULL && *p != NUL)
)
set_string_default("sh", p);
@@ -2170,7 +2171,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 (mch_getenv((char_u *)"MLTERM") != NULL)
+ if (mch_getenv("MLTERM") != NULL)
set_option_value((char_u *)"tbidi", 1L, NULL, 0);
/* Parse default for 'fillchars'. */
@@ -2447,7 +2448,7 @@ static char_u *term_bg_default(void) {
|| STRCMP(T_NAME, "screen.linux") == 0
|| STRCMP(T_NAME, "cygwin") == 0
|| STRCMP(T_NAME, "putty") == 0
- || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
+ || ((p = (char_u *)mch_getenv("COLORFGBG")) != NULL
&& (p = vim_strrchr(p, ';')) != NULL
&& ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
&& p[2] == NUL))