github.com/andrewsun2898/u-root@v6.0.1-0.20200616011413-4b2895c1b815+incompatible/cmds/core/printenv/printenv.go (about)

     1  // Copyright 2014-2017 the u-root 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  // Print environment variables.
     6  //
     7  // Synopsis:
     8  //     printenv
     9  package main
    10  
    11  import (
    12  	"fmt"
    13  	"io"
    14  	"os"
    15  )
    16  
    17  func printenv(w io.Writer) {
    18  	e := os.Environ()
    19  
    20  	for _, v := range e {
    21  		fmt.Fprintf(w, "%v\n", v)
    22  	}
    23  }
    24  
    25  func main() {
    26  	printenv(os.Stdout)
    27  }