]>
jfr.im git - solanum.git/blob - include/newconf.h
1 /* This code is in the public domain.
4 #ifndef _NEWCONF_H_INCLUDED
5 #define _NEWCONF_H_INCLUDED
11 void (*cf_func
) (void *);
19 int (*tc_sfunc
) (struct TopConf
*);
20 int (*tc_efunc
) (struct TopConf
*);
21 rb_dlink_list tc_items
;
22 struct ConfEntry
*tc_entries
;
26 #define CF_QSTRING 0x01 /* quoted string */
28 #define CF_STRING 0x03 /* unquoted string */
32 #define CF_MTYPE 0xFF /* mask for type */
34 /* CF_FLIST is used to allow specifying that an option accepts a list of (type)
35 * values. conf_parm_t.type will never actually have another type & CF_FLIST;
36 * it's only used as a true flag in newconf.c (which only consumes conf_parm_t
37 * structures and doesn't create them itself).
39 #define CF_FLIST 0x0100 /* flag for list */
40 #define CF_MFLAG 0xFF00 /* mask for flags */
42 /* conf_parm_t.type must be either one type OR one flag. this is pretty easy to
43 * enforce because lists always contain nested conf_parm_t structures whose
44 * .type is the real type, so it doesn't need to be stored in the top-level one
47 typedef struct conf_parm_t_stru
49 struct conf_parm_t_stru
*next
;
55 struct conf_parm_t_stru
*list
;
61 extern struct TopConf
*conf_cur_block
;
63 extern char *current_file
;
65 int read_config(char *);
66 int conf_start_block(char *, char *);
67 int conf_end_block(struct TopConf
*);
68 int conf_call_set(struct TopConf
*, char *, conf_parm_t
*);
69 void conf_report_error(const char *, ...);
70 void conf_report_warning(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
);