diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-04-07 21:25:44 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-04-07 23:47:51 +0100 |
| commit | 203a7732f5fafb5f9b7e8564bd3bd4587e168134 (patch) | |
| tree | e136448924786ac638b8ad91304b6cdf6e5eb035 /src/env_vars.cc | |
| parent | 33de42610dc08dd7bfd65f49a70ec68a478dee2d (diff) | |
Add support for querying client environement variables
At connection, a remote client sends all its environement to the
server, which then provides access to client env through
kak_client_env_VAR_NAME variables in the shell.
Diffstat (limited to 'src/env_vars.cc')
| -rw-r--r-- | src/env_vars.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/env_vars.cc b/src/env_vars.cc new file mode 100644 index 00000000..d6c04fa3 --- /dev/null +++ b/src/env_vars.cc @@ -0,0 +1,20 @@ +#include "env_vars.hh" + +namespace Kakoune +{ + +EnvVarMap get_env_vars() +{ + EnvVarMap env_vars; + for (char** it = environ; *it; ++it) + { + const char* name = *it; + const char* value = name; + while (*value != 0 and *value != '=') + ++value; + env_vars[String{name, value}] = (*value == '=') ? value+1 : value; + } + return env_vars; +} + +} |
