Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc Add utmp processing functions
details: https://anonhg.NetBSD.org/src/rev/4a830d406110
branches: trunk
changeset: 534480:4a830d406110
user: christos <christos%NetBSD.org@localhost>
date: Sat Jul 27 23:57:39 2002 +0000
description:
Add utmp processing functions
diffstat:
lib/libc/gen/Makefile.inc | 8 ++--
lib/libc/gen/utmp.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++
lib/libc/shlib_version | 4 +-
3 files changed, 85 insertions(+), 6 deletions(-)
diffs (120 lines):
diff -r 0aeff8ef0dbf -r 4a830d406110 lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc Sat Jul 27 23:57:02 2002 +0000
+++ b/lib/libc/gen/Makefile.inc Sat Jul 27 23:57:39 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.112 2002/06/30 09:45:39 bjh21 Exp $
+# $NetBSD: Makefile.inc,v 1.113 2002/07/27 23:57:39 christos Exp $
# from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
# gen sources
@@ -22,9 +22,9 @@
__signame14.c signame.c __sigsetops14.c sigsetops.c sleep.c \
stringlist.c sysconf.c sysctl.c syslog.c telldir.c time.c __times13.c \
times.c timezone.c toascii.c tolower_.c ttyname.c ttyslot.c \
- toupper_.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c utmpx.c \
- valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c vwarn.c \
- vwarnx.c verr.c verrx.c
+ toupper_.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c utmp.c \
+ utmpx.c valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c \
+ vwarn.c vwarnx.c verr.c verrx.c
# indirect reference stubs, to be removed soon.
SRCS+= _err.c _errx.c _sys_errlist.c _sys_nerr.c _sys_siglist.c \
diff -r 0aeff8ef0dbf -r 4a830d406110 lib/libc/gen/utmp.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/gen/utmp.c Sat Jul 27 23:57:39 2002 +0000
@@ -0,0 +1,79 @@
+/* $NetBSD: utmp.c,v 1.1 2002/07/27 23:57:39 christos Exp $ */
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: utmp.c,v 1.1 2002/07/27 23:57:39 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+#include <time.h>
+#include <utmp.h>
+
+static struct utmp utmp;
+static FILE *ut;
+
+void
+setutent(void)
+{
+ if (ut != NULL)
+ (void)fclose(ut);
+ ut = fopen(_PATH_UTMP, "r");
+}
+
+struct utmp *
+getutent(void)
+{
+ if (ut == NULL)
+ return NULL;
+ while (fread(&utmp, sizeof(utmp), 1, ut) == 1) {
+ if (utmp.ut_name[0] == '\0')
+ continue;
+ return &utmp;
+ }
+ return NULL;
+}
+
+void
+endutent(void)
+{
+ if (ut != NULL) {
+ (void)fclose(ut);
+ ut = NULL;
+ }
+}
diff -r 0aeff8ef0dbf -r 4a830d406110 lib/libc/shlib_version
--- a/lib/libc/shlib_version Sat Jul 27 23:57:02 2002 +0000
+++ b/lib/libc/shlib_version Sat Jul 27 23:57:39 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shlib_version,v 1.118 2002/06/30 09:46:18 bjh21 Exp $
+# $NetBSD: shlib_version,v 1.119 2002/07/27 23:57:39 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
# things we wish to do on next major version bump:
@@ -11,4 +11,4 @@
# - libc/net/getaddrinfo.c, netdb.h: remove __ai_pad0
#
major=12
-minor=85
+minor=86
Home |
Main Index |
Thread Index |
Old Index