203a7732f5
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.
21 lines
383 B
C++
21 lines
383 B
C++
#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;
|
|
}
|
|
|
|
}
|