aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/getenv.c
blob: 2a2d1391338543560e7cb5209cfa0016dc0c26b2 (plain)
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
#include <u.h>
#define NOPLAN9DEFINES
#include <libc.h>

char*
p9getenv(char *s)
{
	char *t;

	t = getenv(s);
	if(t == 0)
		return 0;
	return strdup(t);
}

int
p9putenv(char *s, char *v)
{
	char *t;

	t = smprint("%s=%s", s, v);
	if(t == nil)
		return -1;
	putenv(t);
	free(t);
	return 0;
}