xref: /netbsd-src/lib/libutil/compat/util.h (revision 82ad575716605df31379cf04a2f3efbc97b8a6f5)
1*82ad5757Schristos /*	$NetBSD: util.h,v 1.3 2012/11/04 13:08:57 christos Exp $	*/
250728e78Schristos 
350728e78Schristos /*-
450728e78Schristos  * Copyright (c) 1995
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 #ifndef _COMPAT_UTIL_H_
3350728e78Schristos #define	_COMPAT_UTIL_H_
3450728e78Schristos 
3550728e78Schristos #include <sys/cdefs.h>
3650728e78Schristos #include <sys/types.h>
37*82ad5757Schristos #include <sys/inttypes.h>
38*82ad5757Schristos #include <sys/ansi.h>
39*82ad5757Schristos 
40*82ad5757Schristos struct utmp50;
41*82ad5757Schristos struct utmpx50;
42*82ad5757Schristos struct passwd50;
43*82ad5757Schristos struct utmp;
44*82ad5757Schristos struct utmpx;
45*82ad5757Schristos struct passwd;
4650728e78Schristos 
4750728e78Schristos void		login(const struct utmp50 *);
4850728e78Schristos void		loginx(const struct utmpx50 *);
4950728e78Schristos 
5050728e78Schristos int32_t		parsedate(const char *, const int32_t *, const int *);
5150728e78Schristos 
5250728e78Schristos void		pw_copy(int, int, struct passwd50 *, struct passwd50 *);
5350728e78Schristos int		pw_copyx(int, int, struct passwd50 *, struct passwd50 *,
5450728e78Schristos     char *, size_t);
5550728e78Schristos void		pw_getpwconf(char *, size_t, const struct passwd50 *,
5650728e78Schristos     const char *);
5750728e78Schristos 
5850728e78Schristos void		__login50(const struct utmp *);
5950728e78Schristos void		__loginx50(const struct utmpx *);
6050728e78Schristos 
6150728e78Schristos time_t		__parsedate50(const char *, const time_t *, const int *);
6250728e78Schristos 
6350728e78Schristos void		__pw_copy50(int, int, struct passwd *, struct passwd *);
6450728e78Schristos int		__pw_copyx50(int, int, struct passwd *, struct passwd *,
6550728e78Schristos     char *, size_t);
6650728e78Schristos void		__pw_getpwconf50(char *, size_t, const struct passwd *,
6750728e78Schristos     const char *);
6850728e78Schristos #endif /* !_COMPAT_UTIL_H_ */
69