]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* This code is in the public domain. |
2 | * $Nightmare: nightmare/include/config.h,v 1.32.2.2.2.2 2002/07/02 03:41:28 ejb Exp $ | |
3 | * $Id: newconf.h 1735 2006-07-19 02:35:40Z nenolod $ | |
4 | */ | |
5 | ||
6 | #ifndef _NEWCONF_H_INCLUDED | |
7 | #define _NEWCONF_H_INCLUDED | |
8 | ||
9 | #include <sys/types.h> | |
10 | ||
11 | #include <stdio.h> | |
12 | ||
13 | #include "tools.h" | |
14 | #include "client.h" | |
15 | ||
16 | struct ConfEntry | |
17 | { | |
18 | const char *cf_name; | |
19 | int cf_type; | |
20 | void (*cf_func) (void *); | |
21 | int cf_len; | |
22 | void *cf_arg; | |
23 | }; | |
24 | ||
25 | struct TopConf | |
26 | { | |
d7f753cd | 27 | const char *tc_name; |
212380e3 AC |
28 | int (*tc_sfunc) (struct TopConf *); |
29 | int (*tc_efunc) (struct TopConf *); | |
30 | dlink_list tc_items; | |
31 | struct ConfEntry *tc_entries; | |
32 | }; | |
33 | ||
34 | ||
35 | #define CF_QSTRING 0x01 | |
36 | #define CF_INT 0x02 | |
37 | #define CF_STRING 0x03 | |
38 | #define CF_TIME 0x04 | |
39 | #define CF_YESNO 0x05 | |
40 | #define CF_LIST 0x06 | |
41 | #define CF_ONE 0x07 | |
42 | ||
43 | #define CF_MTYPE 0xFF | |
44 | ||
45 | #define CF_FLIST 0x1000 | |
46 | #define CF_MFLAG 0xFF00 | |
47 | ||
48 | typedef struct conf_parm_t_stru | |
49 | { | |
50 | struct conf_parm_t_stru *next; | |
51 | int type; | |
52 | union | |
53 | { | |
54 | char *string; | |
55 | int number; | |
56 | struct conf_parm_t_stru *list; | |
57 | } | |
58 | v; | |
59 | } | |
60 | conf_parm_t; | |
61 | ||
62 | extern struct TopConf *conf_cur_block; | |
63 | ||
64 | extern char *current_file; | |
65 | ||
66 | int read_config(char *); | |
67 | int conf_start_block(char *, char *); | |
68 | int conf_end_block(struct TopConf *); | |
69 | int conf_call_set(struct TopConf *, char *, conf_parm_t *, int); | |
70 | void conf_report_error(const char *, ...); | |
71 | void newconf_init(void); | |
72 | int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); | |
73 | int remove_conf_item(const char *topconf, const char *name); | |
74 | int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items); | |
75 | int remove_top_conf(char *name); | |
76 | struct TopConf *find_top_conf(const char *name); | |
77 | struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name); | |
78 | ||
79 | #endif |