xref: /illumos-gate/usr/src/head/deflt.h (revision 47842382d52f28aa3173aa6b511781c322ccb6a2)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
30 /*	  All Rights Reserved	*/
31 
32 #ifndef	_DEFLT_H
33 #define	_DEFLT_H
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	DEFLT	"/etc/default"
40 
41 /*
42  * Following for defcntl(3).
43  * If you add new args, make sure that the default is:
44  *	OFF	new-improved-feature-off, i.e. current state of affairs
45  *	ON	new-improved-feature-on
46  * or that you change the code for deflt(3) to have the old value as the
47  * default.  (for compatibility).
48  */
49 
50 /* ... cmds */
51 #define	DC_GETFLAGS	0	/* get current flags */
52 #define	DC_SETFLAGS	1	/* set flags */
53 
54 /* ... args */
55 #define	DC_CASE		0001	/* ON: respect case; OFF: ignore case */
56 #define	DC_NOREWIND	0002	/* ON: don't rewind in defread */
57 				/* OFF: do rewind in defread */
58 #define	DC_STRIP_QUOTES	0004	/* ON: strip quotes; OFF: leave quotes */
59 
60 #define	DC_STD		((0) | (DC_CASE))
61 
62 #ifdef __STDC__
63 extern int defcntl(int, int);
64 extern int defopen(char *);
65 extern char *defread(char *);
66 
67 extern int	defcntl_r(int, int, void *);
68 extern void	*defopen_r(const char *);
69 extern char	*defread_r(const char *, void *);
70 extern void	defclose_r(void *);
71 #else
72 extern int defcntl();
73 extern int defopen();
74 extern char *defread();
75 
76 extern int	defcntl_r();
77 extern void	*defopen_r();
78 extern char	*defread_r();
79 extern void	defclose_r();
80 #endif
81 
82 #define	TURNON(flags, mask)	((flags) |= (mask))
83 #define	TURNOFF(flags, mask)	((flags) &= ~(mask))
84 #define	ISON(flags, mask)	(((flags) & (mask)) == (mask))
85 #define	ISOFF(flags, mask)	(((flags) & (mask)) != (mask))
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _DEFLT_H */
92