xref: /netbsd/lib/libutil/login.3 (revision bf9ec67e)
1.\"	$NetBSD: login.3,v 1.4 2002/02/07 07:00:52 ross Exp $
2.\"
3.\" Copyright (c) 1995
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software developed by the Computer Systems
7.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
8.\" BG 91-66 and contributed to Berkeley.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. All advertising materials mentioning features or use of this software
19.\"    must display the following acknowledgement:
20.\"	This product includes software developed by the University of
21.\"	California, Berkeley and its contributors.
22.\" 4. Neither the name of the University nor the names of its contributors
23.\"    may be used to endorse or promote products derived from this software
24.\"    without specific prior written permission.
25.\"
26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36.\" SUCH DAMAGE.
37.\"
38.Dd December 14, 1995
39.Dt LOGIN 3
40.Os
41.Sh NAME
42.Nm login ,
43.Nm logout ,
44.Nm logwtmp
45.Nd login utility functions
46.Sh LIBRARY
47.Lb libutil
48.Sh SYNOPSIS
49.Fd #include \*[Lt]util.h\*[Gt]
50.Ft void
51.Fn login "struct utmp *ut"
52.Ft int
53.Fn logout "const char *line"
54.Ft void
55.Fn logwtmp "const char *line" "const char *name" "const char *host"
56.Sh DESCRIPTION
57The
58.Fn login ,
59.Fn logout ,
60and
61.Fn logwtmp
62functions operate on the database of current users in
63.Pa /var/run/utmp
64and on the logfile
65.Pa /var/log/wtmp
66of logins and logouts.
67.Pp
68The
69.Fn login
70function updates the
71.Pa /var/run/utmp
72and
73.Pa /var/log/wtmp
74files with user information contained in
75.Fa ut .
76.Pp
77The
78.Fn logout
79function removes the entry from
80.Pa /var/run/utmp
81corresponding to the device
82.Fa line .
83.Pp
84The
85.Fn logwtmp
86function adds an entry to
87.Pa /var/log/wtmp .
88Since
89.Fn login
90will add the appropriate entry for
91.Pa /var/log/wtmp
92during a login,
93.Fn logwtmp
94is usually used for logouts.
95.Sh RETURN VALUES
96.Fn logout
97returns non-zero if it was able to find and delete an entry for
98.Fa line ,
99and zero if there is no entry for
100.Fa line
101in
102.Pa /var/run/utmp .
103.Sh FILES
104.Bl -tag -width /var/run/wtmp -compact
105.It Pa /dev/\(**
106.It Pa /etc/ttys
107.It Pa /var/run/utmp
108.It Pa /var/log/wtmp
109.El
110.Sh SEE ALSO
111.Xr utmp 5
112