aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.posix/getenv.ccm
diff options
context:
space:
mode:
Diffstat (limited to 'nihil.posix/getenv.ccm')
-rw-r--r--nihil.posix/getenv.ccm23
1 files changed, 23 insertions, 0 deletions
diff --git a/nihil.posix/getenv.ccm b/nihil.posix/getenv.ccm
new file mode 100644
index 0000000..465f7e7
--- /dev/null
+++ b/nihil.posix/getenv.ccm
@@ -0,0 +1,23 @@
+/*
+ * This source code is released into the public domain.
+ */
+
+module;
+
+#include <expected>
+#include <string>
+
+export module nihil.posix:getenv;
+
+import nihil.error;
+
+namespace nihil {
+
+/*
+ * Find a variable by the given name in the environment by calling getenv_r().
+ */
+
+export [[nodiscard]] auto getenv(std::string_view varname)
+ -> std::expected<std::string, error>;
+
+} // namespace nihil