svn commit: r202191 - head/usr.bin/finger

Ed Schouten ed at FreeBSD.org
Wed Jan 13 17:50:58 UTC 2010


Author: ed
Date: Wed Jan 13 17:50:58 2010
New Revision: 202191
URL: http://svn.freebsd.org/changeset/base/202191

Log:
  Migrate finger(1) towards utmpx.
  
  It was already ported to use libulog, which makes it simpler now. Be
  sure to catch the error returned by setutxdb(). Otherwise it may perform
  a lookup on the utx.active database.

Modified:
  head/usr.bin/finger/Makefile
  head/usr.bin/finger/finger.c
  head/usr.bin/finger/lprint.c
  head/usr.bin/finger/net.c
  head/usr.bin/finger/sprint.c
  head/usr.bin/finger/util.c

Modified: head/usr.bin/finger/Makefile
==============================================================================
--- head/usr.bin/finger/Makefile	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/Makefile	Wed Jan 13 17:50:58 2010	(r202191)
@@ -7,7 +7,4 @@ MAN=	finger.1 finger.conf.5
 
 WARNS?=	2
 
-DPADD=	${LIBULOG}
-LDADD=	-lulog
-
 .include <bsd.prog.mk>

Modified: head/usr.bin/finger/finger.c
==============================================================================
--- head/usr.bin/finger/finger.c	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/finger.c	Wed Jan 13 17:50:58 2010	(r202191)
@@ -82,9 +82,8 @@ __FBSDID("$FreeBSD$");
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#define	_ULOG_POSIX_NAMES
-#include <ulog.h>
 #include <unistd.h>
+#include <utmpx.h>
 #include <locale.h>
 
 #include "finger.h"

Modified: head/usr.bin/finger/lprint.c
==============================================================================
--- head/usr.bin/finger/lprint.c	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/lprint.c	Wed Jan 13 17:50:58 2010	(r202191)
@@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$");
 #include <pwd.h>
 #include <stdio.h>
 #include <string.h>
-#define	_ULOG_POSIX_NAMES
-#include <ulog.h>
 #include <unistd.h>
+#include <utmpx.h>
 #include "finger.h"
 #include "pathnames.h"
 

Modified: head/usr.bin/finger/net.c
==============================================================================
--- head/usr.bin/finger/net.c	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/net.c	Wed Jan 13 17:50:58 2010	(r202191)
@@ -54,9 +54,8 @@ __FBSDID("$FreeBSD$");
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define	_ULOG_POSIX_NAMES
-#include <ulog.h>
 #include <unistd.h>
+#include <utmpx.h>
 #include "finger.h"
 
 static void cleanup(int sig);

Modified: head/usr.bin/finger/sprint.c
==============================================================================
--- head/usr.bin/finger/sprint.c	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/sprint.c	Wed Jan 13 17:50:58 2010	(r202191)
@@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$");
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
-#define	_ULOG_POSIX_NAMES
-#include <ulog.h>
+#include <utmpx.h>
 #include "finger.h"
 
 static void	  stimeprint(WHERE *);

Modified: head/usr.bin/finger/util.c
==============================================================================
--- head/usr.bin/finger/util.c	Wed Jan 13 17:49:35 2010	(r202190)
+++ head/usr.bin/finger/util.c	Wed Jan 13 17:50:58 2010	(r202191)
@@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$");
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#define	_ULOG_POSIX_NAMES
-#include <ulog.h>
 #include <unistd.h>
+#include <utmpx.h>
 #include "finger.h"
 #include "pathnames.h"
 
@@ -110,11 +109,11 @@ void
 enter_lastlog(PERSON *pn)
 {
 	WHERE *w;
-	struct ulog_utmpx *ut;
+	struct utmpx *ut = NULL;
 	char doit = 0;
 
-	ulog_setutxfile(UTXI_USER, NULL);
-	ut = ulog_getutxuser(pn->name);
+	if (setutxdb(UTXDB_LASTLOGIN, NULL) == 0)
+		ut = getutxuser(pn->name);
 	if ((w = pn->whead) == NULL)
 		doit = 1;
 	else if (ut != NULL && ut->ut_type == USER_PROCESS) {
@@ -140,7 +139,7 @@ enter_lastlog(PERSON *pn)
 		strcpy(w->host, ut->ut_host);
 		w->loginat = ut->ut_tv.tv_sec;
 	}
-	ulog_endutxent();
+	endutxent();
 }
 
 void


More information about the svn-src-head mailing list