]> Cypherpunks.ru repositories - nncp.git/commitdiff
nncp-freq DST argument is optional
authorSergey Matveev <stargrave@stargrave.org>
Tue, 4 Jul 2017 08:06:01 +0000 (11:06 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 4 Jul 2017 08:06:04 +0000 (11:06 +0300)
VERSION
doc/cmds.texi
doc/news.ru.texi
doc/news.texi
ports/nncp/Makefile
src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go

diff --git a/VERSION b/VERSION
index b63ba696b7a7e4d89fa1517b02bfdccb2f1a10e1..68c123cf10e0a36b6036c9fbc30275960d19e749 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.9
+0.10
index 039fc2d1a079383f45339a777e46a113a7a42661..38f77eefd0830fe7be3eff7228106304ae5124fa 100644 (file)
@@ -219,12 +219,13 @@ file receiving.
 @section nncp-freq
 
 @verbatim
-% nncp-freq [options] NODE:SRC DST
+% nncp-freq [options] NODE:SRC [DST]
 @end verbatim
 
 Send file request to @option{NODE}, asking it to send its @file{SRC}
 file from @ref{CfgFreq, freq} directory to our node under @file{DST}
-filename in our @ref{CfgIncoming, incoming} one.
+filename in our @ref{CfgIncoming, incoming} one. If @file{DST} is not
+specified, then last element of @file{SRC} will be used.
 
 If @ref{CfgNotify, notification} is enabled on the remote side for
 file request, then it will sent simple letter after successful file
index 668c4fef6c59f7fb30cd7cd5ef71d1a36c16746d..0b061c90b4a8cabd3248ac35b5f8c20b13779b39 100644 (file)
@@ -1,6 +1,14 @@
 @node Новости
 @section Новости
 
+@node Релиз 0.10
+@subsection Релиз 0.10
+@itemize
+@item
+@file{DST} аргумент @command{nncp-freq} команды теперь опционален.
+По-умолчанию будет подставлен последний элемент @file{SRC} пути.
+@end itemize
+
 @node Релиз 0.9
 @subsection Релиз 0.9
 @itemize
index 3d55767e0f2550d8c8dc387283cc6a55c17ff67e..1853f21e298ad4f05deb0fd8a7cff6e5a7a44fd4 100644 (file)
@@ -3,6 +3,14 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 0.10
+@section Release 0.10
+@itemize
+@item
+@command{nncp-freq}'s @file{DST} argument is optional now. Last
+@file{SRC} path's element will be used by default.
+@end itemize
+
 @node Release 0.9
 @section Release 0.9
 @itemize
index 00e5818cb23fee2933856cd6fdcb076853e5c8d9..49a463a95358841ae817e164be4777b16a57c723 100644 (file)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTNAME=      nncp
-PORTVERSION=   0.9
+PORTVERSION=   0.10
 CATEGORIES=    net
 MASTER_SITES=  http://www.nncpgo.org/download/ \
                http://sourceforge.net/projects/nncp/files/
index 8318191009af9b45f265307a52d61ba34850c657..da5268fbda69d63ac8f803ece6e73364d7802014 100644 (file)
@@ -25,6 +25,7 @@ import (
        "io/ioutil"
        "log"
        "os"
+       "path/filepath"
        "strings"
 
        "cypherpunks.ru/nncp"
@@ -33,7 +34,7 @@ import (
 func usage() {
        fmt.Fprintf(os.Stderr, nncp.UsageHeader())
        fmt.Fprintln(os.Stderr, "nncp-freq -- send file request\n")
-       fmt.Fprintf(os.Stderr, "Usage: %s [options] NODE:SRC DST\nOptions:\n", os.Args[0])
+       fmt.Fprintf(os.Stderr, "Usage: %s [options] NODE:SRC [DST]\nOptions:\n", os.Args[0])
        flag.PrintDefaults()
 }
 
@@ -57,7 +58,7 @@ func main() {
                fmt.Println(nncp.VersionGet())
                return
        }
-       if flag.NArg() != 2 {
+       if flag.NArg() == 0 {
                usage()
                os.Exit(1)
        }
@@ -90,11 +91,18 @@ func main() {
                log.Fatalln("Invalid NODE specified:", err)
        }
 
+       var dst string
+       if flag.NArg() == 2 {
+               dst = flag.Arg(1)
+       } else {
+               dst = filepath.Base(splitted[1])
+       }
+
        if err = ctx.TxFreq(
                node,
                nice,
                splitted[1],
-               flag.Arg(1),
+               dst,
                int64(*minSize)*1024,
        ); err != nil {
                log.Fatalln(err)