1*84d9c625SLionel Sambuc /* $NetBSD: compat_loginx.c,v 1.3 2012/11/04 13:08:56 christos Exp $ */
20c3983b2SBen Gras
30c3983b2SBen Gras /*
40c3983b2SBen Gras * Copyright (c) 1988, 1993
50c3983b2SBen Gras * The Regents of the University of California. All rights reserved.
60c3983b2SBen Gras *
70c3983b2SBen Gras * Redistribution and use in source and binary forms, with or without
80c3983b2SBen Gras * modification, are permitted provided that the following conditions
90c3983b2SBen Gras * are met:
100c3983b2SBen Gras * 1. Redistributions of source code must retain the above copyright
110c3983b2SBen Gras * notice, this list of conditions and the following disclaimer.
120c3983b2SBen Gras * 2. Redistributions in binary form must reproduce the above copyright
130c3983b2SBen Gras * notice, this list of conditions and the following disclaimer in the
140c3983b2SBen Gras * documentation and/or other materials provided with the distribution.
150c3983b2SBen Gras * 3. Neither the name of the University nor the names of its contributors
160c3983b2SBen Gras * may be used to endorse or promote products derived from this software
170c3983b2SBen Gras * without specific prior written permission.
180c3983b2SBen Gras *
190c3983b2SBen Gras * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
200c3983b2SBen Gras * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
210c3983b2SBen Gras * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
220c3983b2SBen Gras * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
230c3983b2SBen Gras * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
240c3983b2SBen Gras * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
250c3983b2SBen Gras * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
260c3983b2SBen Gras * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
270c3983b2SBen Gras * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
280c3983b2SBen Gras * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
290c3983b2SBen Gras * SUCH DAMAGE.
300c3983b2SBen Gras */
310c3983b2SBen Gras
320c3983b2SBen Gras #include <sys/cdefs.h>
330c3983b2SBen Gras #if defined(LIBC_SCCS) && !defined(lint)
34*84d9c625SLionel Sambuc __RCSID("$NetBSD: compat_loginx.c,v 1.3 2012/11/04 13:08:56 christos Exp $");
350c3983b2SBen Gras #endif /* LIBC_SCCS and not lint */
360c3983b2SBen Gras
370c3983b2SBen Gras #include <sys/types.h>
380c3983b2SBen Gras
390c3983b2SBen Gras #define __LIBC12_SOURCE__
400c3983b2SBen Gras #include <assert.h>
410c3983b2SBen Gras #include <errno.h>
420c3983b2SBen Gras #include <fcntl.h>
430c3983b2SBen Gras #include <stdio.h>
440c3983b2SBen Gras #include <string.h>
450c3983b2SBen Gras #include <stdlib.h>
460c3983b2SBen Gras #include <unistd.h>
470c3983b2SBen Gras #include <utmpx.h>
480c3983b2SBen Gras #include <compat/include/utmpx.h>
49*84d9c625SLionel Sambuc #include <util.h>
50*84d9c625SLionel Sambuc #include <compat/util.h>
510c3983b2SBen Gras
520c3983b2SBen Gras __warn_references(loginx,
530c3983b2SBen Gras "warning: reference to compatibility loginx(); include <util.h> to generate correct reference")
540c3983b2SBen Gras
550c3983b2SBen Gras void
loginx(const struct utmpx50 * ut50)560c3983b2SBen Gras loginx(const struct utmpx50 *ut50)
570c3983b2SBen Gras {
580c3983b2SBen Gras struct utmpx ut;
590c3983b2SBen Gras utmpx50_to_utmpx(ut50, &ut);
600c3983b2SBen Gras (void)__pututxline50(&ut);
610c3983b2SBen Gras (void)__updwtmpx50(_PATH_WTMPX, &ut);
620c3983b2SBen Gras }
63