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 @@ ...@@ -26,11 +26,13 @@
package main package main
import ( import (
"bufio"
"flag" "flag"
"fmt" "fmt"
"bufio"
"os"
"math" "math"
"runtime"
"os"
"path/filepath"
"strconv" "strconv"
"unicode/utf8" "unicode/utf8"
) )
...@@ -287,13 +289,11 @@ func main() { ...@@ -287,13 +289,11 @@ func main() {
flag.Parse() flag.Parse()
if dir := os.Getenv("GOROOT"); dir != "" { file = filepath.Join(runtime.GOROOT(), "src/cmd/yacc/units.txt")
file = dir + "/src/cmd/yacc/units.txt"
}
if flag.NArg() > 0 { if flag.NArg() > 0 {
file = flag.Arg(0) file = flag.Arg(0)
} else if file == "" { } 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) os.Exit(1)
} }
...@@ -308,7 +308,7 @@ func main() { ...@@ -308,7 +308,7 @@ func main() {
/* /*
* read the 'units' file to * read the 'units' file to
* develope a database * develop a database
*/ */
lineno = 0 lineno = 0
for { 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