|
|
|
|
@ -833,10 +833,12 @@ char *yon_char_parsed_to_string(config_str parsed, int size, char *divider_repla
|
|
|
|
|
char *final_string = "";
|
|
|
|
|
char *temp;
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
if (!yon_char_is_empty(parsed[i])){
|
|
|
|
|
temp = yon_char_unite(final_string,yon_char_is_empty(final_string)?"":divider_replace,parsed[i],NULL);
|
|
|
|
|
if (!yon_char_is_empty(final_string)) free(final_string);
|
|
|
|
|
final_string=temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!yon_char_is_empty(final_string)){
|
|
|
|
|
return final_string;
|
|
|
|
|
} else return NULL;
|
|
|
|
|
@ -1257,8 +1259,9 @@ int yon_config_load_config(YON_CONFIG_TYPE config_type, ...){
|
|
|
|
|
config_str parsed = yon_config_load(command[i],&parsed_size);
|
|
|
|
|
int command_parsed_size=0;
|
|
|
|
|
config_str command_parsed = yon_char_parse(command[i],&command_parsed_size," ");
|
|
|
|
|
if (config_type==YON_CONFIG_DEFAULT&&!strstr(command_parsed[5],"[*]")){
|
|
|
|
|
yon_config_register(command_parsed[5], command[i],NULL);
|
|
|
|
|
yon_config_set_status(command_parsed[5],0);
|
|
|
|
|
}
|
|
|
|
|
yon_char_parsed_free(command_parsed,command_parsed_size);
|
|
|
|
|
if (parsed_size>0){
|
|
|
|
|
for (int j=0;j<parsed_size;j++){
|
|
|
|
|
@ -1269,8 +1272,12 @@ int yon_config_load_config(YON_CONFIG_TYPE config_type, ...){
|
|
|
|
|
yon_char_remove_brackets(current_value);
|
|
|
|
|
char *current_command = yon_char_new(command[i]);
|
|
|
|
|
current_command = yon_config_replace_parameter(current_command,key,5);
|
|
|
|
|
char *cur_data = config(key);
|
|
|
|
|
int cur_ignore = yon_config_check_ignore(key);
|
|
|
|
|
if ((cur_ignore&¤t_value)||(!cur_ignore))
|
|
|
|
|
yon_config_register(key,current_command,current_value);
|
|
|
|
|
if (config_type==YON_CONFIG_DEFAULT){
|
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
|
yon_config_set_status(key,-2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1371,7 +1378,8 @@ int yon_config_remove_element(char *key, char *delete_target, char *divider){
|
|
|
|
|
config_str final = NULL;
|
|
|
|
|
for(int i=0;i<size;i++){
|
|
|
|
|
if (!strcmp(parsed[i],delete_target)){
|
|
|
|
|
parsed = yon_char_parsed_rip(parsed,&size,i--);
|
|
|
|
|
free(parsed[i]);
|
|
|
|
|
parsed[i]="";
|
|
|
|
|
found = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1604,7 +1612,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
|
if (yon_dictionary_get(&__yon_config_ignored, current->key)){
|
|
|
|
|
yon_dictionary_rip(__yon_config_ignored);
|
|
|
|
|
__yon_config_ignored = yon_dictionary_rip(__yon_config_ignored);
|
|
|
|
|
}
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
@ -1621,6 +1629,50 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
} else {
|
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
|
{
|
|
|
|
|
if (__yon__config__strings){
|
|
|
|
|
yon_config_parameter* dict=NULL;
|
|
|
|
|
for_dictionaries(dict,__yon__config__strings){
|
|
|
|
|
if (!dict->next){
|
|
|
|
|
__yon__config__strings=dict;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings=yon_config_parameter_append_with_data(__yon__config__strings,key,NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
__yon__config__strings=yon_config_parameter_new_with_data(key,NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
|
__yon__config__strings = (yon_config_parameter*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
|
__yon__config__strings->flag1=0;
|
|
|
|
|
__yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
__yon__config__strings->load_command=config_load;
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[4]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
|
if ((current->data&&data!=__yon__config__strings->data&&strcmp(__yon__config__strings->data,data))||!current->data){
|
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
|
|
|
|
|
|
current->data=NULL;
|
|
|
|
|
current->flag1=0;
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
|
if (yon_dictionary_get(&__yon_config_ignored, current->key)){
|
|
|
|
|
__yon_config_ignored= yon_dictionary_rip(__yon_config_ignored);
|
|
|
|
|
}
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|