summaryrefslogtreecommitdiff
path: root/userland/libc/stdlib/getenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/stdlib/getenv.c')
-rw-r--r--userland/libc/stdlib/getenv.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/userland/libc/stdlib/getenv.c b/userland/libc/stdlib/getenv.c
index 0240d66..487ac76 100644
--- a/userland/libc/stdlib/getenv.c
+++ b/userland/libc/stdlib/getenv.c
@@ -1,7 +1,19 @@
#include <stdlib.h>
+#include <string.h>
+
+// Defined in stdlib/setenv.c
+struct env {
+ char *name;
+ char *value;
+ struct env *next;
+};
+
+struct env *internal_getenv(const char *name);
char *getenv(const char *name) {
- (void)name;
- // FIXME
- return NULL;
+ struct env *p = internal_getenv(name);
+ if (!p) {
+ return NULL;
+ }
+ return p->value;
}