mailing list of musl libc
 help / color / mirror / code / Atom feed
5e5727f628b9f882eac6ebb86170301d367bbde6 blob 630 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "libc.h"

char *__strchrnul(const char *, int);

static void dummy(char *p, char *r) {}
weak_alias(dummy, __env_change);

int __unsetenv(const char *name, size_t l, char **e)
{
	for (; *e; e++)
		while (*e && !strncmp(name, *e, l) && l[*e] == '=') {
			char **ee = e, *tmp = *e;
			do *ee = *(ee+1);
			while (*++ee);
			__env_change(tmp, 0);
		}
	return 0;
}

int unsetenv(const char *name)
{
	size_t l = __strchrnul(name, '=') - name;
	if (!l || name[l]) {
		errno = EINVAL;
		return -1;
	}
	if (!__environ) return 0;
	return __unsetenv(name, l, __environ);
}
debug log:

solving 5e5727f ...
found 5e5727f in https://inbox.vuxu.org/musl/1457895230-13602-3-git-send-email-amonakov@ispras.ru/
found 86873cd in https://inbox.vuxu.org/musl/1457895230-13602-2-git-send-email-amonakov@ispras.ru/
found 3569335 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 356933546a31a41ad859c3bc08709aa76a5a2644	src/env/unsetenv.c

applying [1/2] https://inbox.vuxu.org/musl/1457895230-13602-2-git-send-email-amonakov@ispras.ru/
diff --git a/src/env/unsetenv.c b/src/env/unsetenv.c
dissimilarity index 77%
index 3569335..86873cd 100644


applying [2/2] https://inbox.vuxu.org/musl/1457895230-13602-3-git-send-email-amonakov@ispras.ru/
diff --git a/src/env/unsetenv.c b/src/env/unsetenv.c
index 86873cd..5e5727f 100644

Checking patch src/env/unsetenv.c...
Applied patch src/env/unsetenv.c cleanly.
Checking patch src/env/unsetenv.c...
Applied patch src/env/unsetenv.c cleanly.

index at:
100644 5e5727f628b9f882eac6ebb86170301d367bbde6	src/env/unsetenv.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).