diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-10 23:40:00 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-10 23:40:00 +0200 |
commit | 1a7c572099edf744d6bb67318cff215de3fcd897 (patch) | |
tree | c9c106937b892ab0ef2c99394b7f7052dd1e53eb /src/session.cc | |
parent | 2b4d7de34d173279fd8f09a25699d861c2b057ca (diff) |
turned Tools class into a namespace
use Tools::get/setenv in more places
Diffstat (limited to 'src/session.cc')
-rw-r--r-- | src/session.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/session.cc b/src/session.cc index aa09abe..0ae87df 100644 --- a/src/session.cc +++ b/src/session.cc @@ -19,8 +19,6 @@ using namespace Binc; using std::string; -extern char **environ; - Session::Session() { readbytes = 0; @@ -192,17 +190,15 @@ int Session::timeout() const bool Session::hasEnv(const string &key) const { - return getenv(key.c_str()) != nullptr; + return Tools::getenv(key).has_value(); } string Session::getEnv(const string &key) { - char *c = getenv(key.c_str()); - return c ? c : ""; + return Tools::getenv(key).value_or(string{}); } void Session::setEnv(const string &key, const string &value) { - string env = key + "=" + value; - putenv(strdup(env.c_str())); + Tools::setenv(key, value); } |