$NetBSD$

--- mtfread.c.orig	2000-09-13 11:14:33.000000000 -0400
+++ mtfread.c
@@ -42,7 +42,13 @@ See mtf.c for version history, contribut
 #include <limits.h>
 #include <sys/stat.h>
 #include <sys/fcntl.h>
+#if defined(__FreeBSD__)
+#include <sys/mount.h>
+#elif defined(__NetBSD__)
+#include <sys/statvfs.h>
+#else
 #include <sys/vfs.h>
+#endif
 #include <utime.h>
 #include <unistd.h>
 #include <time.h>
@@ -363,7 +369,7 @@ INT32 readTapeBlock(void)
 	{
 		stream = (MTF_STREAM_HDR*) ((char*) tape + dbHdr->off);
 		result = skipToNextBlock();
-		if (result != 1)
+		if (result != 0) /* skipToNextBlock returns 0 upon success -1 otherwise */
 		{
 			fprintf(stderr, "Error traversing to end of descriptor block!\n");
 			return(-1);
@@ -671,11 +677,16 @@ INT32 readFileBlock(void)
 	INT32 result;
 	char *ptr, *ptr2, filePath[MAXPATHLEN + 1], fullPath[MAXPATHLEN + 1];
 	char tmpPath[MAXPATHLEN + 1];
-	int i, output;
+	int i;
+	int output=-1; /* Initialized to avoid gcc warning */
 	struct tm tbuf;
 	struct utimbuf utbuf;
 	UINT32 threshold;
+#if defined(__NetBSD__)
+	struct statvfs fsbuf;
+#else
 	struct statfs fsbuf;
+#endif
 	struct stat sbuf;
 
 	if (verbose > 1)
@@ -864,7 +875,11 @@ INT32 readFileBlock(void)
 			ptr = strrchr(filePath, '/');
 			*ptr = '\0';
 
+#if defined(__NetBSD__)
+			if (statvfs(filePath, &fsbuf) != 0)
+#else
 			if (statfs(filePath, &fsbuf) != 0)
+#endif
 			{
 				if (debug > 0) printf("filePath=%s\n", filePath);
 				fprintf(stderr, "Error testing for free space!\n");
@@ -883,7 +898,11 @@ INT32 readFileBlock(void)
 						fsbuf.f_bavail * fsbuf.f_bsize);
 				sleep(60);
 
+#if defined(__NetBSD__)
+				if (statvfs(filePath, &fsbuf) != 0)
+#else
 				if (statfs(filePath, &fsbuf) != 0)
+#endif
 				{
 					fprintf(stderr, "Error testing for free space!\n");
 					return(-1);
