mirror of
https://github.com/golang/go
synced 2024-11-22 14:24:45 -07:00
b4fb00b69b
R=rsc CC=golang-dev https://golang.org/cl/204044
42 lines
563 B
C
42 lines
563 B
C
// 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;
|
|
}
|