diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/flag/flag.go | 24 | ||||
-rw-r--r-- | src/lib/http/triv.go | 2 | ||||
-rw-r--r-- | src/lib/log/log.go | 9 | ||||
-rw-r--r-- | src/lib/os/Makefile | 5 | ||||
-rw-r--r-- | src/lib/os/env.go | 2 | ||||
-rw-r--r-- | src/lib/os/file.go | 2 | ||||
-rw-r--r-- | src/lib/regexp/regexp.go | 3 | ||||
-rw-r--r-- | src/lib/template/template.go | 5 | ||||
-rw-r--r-- | src/lib/testing/testing.go | 6 |
9 files changed, 32 insertions, 26 deletions
diff --git a/src/lib/flag/flag.go b/src/lib/flag/flag.go index e66238f6d..63d649a9b 100644 --- a/src/lib/flag/flag.go +++ b/src/lib/flag/flag.go @@ -261,15 +261,15 @@ func PrintDefaults() { } // Usage prints to standard error a default usage message documenting all defined flags and -// then calls sys.Exit(1). +// then calls os.Exit(1). func Usage() { - if len(sys.Args) > 0 { - fmt.Fprintln(os.Stderr, "Usage of", sys.Args[0] + ":"); + if len(os.Args) > 0 { + fmt.Fprintln(os.Stderr, "Usage of", os.Args[0] + ":"); } else { fmt.Fprintln(os.Stderr, "Usage:"); } PrintDefaults(); - sys.Exit(1); + os.Exit(1); } func NFlag() int { @@ -280,20 +280,20 @@ func NFlag() int { // after flags have been processed. func Arg(i int) string { i += flags.first_arg; - if i < 0 || i >= len(sys.Args) { + if i < 0 || i >= len(os.Args) { return ""; } - return sys.Args[i] + return os.Args[i] } // NArg is the number of arguments remaining after flags have been processed. func NArg() int { - return len(sys.Args) - flags.first_arg + return len(os.Args) - flags.first_arg } // Args returns the non-flag command-line arguments. func Args() []string { - return sys.Args[flags.first_arg:len(sys.Args)]; + return os.Args[flags.first_arg:len(os.Args)]; } func add(name string, value FlagValue, usage string) { @@ -393,7 +393,7 @@ func String(name, value string, usage string) *string { func (f *allFlags) parseOne(index int) (ok bool, next int) { - s := sys.Args[index]; + s := os.Args[index]; f.first_arg = index; // until proven otherwise if len(s) == 0 { return false, -1 @@ -450,11 +450,11 @@ func (f *allFlags) parseOne(index int) (ok bool, next int) } } else { // It must have a value, which might be the next argument. - if !has_value && index < len(sys.Args)-1 { + if !has_value && index < len(os.Args)-1 { // value is the next arg has_value = true; index++; - value = sys.Args[index]; + value = os.Args[index]; } if !has_value { print("flag needs an argument: -", name, "\n"); @@ -473,7 +473,7 @@ func (f *allFlags) parseOne(index int) (ok bool, next int) // Parse parses the command-line flags. Must be called after all flags are defined // and before any are accessed by the program. func Parse() { - for i := 1; i < len(sys.Args); { + for i := 1; i < len(os.Args); { ok, next := flags.parseOne(i); if next > 0 { flags.first_arg = next; diff --git a/src/lib/http/triv.go b/src/lib/http/triv.go index d2e074d73..f8b59ebea 100644 --- a/src/lib/http/triv.go +++ b/src/lib/http/triv.go @@ -74,7 +74,7 @@ func FlagServer(c *http.Conn, req *http.Request) { // simple argument server func ArgServer(c *http.Conn, req *http.Request) { - for i, s := range sys.Args { + for i, s := range os.Args { fmt.Fprint(c, s, " "); } } diff --git a/src/lib/log/log.go b/src/lib/log/log.go index 4a679a839..f5e4dd4a9 100644 --- a/src/lib/log/log.go +++ b/src/lib/log/log.go @@ -14,6 +14,7 @@ package log import ( "fmt"; "io"; + "runtime"; "os"; "time"; ) @@ -96,7 +97,7 @@ func (l *Logger) formatHeader(ns int64, calldepth int) string { } } if l.flag & (Lshortfile | Llongfile) != 0 { - pc, file, line, ok := sys.Caller(calldepth); + pc, file, line, ok := runtime.Caller(calldepth); if ok { if l.flag & Lshortfile != 0 { short, ok := shortnames[file]; @@ -139,7 +140,7 @@ func (l *Logger) Output(calldepth int, s string) { case Lcrash: panic("log: fatal error"); case Lexit: - sys.Exit(1); + os.Exit(1); } } @@ -173,12 +174,12 @@ func Stderrf(format string, v ...) { stderr.Output(2, fmt.Sprintf(format, v)) } -// Exit is equivalent to Stderr() followed by a call to sys.Exit(1). +// Exit is equivalent to Stderr() followed by a call to os.Exit(1). func Exit(v ...) { exit.Output(2, fmt.Sprintln(v)) } -// Exitf is equivalent to Stderrf() followed by a call to sys.Exit(1). +// Exitf is equivalent to Stderrf() followed by a call to os.Exit(1). func Exitf(format string, v ...) { exit.Output(2, fmt.Sprintf(format, v)) } diff --git a/src/lib/os/Makefile b/src/lib/os/Makefile index b563da3f3..e7b49e5b9 100644 --- a/src/lib/os/Makefile +++ b/src/lib/os/Makefile @@ -3,7 +3,7 @@ # license that can be found in the LICENSE file. # DO NOT EDIT. Automatically generated by gobuild. -# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile +# gobuild -m dir_${GOARCH}_${GOOS}.go env.go error.go file.go proc.go stat_${GOARCH}_${GOOS}.go time.go types.go exec.go >Makefile D= @@ -41,6 +41,7 @@ coverage: packages O1=\ error.$O\ + proc.$O\ types.$O\ O2=\ @@ -60,7 +61,7 @@ phases: a1 a2 a3 a4 _obj$D/os.a: phases a1: $(O1) - $(AR) grc _obj$D/os.a error.$O types.$O + $(AR) grc _obj$D/os.a error.$O proc.$O types.$O rm -f $(O1) a2: $(O2) diff --git a/src/lib/os/env.go b/src/lib/os/env.go index e7df309e0..748750413 100644 --- a/src/lib/os/env.go +++ b/src/lib/os/env.go @@ -19,7 +19,7 @@ var env map[string] string; func copyenv() { env = make(map[string] string); - for i, s := range sys.Envs { + for i, s := range os.Envs { for j := 0; j < len(s); j++ { if s[j] == '=' { env[s[0:j]] = s[j+1:len(s)]; diff --git a/src/lib/os/file.go b/src/lib/os/file.go index fa1784a42..9b22a896d 100644 --- a/src/lib/os/file.go +++ b/src/lib/os/file.go @@ -132,7 +132,7 @@ func (file *File) Write(b []byte) (ret int, err Error) { if e == syscall.EPIPE { file.nepipe++; if file.nepipe >= 10 { - sys.Exit(syscall.EPIPE); + os.Exit(syscall.EPIPE); } } else { file.nepipe = 0; diff --git a/src/lib/regexp/regexp.go b/src/lib/regexp/regexp.go index 135dcc368..8cbd38035 100644 --- a/src/lib/regexp/regexp.go +++ b/src/lib/regexp/regexp.go @@ -25,6 +25,7 @@ package regexp import ( "container/vector"; "os"; + "runtime"; "utf8"; ) @@ -236,7 +237,7 @@ func (nop *_Nop) print() { print("nop") } func (re *Regexp) setError(err os.Error) { re.error = err; re.ch <- re; - sys.Goexit(); + runtime.Goexit(); } func (re *Regexp) add(i instr) instr { diff --git a/src/lib/template/template.go b/src/lib/template/template.go index b886b3181..182a85b42 100644 --- a/src/lib/template/template.go +++ b/src/lib/template/template.go @@ -44,7 +44,7 @@ first looked for in the cursor, as in .section and .repeated. If it is not found, the search continues in outer sections until the top level is reached. - + If a formatter is specified, it must be named in the formatter map passed to the template set up routines or in the default set ("html","str","") and is used to process the data for @@ -61,6 +61,7 @@ import ( "io"; "os"; "reflect"; + "runtime"; "strings"; "template"; "container/vector"; @@ -181,7 +182,7 @@ func New(fmap FormatterMap) *Template { // Generic error handler, called only from execError or parseError. func error(errors chan os.Error, line int, err string, args ...) { errors <- ParseError{fmt.Sprintf("line %d: %s", line, fmt.Sprintf(err, args))}; - sys.Goexit(); + runtime.Goexit(); } // Report error and stop executing. The line number must be provided explicitly. diff --git a/src/lib/testing/testing.go b/src/lib/testing/testing.go index 2f717d0e9..63e4af5e9 100644 --- a/src/lib/testing/testing.go +++ b/src/lib/testing/testing.go @@ -14,6 +14,8 @@ package testing import ( "flag"; "fmt"; + "os"; + "runtime"; ) // Report as tests are run; default is silent for success. @@ -47,7 +49,7 @@ func (t *T) Fail() { func (t *T) FailNow() { t.Fail(); t.ch <- t; - sys.Goexit(); + runtime.Goexit(); } // Log formats its arguments using default formatting, analogous to Print(), @@ -129,7 +131,7 @@ func Main(tests []Test) { } if !ok { println("FAIL"); - sys.Exit(1); + os.Exit(1); } println("PASS"); } |