summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib/unsetenv.c
blob: bce55e9718dcb464cd5eec5270d649e7a2410cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "stddef.h" // for NULL

#include <errno.h>  // for EINVAL, errno
#include <stdlib.h> // for setenv, unsetenv
#include <string.h> // for strchr

int unsetenv(const char *name)
{
	if (name == NULL || *name == '\0' || strchr(name, '=')) {
		errno = EINVAL;
		return -1;
	}

	return setenv(name, NULL, 1);
}