svn commit: r200154 - head/usr.bin/users
Ed Schouten
ed at FreeBSD.org
Sat Dec 5 19:54:37 UTC 2009
Author: ed
Date: Sat Dec 5 19:54:37 2009
New Revision: 200154
URL: http://svn.freebsd.org/changeset/base/200154
Log:
Use _ULOG_POSIX_NAMES here, to make eventual porting to <utmpx.h> easier.
By the time we gain a real <utmpx.h>, it's just a matter of changing the
include at the top and -lulog from the Makefile.
Modified:
head/usr.bin/users/users.c
Modified: head/usr.bin/users/users.c
==============================================================================
--- head/usr.bin/users/users.c Sat Dec 5 19:53:29 2009 (r200153)
+++ head/usr.bin/users/users.c Sat Dec 5 19:54:37 2009 (r200154)
@@ -51,6 +51,7 @@ static const char rcsid[] =
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#define _ULOG_POSIX_NAMES
#include <ulog.h>
#include <unistd.h>
@@ -66,7 +67,7 @@ main(int argc, char **argv)
int ncnt = 0;
int nmax = 0;
int cnt;
- struct ulog_utmpx *ut;
+ struct utmpx *ut;
int ch;
while ((ch = getopt(argc, argv, "")) != -1)
@@ -78,8 +79,8 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
- ulog_setutxent();
- while ((ut = ulog_getutxent()) != NULL) {
+ setutxent();
+ while ((ut = getutxent()) != NULL) {
if (ut->ut_type != USER_PROCESS)
continue;
if (ncnt >= nmax) {
@@ -93,7 +94,7 @@ main(int argc, char **argv)
(void)strlcpy(names[ncnt], ut->ut_user, sizeof(*names));
++ncnt;
}
- ulog_endutxent();
+ endutxent();
if (ncnt > 0) {
qsort(names, ncnt, sizeof(namebuf), scmp);
(void)printf("%s", names[0]);
More information about the svn-src-all
mailing list