PM_PROC_NR shouldn't be hardcoded as the caller.
[minix.git] / include / configfile.h
blobf3801807b21f705bf8f16a17d028873d0e980a2f
1 /* configfile.h - Generic configuration file format.
2 * Author: Kees J. Bot
3 * 5 Jun 1999
4 */
5 #ifndef _CONFIGFILE_H
6 #define _CONFIGFILE_H
8 /* Data can only be modified inside the library. */
9 #ifndef _c
10 #define _c const
11 #endif
13 typedef _c struct config { /* Contents of a generic configuration file. */
14 _c struct config *next; /* Next configuration file thing. */
15 _c struct config *list; /* For a { sublist }. */
16 const char *file; /* File and line where this is found. */
17 unsigned line;
18 int flags; /* Special flags. */
19 char word[1]; /* Payload. */
20 } config_t;
22 #define CFG_CLONG 0x0001 /* strtol(word, &end, 0) is valid. */
23 #define CFG_OLONG 0x0002 /* strtol(word, &end, 010). */
24 #define CFG_DLONG 0x0004 /* strtol(word, &end, 10). */
25 #define CFG_XLONG 0x0008 /* strtol(word, &end, 0x10). */
26 #define CFG_CULONG 0x0010 /* strtoul(word, &end, 0). */
27 #define CFG_OULONG 0x0020 /* strtoul(word, &end, 010). */
28 #define CFG_DULONG 0x0040 /* strtoul(word, &end, 10). */
29 #define CFG_XULONG 0x0080 /* strtoul(word, &end, 0x10). */
30 #define CFG_STRING 0x0100 /* The word is enclosed in quotes. */
31 #define CFG_SUBLIST 0x0200 /* This is a sublist, so no word. */
32 #define CFG_ESCAPED 0x0400 /* Escapes are still marked with \. */
34 config_t *config_read(const char *_file, int flags, config_t *_cfg);
35 void config_delete(config_t *_cfg);
36 int config_renewed(config_t *_cfg);
37 size_t config_length(config_t *_cfg);
38 #define config_issub(cfg) (!!((cfg)->flags & CFG_SUBLIST))
39 #define config_isatom(cfg) (!config_issub(cfg))
40 #define config_isstring(cfg) (!!((cfg)->flags & CFG_STRING))
42 #undef _c
44 #endif /* _CONFIGFILE_H */