summaryrefslogtreecommitdiffhomepage
path: root/env.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2024-05-10 15:09:50 +0200
committerRoland Reichwein <mail@reichwein.it>2024-05-10 15:09:50 +0200
commitbfdb4e9d2cfc7890c5f194e670039fa76c391330 (patch)
tree2584a736ed6f2827c39420882555a154d7b5d570 /env.cpp
parent6086ec079a31276c81decdd7b5b5daaafdeb58ca (diff)
Added tests
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;
+ }
+}
+