$NetBSD: patch-aj,v 1.1 2002/08/19 09:17:16 agc Exp $

--- base/libmisc/utmp.c	2002/08/19 08:56:57	1.1
+++ base/libmisc/utmp.c	2002/08/19 09:02:40
@@ -93,6 +93,8 @@
 #endif
 #endif
 
+	ut = NULL;
+
 #if HAVE_UTMPX_H
 	setutxent ();
 #endif
@@ -141,17 +143,21 @@
 		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 +194,7 @@
 		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 +213,7 @@
 		gettimeofday((struct timeval *) &utxent.ut_tv, NULL);
 		utent.ut_time = utxent.ut_tv.tv_sec;
 #endif
+#endif /* !NetBSD */
 	}
 #else	/* !USG */
 
@@ -283,6 +291,7 @@
 			break;
 		}
 	}
+#if HAVE_GETUTENT
 	while (utmp = getutent ()) {
 		if (utmp->ut_pid == pid) {
 			found_utmp = 1;
@@ -357,6 +366,7 @@
 
 	utxent = utxline;
 	utent = utline;
+#endif
 	
 #else /* !SVR4 */
 	struct	utmp	utmp;
