]> Cypherpunks.ru repositories - nncp.git/commitdiff
NetBSD compatible IsEnoughSpace()
authorSergey Matveev <stargrave@stargrave.org>
Thu, 5 Aug 2021 12:42:05 +0000 (15:42 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 5 Aug 2021 13:35:14 +0000 (16:35 +0300)
doc/news.ru.texi
doc/news.texi
src/ctx.go
src/df.go [new file with mode: 0644]
src/df_netbsd.go [new file with mode: 0644]
src/nncp.go

index ca867b18c967b8f96c919d531621f2af03739e3a..8218c805bf1f6678d857c47cca430e85e8de74d1 100644 (file)
@@ -1,6 +1,15 @@
 @node Новости
 @section Новости
 
+@node Релиз 7.5.1
+@subsection Релиз 7.5.1
+@itemize
+
+@item
+NNCP собирается на NetBSD.
+
+@end itemize
+
 @node Релиз 7.5.0
 @subsection Релиз 7.5.0
 @itemize
index a17cdad5fb66e29ffd54c20849b9b39c019277f3..85c7acdc1ed3bc13f09e30633da85f33b1071cde 100644 (file)
@@ -3,6 +3,15 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 7_5_1
+@section Release 7.5.1
+@itemize
+
+@item
+NNCP builds on NetBSD.
+
+@end itemize
+
 @node Release 7_5_0
 @section Release 7.5.0
 @itemize
index 4d762d290cadfb83fde02a36e5bd74b8850a50d2..7e4d726751f149963fb189dfa5df46bc03727581 100644 (file)
@@ -21,13 +21,10 @@ import (
        "errors"
        "fmt"
        "io/ioutil"
-       "log"
        "os"
        "path/filepath"
 
        "syscall"
-
-       "golang.org/x/sys/unix"
 )
 
 type Ctx struct {
@@ -149,14 +146,6 @@ func CtxFromCmdline(
        return ctx, nil
 }
 
-func (ctx *Ctx) IsEnoughSpace(want int64) bool {
-       var s unix.Statfs_t
-       if err := unix.Statfs(ctx.Spool, &s); err != nil {
-               log.Fatalln("Can not stat spool:", err)
-       }
-       return int64(s.Bavail)*int64(s.Bsize) > want
-}
-
 func (ctx *Ctx) Umask() {
        if ctx.UmaskForce != nil {
                syscall.Umask(*ctx.UmaskForce)
diff --git a/src/df.go b/src/df.go
new file mode 100644 (file)
index 0000000..bfcac56
--- /dev/null
+++ b/src/df.go
@@ -0,0 +1,20 @@
+// +build !netbsd
+
+// NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+// Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+
+package nncp
+
+import (
+       "log"
+
+       "golang.org/x/sys/unix"
+)
+
+func (ctx *Ctx) IsEnoughSpace(want int64) bool {
+       var s unix.Statfs_t
+       if err := unix.Statfs(ctx.Spool, &s); err != nil {
+               log.Fatalln("Can not stat spool:", err)
+       }
+       return int64(s.Bavail)*int64(s.Bsize) > want
+}
diff --git a/src/df_netbsd.go b/src/df_netbsd.go
new file mode 100644 (file)
index 0000000..b3fb82d
--- /dev/null
@@ -0,0 +1,20 @@
+// +build netbsd
+
+// NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+// Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+
+package nncp
+
+import (
+       "log"
+
+       "golang.org/x/sys/unix"
+)
+
+func (ctx *Ctx) IsEnoughSpace(want int64) bool {
+       var s unix.Statvfs_t
+       if err := unix.Statvfs(ctx.Spool, &s); err != nil {
+               log.Fatalln("Can not stat spool:", err)
+       }
+       return int64(s.Bavail)*int64(s.Frsize) > want
+}
index 2ee727fb3401eeff6aa67d74557b114e77d71136..8e04f041316b694be2d9e7eebfe53cb67946d4b2 100644 (file)
@@ -40,7 +40,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 const Base32Encoded32Len = 52
 
 var (
-       Version string = "7.5.0"
+       Version string = "7.5.1"
 
        Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
 )