| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| switch nr, er := f.Read(buf[:]); true { |
| fmt.Fprintf(os.Stderr, "cat: error reading from %s: %s\n", f.String(), er.String()) |
| if nw, ew := file.Stdout.Write(buf[0:nr]); nw != nr { |
| fmt.Fprintf(os.Stderr, "cat: error writing from %s: %s\n", f.String(), ew.String()) |
| flag.Parse() // Scans the arg list and sets up flags |
| for i := 0; i < flag.NArg(); i++ { |
| f, err := file.Open(flag.Arg(i), 0, 0) |
| fmt.Fprintf(os.Stderr, "cat: can't open %s: error %s\n", flag.Arg(i), err) |