The Go Programming Language

Text file src/lib9/goos.c

     1	// Copyright 2010 The Go Authors.  All rights reserved.
     2	// Use of this source code is governed by a BSD-style
     3	// license that can be found in the LICENSE file.
     4	
     5	#include <u.h>
     6	#include <libc.h>
     7	
     8	static char*
     9	defgetenv(char *name, char *def)
    10	{
    11		char *p;
    12		
    13		p = getenv(name);
    14		if(p == nil || p[0] == '\0')
    15			p = def;
    16		return p;
    17	}
    18	
    19	char*
    20	getgoos(void)
    21	{
    22		return defgetenv("GOOS", GOOS);
    23	}
    24	
    25	char*
    26	getgoarch(void)
    27	{
    28		return defgetenv("GOARCH", GOARCH);
    29	}
    30	
    31	char*
    32	getgoroot(void)
    33	{
    34		return defgetenv("GOROOT", GOROOT);
    35	}
    36	
    37	char*
    38	getgoversion(void)
    39	{
    40		return GOVERSION;
    41	}

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.