summaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'env.cpp')
-rw-r--r--env.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/env.cpp b/env.cpp
new file mode 100644
index 0000000..ff44ff3
--- /dev/null
+++ b/env.cpp
@@ -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;
+ }
+}
+