xref: /netbsd-src/lib/libutil/compat/compat_loginx.c (revision 82ad575716605df31379cf04a2f3efbc97b8a6f5)
1*82ad5757Schristos /*	$NetBSD: compat_loginx.c,v 1.3 2012/11/04 13:08:56 christos Exp $	*/
250728e78Schristos 
350728e78Schristos /*
450728e78Schristos  * Copyright (c) 1988, 1993
550728e78Schristos  *	The Regents of the University of California.  All rights reserved.
650728e78Schristos  *
750728e78Schristos  * Redistribution and use in source and binary forms, with or without
850728e78Schristos  * modification, are permitted provided that the following conditions
950728e78Schristos  * are met:
1050728e78Schristos  * 1. Redistributions of source code must retain the above copyright
1150728e78Schristos  *    notice, this list of conditions and the following disclaimer.
1250728e78Schristos  * 2. Redistributions in binary form must reproduce the above copyright
1350728e78Schristos  *    notice, this list of conditions and the following disclaimer in the
1450728e78Schristos  *    documentation and/or other materials provided with the distribution.
1550728e78Schristos  * 3. Neither the name of the University nor the names of its contributors
1650728e78Schristos  *    may be used to endorse or promote products derived from this software
1750728e78Schristos  *    without specific prior written permission.
1850728e78Schristos  *
1950728e78Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2050728e78Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2150728e78Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2250728e78Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2350728e78Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2450728e78Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2550728e78Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2650728e78Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2750728e78Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2850728e78Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2950728e78Schristos  * SUCH DAMAGE.
3050728e78Schristos  */
3150728e78Schristos 
3250728e78Schristos #include <sys/cdefs.h>
3350728e78Schristos #if defined(LIBC_SCCS) && !defined(lint)
34*82ad5757Schristos __RCSID("$NetBSD: compat_loginx.c,v 1.3 2012/11/04 13:08:56 christos Exp $");
3550728e78Schristos #endif /* LIBC_SCCS and not lint */
3650728e78Schristos 
3750728e78Schristos #include <sys/types.h>
3850728e78Schristos 
3950728e78Schristos #define __LIBC12_SOURCE__
4050728e78Schristos #include <assert.h>
4150728e78Schristos #include <errno.h>
4250728e78Schristos #include <fcntl.h>
4350728e78Schristos #include <stdio.h>
4450728e78Schristos #include <string.h>
4550728e78Schristos #include <stdlib.h>
4650728e78Schristos #include <unistd.h>
4750728e78Schristos #include <utmpx.h>
4850728e78Schristos #include <compat/include/utmpx.h>
49*82ad5757Schristos #include <util.h>
50*82ad5757Schristos #include <compat/util.h>
5150728e78Schristos 
5250728e78Schristos __warn_references(loginx,
5350728e78Schristos     "warning: reference to compatibility loginx(); include <util.h> to generate correct reference")
5450728e78Schristos 
5550728e78Schristos void
loginx(const struct utmpx50 * ut50)5650728e78Schristos loginx(const struct utmpx50 *ut50)
5750728e78Schristos {
5850728e78Schristos 	struct utmpx ut;
5950728e78Schristos 	utmpx50_to_utmpx(ut50, &ut);
6050728e78Schristos 	(void)__pututxline50(&ut);
6150728e78Schristos 	(void)__updwtmpx50(_PATH_WTMPX, &ut);
6250728e78Schristos }
63