[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Revert utmpx change?
From: |
Ken Hornstein |
Subject: |
Re: [Nmh-workers] Revert utmpx change? |
Date: |
Wed, 25 Apr 2012 09:34:38 -0500 |
>Yes, that seems sensible to me for a feature that is (I assume) rarely used
>on this platform.
Anthony,
Could you try out the following patch? If it works for you, then I'll put
it in the next release candidate.
--Ken
diff --git a/configure.ac b/configure.ac
index af186fe..26b2606 100644
--- a/configure.ac
+++ b/configure.ac
@@ -424,7 +424,7 @@ AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM,1,
dnl ---------------
dnl CHECK FUNCTIONS
dnl ---------------
-AC_CHECK_FUNCS([wcwidth mbtowc writev lstat nl_langinfo])
+AC_CHECK_FUNCS([wcwidth mbtowc writev lstat nl_langinfo getutxent])
dnl Check for multibyte character set support
if test "x$ac_cv_header_wchar_h" = "xyes" -a "x$ac_cv_header_wctype_h" =
"xyes" \
diff --git a/uip/rcvtty.c b/uip/rcvtty.c
index 048407a..63a97b9 100644
--- a/uip/rcvtty.c
+++ b/uip/rcvtty.c
@@ -22,7 +22,9 @@
#include <signal.h>
#include <fcntl.h>
+#ifdef HAVE_GETUTXENT
#include <utmpx.h>
+#endif /* HAVE_GETUTXENT */
#define SCANFMT \
"%2(hour{dtimenow}):%02(min{dtimenow}): %<(size)%5(size) %>%<{encrypted}E%>\
@@ -156,6 +158,7 @@ main (int argc, char **argv)
user = getusername();
+#if HAVE_GETUTXENT
setutxent();
while ((utp = getutxent()) != NULL) {
if (utp->ut_type == USER_PROCESS && utp->ut_user[0] != 0
@@ -166,6 +169,7 @@ main (int argc, char **argv)
}
}
endutxent();
+#endif /* HAVE_GETUTXENT */
exit (RCV_MOK);
return 0; /* dead code to satisfy the compiler */
diff --git a/uip/slocal.c b/uip/slocal.c
index 71e09ff..cc3c872 100644
--- a/uip/slocal.c
+++ b/uip/slocal.c
@@ -51,7 +51,9 @@
#include NDBM_HEADER
#endif
+#ifdef HAVE_GETUTXENT
#include <utmpx.h>
+#endif /* HAVE_GETUTXENT */
static struct swit switches[] = {
#define ADDRSW 0
@@ -930,6 +932,7 @@ lookup (struct pair *pairs, char *key)
static int
logged_in (void)
{
+#if HAVE_GETUTXENT
struct utmpx *utp;
if (utmped)
@@ -948,6 +951,7 @@ logged_in (void)
}
endutxent();
+#endif /* HAVE_GETUTXENT */
return (utmped = NOTOK);
}