Commit f6d582db authored by Benny Siegert's avatar Benny Siegert Committed by Russ Cox

cmd/yacc: spring cleaning for units.y

* sort imports
* use runtime.GOROOT
* fix some typos

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5987054
parent 494fe3b0
......@@ -26,11 +26,13 @@
package main
import (
"bufio"
"flag"
"fmt"
"bufio"
"os"
"math"
"runtime"
"os"
"path/filepath"
"strconv"
"unicode/utf8"
)
......@@ -287,13 +289,11 @@ func main() {
flag.Parse()
if dir := os.Getenv("GOROOT"); dir != "" {
file = dir + "/src/cmd/yacc/units.txt"
}
file = filepath.Join(runtime.GOROOT(), "src/cmd/yacc/units.txt")
if flag.NArg() > 0 {
file = flag.Arg(0)
} else if file == "" {
fmt.Fprintf(os.Stderr, "can not find data file units.txt; provide it as argument or set $GOROOT\n")
fmt.Fprintf(os.Stderr, "cannot find data file units.txt; provide it as argument or set $GOROOT\n")
os.Exit(1)
}
......@@ -308,7 +308,7 @@ func main() {
/*
* read the 'units' file to
* develope a database
* develop a database
*/
lineno = 0
for {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment