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.
This commit is contained in:
Ed Schouten 2010-01-13 17:50:58 +00:00
parent d0632ec94a
commit 550dcc5960
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202191
6 changed files with 9 additions and 17 deletions

View File

@ -7,7 +7,4 @@ MAN= finger.1 finger.conf.5
WARNS?= 2
DPADD= ${LIBULOG}
LDADD= -lulog
.include <bsd.prog.mk>

View File

@ -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"

View File

@ -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"

View File

@ -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);

View File

@ -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 *);

View File

@ -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