From 550dcc5960c0e93df52fc5e9363cacfa935849d3 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Wed, 13 Jan 2010 17:50:58 +0000 Subject: [PATCH] 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. --- usr.bin/finger/Makefile | 3 --- usr.bin/finger/finger.c | 3 +-- usr.bin/finger/lprint.c | 3 +-- usr.bin/finger/net.c | 3 +-- usr.bin/finger/sprint.c | 3 +-- usr.bin/finger/util.c | 11 +++++------ 6 files changed, 9 insertions(+), 17 deletions(-) diff --git a/usr.bin/finger/Makefile b/usr.bin/finger/Makefile index a7db06309140..30e04dfed68e 100644 --- a/usr.bin/finger/Makefile +++ b/usr.bin/finger/Makefile @@ -7,7 +7,4 @@ MAN= finger.1 finger.conf.5 WARNS?= 2 -DPADD= ${LIBULOG} -LDADD= -lulog - .include diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c index 88b39fa21d9a..ae2766f08ee2 100644 --- a/usr.bin/finger/finger.c +++ b/usr.bin/finger/finger.c @@ -82,9 +82,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include #include "finger.h" diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c index c473c7fee3c6..628aab6fbd5f 100644 --- a/usr.bin/finger/lprint.c +++ b/usr.bin/finger/lprint.c @@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include "finger.h" #include "pathnames.h" diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c index dfc533af0bdc..14a69c98cc39 100644 --- a/usr.bin/finger/net.c +++ b/usr.bin/finger/net.c @@ -54,9 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include "finger.h" static void cleanup(int sig); diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c index c08ca3ab0feb..d4091a8cbfba 100644 --- a/usr.bin/finger/sprint.c +++ b/usr.bin/finger/sprint.c @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include +#include #include "finger.h" static void stimeprint(WHERE *); diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index 8ee082524adb..8e3812b60bee 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #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