︙ | | | ︙ | |
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
|
} else {
localvar = NULL;
}
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);
}
break;
case LC_MODE_VAR:
return(lc_handle_type(handler->type, value, handler->data));
break;
}
|
<
<
<
>
|
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
} else {
localvar = NULL;
}
switch (handler->mode) {
case LC_MODE_CALLBACK:
if (handler->callback != NULL) {
retval = handler->callback(localvar, var, varargs, value, flags, handler->extra);
if (retval < 0) {
lc_errno = LC_ERR_CALLBACK;
}
return(retval);
}
break;
case LC_MODE_VAR:
return(lc_handle_type(handler->type, value, handler->data));
break;
}
|
︙ | | | ︙ | |
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
|
}
int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
struct lc_varhandler_st *handler = NULL;
const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;
lc_errno = LC_ERR_NONE;
lc_err_usererrmsg = NULL;
lastcomponent_var = strrchr(var, '.');
if (lastcomponent_var == NULL) {
lastcomponent_var = var;
} else {
lastcomponent_var++;
}
|
<
<
<
|
806
807
808
809
810
811
812
813
814
815
816
817
818
819
|
}
int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
struct lc_varhandler_st *handler = NULL;
const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;
lastcomponent_var = strrchr(var, '.');
if (lastcomponent_var == NULL) {
lastcomponent_var = var;
} else {
lastcomponent_var++;
}
|
︙ | | | ︙ | |
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
|
return(-1);
}
int lc_register_callback(const char *var, char opt, lc_var_type_t type, int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *extra) {
struct lc_varhandler_st *newhandler = NULL;
lc_errno = LC_ERR_NONE;
lc_err_usererrmsg = NULL;
newhandler = malloc(sizeof(*newhandler));
if (newhandler == NULL) {
return(-1);
}
if (var == NULL) {
|
<
<
<
|
855
856
857
858
859
860
861
862
863
864
865
866
867
868
|
return(-1);
}
int lc_register_callback(const char *var, char opt, lc_var_type_t type, int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *extra) {
struct lc_varhandler_st *newhandler = NULL;
newhandler = malloc(sizeof(*newhandler));
if (newhandler == NULL) {
return(-1);
}
if (var == NULL) {
|
︙ | | | ︙ | |
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
|
return(0);
}
int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
struct lc_varhandler_st *newhandler = NULL;
lc_errno = LC_ERR_NONE;
lc_err_usererrmsg = NULL;
newhandler = malloc(sizeof(*newhandler));
if (newhandler == NULL) {
return(-1);
}
if (var == NULL) {
|
<
<
<
|
881
882
883
884
885
886
887
888
889
890
891
892
893
894
|
return(0);
}
int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
struct lc_varhandler_st *newhandler = NULL;
newhandler = malloc(sizeof(*newhandler));
if (newhandler == NULL) {
return(-1);
}
if (var == NULL) {
|
︙ | | | ︙ | |
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
|
return(0);
}
int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
int chkretval = 0;
lc_errno = LC_ERR_NONE;
lc_err_usererrmsg = NULL;
switch (type) {
case LC_CONF_SECTION:
chkretval = lc_process_conf_section(appname, pathname);
break;
case LC_CONF_APACHE:
chkretval = lc_process_conf_apache(appname, pathname);
break;
|
<
<
<
|
907
908
909
910
911
912
913
914
915
916
917
918
919
920
|
return(0);
}
int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
int chkretval = 0;
switch (type) {
case LC_CONF_SECTION:
chkretval = lc_process_conf_section(appname, pathname);
break;
case LC_CONF_APACHE:
chkretval = lc_process_conf_apache(appname, pathname);
break;
|
︙ | | | ︙ | |
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
|
return(retval);
}
void lc_cleanup(void) {
struct lc_varhandler_st *handler = NULL, *next = NULL;
lc_errno = LC_ERR_NONE;
lc_err_usererrmsg = NULL;
handler = varhandlers;
while (handler != NULL) {
if (handler->var != NULL) {
free(handler->var);
}
next = handler->_next;
|
<
<
<
|
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
|
return(retval);
}
void lc_cleanup(void) {
struct lc_varhandler_st *handler = NULL, *next = NULL;
handler = varhandlers;
while (handler != NULL) {
if (handler->var != NULL) {
free(handler->var);
}
next = handler->_next;
|
︙ | | | ︙ | |