+Fri Nov 8 17:45:42 1996 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * update_utmp.c (pty_update_utmp): Add code which attempts to
+ compensate for systems that don't have getutmpx()
+
+ * configure.in: Check for getutmpx(). Replace calls to
+ AC_FUNC_CHECK with AC_HAVE_FUNCS().
Thu Jun 13 22:14:24 1996 Tom Yu <tlyu@voltage-multiplier.mit.edu>
dnl
AC_TYPE_MODE_T
AC_FUNC_CHECK(strsave,AC_DEFINE(HAS_STRSAVE))
-AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT))
-AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
-AC_FUNC_CHECK(gettosbyname,AC_DEFINE(HAVE_GETTOSBYNAME))
-AC_FUNC_CHECK(setsid,AC_DEFINE(HAVE_SETSID))
-AC_FUNC_CHECK(ttyname,AC_DEFINE(HAVE_TTYNAME))
-AC_FUNC_CHECK(line_push,AC_DEFINE(HAVE_LINE_PUSH))
-AC_FUNC_CHECK(ptsname,AC_DEFINE(HAVE_PTSNAME))
-AC_FUNC_CHECK(grantpt,AC_DEFINE(HAVE_GRANTPT))
-AC_FUNC_CHECK(openpty,AC_DEFINE(HAVE_OPENPTY))
-AC_FUNC_CHECK(logwtmp,AC_DEFINE(HAVE_LOGWTMP))
+AC_HAVE_FUNCS(getutent setreuid gettosbyname setsid ttyname line_push ptsname grantpt openpty logwtmp getutmpx)
AC_CHECK_HEADERS(unistd.h stdlib.h string.h utmpx.h utmp.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_FUNCS(waitpid updwtmpx)
#ifdef HAVE_SETUTXENT
setutxent();
+#ifdef HAVE_GETUTMPX
getutmpx(&ent, &utx);
+#else
+ /* For platforms like HPUX and Dec Unix which don't have getutmpx */
+ strncpy(utx.ut_user, ent.ut_user, sizeof(ent.ut_user));
+ strncpy(utx.ut_id, ent.ut_id, sizeof(ent.ut_id));
+ strncpy(utx.ut_line, ent.ut_line, sizeof(ent.ut_line));
+ utx.ut_pid = ent.ut_pid;
+ utx.ut_type = ent.ut_type;
+ utx.ut_exit = ent.ut_exit;
+ utx.ut_tv.tv_sec = ent.ut_time;
+ utx.ut_tv.tv_usec = 0;
+#endif
if (host)
strncpy(utx.ut_host, host, sizeof(utx.ut_host));
else