summaryrefslogtreecommitdiff
path: root/src/lib9/goos.c
blob: 3b00271117bc7666fffb0208d6925f7ced923349 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2010 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include <u.h>
#include <libc.h>

static char*
defgetenv(char *name, char *def)
{
	char *p;
	
	p = getenv(name);
	if(p == nil || p[0] == '\0')
		p = def;
	return p;
}

char*
getgoos(void)
{
	return defgetenv("GOOS", GOOS);
}

char*
getgoarch(void)
{
	return defgetenv("GOARCH", GOARCH);
}

char*
getgoroot(void)
{
	return defgetenv("GOROOT", GOROOT);
}

char*
getgoversion(void)
{
	return GOVERSION;
}

char*
getgoarm(void)
{
	return defgetenv("GOARM", GOARM);
}

char*
getgo386(void)
{
	return defgetenv("GO386", GO386);
}