1.\" $OpenBSD: login.3,v 1.4 2003/06/02 20:18:42 millert 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. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.Dd December 14, 1995 35.Dt LOGIN 3 36.Os 37.Sh NAME 38.Nm login , 39.Nm logout , 40.Nm logwtmp 41.Nd login utility functions 42.Sh SYNOPSIS 43.Fd #include <utmp.h> 44.Fd #include <util.h> 45.Ft void 46.Fn login "struct utmp *ut" 47.Ft int 48.Fn logout "const char *line" 49.Ft void 50.Fn logwtmp "const char *line" "const char *name" "const char *host" 51.Sh DESCRIPTION 52The 53.Fn login , 54.Fn logout , 55and 56.Fn logwtmp 57functions operate on the database of current users in 58.Pa /var/run/utmp 59and on the logfile 60.Pa /var/log/wtmp 61of logins and logouts. 62.Pp 63The 64.Fn login 65function updates the 66.Pa /var/run/utmp 67and 68.Pa /var/log/wtmp 69files with user information contained in 70.Fa ut . 71.Pp 72The 73.Fn logout 74function removes the entry from 75.Pa /var/run/utmp 76corresponding to the device 77.Fa line . 78.Pp 79The 80.Fn logwtmp 81function adds an entry to 82.Pa /var/log/wtmp . 83Since 84.Fn login 85will add the appropriate entry for 86.Pa /var/log/wtmp 87during a login, 88.Fn logwtmp 89is usually used for logouts. 90.Sh RETURN VALUES 91.Fn logout 92returns non-zero if it was able to find and delete an entry for 93.Fa line , 94and zero if there is no entry for 95.Fa line 96in 97.Pa /var/run/utmp . 98.Sh FILES 99.Bl -tag -width /var/run/wtmp -compact 100.It Pa /dev/\(** 101.It Pa /etc/ttys 102.It Pa /var/run/utmp 103.It Pa /var/log/wtmp 104.El 105.Sh SEE ALSO 106.Xr utmp 5 107