xref: /openbsd-src/lib/libutil/util.h (revision 3a3fbb3f2e2521ab7c4a56b7ff7462ebd9095ec5)
1 /*	$OpenBSD: util.h,v 1.18 2001/09/29 17:45:36 jakob Exp $	*/
2 /*	$NetBSD: util.h,v 1.2 1996/05/16 07:00:22 thorpej Exp $	*/
3 
4 /*-
5  * Copyright (c) 1995
6  *	The Regents of the University of California.  All rights reserved.
7  * Portions Copyright (c) 1996, Jason Downs.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by the University of
20  *	California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  */
37 
38 #ifndef _UTIL_H_
39 #define _UTIL_H_
40 
41 #include <sys/cdefs.h>
42 #include <sys/types.h>
43 
44 /*
45  * fparseln() specific operation flags.
46  */
47 #define FPARSELN_UNESCESC	0x01
48 #define FPARSELN_UNESCCONT	0x02
49 #define FPARSELN_UNESCCOMM	0x04
50 #define FPARSELN_UNESCREST	0x08
51 #define FPARSELN_UNESCALL	0x0f
52 
53 /*
54  * opendev() specific operation flags.
55  */
56 #define OPENDEV_PART	0x01		/* Try to open the raw partition. */
57 #define OPENDEV_DRCT	0x02		/* Obsolete (now default behavior). */
58 #define OPENDEV_BLCK	0x04		/* Open block, not character device. */
59 
60 /*
61  * uucplock(3) specific flags.
62  */
63 #define UU_LOCK_INUSE (1)
64 #define UU_LOCK_OK (0)
65 #define UU_LOCK_OPEN_ERR (-1)
66 #define UU_LOCK_READ_ERR (-2)
67 #define UU_LOCK_CREAT_ERR (-3)
68 #define UU_LOCK_WRITE_ERR (-4)
69 #define UU_LOCK_LINK_ERR (-5)
70 #define UU_LOCK_TRY_ERR (-6)
71 #define UU_LOCK_OWNER_ERR (-7)
72 
73 /*
74  * stub struct definitions.
75  */
76 struct __sFILE;
77 struct login_cap;
78 struct passwd;
79 struct termios;
80 struct utmp;
81 struct winsize;
82 
83 __BEGIN_DECLS
84 char   *fparseln __P((struct __sFILE *, size_t *, size_t *, const char[3], int));
85 void	login __P((struct utmp *));
86 int	login_tty __P((int));
87 int	logout __P((const char *));
88 void	logwtmp __P((const char *, const char *, const char *));
89 int	opendev __P((char *, int, int, char **));
90 int	pidfile __P((const char *));
91 void	pw_setdir __P((const char *));
92 char   *pw_file __P((const char *));
93 int	pw_lock __P((int retries));
94 int	pw_mkdb __P((char *, int));
95 int	pw_abort __P((void));
96 void	pw_init __P((void));
97 void	pw_edit __P((int, const char *));
98 void	pw_prompt __P((void));
99 void	pw_copy __P((int, int, struct passwd *));
100 void	pw_getconf __P((char *, size_t, const char *, const char *));
101 int	pw_scan __P((char *, struct passwd *, int *));
102 void	pw_error __P((const char *, int, int));
103 int	openpty __P((int *, int *, char *, struct termios *,
104 	    struct winsize *));
105 int	opendisk __P((const char *path, int flags, char *buf, size_t buflen,
106 	    int iscooked));
107 pid_t	forkpty __P((int *, char *, struct termios *, struct winsize *));
108 int	getmaxpartitions __P((void));
109 int	getrawpartition __P((void));
110 void	login_fbtab __P((char *, uid_t, gid_t));
111 int	login_check_expire __P((struct __sFILE *, struct passwd *, char *, int));
112 char   *readlabelfs __P((char *, int));
113 const char *uu_lockerr __P((int _uu_lockresult));
114 int     uu_lock __P((const char *_ttyname));
115 int	uu_lock_txfr __P((const char *_ttyname, pid_t _pid));
116 int     uu_unlock __P((const char *_ttyname));
117 __END_DECLS
118 
119 #endif /* !_UTIL_H_ */
120