Module Name: src Committed By: christos Date: Fri Feb 26 03:05:01 UTC 2021
Modified Files: src/lib/libc/gen: Makefile.inc Added Files: src/lib/libc/gen: endutent.3 Log Message: PR/56012: Kouichi Hashikawa: getutent(3) man page is missing To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/lib/libc/gen/Makefile.inc cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/endutent.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/gen/Makefile.inc diff -u src/lib/libc/gen/Makefile.inc:1.206 src/lib/libc/gen/Makefile.inc:1.207 --- src/lib/libc/gen/Makefile.inc:1.206 Tue Sep 22 17:37:47 2020 +++ src/lib/libc/gen/Makefile.inc Thu Feb 25 22:05:01 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.206 2020/09/22 21:37:47 nia Exp $ +# $NetBSD: Makefile.inc,v 1.207 2021/02/26 03:05:01 christos Exp $ # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 # gen sources @@ -98,6 +98,8 @@ MLINKS+=directory.3 closedir.3 directory MLINKS+=endutxent.3 getutxent.3 endutxent.3 getutxid.3 \ endutxent.3 getutxline.3 endutxent.3 pututxline.3 \ endutxent.3 setutxent.3 +MLINKS+=endutent.3 getutent.3 endutent.3 getutline.3 endutent.3 pututline.3 \ + endutent.3 setutent.3 MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \ err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \ err.3 vwarnc.3 @@ -143,7 +145,6 @@ MLINKS+=getpwent.3 endpwent.3 getpwent.3 MLINKS+=getpwent.3 getpwnam_r.3 getpwent.3 getpwuid_r.3 getpwent.3 getpwent_r.3 # getpwent.3 setpwfile.3 - deprecated MLINKS+=getttyent.3 endttyent.3 getttyent.3 getttynam.3 \ - getttyent.3 setttyent.3 getttyent.3 setttyentpath.3 MLINKS+=getusershell.3 endusershell.3 getusershell.3 setusershell.3 MLINKS+=glob.3 globfree.3 MLINKS+=glob.3 glob_pattern_p.3 Added files: Index: src/lib/libc/gen/endutent.3 diff -u /dev/null src/lib/libc/gen/endutent.3:1.1 --- /dev/null Thu Feb 25 22:05:01 2021 +++ src/lib/libc/gen/endutent.3 Thu Feb 25 22:05:01 2021 @@ -0,0 +1,123 @@ +.\" $NetBSD: endutent.3,v 1.1 2021/02/26 03:05:01 christos Exp $ +.\" +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Thomas Klausner. +.\" +.\" 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. +.\" +.\" 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. +.\" +.Dd February 25, 2021 +.Dt ENDUTENT 3 +.Os +.Sh NAME +.Nm endutent , +.Nm getutent , +.Nm getutline , +.Nm pututline , +.Nm setutent +.Nd user accounting database functions +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In utmp.h +.Ft void +.Fn endutent void +.Ft struct utmp * +.Fn getutent void +.Ft struct utmpx * +.Fn getutline "const struct utmp *" +.Ft struct utmp * +.Fn pututline "const struct utmp *" +.Ft void +.Fn setutent void +.Sh DESCRIPTION +These functions provide access to the +.Xr utmp 5 +user accounting database. +.Pp +These interfaces are only provided for compatibility purpuses and +have been superseeded by +.Xr endutent 3 , +.Xr utmpx 5 . +.Pp +.Fn getutent +reads the next entry from the database; +if the database was not yet open, it also opens it. +.Fn setutent +resets the database, so that the next +.Fn getutent +call will get the first entry. +.Fn endutent +closes the database. +.Pp +.Fn getutline +returns the next +entry which has the same name as specified in the +.Va ut_line +field, or +.Dv NULL +if no match is found. +.Pp +.Fn pututline +adds the argument +.Xr utmp 5 +entry line to the accounting database, replacing a previous entry for +the same user if it exists. +.Ss The utmp structure +The +.Nm utmp +structure has the following definition: +.Pp +.Bd -literal +struct utmp { + char ut_line[UT_LINESIZE]; /* tty name */ + char ut_name[UT_USERSIZE]; /* login name */ + char ut_host[UT_HOSTSIZE]; /* host name */ + time_t ut_time; /* time entry was created */ +}; +.Ed +.Sh RETURN VALUES +.Fn getutent +returns the next entry, or +.Dv NULL +on failure (end of database or problems reading from the database). +.Fn getutline +returns the matching structure on success, or +.Dv NULL +if no match was found. +.Fn pututline +returns the structure that was successfully written, or +.Dv NULL . +.Sh SEE ALSO +.Xr logwtmp 3 , +.Xr utmp 5 +.Sh STANDARDS +The +.Fn endutent , +.Fn getutent , +.Fn getutline , +.Fn pututline , +.Fn setutent +all conform to +.St -xpg4.2 .