Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1199)

Unified Diff: fusl/src/env/getenv.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/env/clearenv.c ('k') | fusl/src/env/putenv.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/env/getenv.c
diff --git a/fusl/src/env/getenv.c b/fusl/src/env/getenv.c
new file mode 100644
index 0000000000000000000000000000000000000000..00c1bce03725bf51c077cf6334d826105f5ad12e
--- /dev/null
+++ b/fusl/src/env/getenv.c
@@ -0,0 +1,14 @@
+#include <stdlib.h>
+#include <string.h>
+#include "libc.h"
+
+char *getenv(const char *name)
+{
+ int i;
+ size_t l = strlen(name);
+ if (!__environ || !*name || strchr(name, '=')) return NULL;
+ for (i=0; __environ[i] && (strncmp(name, __environ[i], l)
+ || __environ[i][l] != '='); i++);
+ if (__environ[i]) return __environ[i] + l+1;
+ return NULL;
+}
« no previous file with comments | « fusl/src/env/clearenv.c ('k') | fusl/src/env/putenv.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698