func lsone(c *clnt.Clnt, s string, long bool) { st, oserr := c.FStat(normpath(s)) if oserr != nil { fmt.Fprintf(os.Stderr, "error stat: %v\n", oserr) return } if st.Mode&ninep.DMDIR != 0 { file, oserr := c.FOpen(s, ninep.OREAD) if oserr != nil { fmt.Fprintf(os.Stderr, "error opening dir: %s\n", oserr) return } defer file.Close() for { d, oserr := file.Readdir(0) if oserr != nil { fmt.Fprintf(os.Stderr, "error reading dir: %v\n", oserr) } if d == nil || len(d) == 0 { break } for _, dir := range d { if long { fmt.Fprintf(os.Stdout, "%s\n", dirtostr(dir)) } else { os.Stdout.WriteString(dir.Name + "\n") } } } } else { fmt.Fprintf(os.Stdout, "%s\n", dirtostr(st)) } }
// Stat the remote file f func statone(c *clnt.Clnt, f string) { fname := normpath(f) stat, oserr := c.FStat(fname) if oserr != nil { fmt.Fprintf(os.Stderr, "error in stat %s: %v\n", fname, oserr) return } fmt.Fprintf(os.Stdout, "%s\n", stat) }