xref: /titanic_44/usr/src/head/deflt.h (revision 5fd03bc0f2e00e7ba02316c2e08f45d52aab15db)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23  *
24  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
32 /*	  All Rights Reserved	*/
33 
34 #ifndef	_DEFLT_H
35 #define	_DEFLT_H
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	DEFLT	"/etc/default"
42 
43 /*
44  * Following for defcntl(3).
45  * If you add new args, make sure that the default is:
46  *	OFF	new-improved-feature-off, i.e. current state of affairs
47  *	ON	new-improved-feature-on
48  * or that you change the code for deflt(3) to have the old value as the
49  * default.  (for compatibility).
50  */
51 
52 /* ... cmds */
53 #define	DC_GETFLAGS	0	/* get current flags */
54 #define	DC_SETFLAGS	1	/* set flags */
55 
56 /* ... args */
57 #define	DC_CASE		0001	/* ON: respect case; OFF: ignore case */
58 #define	DC_NOREWIND	0002	/* ON: don't rewind in defread */
59 				/* OFF: do rewind in defread */
60 #define	DC_STRIP_QUOTES	0004	/* ON: strip quotes; OFF: leave quotes */
61 
62 #define	DC_STD		((0) | (DC_CASE))
63 
64 extern int defcntl(int, int);
65 extern int defopen(char *);
66 extern char *defread(char *);
67 
68 extern int	defcntl_r(int, int, void *);
69 extern void	*defopen_r(const char *);
70 extern char	*defread_r(const char *, void *);
71 extern void	defclose_r(void *);
72 
73 #define	TURNON(flags, mask)	((flags) |= (mask))
74 #define	TURNOFF(flags, mask)	((flags) &= ~(mask))
75 #define	ISON(flags, mask)	(((flags) & (mask)) == (mask))
76 #define	ISOFF(flags, mask)	(((flags) & (mask)) != (mask))
77 
78 #ifdef	__cplusplus
79 }
80 #endif
81 
82 #endif	/* _DEFLT_H */
83