]>
jfr.im git - solanum.git/blob - include/newconf.h
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 $
5 #ifndef _NEWCONF_H_INCLUDED
6 #define _NEWCONF_H_INCLUDED
12 void (*cf_func
) (void *);
20 int (*tc_sfunc
) (struct TopConf
*);
21 int (*tc_efunc
) (struct TopConf
*);
22 rb_dlink_list tc_items
;
23 struct ConfEntry
*tc_entries
;
27 #define CF_QSTRING 0x01 /* quoted string */
29 #define CF_STRING 0x03 /* unquoted string */
33 #define CF_MTYPE 0xFF /* mask for type */
35 /* CF_FLIST is used to allow specifying that an option accepts a list of (type)
36 * values. conf_parm_t.type will never actually have another type & CF_FLIST;
37 * it's only used as a true flag in newconf.c (which only consumes conf_parm_t
38 * structures and doesn't create them itself).
40 #define CF_FLIST 0x0100 /* flag for list */
41 #define CF_MFLAG 0xFF00 /* mask for flags */
43 /* conf_parm_t.type must be either one type OR one flag. this is pretty easy to
44 * enforce because lists always contain nested conf_parm_t structures whose
45 * .type is the real type, so it doesn't need to be stored in the top-level one
48 typedef struct conf_parm_t_stru
50 struct conf_parm_t_stru
*next
;
56 struct conf_parm_t_stru
*list
;
62 extern struct TopConf
*conf_cur_block
;
64 extern char *current_file
;
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
*);
70 void conf_report_error(const char *, ...);
71 void conf_report_warning(const char *, ...);
72 void newconf_init(void);
73 int add_conf_item(const char *topconf
, const char *name
, int type
, void (*func
) (void *));
74 int remove_conf_item(const char *topconf
, const char *name
);
75 int add_top_conf(const char *name
, int (*sfunc
) (struct TopConf
*), int (*efunc
) (struct TopConf
*), struct ConfEntry
*items
);
76 int remove_top_conf(char *name
);
77 struct TopConf
*find_top_conf(const char *name
);
78 struct ConfEntry
*find_conf_item(const struct TopConf
*top
, const char *name
);