|
|
|
@ -371,6 +371,7 @@ int yon_config_command_get_section_pos(const char *command){
|
|
|
|
for (int i=0;i<size-1;i++){
|
|
|
|
for (int i=0;i<size-1;i++){
|
|
|
|
if (!strcmp(parsed[i],"get")||!strcmp(parsed[i],"set")||!strcmp(parsed[i],"remove")){
|
|
|
|
if (!strcmp(parsed[i],"get")||!strcmp(parsed[i],"set")||!strcmp(parsed[i],"remove")){
|
|
|
|
pos = i+1;
|
|
|
|
pos = i+1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
@ -1028,11 +1029,31 @@ config_str yon_config_load_file(FILE *file, int *str_len) {
|
|
|
|
return output_strings;
|
|
|
|
return output_strings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_config_parameter_wrap(char *parameter_key){
|
|
|
|
|
|
|
|
char *cur = NULL;
|
|
|
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
config_str parsed = yon_char_parse(parameter_key,&size,"[");
|
|
|
|
|
|
|
|
char *temp = yon_char_append("\'",parsed[1]);
|
|
|
|
|
|
|
|
free(parsed[1]);
|
|
|
|
|
|
|
|
parsed[1] = temp;
|
|
|
|
|
|
|
|
char *half_wrapped = yon_char_parsed_to_string_full(parsed,size,"[");
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
|
|
|
parsed = yon_char_parse(half_wrapped,&size,"]");
|
|
|
|
|
|
|
|
temp = yon_char_append_c(parsed[size-2],'\'');
|
|
|
|
|
|
|
|
free(parsed[size-2]);
|
|
|
|
|
|
|
|
parsed[size-2] = temp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *full_wrapped = yon_char_parsed_to_string_full(parsed,size,"]");
|
|
|
|
|
|
|
|
free(half_wrapped);
|
|
|
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
|
|
|
return full_wrapped;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_config_parameter_to_string(yon_config_parameter *parameter, int insert_section){
|
|
|
|
char *yon_config_parameter_to_string(yon_config_parameter *parameter, int insert_section){
|
|
|
|
if (parameter){
|
|
|
|
if (parameter){
|
|
|
|
char *param_string = NULL;
|
|
|
|
char *param_string = NULL;
|
|
|
|
param_string = yon_char_unite(insert_section?parameter->section:"",insert_section?" ":"", parameter->key,parameter->flag1==-1?NULL:"","=\'",parameter->data,"\'",NULL);
|
|
|
|
char *parameter_wrapped = yon_config_parameter_wrap(parameter->key);
|
|
|
|
|
|
|
|
param_string = yon_char_unite(insert_section?parameter->section:"",insert_section?" ":"", parameter_wrapped,parameter->flag1==-1?NULL:"","=\'",parameter->data,"\'",NULL);
|
|
|
|
return param_string;
|
|
|
|
return param_string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
@ -1120,7 +1141,7 @@ config_str yon_config_get_save_parameters_by_list(int *size, config_str paramete
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
char *string = yon_char_unite("remove"," ",parameters[i],NULL);
|
|
|
|
char *string = yon_char_unite("remove"," ",yon_config_parameter_wrap(parameters[i]),NULL);
|
|
|
|
yon_char_parsed_add_or_create_if_exists(removed,&removed_size,string);
|
|
|
|
yon_char_parsed_add_or_create_if_exists(removed,&removed_size,string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|