Updated to recent version of Christoph's init, the version I had was way
[unix-history] / sbin / init.chmr / cf_defs.h
CommitLineData
9a6eb889
NW
1/*
2 * Copyright (c) 1993 Christoph M. Robitschko
800ffe89
NW
3 * All rights reserved.
4 *
800ffe89
NW
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
9a6eb889
NW
15 * This product includes software developed by Christoph M. Robitschko
16 * 4. The name of the author may not be used to endorse or promote products
17 * derived from this software withough specific prior written permission
800ffe89 18 *
9a6eb889
NW
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
800ffe89
NW
29 */
30
31/*
32 * cf_defs.h
33 * typedefs and defines for the configuration subsystem.
34 */
35
36struct Command {
37 char *name; /* command name / value description */
38 short level; /* level of command nesting */
39 u_char type; /* type of entry (exact, string, int) */
40 u_char flags; /* additional flags */
41 void *var; /* Pointer to variable to assign to */
42 union {
43 int intval; /* Integer value to assign to *var */
44 char *chval; /* String ... */
45 } val;
46 };
47
48
49/* defines for the level field */
50#define SUB 0x100 /* There must be another argument */
51#define OPT 0x200 /* There can be another argument (not yet impl) */
52#define LEVEL 0x0ff /* Flags masked off */
53
54/* Valid types */
55#define T_EX 0x00 /* Must match exact */
56#define T_STR 0x01 /* Matches any string */
57#define T_INT 0x02 /* Matches an integer */
58#define T_BYTE 0x03 /* Matches a byte expression (1m = 1024k == 1024 == 1048576b) */
59#define T_TIME 0x04 /* Matches a time expression (1:00:00 == 1h == 60m == 3600s == 3600) */
60
61/* values for the flags field */
62#define NRAISE 0x01 /* Variable can be lowered but not raised */
63#define MAXVAL 0x02 /* intval contains the maximum allowed value */
64#define CFUNC 0x04 /* Call the function *(void (*)())var(argc, argv) */
65
66
67#define NOVAR NULL, {0}