diff options
author | christos <christos@NetBSD.org> | 2002-08-02 03:06:24 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2002-08-02 03:06:24 +0000 |
commit | a26880c9f0ef11de16ef7cb99e3ad1197ee2f8f0 (patch) | |
tree | cdb384e661b8e78cd44127c70780a74304379b09 /dm/dm.c | |
parent | a37449a45f86b92f813b114677d604c56618ec53 (diff) | |
download | bsdgames-darwin-a26880c9f0ef11de16ef7cb99e3ad1197ee2f8f0.tar.gz bsdgames-darwin-a26880c9f0ef11de16ef7cb99e3ad1197ee2f8f0.tar.zst bsdgames-darwin-a26880c9f0ef11de16ef7cb99e3ad1197ee2f8f0.zip |
utmpx support.
Diffstat (limited to 'dm/dm.c')
-rw-r--r-- | dm/dm.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -1,4 +1,4 @@ -/* $NetBSD: dm.c,v 1.16 2001/01/25 20:41:41 jdolecek Exp $ */ +/* $NetBSD: dm.c,v 1.17 2002/08/02 03:06:24 christos Exp $ */ /* * Copyright (c) 1987, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\ #if 0 static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dm.c,v 1.16 2001/01/25 20:41:41 jdolecek Exp $"); +__RCSID("$NetBSD: dm.c,v 1.17 2002/08/02 03:06:24 christos Exp $"); #endif #endif /* not lint */ @@ -61,8 +61,8 @@ __RCSID("$NetBSD: dm.c,v 1.16 2001/01/25 20:41:41 jdolecek Exp $"); #include <string.h> #include <time.h> #include <unistd.h> -#include <utmp.h> +#include "utmpentry.h" #include "pathnames.h" static time_t now; /* current time value */ @@ -256,16 +256,16 @@ load() int users() { - - int nusers, utmp; - struct utmp buf; - - if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) - err(1, "%s", _PATH_UTMP); - for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;) - if (buf.ut_name[0] != '\0') - ++nusers; - return (nusers); + static struct utmpentry *ohead = NULL; + struct utmpentry *ep; + int nusers; + + nusers = getutentries(NULL, &ep); + if (ep != ohead) { + freeutentries(ep); + ohead = ep; + } + return nusers; } void |