|
|
|
|
@ -1302,24 +1302,25 @@ int yon_config_load_register_no_cleaning(YON_CONFIG_TYPE config_type,char *secti
|
|
|
|
|
free(yon_char_divide(final_str,0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dictionary *dicte = yon_dictionary_get((dictionary**)&__yon__config__strings,key);
|
|
|
|
|
yon_config_parameter *cur_config = (config_type!=YON_CONFIG_DEFAULT? __yon__config__strings:__yon__config__default__strings);
|
|
|
|
|
dictionary *dicte = yon_dictionary_get((dictionary**)&cur_config,key);
|
|
|
|
|
if (!dicte){
|
|
|
|
|
yon_config_parameter_add_or_create_if_exists_with_data(__yon__config__strings,key,yon_char_new(final_str));
|
|
|
|
|
yon_config_parameter_add_or_create_if_exists_with_data(cur_config,key,yon_char_new(final_str));
|
|
|
|
|
} else {
|
|
|
|
|
if (strcmp((char*)dicte->data,final_str)){
|
|
|
|
|
__yon__config__strings->data=final_str;
|
|
|
|
|
cur_config->data=final_str;
|
|
|
|
|
} else {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings->flag1=0;
|
|
|
|
|
cur_config->flag1=0;
|
|
|
|
|
yon_config_remove_ignore(key);
|
|
|
|
|
if (config_type==YON_CONFIG_DEFAULT){
|
|
|
|
|
__yon__config__strings->flag1=-2;
|
|
|
|
|
cur_config->flag1=-2;
|
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
__yon__config__strings->section=dict->key;
|
|
|
|
|
cur_config->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
cur_config->section=dict->key;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free(command);
|
|
|
|
|
@ -1751,104 +1752,110 @@ int yon_config_clean(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
|
key=yon_char_new(key);
|
|
|
|
|
config_load=yon_char_new(config_load);
|
|
|
|
|
yon_config_parameter *current = NULL;
|
|
|
|
|
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);
|
|
|
|
|
yon_config_parameter* dict=NULL;
|
|
|
|
|
for_dictionaries(dict,__yon__config__strings){
|
|
|
|
|
if (!dict->next){
|
|
|
|
|
__yon__config__strings=dict;
|
|
|
|
|
if (!yon_char_is_empty(key)){
|
|
|
|
|
key=yon_char_new(key);
|
|
|
|
|
config_load=yon_char_new(config_load);
|
|
|
|
|
yon_config_parameter *current = NULL;
|
|
|
|
|
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);
|
|
|
|
|
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,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 {
|
|
|
|
|
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*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
|
__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[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
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_config_ignored = yon_dictionary_rip(__yon_config_ignored);
|
|
|
|
|
}
|
|
|
|
|
__yon__config__strings = (yon_config_parameter*)yon_dictionary_get_last((dictionary*)__yon__config__strings);
|
|
|
|
|
__yon__config__strings->flag1=1;
|
|
|
|
|
__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," ");
|
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))) {
|
|
|
|
|
current->data=NULL;
|
|
|
|
|
current->flag1=0;
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
|
yon_config_parameter *cur_default = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__default__strings,current->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_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[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
if (!cur_default||(cur_default&&strcmp((char*)cur_default->data,(char*)current->data))){
|
|
|
|
|
yon_config_remove_by_key(current->key);
|
|
|
|
|
}
|
|
|
|
|
__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;
|
|
|
|
|
} else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))) {
|
|
|
|
|
current->data=NULL;
|
|
|
|
|
current->flag1=0;
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
|
current->load_command=config_load;
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
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);
|
|
|
|
|
} 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," ");
|
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
__yon__config__strings->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
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[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -2149,6 +2156,10 @@ char *yon_config_parameter_prepare_command(char *command, char *path, char *sect
|
|
|
|
|
config_str parsed = yon_char_parse(command,&size," ");
|
|
|
|
|
int source_pos=yon_char_parsed_check_exist(parsed,size,"--source");
|
|
|
|
|
int get_pos = yon_char_parsed_check_exist(parsed,size,"get");
|
|
|
|
|
if (source_pos==-1) {
|
|
|
|
|
source_pos = yon_char_parsed_check_exist(parsed,size,"--target");
|
|
|
|
|
get_pos = yon_char_parsed_check_exist(parsed,size,"set");
|
|
|
|
|
}
|
|
|
|
|
if (path&&!strcmp(path,"")){
|
|
|
|
|
if (source_pos>-1&&size>source_pos+1){
|
|
|
|
|
free(parsed[source_pos]);
|
|
|
|
|
|