]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-toss/main.go
Remove huge usage headers, -warranty exists anyway
[nncp.git] / src / cmd / nncp-toss / main.go
index 76bb7653b2e97f177e0313d1005b33b8f3ef9d84..dad1d3ee979120fc6a21c64bec94a7237b02f912 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -30,8 +30,7 @@ import (
 )
 
 func usage() {
-       fmt.Fprintf(os.Stderr, nncp.UsageHeader())
-       fmt.Fprintf(os.Stderr, "nncp-toss -- process inbound packets\n\n")
+       fmt.Fprint(os.Stderr, "nncp-toss -- process inbound packets\n\n")
        fmt.Fprintf(os.Stderr, "Usage: %s [options]\nOptions:\n", os.Args[0])
        flag.PrintDefaults()
 }
@@ -110,15 +109,30 @@ func main() {
                        isBad = ctx.Toss(
                                node.Id,
                                nncp.TRx,
-                               nice,
-                               *dryRun, *doSeen, *noFile, *noFreq, *noExec, *noTrns, *noArea, *noACK,
+                               &nncp.TossOpts{
+                                       Nice:   nice,
+                                       DoSeen: *doSeen,
+                                       NoFile: *noFile,
+                                       NoFreq: *noFreq,
+                                       NoExec: *noExec,
+                                       NoTrns: *noTrns,
+                                       NoArea: *noArea,
+                                       NoACK:  *noACK,
+                               },
                        ) || isBad
                        if nodeId == *ctx.SelfId {
                                isBad = ctx.Toss(
                                        node.Id,
                                        nncp.TTx,
-                                       nice,
-                                       *dryRun, false, true, true, true, true, *noArea, *noACK,
+                                       &nncp.TossOpts{
+                                               Nice:   nice,
+                                               NoFile: true,
+                                               NoFreq: true,
+                                               NoExec: true,
+                                               NoTrns: true,
+                                               NoArea: *noArea,
+                                               NoACK:  *noACK,
+                                       },
                                ) || isBad
                        }
                }
@@ -150,15 +164,31 @@ func main() {
                ctx.Toss(
                        nodeId,
                        nncp.TRx,
-                       nice,
-                       *dryRun, *doSeen, *noFile, *noFreq, *noExec, *noTrns, *noArea, *noACK,
+                       &nncp.TossOpts{
+                               Nice:   nice,
+                               DryRun: *dryRun,
+                               DoSeen: *doSeen,
+                               NoFile: *noFile,
+                               NoFreq: *noFreq,
+                               NoExec: *noExec,
+                               NoTrns: *noTrns,
+                               NoArea: *noArea,
+                               NoACK:  *noACK,
+                       },
                )
                if *nodeId == *ctx.SelfId {
                        ctx.Toss(
                                nodeId,
                                nncp.TTx,
-                               nice,
-                               *dryRun, false, true, true, true, true, *noArea, *noACK,
+                               &nncp.TossOpts{
+                                       Nice:   nice,
+                                       NoFile: true,
+                                       NoFreq: true,
+                                       NoExec: true,
+                                       NoTrns: true,
+                                       NoArea: *noArea,
+                                       NoACK:  *noACK,
+                               },
                        )
                }
        }