From bfdb4e9d2cfc7890c5f194e670039fa76c391330 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 10 May 2024 15:09:50 +0200 Subject: Added tests --- env.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 env.cpp (limited to 'env.cpp') 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 + +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; + } +} + -- cgit v1.2.3