source: trunk/minix/include/configfile.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 1.6 KB
Line 
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
7
8/* Data can only be modified inside the library. */
9#ifndef _c
10#define _c const
11#endif
12
13typedef _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;
21
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 \. */
33
34config_t *config_read(const char *_file, int flags, config_t *_cfg);
35void config_delete(config_t *_cfg);
36int config_renewed(config_t *_cfg);
37size_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))
41
42#undef _c
43
44#endif /* _CONFIGFILE_H */
Note: See TracBrowser for help on using the repository browser.