|
|
|
@ -14,22 +14,17 @@ typedef struct yon_config_parameter
|
|
|
|
char *save_command;
|
|
|
|
char *save_command;
|
|
|
|
char *load_command;
|
|
|
|
char *load_command;
|
|
|
|
int compare_ignore;
|
|
|
|
int compare_ignore;
|
|
|
|
|
|
|
|
char *regex_mask_pattern;
|
|
|
|
} yon_config_parameter;
|
|
|
|
} yon_config_parameter;
|
|
|
|
|
|
|
|
|
|
|
|
yon_config_parameter *yon_config_parameter_new_with_data(char *key, void *data){
|
|
|
|
yon_config_parameter *yon_config_parameter_new_with_data(char *key, void *data){
|
|
|
|
yon_config_parameter *param = yon_remalloc(NULL,sizeof(yon_config_parameter));
|
|
|
|
yon_config_parameter *param = yon_remalloc(NULL,sizeof(yon_config_parameter));
|
|
|
|
|
|
|
|
memset(param,0,sizeof(yon_config_parameter));
|
|
|
|
param->data=yon_char_new(data);
|
|
|
|
param->data=yon_char_new(data);
|
|
|
|
param->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
param->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
param->first=param;
|
|
|
|
param->first=param;
|
|
|
|
param->flag1=1;
|
|
|
|
param->flag1=1;
|
|
|
|
param->key=yon_char_new(key);
|
|
|
|
param->key=yon_char_new(key);
|
|
|
|
param->next=NULL;
|
|
|
|
|
|
|
|
param->prev=NULL;
|
|
|
|
|
|
|
|
param->section=NULL;
|
|
|
|
|
|
|
|
param->ignore=0;
|
|
|
|
|
|
|
|
param->save_command=NULL;
|
|
|
|
|
|
|
|
param->load_command=NULL;
|
|
|
|
|
|
|
|
param->compare_ignore=0;
|
|
|
|
|
|
|
|
return param;
|
|
|
|
return param;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -128,6 +123,30 @@ int yon_config_set_ignore(char *key){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_config_set_mask_pattern(const char *key, const char *mask_pattern){
|
|
|
|
|
|
|
|
if (yon_char_is_empty(key)) return 0;
|
|
|
|
|
|
|
|
yon_config_parameter *parameter = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,(char*)key);
|
|
|
|
|
|
|
|
if (!parameter) return 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(parameter->regex_mask_pattern))
|
|
|
|
|
|
|
|
free(parameter->regex_mask_pattern);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (yon_char_is_empty(mask_pattern)){
|
|
|
|
|
|
|
|
parameter->regex_mask_pattern = NULL;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
parameter->regex_mask_pattern = yon_char_new(mask_pattern);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_config_get_mask_pattern(const char *key){
|
|
|
|
|
|
|
|
if (yon_char_is_empty(key)) return NULL;
|
|
|
|
|
|
|
|
yon_config_parameter *parameter = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,(char*)key);
|
|
|
|
|
|
|
|
if (!parameter) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return yon_char_new(parameter->regex_mask_pattern);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int yon_config_remove_ignore(char *key){
|
|
|
|
int yon_config_remove_ignore(char *key){
|
|
|
|
dictionary *dict = yon_dictionary_get(&__yon_config_ignored,key);
|
|
|
|
dictionary *dict = yon_dictionary_get(&__yon_config_ignored,key);
|
|
|
|
if (dict) {
|
|
|
|
if (dict) {
|
|
|
|
@ -897,11 +916,6 @@ enum YON_CONFIG_SAVED_TYPE yon_config_register(char *key,char *config_load, char
|
|
|
|
current = __yon__config__strings;
|
|
|
|
current = __yon__config__strings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch(current->flag1){
|
|
|
|
|
|
|
|
case -1: save_type = YON_CONFIG_SAVED_REMOVED; break;
|
|
|
|
|
|
|
|
case 1: save_type = YON_CONFIG_SAVED_CHANGED; break;
|
|
|
|
|
|
|
|
default: save_type = YON_CONFIG_SAVED_NEW; break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
config_load = yon_char_new(config_load);
|
|
|
|
config_load = yon_char_new(config_load);
|
|
|
|
|
|
|
|
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
current->data_type=DICTIONARY_CHAR_TYPE;
|
|
|
|
@ -915,6 +929,11 @@ enum YON_CONFIG_SAVED_TYPE yon_config_register(char *key,char *config_load, char
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
yon_config_set_ignore(key);
|
|
|
|
current->flag1 = 0;
|
|
|
|
current->flag1 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(current->flag1){
|
|
|
|
|
|
|
|
case -1: save_type = YON_CONFIG_SAVED_REMOVED; break;
|
|
|
|
|
|
|
|
case 1: save_type = YON_CONFIG_SAVED_CHANGED; break;
|
|
|
|
|
|
|
|
default: save_type = YON_CONFIG_SAVED_NEW; break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return save_type;
|
|
|
|
return save_type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|