|
|
|
@ -1554,48 +1554,59 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
key=yon_char_new(key);
|
|
|
|
key=yon_char_new(key);
|
|
|
|
config_load=yon_char_new(config_load);
|
|
|
|
config_load=yon_char_new(config_load);
|
|
|
|
yon_config_parameter *current = NULL;
|
|
|
|
yon_config_parameter *current = NULL;
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
if (data){
|
|
|
|
{
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
if (__yon__config__strings){
|
|
|
|
{
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
if (__yon__config__strings){
|
|
|
|
yon_config_parameter* dict=NULL;
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
for_dictionaries(dict,__yon__config__strings){
|
|
|
|
yon_config_parameter* dict=NULL;
|
|
|
|
if (!dict->next){
|
|
|
|
for_dictionaries(dict,__yon__config__strings){
|
|
|
|
__yon__config__strings=dict;
|
|
|
|
if (!dict->next){
|
|
|
|
|
|
|
|
__yon__config__strings=dict;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
__yon__config__strings=yon_config_parameter_append_with_data(__yon__config__strings,key,data_copy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
|
|
|
|
__yon__config__strings=yon_config_parameter_new_with_data(key,yon_char_new(data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__yon__config__strings=yon_config_parameter_append_with_data(__yon__config__strings,key,data_copy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
__yon__config__strings = (yon_config_parameter*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
char *data_copy = yon_char_new(data);
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
__yon__config__strings=yon_config_parameter_new_with_data(key,yon_char_new(data));
|
|
|
|
__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){
|
|
|
|
|
|
|
|
current->data=yon_char_new(data);
|
|
|
|
|
|
|
|
current->flag1=1;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__yon__config__strings = (yon_config_parameter*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
} else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))) {
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
current->data=NULL;
|
|
|
|
__yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
current->flag1=0;
|
|
|
|
__yon__config__strings->load_command=config_load;
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
__yon__config__strings->section=yon_char_new(section[4]);
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
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){
|
|
|
|
|
|
|
|
current->data=yon_char_new(data);
|
|
|
|
|
|
|
|
current->flag1=1;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_config_load(char *command, int *str_len){
|
|
|
|
config_str yon_config_load(char *command, int *str_len){
|
|
|
|
@ -1855,7 +1866,7 @@ char *yon_config_save_simple(YON_CONFIG_TYPE target, char *path){
|
|
|
|
if (parameters){
|
|
|
|
if (parameters){
|
|
|
|
yon_char_parsed_prepend_strings(parameters,parameters_size,ubconfig_set_command(path));
|
|
|
|
yon_char_parsed_prepend_strings(parameters,parameters_size,ubconfig_set_command(path));
|
|
|
|
char *final_command = yon_char_parsed_to_string(parameters,parameters_size,";");
|
|
|
|
char *final_command = yon_char_parsed_to_string(parameters,parameters_size,";");
|
|
|
|
printf("%s\n",final_command);
|
|
|
|
yon_debug_output("%s\n",final_command);
|
|
|
|
FILE *file = popen(final_command,"r");
|
|
|
|
FILE *file = popen(final_command,"r");
|
|
|
|
if (file){
|
|
|
|
if (file){
|
|
|
|
int file_size=0;
|
|
|
|
int file_size=0;
|
|
|
|
|