nmh-1.2 on CURRENT

Derek Tattersall dlt at mebtel.net
Sat Sep 18 20:02:09 UTC 2010


nmh-1.2 has not been updated for the new utmpx implementation.  The
patch is not terribly large.  I haven't figured how to conditionally
patch for Current, vs. leaving it alone on other releases.  Here's the
patch anyway.
------------------------ Patch follows ---------------------------------

--- uip/rcvtty.c.orig	2010-09-18 14:23:38.000000000 -0400
+++ uip/rcvtty.c	2010-09-18 14:27:18.000000000 -0400
@@ -23,7 +23,7 @@
 #include <signal.h>
 #include <fcntl.h>
 
-#include <utmp.h>
+#include <utmpx.h>
 
 #ifndef HAVE_GETUTENT
 # ifndef UTMP_FILE
@@ -93,9 +93,9 @@
     char *cp, *user, buf[BUFSIZ], tty[BUFSIZ];
     char **argp, **arguments, *vec[MAXARGS];
 #ifdef HAVE_GETUTENT
-    struct utmp * utp;
+    struct utmpx * utp;
 #else
-    struct utmp ut;
+    struct utmpx ut;
     register FILE *uf;
 #endif
 
@@ -181,9 +181,9 @@
 	       utp->ut_type == USER_PROCESS 
 	       &&
 #endif
-               utp->ut_name[0] != 0
+               utp->ut_user[0] != 0
                && utp->ut_line[0] != 0
-               && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) {
+               && strncmp (user, utp->ut_user, sizeof(utp->ut_user)) == 0) {
             strncpy (tty, utp->ut_line, sizeof(utp->ut_line));
 	    alert (tty, md);
         }
@@ -193,8 +193,8 @@
     if ((uf = fopen (UTMP_FILE, "r")) == NULL)
 	exit (RCV_MBX);
     while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1)
-	if (ut.ut_name[0] != 0
-		&& strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
+	if (ut.ut_user[0] != 0
+		&& strncmp (user, ut.ut_user, sizeof(ut.ut_user)) == 0) {
 	    strncpy (tty, ut.ut_line, sizeof(ut.ut_line));
 	    alert (tty, md);
 	}
--- uip/slocal.c.orig	2010-09-18 14:24:09.000000000 -0400
+++ uip/slocal.c	2010-09-18 14:29:11.000000000 -0400
@@ -64,7 +64,7 @@
 #endif
 #endif
 
-#include <utmp.h>
+#include <utmpx.h>
 
 #ifndef HAVE_GETUTENT
 # ifndef UTMP_FILE
@@ -957,7 +957,7 @@
 static int
 logged_in (void)
 {
-    struct utmp * utp;
+    struct utmpx * utp;
 
     if (utmped)
         return utmped;
@@ -970,8 +970,8 @@
 		utp->ut_type == USER_PROCESS
                 &&
 #endif
-		utp->ut_name[0] != 0
-                && strncmp (user, utp->ut_name, sizeof(utp->ut_name)) == 0) {
+		utp->ut_user[0] != 0
+                && strncmp (user, utp->ut_user, sizeof(utp->ut_user)) == 0) {
             if (debug)
                 continue;
             endutent();
@@ -986,7 +986,7 @@
 static int
 logged_in (void)
 {
-    struct utmp ut;
+    struct utmpx ut;
     FILE *uf;
 
     if (utmped)
@@ -996,8 +996,8 @@
 	return NOTOK;
 
     while (fread ((char *) &ut, sizeof(ut), 1, uf) == 1) {
-	if (ut.ut_name[0] != 0
-	    && strncmp (user, ut.ut_name, sizeof(ut.ut_name)) == 0) {
+	if (ut.ut_user[0] != 0
+	    && strncmp (user, ut.ut_user, sizeof(ut.ut_user)) == 0) {
 	    if (debug)
 		continue;
 	    fclose (uf);
---------------------- Patch precedes --------------------------------	    
-- 
Best regards,
Derek Tattersall
dlt at mebtel.net		dlt666 at yahoo.com		 dtatters at gmail.com


More information about the freebsd-ports mailing list