$NetBSD: patch-aj,v 1.2 2004/09/08 14:30:00 markd Exp $

--- base/libmisc/utmp.c.orig	1998-12-10 14:43:22.000000000 +1300
+++ base/libmisc/utmp.c
@@ -37,6 +37,12 @@
 #include <utmpx.h>
 #endif
 
+#if HAVE_UTMPX_H && defined(__NetBSD__)
+#undef HAVE_SETUTENT
+#undef HAVE_GETUTENT
+#undef HAVE_ENDUTENT
+#endif
+
 #include <fcntl.h>
 #include <stdio.h>
 
@@ -93,6 +99,8 @@ checkutmp (picky)
 #endif
 #endif
 
+	ut = NULL;
+
 #if HAVE_UTMPX_H
 	setutxent ();
 #endif
@@ -141,17 +149,21 @@ checkutmp (picky)
 		if (utx)
 			utxent = *utx;
 #endif
+#if HAVE_GETUTENT
 		while ((ut = getutent()))
 			if (ut->ut_pid == pid)
 				break;
 
 		if (ut)
 			utent = *ut;
+#endif
 
 #if HAVE_UTMPX_H
 		endutxent();
 #endif
+#if HAVE_ENDUTENT
 		endutent();
+#endif
 
 		if (!ut) {
  			puts(NO_UTENT);
@@ -188,6 +200,7 @@ checkutmp (picky)
 		if (strncmp(line, "/dev/", 5) == 0)
 			line += 5;
 
+#if !defined(__NetBSD__)
  		strncpy (utent.ut_line, line, sizeof utent.ut_line);
 		if ((ut = getutline(&utent)))
  			strncpy(utent.ut_id, ut->ut_id, sizeof ut->ut_id);
@@ -206,6 +219,7 @@ checkutmp (picky)
 		gettimeofday((struct timeval *) &utxent.ut_tv, NULL);
 		utent.ut_time = utxent.ut_tv.tv_sec;
 #endif
+#endif /* !NetBSD */
 	}
 #else	/* !USG */
 
@@ -283,6 +297,7 @@ setutmp (name, line)
 			break;
 		}
 	}
+#if HAVE_GETUTENT
 	while (utmp = getutent ()) {
 		if (utmp->ut_pid == pid) {
 			found_utmp = 1;
@@ -357,6 +372,7 @@ setutmp (name, line)
 
 	utxent = utxline;
 	utent = utline;
+#endif
 	
 #else /* !SVR4 */
 	struct	utmp	utmp;
