$NetBSD: patch-aa,v 1.2 1998/08/07 11:10:50 agc Exp $

--- build/os-type	1998/04/24 14:27:16	1.1
+++ build/os-type	1998/04/24 14:28:04
@@ -106,6 +106,7 @@
 				;;
 		"linux"*)	OS=linux;;
 		"freebsd"*)	OS="${osname}${osmajver}";;
+		"netbsd"*)	OS="netbsd131";;
 	  	# OpenBSD looks like freebsd2 right now
 		"openbsd"*)	OS="freebsd2";;
 		"dgux"*)	OS=dgux;;
--- include/defs.h	1998/04/24 14:28:52	1.1
+++ include/defs.h	1998/04/24 14:29:43
@@ -403,7 +403,11 @@
 extern void			error(char *, ...);
 extern void			fatalerr(char *, ...);
 extern void			message(int, char *, ...);
+#if	defined(NETBSD)
+extern void			setproctitle(const char *fmt, ...);
+#else
 extern void			setproctitle(char *fmt, ...);
+#endif /* NetBSD */
 #else
 extern void			debugmsg();
 extern void			error();
--- include/filesys.h	1998/04/24 14:30:29	1.1
+++ include/filesys.h	1998/04/24 14:30:47
@@ -111,7 +111,7 @@
 	typedef struct statvfs		statfs_t;
 #	define statfs(mp,sb)		statvfs(mp,sb)
 #else
-#if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
+#if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || defined(NETBSD) || STATFS_TYPE == STATFS_OSF1
 	typedef struct statfs		statfs_t;
 #else
 #	include <sys/vfs.h>
--- src/filesys-os.c	1998/04/24 14:35:12	1.1
+++ src/filesys-os.c	1998/04/24 14:38:58
@@ -51,7 +51,9 @@
 
 #if 	FSI_TYPE == FSI_GETFSSTAT
 static struct statfs   *mnt = NULL;
+#if	!defined(NETBSD)
 typedef u_long 		ulong;
+#endif	/* !NetBSD */
 #endif	/* FSI_GETFSSTAT */
 
 #if	FSI_TYPE == FSI_MNTCTL
@@ -179,6 +181,16 @@
 	if (mnt->f_flags & M_RDONLY)
 		mntstruct.me_flags |= MEFLAG_READONLY;
 #endif
+#if	defined(NETBSD)
+	if (strcmp(mnt->f_fstypename, MOUNT_NFS)) {
+		(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
+		mntstruct.me_path = remote_dev;
+		mntstruct.me_type = METYPE_NFS;
+	} else {
+		mntstruct.me_path = mnt->f_mntonname;
+		mntstruct.me_type = METYPE_OTHER;
+	}
+#else
 	switch ((ulong)((struct statfs*)mnt)->f_type) {
 	      case MOUNT_NFS:
 		(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
@@ -190,6 +202,7 @@
 		mntstruct.me_type = METYPE_OTHER;
 		break;
 	}
+#endif	/* !NetBSD */
 
 	mnt++;
 	entries_left--;
--- src/setargs.c	1998/04/24 14:40:02	1.1
+++ src/setargs.c	1998/04/24 14:41:06
@@ -130,7 +130,11 @@
 /*
  * Stdarg front-end to _setproctitle()
  */
+#if	defined(NETBSD)
+extern void setproctitle(const char *fmt, ...)
+#else
 extern void setproctitle(char *fmt, ...)
+#endif
 {
 	static char buf[BUFSIZ];
 	va_list args;
--- /dev/null	Fri Apr 24 09:44:17 1998
+++ config/mf.netbsd131	Fri Apr 24 15:43:50 1998
@@ -0,0 +1,56 @@
+#
+# Copyright (c) 1993 Michael A. Cooper
+# Copyright (c) 1993 Regents of the University of California.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#	This product includes software developed by the University of
+#	California, Berkeley and its contributors.
+# 4. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#
+
+#
+# NetBSD 1.3.1 Makefile
+#
+
+#
+# Functions that are missing in this OS are contained in the
+# files specified in ${MISSINGOBJS}.
+#
+#MISSINGOBJS 	= $(O)strerror.o $(O)strcasecmp.o
+
+#
+# System libraries that we need to load.
+#
+LIB_SYS	= -lcompat
+
+#
+# System dependent options for compiling
+#
+#CFLAGS_OS	=
+
+BIN_DIR = /usr/local/bin
--- /dev/null	Fri Apr 24 09:44:17 1998
+++ config/os-netbsd131.h	Fri Apr 24 15:55:44 1998
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1993 Michael A. Cooper
+ * Copyright (c) 1993 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Original Id: os-freebsd2.h,v 1.2 1996/02/15 18:53:48 mcooper Exp
+ */
+
+/*
+ * TEMPLATE os-*.h file
+ */
+
+/*
+ * Define the following name for use in #ifdef's.
+ * The value should be all upper-case with no periods (.).
+ */
+#if	!defined(NETBSD)
+#define NETBSD
+#endif
+
+/*
+ * NOTE: NetBSD uses 64-bit file size semantics, and so you
+ * must be careful when using varargs-type functions
+ * like the *printf family when printing elements which
+ * might be 64-bits (such as stat->st_size from stat.h).
+ */
+
+/*
+ * Set process args to messages that show up when running ps(1)
+ *
+ * Under some OS's, the SETARGS code will cause ": is not an identifier"
+ * errors for "special" commands.
+ */
+#define SETARGS
+
+/*
+ * Define the type of directory routines your system has.
+ */
+#define DIR_TYPE	DIR_DIRENT
+
+/*
+ * Determine what routines we have to get filesystem info.
+ */
+#define FSI_TYPE	FSI_GETFSSTAT
+
+/*
+ * Type of non-blocking I/O.
+ */
+#define NBIO_TYPE	NBIO_FCNTL
+
+/*
+ * Type of wait() function to use.
+ */
+#define WAIT_TYPE	WAIT_WAIT3
+
+/*
+ * Type of argument passed to wait() (above).
+ */
+#define WAIT_ARG_TYPE	int
+
+/*
+ * Select the type of executable file format.
+ */
+#define EXE_TYPE	EXE_AOUT
+
+/*
+ * Select the type of statfs() system call (if any).
+ */
+#define STATFS_TYPE	STATFS_BSD
+
+/*
+ * Type of arg functions we have.
+ */
+#define ARG_TYPE	ARG_STDARG
+
+/*
+ * UID argument type for chown()
+ */
+typedef uid_t CHOWN_UID_T;
+
+/*
+ * GID argument type for chown()
+ */
+typedef gid_t CHOWN_GID_T;
+
+/*
+ * Our types, usually these are uid_t and gid_t.
+ */
+typedef uid_t UID_T;	/* Must be signed */
+typedef gid_t GID_T;	/* Must be signed */
+
+/*
+ * Generic pointer, used by memcpy, malloc, etc.  Usually char or void.
+ */
+typedef void POINTER;
+
+/*
+ * Type of set file time function available
+ */
+#define SETFTIME_TYPE	SETFTIME_UTIMES
+
+/*
+ * Type of set line buffering function available
+ */
+#define SETBUF_TYPE	SETLINEBUF
+
+/*
+ * Things we have
+ */
+#define HAVE_FCHOWN			/* Have fchown() */
+#define HAVE_FCHMOD			/* Have fchmod() */
+#define HAVE_SELECT			/* Have select() */
+#define HAVE_SAVED_IDS			/* Have POSIX style saved [ug]id's */
+#define POSIX_SIGNALS			/* Have POSIX signals */
+
+/*
+ * Things we need
+ */
+#define NEED_UNISTD_H			/* Need <unistd.h> */
+
+/*
+ * Path to the remote shell command.
+ * Define this only if the pathname is different than
+ * that which appears in "include/paths.h".
+ */
+#define _PATH_REMSH	"/usr/bin/rsh"			/**/
--- src/message.c	1998/04/24 14:59:28	1.1
+++ src/message.c	1998/04/24 15:02:47
@@ -467,10 +467,21 @@
 		(void) sprintf(tempfile, "%s/%s", cp, _RDIST_TMP);
 
 		msgfac->mf_filename = tempfile;
+#if	defined(NETBSD)
+		{
+			int	fd;
+
+			if ((fd = mkstemp(msgfac->mf_filename)) < 0 ||
+			    (msgfac->mf_fptr = fdopen(fd, "w")) == NULL)
+				fatalerr("Cannot open notify file for writing: %s: %s.",
+				      msgfac->mf_filename, SYSERR);
+		}
+#else
 		(void) mktemp(msgfac->mf_filename);
 		if ((msgfac->mf_fptr = fopen(msgfac->mf_filename, "w"))==NULL)
 			fatalerr("Cannot open notify file for writing: %s: %s.",
 			      msgfac->mf_filename, SYSERR);
+#endif
 		debugmsg(DM_MISC, "Created notify temp file '%s'",
 			 msgfac->mf_filename);
 	}
--- mf/Makefile.var	1998/04/24 15:38:29	1.1
+++ mf/Makefile.var	1998/04/24 15:43:39
@@ -172,6 +172,7 @@
 	config/mf.mipsos4 \
 	config/mf.mipsos5 \
 	config/mf.ncr \
+	config/mf.netbsd131 \
 	config/mf.nextstep2 \
 	config/mf.nextstep3 \
 	config/mf.osf1 \
@@ -214,6 +215,7 @@
 	config/os-mipsos4.h \
 	config/os-mipsos5.h \
 	config/os-ncr.h \
+	config/os-netbsd131.h \
 	config/os-nextstep2.h \
 	config/os-nextstep3.h \
 	config/os-osf1.h \
--- Makefile.local	1998/04/24 15:38:29	1.1
+++ Makefile.local	1998/04/24 15:43:39
@@ -8,7 +8,9 @@
 # BIN_DIR variable, you would uncomment the following line
 # or add your own line.
 #
-#BIN_DIR	= /usr/bin
+BIN_DIR=	${PREFIX}/bin
+
+CLIENT=		${RDIST6_NAME}
 
 #
 # Add any local definitions you want pass to the compiler to DEFS_LOCAL
@@ -28,6 +30,7 @@
 #
 #OPT		= -O
 #OPT		=
+OPT= -O
 
 #
 # You may want to use your own C Compiler (such as GCC) by enabling
@@ -45,8 +48,8 @@
 #
 # Site specific Man Page configuration.
 #
-#MAN_1_DIR	= /usr/local/man/man1
-#MAN_8_DIR	= /usr/local/man/man8
+MAN_1_DIR	= ${PREFIX}/man/man1
+MAN_8_DIR	= ${PREFIX}/man/man8
 #MAN_OWNER	= bin
 #MAN_GROUP	= bin
 #MAN_MODE	= 644
