|
|
|
@ -878,6 +878,37 @@ char *yon_char_parsed_to_string(config_str parsed, int size, char *divider_repla
|
|
|
|
} else if (size==0&&!parsed) return "";
|
|
|
|
} else if (size==0&&!parsed) return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *yon_char_parsed_to_string_for_iters(config_str parsed, int size, char *divider_replace,int iterations){
|
|
|
|
|
|
|
|
if (parsed && size>0&& iterations>0){
|
|
|
|
|
|
|
|
char *final_string = "";
|
|
|
|
|
|
|
|
char *temp;
|
|
|
|
|
|
|
|
for (int i=0;i<iterations;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;
|
|
|
|
|
|
|
|
} else if (size==0&&!parsed) return "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config_str yon_char_parsed_cut(config_str parsed, int size, int pos){
|
|
|
|
|
|
|
|
if (size&&pos&&parsed&&size>pos){
|
|
|
|
|
|
|
|
config_str new_parsed = malloc(sizeof(char*)*pos);
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
|
|
|
if (i<pos){
|
|
|
|
|
|
|
|
new_parsed[i]=parsed[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new_parsed;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int yon_char_parsed_find_element(config_str parsed, int size, char *target){
|
|
|
|
int yon_char_parsed_find_element(config_str parsed, int size, char *target){
|
|
|
|
if (parsed&&size){
|
|
|
|
if (parsed&&size){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
@ -1294,16 +1325,20 @@ int yon_config_command_prepare(config_str *commands, int *commands_size,char *co
|
|
|
|
int parsed_size;
|
|
|
|
int parsed_size;
|
|
|
|
int done=0;
|
|
|
|
int done=0;
|
|
|
|
config_str parsed = yon_char_parse(command,&parsed_size," ");
|
|
|
|
config_str parsed = yon_char_parse(command,&parsed_size," ");
|
|
|
|
if (parsed_size>5){
|
|
|
|
int get_place = yon_char_parsed_check_exist(parsed,parsed_size,"get");
|
|
|
|
for (int j=5;j<parsed_size;j++){
|
|
|
|
if (get_place){
|
|
|
|
int new_size;
|
|
|
|
if (parsed_size>get_place+2){
|
|
|
|
config_str new_element = yon_char_parsed_new(&new_size,parsed[0],parsed[1],parsed[2],parsed[3],parsed[4],parsed[j],NULL);
|
|
|
|
for (int j=get_place+2;j<parsed_size;j++){
|
|
|
|
|
|
|
|
int new_size=get_place+2;
|
|
|
|
|
|
|
|
config_str new_element = yon_char_parsed_cut(parsed,parsed_size,get_place+2);
|
|
|
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(new_element,&new_size,parsed[j]);
|
|
|
|
*commands = yon_char_parsed_append(*commands,commands_size,yon_char_parsed_to_string(new_element,new_size," "));
|
|
|
|
*commands = yon_char_parsed_append(*commands,commands_size,yon_char_parsed_to_string(new_element,new_size," "));
|
|
|
|
done=1;
|
|
|
|
done=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return done;
|
|
|
|
return done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1686,7 +1721,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
__yon__config__strings->load_command=config_load;
|
|
|
|
__yon__config__strings->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]);
|
|
|
|
__yon__config__strings->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
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))){
|
|
|
|
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
@ -1700,7 +1735,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1711,7 +1746,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
current->load_command=config_load;
|
|
|
|
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," ");
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
if (!__yon__config__strings||!(current=(yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
@ -1737,7 +1772,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
__yon__config__strings->load_command=config_load;
|
|
|
|
__yon__config__strings->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]);
|
|
|
|
__yon__config__strings->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
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))){
|
|
|
|
else if ((current = (yon_config_parameter*)yon_dictionary_get((dictionary**)&__yon__config__strings,key))){
|
|
|
|
@ -1753,7 +1788,7 @@ void yon_config_register(char *key, char *config_load, void *data){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
config_str section = yon_char_parse(config_load,&size," ");
|
|
|
|
current->section=yon_char_new(section[4]);
|
|
|
|
current->section=yon_char_new(section[yon_char_parsed_check_exist(section,size,"get")+1]);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
yon_char_parsed_free(section,size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -2038,29 +2073,31 @@ char *yon_config_parameter_prepare_command(char *command, char *path, char *sect
|
|
|
|
if (!yon_char_is_empty(command)){
|
|
|
|
if (!yon_char_is_empty(command)){
|
|
|
|
int size=0;
|
|
|
|
int size=0;
|
|
|
|
config_str parsed = yon_char_parse(command,&size," ");
|
|
|
|
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 (path&&!strcmp(path,"")){
|
|
|
|
if (path&&!strcmp(path,"")){
|
|
|
|
if (size>4&&!strcmp(parsed[1],"--source")){
|
|
|
|
if (source_pos>-1&&size>source_pos+1){
|
|
|
|
free(parsed[1]);
|
|
|
|
free(parsed[source_pos]);
|
|
|
|
parsed[1]=yon_char_new("");
|
|
|
|
parsed[source_pos]=yon_char_new("");
|
|
|
|
free(parsed[2]);
|
|
|
|
free(parsed[source_pos+1]);
|
|
|
|
parsed[2]=yon_char_new("");
|
|
|
|
parsed[source_pos+1]=yon_char_new("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (path){
|
|
|
|
} else if (path){
|
|
|
|
if (size>4&&!strcmp(parsed[1],"--source")){
|
|
|
|
if (source_pos>-1&&size>source_pos+1){
|
|
|
|
free(parsed[2]);
|
|
|
|
free(parsed[source_pos+1]);
|
|
|
|
parsed[2]=yon_char_new(path);
|
|
|
|
parsed[source_pos+1]=yon_char_new(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (section){
|
|
|
|
if (section){
|
|
|
|
if (size>4){
|
|
|
|
if (size>get_pos+2){
|
|
|
|
free(parsed[4]);
|
|
|
|
free(parsed[get_pos+1]);
|
|
|
|
parsed[4]=yon_char_new(section);
|
|
|
|
parsed[get_pos+1]=yon_char_new(section);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parameter){
|
|
|
|
if (parameter){
|
|
|
|
if (size>5){
|
|
|
|
if (size>get_pos+3){
|
|
|
|
free(parsed[5]);
|
|
|
|
free(parsed[get_pos+2]);
|
|
|
|
parsed[5] = yon_char_new(parameter);
|
|
|
|
parsed[get_pos+2] = yon_char_new(parameter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
char *final = yon_char_parsed_to_string(parsed,size," ");
|
|
|
|
char *final = yon_char_parsed_to_string(parsed,size," ");
|
|
|
|
|