mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 09:02:44 +00:00
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:
parent
d0632ec94a
commit
550dcc5960
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202191
@ -7,7 +7,4 @@ MAN= finger.1 finger.conf.5
|
||||
|
||||
WARNS?= 2
|
||||
|
||||
DPADD= ${LIBULOG}
|
||||
LDADD= -lulog
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 *);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user