getenv.c\env\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/env/getenv.c
blob: a90d39cf74f35bf0324ea7dea20ecdabdb5030dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
char *getenv(const char *name)
{
	size_t l = __strchrnul(name, '=') - name;
	if (l && !name[l] && __environ)
		for (char **e = __environ; *e; e++)
			if (!strncmp(name, *e, l) && l[*e] == '=')
				return *e + l+1;
	return 0;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月08日 04:29:24 +0000

AltStyle によって変換されたページ (->オリジナル) /