|
|
|
|
@ -306,6 +306,26 @@ char *yon_config_command_get_section(const char *command){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse((char*)command,&size," ");
|
|
|
|
|
int section_pos = yon_config_command_get_section_pos(parsed,size);
|
|
|
|
|
if (section_pos==-1) return NULL;
|
|
|
|
|
char *section = yon_char_new(parsed[section_pos]);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
return section;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int yon_config_command_get_path_pos(config_str parsed, int size){
|
|
|
|
|
for (int i=0;i<size-1;i++){
|
|
|
|
|
if (!strcmp(parsed[i],"--source")||!strcmp(parsed[i],"--target")){
|
|
|
|
|
return i+1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *yon_config_command_get_path(const char *command){
|
|
|
|
|
int size;
|
|
|
|
|
config_str parsed = yon_char_parse((char*)command,&size," ");
|
|
|
|
|
int section_pos = yon_config_command_get_path_pos(parsed,size);
|
|
|
|
|
if (section_pos==-1) return NULL;
|
|
|
|
|
char *section = yon_char_new(parsed[section_pos]);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
return section;
|
|
|
|
|
|