From owner-svn-src-user@FreeBSD.ORG Wed Jan 6 12:42:17 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AA541065670; Wed, 6 Jan 2010 12:42:17 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1666E8FC14; Wed, 6 Jan 2010 12:42:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o06CgGq8026242; Wed, 6 Jan 2010 12:42:16 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o06CgGPZ026230; Wed, 6 Jan 2010 12:42:16 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201001061242.o06CgGPZ026230@svn.freebsd.org> From: Ed Schouten Date: Wed, 6 Jan 2010 12:42:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201640 - in user/ed/utmpx: usr.bin/finger usr.bin/who usr.sbin/ac usr.sbin/lastlogin X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2010 12:42:17 -0000 Author: ed Date: Wed Jan 6 12:42:16 2010 New Revision: 201640 URL: http://svn.freebsd.org/changeset/base/201640 Log: Make more tools use the utmpx interface. Modified: user/ed/utmpx/usr.bin/finger/Makefile user/ed/utmpx/usr.bin/finger/finger.c user/ed/utmpx/usr.bin/finger/lprint.c user/ed/utmpx/usr.bin/finger/net.c user/ed/utmpx/usr.bin/finger/sprint.c user/ed/utmpx/usr.bin/finger/util.c user/ed/utmpx/usr.bin/who/who.c user/ed/utmpx/usr.sbin/ac/Makefile user/ed/utmpx/usr.sbin/ac/ac.c user/ed/utmpx/usr.sbin/lastlogin/Makefile user/ed/utmpx/usr.sbin/lastlogin/lastlogin.c Modified: user/ed/utmpx/usr.bin/finger/Makefile ============================================================================== --- user/ed/utmpx/usr.bin/finger/Makefile Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/Makefile Wed Jan 6 12:42:16 2010 (r201640) @@ -7,7 +7,4 @@ MAN= finger.1 finger.conf.5 WARNS?= 2 -DPADD= ${LIBULOG} -LDADD= -lulog - .include Modified: user/ed/utmpx/usr.bin/finger/finger.c ============================================================================== --- user/ed/utmpx/usr.bin/finger/finger.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/finger.c Wed Jan 6 12:42:16 2010 (r201640) @@ -82,9 +82,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include #include "finger.h" Modified: user/ed/utmpx/usr.bin/finger/lprint.c ============================================================================== --- user/ed/utmpx/usr.bin/finger/lprint.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/lprint.c Wed Jan 6 12:42:16 2010 (r201640) @@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include "finger.h" #include "pathnames.h" Modified: user/ed/utmpx/usr.bin/finger/net.c ============================================================================== --- user/ed/utmpx/usr.bin/finger/net.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/net.c Wed Jan 6 12:42:16 2010 (r201640) @@ -54,9 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include #include "finger.h" static void cleanup(int sig); Modified: user/ed/utmpx/usr.bin/finger/sprint.c ============================================================================== --- user/ed/utmpx/usr.bin/finger/sprint.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/sprint.c Wed Jan 6 12:42:16 2010 (r201640) @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include +#include #include "finger.h" static void stimeprint(WHERE *); Modified: user/ed/utmpx/usr.bin/finger/util.c ============================================================================== --- user/ed/utmpx/usr.bin/finger/util.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/finger/util.c Wed Jan 6 12:42:16 2010 (r201640) @@ -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 Modified: user/ed/utmpx/usr.bin/who/who.c ============================================================================== --- user/ed/utmpx/usr.bin/who/who.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.bin/who/who.c Wed Jan 6 12:42:16 2010 (r201640) @@ -107,12 +107,10 @@ main(int argc, char *argv[]) if (argc > 1) usage(); -#if 0 if (*argv != NULL) { - if (ulog_setutxfile(UTXI_TTY, *argv) != 0) + if (setutxdb(UTXDB_ACTIVE, *argv) != 0) err(1, "%s", *argv); } -#endif if (qflag) quick(); Modified: user/ed/utmpx/usr.sbin/ac/Makefile ============================================================================== --- user/ed/utmpx/usr.sbin/ac/Makefile Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.sbin/ac/Makefile Wed Jan 6 12:42:16 2010 (r201640) @@ -5,9 +5,6 @@ MAN= ac.8 WARNS?= 6 -DPADD= ${LIBULOG} -LDADD= -lulog - # Temporary, while tracking down problem wrt 64-bit time_t's on sparc64 .if ${MACHINE_ARCH} == "sparc64" CFLAGS+=-DDEBUG Modified: user/ed/utmpx/usr.sbin/ac/ac.c ============================================================================== --- user/ed/utmpx/usr.sbin/ac/ac.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.sbin/ac/ac.c Wed Jan 6 12:42:16 2010 (r201640) @@ -26,9 +26,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _ULOG_POSIX_NAMES -#include #include +#include /* * this is for our list of currently logged in sessions @@ -486,7 +485,7 @@ ac(const char *file) prev_secs = 1; /* Minimum acceptable date == 1970 */ rfound = tchanged = tskipped = 0; secs = 0; - if (ulog_setutxfile(UTXI_TIME, file) != 0) + if (setutxdb(UTXDB_LOG, file) != 0) err(1, "%s", file); while ((usr = getutxent()) != NULL) { rfound++; Modified: user/ed/utmpx/usr.sbin/lastlogin/Makefile ============================================================================== --- user/ed/utmpx/usr.sbin/lastlogin/Makefile Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.sbin/lastlogin/Makefile Wed Jan 6 12:42:16 2010 (r201640) @@ -3,7 +3,4 @@ PROG= lastlogin MAN= lastlogin.8 -DPADD= ${LIBULOG} -LDADD= -lulog - .include Modified: user/ed/utmpx/usr.sbin/lastlogin/lastlogin.c ============================================================================== --- user/ed/utmpx/usr.sbin/lastlogin/lastlogin.c Wed Jan 6 12:15:10 2010 (r201639) +++ user/ed/utmpx/usr.sbin/lastlogin/lastlogin.c Wed Jan 6 12:42:16 2010 (r201640) @@ -41,62 +41,62 @@ __RCSID("$NetBSD: lastlogin.c,v 1.4 1998 #include #include #include -#include #include +#include int main(int, char **); -static void output(struct ulog_utmpx *); +static void output(struct utmpx *); static void usage(void); int main(int argc, char *argv[]) { int ch, i; - struct ulog_utmpx *u; + struct utmpx *u; while ((ch = getopt(argc, argv, "")) != -1) { usage(); } - if (ulog_setutxfile(UTXI_USER, NULL) != 0) - errx(1, "failed to open lastlog database"); - setpassent(1); /* Keep passwd file pointers open */ /* Process usernames given on the command line. */ if (argc > 1) { for (i = 1; i < argc; ++i) { - if ((u = ulog_getutxuser(argv[i])) == NULL) { + if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) + errx(1, "failed to open lastlog database"); + if ((u = getutxuser(argv[i])) == NULL) { warnx("user '%s' not found", argv[i]); continue; } output(u); + endutxent(); } } /* Read all lastlog entries, looking for active ones */ else { - while ((u = ulog_getutxent()) != NULL) { + if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) + errx(1, "failed to open lastlog database"); + while ((u = getutxent()) != NULL) { if (u->ut_type != USER_PROCESS) continue; output(u); } + endutxent(); } setpassent(0); /* Close passwd file pointers */ - - ulog_endutxent(); exit(0); } /* Duplicate the output of last(1) */ static void -output(struct ulog_utmpx *u) +output(struct utmpx *u) { time_t t = u->ut_tv.tv_sec; printf("%-16s %-8s %-16s %s", - u->ut_user, u->ut_line, u->ut_host, - (u->ut_type == USER_PROCESS) ? ctime(&t) : "Never logged in\n"); + u->ut_user, u->ut_line, u->ut_host, ctime(&t)); } static void