summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/helpers.h b/lib/helpers.h
index a8a630e..d2584d0 100644
--- a/lib/helpers.h
+++ b/lib/helpers.h
@@ -3,6 +3,7 @@
#include <concepts>
#include <cstdint>
+#include <cstdlib>
#include <string>
#include <utility>
@@ -49,6 +50,15 @@ namespace MyGrate {
a.size()
} -> std::integral;
};
+
+ inline const char *
+ getenv(const char * env, const char * dfl)
+ {
+ if (const auto e {::getenv(env)}) {
+ return e;
+ }
+ return dfl;
+ }
}
#endif