]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-xfer/main.go
Merge branch 'develop'
[nncp.git] / src / cmd / nncp-xfer / main.go
index 8685b1c1c5324633c292e2cbe53b08d21e52f03b..7790ba378a93cfcb5266b72fc3d8f8ddb4189aad 100644 (file)
@@ -34,7 +34,6 @@ import (
 )
 
 func usage() {
-       fmt.Fprint(os.Stderr, nncp.UsageHeader())
        fmt.Fprint(os.Stderr, "nncp-xfer -- copy inbound and outbounds packets\n\n")
        fmt.Fprintf(os.Stderr, "Usage: %s [options] DIR\nOptions:\n", os.Args[0])
        flag.PrintDefaults()
@@ -106,7 +105,7 @@ func main() {
        selfPath := filepath.Join(flag.Arg(0), ctx.SelfId.String())
        isBad := false
        var dir *os.File
-       var fis []os.FileInfo
+       var entries []os.DirEntry
        var les nncp.LEs
        var logMsg func(les nncp.LEs) string
        if *txOnly {
@@ -141,7 +140,7 @@ func main() {
                isBad = true
                goto Tx
        }
-       fis, err = dir.Readdir(0)
+       entries, err = dir.ReadDir(0)
        dir.Close()
        if err != nil {
                ctx.LogE("xfer-self-read", les, err, func(les nncp.LEs) string {
@@ -150,12 +149,12 @@ func main() {
                isBad = true
                goto Tx
        }
-       for _, fi := range fis {
-               if !fi.IsDir() {
+       for _, entry := range entries {
+               if !entry.IsDir() {
                        continue
                }
-               nodeId, err := nncp.NodeIdFromString(fi.Name())
-               les := append(les, nncp.LE{K: "Node", V: fi.Name()})
+               nodeId, err := nncp.NodeIdFromString(entry.Name())
+               les := append(les, nncp.LE{K: "Node", V: entry.Name()})
                logMsg := func(les nncp.LEs) string {
                        return "Packet transfer, received from " + ctx.NodeName(nodeId)
                }
@@ -177,7 +176,7 @@ func main() {
                        })
                        continue
                }
-               dir, err = os.Open(filepath.Join(selfPath, fi.Name()))
+               dir, err = os.Open(filepath.Join(selfPath, entry.Name()))
                if err != nil {
                        ctx.LogE("xfer-rx-open", les, err, func(les nncp.LEs) string {
                                return logMsg(les) + ": opening"
@@ -195,7 +194,7 @@ func main() {
                        continue
                }
                for _, fiInt := range fisInt {
-                       if !fi.IsDir() {
+                       if fiInt.IsDir() {
                                continue
                        }
                        // Check that it is valid Base32 encoding