diff options
author | Roland Reichwein <mail@reichwein.it> | 2024-05-10 15:09:50 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2024-05-10 15:09:50 +0200 |
commit | bfdb4e9d2cfc7890c5f194e670039fa76c391330 (patch) | |
tree | 2584a736ed6f2827c39420882555a154d7b5d570 /env.cpp | |
parent | 6086ec079a31276c81decdd7b5b5daaafdeb58ca (diff) |
Added tests
Diffstat (limited to 'env.cpp')
-rw-r--r-- | env.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -0,0 +1,13 @@ +#include "env.h" + +#include <cstdlib> + +std::string env_value(const std::string& key) { + char* value_ptr{std::getenv(key.c_str())}; + if (value_ptr == nullptr) { + return {}; + } else { + return value_ptr; + } +} + |