aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbutl/fdstream.cxx2
-rw-r--r--libbutl/process.cxx2
-rw-r--r--libbutl/sha1.c2
-rw-r--r--libbutl/sha256c.c2
-rw-r--r--libbutl/target-triplet.cxx12
5 files changed, 15 insertions, 5 deletions
diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx
index 54f3e9e..e108df5 100644
--- a/libbutl/fdstream.cxx
+++ b/libbutl/fdstream.cxx
@@ -1047,7 +1047,7 @@ namespace butl
// which will cause all kinds of problems upstream (e.g., cpfile()). So we
// detect and diagnose this.
//
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
{
struct stat s;
if (stat (f, &s) == 0 && S_ISDIR (s.st_mode))
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 142d159..2dc3809 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -43,6 +43,8 @@
//
# elif defined(__FreeBSD__) && __FreeBSD__ >= 8
# define LIBBUTL_POSIX_SPAWN
+# elif defined(__NetBSD__)
+# define LIBBUTL_POSIX_SPAWN
//
// posix_spawn() appeared in Version 3 of the Single UNIX Specification that
// was implemented in MacOS 10.5 (see the man page for details).
diff --git a/libbutl/sha1.c b/libbutl/sha1.c
index 5326208..37e862e 100644
--- a/libbutl/sha1.c
+++ b/libbutl/sha1.c
@@ -96,7 +96,7 @@ main ()
#endif /* SHA1_TEST_DRIVER */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/endian.h> /* BYTE_ORDER */
#else
# if defined(_WIN32)
diff --git a/libbutl/sha256c.c b/libbutl/sha256c.c
index 2db0363..c98dd10 100644
--- a/libbutl/sha256c.c
+++ b/libbutl/sha256c.c
@@ -68,7 +68,7 @@ main ()
#endif /* SHA256_TEST_DRIVER */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/endian.h> /* BYTE_ORDER, be32dec(), be32enc(), be64enc */
#else
# if defined(_WIN32)
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx
index 822461b..8eb6de6 100644
--- a/libbutl/target-triplet.cxx
+++ b/libbutl/target-triplet.cxx
@@ -60,8 +60,9 @@ namespace butl
//
string::size_type p (s.find ('-', ++f)), n (p - f);
- if (n == 0)
- bad ("empty vendor");
+ if (n == 0) {
+ goto netbsd_empty_vendor;
+ }
// Do we have all four components? If so, then we don't need to do any
// special recognition of two-component systems.
@@ -102,6 +103,8 @@ namespace butl
}
}
+netbsd_empty_vendor:
+
// (l, npos) is SYSTEM
//
system.assign (s, ++l, string::npos);
@@ -109,6 +112,11 @@ namespace butl
if (system.empty ())
bad ("missing os/kernel/abi");
+ if (system.compare(0, 6, "netbsd") == 0)
+ vendor.assign("unknown");
+ else
+ bad("empty vendor");
+
if (system.front () == '-' || system.back () == '-')
bad ("invalid os/kernel/abi");