summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-01-13 17:50:58 +0000
committered <ed@FreeBSD.org>2010-01-13 17:50:58 +0000
commit1fded7e6240e43281379cb8abd4569ce41e5dabe (patch)
tree2e61d6f2e0071a081823bc0ca29691f503567f51 /usr.bin
parent521728584fe312e1b5563353930a4959421f4e4e (diff)
downloadFreeBSD-src-1fded7e6240e43281379cb8abd4569ce41e5dabe.zip
FreeBSD-src-1fded7e6240e43281379cb8abd4569ce41e5dabe.tar.gz
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/finger/Makefile3
-rw-r--r--usr.bin/finger/finger.c3
-rw-r--r--usr.bin/finger/lprint.c3
-rw-r--r--usr.bin/finger/net.c3
-rw-r--r--usr.bin/finger/sprint.c3
-rw-r--r--usr.bin/finger/util.c11
6 files changed, 9 insertions, 17 deletions
diff --git a/usr.bin/finger/Makefile b/usr.bin/finger/Makefile
index a7db063..30e04df 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 <bsd.prog.mk>
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 88b39fa..ae2766f 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -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"
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
index c473c7f..628aab6 100644
--- a/usr.bin/finger/lprint.c
+++ b/usr.bin/finger/lprint.c
@@ -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"
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index dfc533a..14a69c9 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -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);
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index c08ca3a..d4091a8 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -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 *);
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 8ee0825..8e3812b 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -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
OpenPOWER on IntegriCloud