$NetBSD: patch-aa,v 1.5 2011/11/26 17:19:13 marino Exp $

--- src/wterm.h.orig	Sun Mar  5 12:22:32 2000
+++ src/wterm.h	Thu Nov 21 17:13:53 2002
@@ -117,6 +117,9 @@
 #ifdef UTMP_SUPPORT
 # ifdef HAVE_UTMPX_H
 #  define __USE_GNU
+#  ifdef __NetBSD__
+#   include <utmp.h>
+#  endif
 #  include <utmpx.h>
 #  define USE_SYSV_UTMP
 # else
@@ -435,10 +438,14 @@
 #   ifdef _PATH_UTMP
 #    define UTMP_FILENAME		_PATH_UTMP
 #   else
-#    ifdef WTERM_UTMP_FILE
-#     define UTMP_FILENAME		WTERM_UTMP_FILE
+#    ifdef _PATH_UTMPX
+#     define UTMP_FILENAME		_PATH_UTMPX
 #    else
-#     error define UTMP_FILENAME in config.h
+#     ifdef WTERM_UTMP_FILE
+#      define UTMP_FILENAME		WTERM_UTMP_FILE
+#     else
+#      error define UTMP_FILENAME in config.h
+#     endif
 #    endif
 #   endif
 #  endif
@@ -458,6 +465,7 @@
 #  define getutid		getutxid
 #  define endutent		endutxent
 #  define pututline		pututxline
+#  define utmpname		utmpxname
 # else
 #  define UTMP			struct utmp
 # endif
@@ -466,7 +474,11 @@
 #ifdef WTMP_SUPPORT
 # ifdef HAVE_UTMPX_H		/* means we're on Solaris (or Irix?) */
 #  undef WTMP_FILENAME
-#  define WTMP_FILENAME		WTMPX_FILE
+#  if defined(__NetBSD__) || defined(__DragonFly__)
+#   define WTMP_FILENAME	_PATH_WTMPX
+#  else
+#   define WTMP_FILENAME	WTMPX_FILE
+#  endif
 #  define update_wtmp		updwtmpx
 # else
 #  define update_wtmp		wterm_update_wtmp
