Index: lc_register_callback.3.in ================================================================== --- lc_register_callback.3.in +++ lc_register_callback.3.in @@ -171,15 +171,10 @@ lc_flags_t flags, void *extra) { if (flags == LC_FLAGS_SECTIONEND) { return(LC_CBRET_OKAY); } - if (flags != LC_FLAGS_SECTIONSTART) { - lc_seterrstr("IfModule can only be used as a \\ - section."); - return(LC_CBRET_ERROR); - } if (arguments == NULL) { lc_seterrstr("You must specify an argument to \\ IfModule."); return(LC_CBRET_ERROR); } @@ -192,13 +187,13 @@ return(LC_CBRET_OKAY); } int main(int argc, char **argv) { - int lc_rc_ret = 0, lc_p_ret; + int lc_rc_ret, lc_p_ret; - lc_rc_ret = lc_register_callback("*.IfModule", 0, LC_VAR_NONE, + lc_rc_ret = lc_register_callback("*.IfModule", 0, LC_VAR_SECTION, callback_ifmodule, NULL); if (lc_rc_ret != 0) { fprintf(stderr, "Error registering callback.\\n"); return(EXIT_FAILURE); Index: libconfig.c ================================================================== --- libconfig.c +++ libconfig.c @@ -298,18 +298,18 @@ *dataval = lc_process_size(value, endptr); return(0); } - -static int lc_handle_type(lc_var_type_t type, const char *value, void *data) { +int lc_handle_type(lc_var_type_t type, const char *value, void *data) { const char *next; int is_list; is_list = type & LC_VAR_LIST; if (is_list == LC_VAR_LIST) { + /* XXX */ } switch (type) { case LC_VAR_STRING: return(lc_process_var_string(data, value, &next)); @@ -375,11 +375,12 @@ case LC_VAR_UNKNOWN: case LC_VAR_SECTION: case LC_VAR_SECTIONSTART: case LC_VAR_SECTIONEND: return(0); - break; + case LC_VAR_LIST: + return(0); } return(-1); } @@ -399,10 +400,13 @@ } switch (handler->mode) { case LC_MODE_CALLBACK: if (handler->callback != NULL) { + lc_errno = LC_ERR_NONE; + lc_err_usererrmsg = NULL; + retval = handler->callback(localvar, var, varargs, value, flags, handler->extra); if (retval < 0) { lc_errno = LC_ERR_CALLBACK; } return(retval); Index: libconfig.h.in ================================================================== --- libconfig.h.in +++ libconfig.h.in @@ -4,14 +4,10 @@ extern "C" { !endif __BLANK_LINE__ -!define LC_VAR_LIST 0x80 - -__BLANK_LINE__ - typedef enum { LC_CONF_SECTION, LC_CONF_APACHE, LC_CONF_COLON, LC_CONF_EQUAL, @@ -47,10 +43,11 @@ LC_VAR_IP, LC_VAR_IP4, LC_VAR_IP6, LC_VAR_HOSTNAME4, LC_VAR_HOSTNAME6, + LC_VAR_LIST = 0x80 } lc_var_type_t; __BLANK_LINE__ typedef enum { @@ -81,10 +78,11 @@ int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt); lc_err_t lc_geterrno(void); void lc_seterrstr(const char *usererrstr); char *lc_geterrstr(void); int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type); +int lc_handle_type(lc_var_type_t type, const char *value, void *data); void lc_cleanup(void); __BLANK_LINE__ !define LC_CBRET_IGNORESECTION (255)