From e8f24338e5a7929ac33172b3318312168868d7af Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 4 Jul 2017 11:06:01 +0300 Subject: [PATCH] nncp-freq DST argument is optional --- VERSION | 2 +- doc/cmds.texi | 5 +++-- doc/news.ru.texi | 8 ++++++++ doc/news.texi | 8 ++++++++ ports/nncp/Makefile | 2 +- src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go | 14 +++++++++++--- 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index b63ba69..68c123c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9 +0.10 diff --git a/doc/cmds.texi b/doc/cmds.texi index 039fc2d..38f77ee 100644 --- a/doc/cmds.texi +++ b/doc/cmds.texi @@ -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 diff --git a/doc/news.ru.texi b/doc/news.ru.texi index 668c4fe..0b061c9 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -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 diff --git a/doc/news.texi b/doc/news.texi index 3d55767..1853f21 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -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 diff --git a/ports/nncp/Makefile b/ports/nncp/Makefile index 00e5818..49a463a 100644 --- a/ports/nncp/Makefile +++ b/ports/nncp/Makefile @@ -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/ diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go index 8318191..da5268f 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go @@ -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) -- 2.44.0