summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/unsetenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/unsetenv.c')
-rw-r--r--lib/libc/stdlib/unsetenv.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libc/stdlib/unsetenv.c b/lib/libc/stdlib/unsetenv.c
new file mode 100644
index 00000000..4eb11d57
--- /dev/null
+++ b/lib/libc/stdlib/unsetenv.c
@@ -0,0 +1,13 @@
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+int unsetenv(const char *name)
+{
+ if (name == NULL || *name == '\0' || strchr(name, '=')) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ return setenv(name, NULL, 1);
+}