@ -286,13 +286,12 @@ dictionary *yon_dictionary_rip(dictionary *dict)
else if ( ! dict - > next )
{
dictionary * prev = dict - > prev ;
free ( dict ) ;
if ( prev )
{
prev - > next = NULL ;
return prev ;
}
else
return dict ;
}
else if ( ! dict - > prev )
{
@ -301,16 +300,16 @@ dictionary *yon_dictionary_rip(dictionary *dict)
{
yon_dictionary_make_first ( next ) ;
next - > prev = NULL ;
free ( dict ) ;
return next ;
}
else
return dict ;
}
else
{
dictionary * next = dict - > next , * prev = dict - > prev ;
next - > prev = prev ;
prev - > next = next ;
free ( dict ) ;
return next ;
}
}
@ -467,10 +466,31 @@ char *yon_cut(char *source, int size, int startpos)
return NULL ;
}
int yon_char_check_begins_with ( char * haystack , char * needle ) {
if ( ! yon_char_is_empty ( haystack ) & & ! yon_char_is_empty ( needle ) & & strlen ( haystack ) > = strlen ( needle ) ) {
int size = strlen ( needle ) ;
for ( int i = 0 ; i < size ; i + + ) {
if ( haystack [ i ] ! = needle [ i ] )
return - 1 ;
}
return 1 ;
}
return - 1 ;
}
char * yon_char_parsed_check_exist_begins_with ( char * * target , int size , char * compare ) {
for ( int i = 0 ; i < size ; i + + ) {
if ( yon_char_check_begins_with ( target [ i ] , compare ) ! = - 1 ) {
return yon_char_new ( target [ i ] ) ;
}
}
return NULL ;
}
config_str yon_char_wrap_to_lines ( char * target , unsigned int line_count , unsigned int * final_size ) {
if ( ! yon_char_is_empty ( target ) & & line_count ) {
( * final_size ) = 0 ;
unsigned int spaces = yon_char_find_count ( target , " " ) ;
unsigned int spaces = yon_char_ count( target , " " ) ;
float line_spaces = ( float ) spaces / line_count ;
float left = spaces % line_count ;
@ -694,7 +714,6 @@ int yon_char_parsed_check_exist(char **parameters, int size, char *param){
return - 1 ;
}
int yon_char_parsed_strstr ( char * * parameters , int size , char * param ) {
if ( parameters ) {
for ( int i = 0 ; i < size ; i + + ) {
@ -951,6 +970,36 @@ int yon_char_parsed_find_element(config_str parsed, int size, char *target){
return - 1 ;
}
int yon_char_find_last_symbol_before_length ( char * string , char target , int length ) {
if ( yon_char_is_empty ( string ) | | strlen ( string ) < length | | length < 1 ) return - 1 ;
int last = - 1 ;
for ( int i = 0 ; i < length ; i + + ) {
if ( string [ i ] = = target ) {
last = i ;
}
}
return last ;
}
config_str yon_char_wrap_to_length ( char * target , unsigned int length , int * size ) {
( * size ) = 0 ;
if ( ! yon_char_is_empty ( target ) & & strlen ( target ) > length ) {
config_str final = NULL ;
char * current = yon_char_new ( target ) ;
for ( ; strlen ( current ) > length ; ) {
int last = yon_char_find_last_symbol_before_length ( target , ' ' , length ) ;
if ( last > - 1 ) {
char * parsed = yon_char_divide ( current , last ) ;
yon_char_parsed_add_or_create_if_exists ( final , size , parsed ) ;
free ( parsed ) ;
}
}
return final ;
}
return NULL ;
}
int yon_ubl_check_root ( ) {
if ( getuid ( ) = = 0 ) return 1 ;
else return 0 ;
@ -1274,24 +1323,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 ) ;
@ -1388,7 +1438,8 @@ int yon_config_load_config(YON_CONFIG_TYPE config_type, ...){
int command_parsed_size = 0 ;
config_str command_parsed = yon_char_parse ( command [ i ] , & command_parsed_size , " " ) ;
if ( config_type = = YON_CONFIG_DEFAULT & & ! strstr ( command_parsed [ 5 ] , " [*] " ) ) {
yon_config_register ( command_parsed [ 5 ] , command [ i ] , NULL ) ;
if ( config_type = = YON_CONFIG_DEFAULT )
yon_config_register_default ( command_parsed [ 5 ] , command [ i ] , NULL ) ;
}
yon_char_parsed_free ( command_parsed , command_parsed_size ) ;
if ( parsed_size > 0 ) {
@ -1437,14 +1488,14 @@ int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *par
char * command = NULL ;
dictionary * dict ;
for_dictionaries ( dict , sections ) {
command = yon_char_unite ( ubconfig_load_command_old , config_type = = YON_CONFIG_GLOBAL ? " global get " : config_type = = YON_CONFIG_LOCAL ? " system get " : " default get " , dict - > key , " " , yon_dictionary_get_data ( dict , char * ) , NULL ) ;
command = yon_char_unite ( ubconfig_load_command_old , config_type = = YON_CONFIG_GLOBAL ? " global get " : config_type = = YON_CONFIG_LOCAL ? " system get " : " default get " , dict - > key , " " , yon_dictionary_get_data ( dict , char * ) , NULL ) ;
FILE * output = popen ( command , " r " ) ;
int i = 0 ;
char str [ 4096 ] ;
memset ( str , 0 , 4096 ) ;
while ( fgets ( str , 4096 , output ) )
{
if ( ! yon_char_is_empty ( str ) & & strcmp ( str , " (null) \n " ) ! = 0 )
if ( strcmp ( str , " " ) ! = 0 & & strcmp ( str , " (null) \n " ) ! = 0 )
{
char * key = yon_char_divide_search ( str , " = " , - 1 ) ;
char * final_str = yon_char_divide_search ( str , " \n " , - 1 ) ;
@ -1453,24 +1504,25 @@ int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *par
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 * ) __yon__config__strings - > data , final_str ) ) {
__yon__config__strings - > data = final_str ;
if ( strcmp ( ( char * ) dicte - > 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 ) ;
@ -1723,39 +1775,43 @@ 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 ;
if ( yon_dictionary_get ( & __yon_config_ignored , key ) ) {
__yon_config_ignored = yon_dictionary_rip ( __yon_config_ignored ) ;
}
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 ) ;
}
__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 ) {
else if ( ( current = ( yon_config_parameter * ) yon_dictionary_get ( ( dictionary * * ) & __yon__config__strings , key ) ) ) {
current - > data = yon_char_new ( data ) ;
current - > flag1 = 1 ;
current - > data_type = DICTIONARY_CHAR_TYPE ;
@ -1768,59 +1824,168 @@ void yon_config_register(char *key, char *config_load, void *data){
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 ) ) ) {
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 ;
}
}
__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 , " " ) ;
__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 ) ;
}
}
}
} 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 ;
}
}
void yon_config_register_default ( char * key , char * config_load , void * data ) {
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__default__strings | | ! ( current = ( yon_config_parameter * ) yon_dictionary_get ( ( dictionary * * ) & __yon__config__default__strings , key ) ) ) {
{
if ( __yon__config__default__strings ) {
char * data_copy = yon_char_new ( data ) ;
yon_config_parameter * dict = NULL ;
for_dictionaries ( dict , __yon__config__default__strings ) {
if ( ! dict - > next ) {
__yon__config__default__strings = dict ;
}
}
__yon__config__default__strings = yon_config_parameter_append_with_data ( __yon__config__default__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 , NULL ) ;
}
else {
__yon__config__strings = yon_config_parameter_new_with_data ( key , NULL ) ;
__yon__config__default__strings = ( yon_config_parameter * ) yon_dictionary_get_last ( ( dictionary * ) __yon__config__default__strings ) ;
__yon__config__default__strings - > flag1 = 1 ;
__yon__config__default__strings - > data_type = DICTIONARY_CHAR_TYPE ;
__yon__config__default__strings - > load_command = config_load ;
int size = 0 ;
config_str section = yon_char_parse ( config_load , & size , " " ) ;
__yon__config__default__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__default__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__default__strings - > data & & strcmp ( __yon__config__default__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 & & strcmp ( ( char * ) cur_default - > data , ( char * ) current - > data ) ) ) {
yon_config_remove_by_key ( current - > key ) ;
}
}
}
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__default__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__default__strings | | ! ( current = ( yon_config_parameter * ) yon_dictionary_get ( ( dictionary * * ) & __yon__config__default__strings , key ) ) ) {
{
if ( __yon__config__default__strings ) {
yon_config_parameter * dict = NULL ;
for_dictionaries ( dict , __yon__config__default__strings ) {
if ( ! dict - > next ) {
__yon__config__default__strings = dict ;
}
}
__yon__config__default__strings = yon_config_parameter_append_with_data ( __yon__config__default__strings , key , NULL ) ;
}
else {
__yon__config__default__strings = yon_config_parameter_new_with_data ( key , NULL ) ;
}
}
yon_config_set_ignore ( key ) ;
__yon__config__default__strings = ( yon_config_parameter * ) yon_dictionary_get_last ( ( dictionary * ) __yon__config__default__strings ) ;
__yon__config__default__strings - > flag1 = 0 ;
__yon__config__default__strings - > data_type = DICTIONARY_CHAR_TYPE ;
__yon__config__default__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__default__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__default__strings , key ) ) ) {
if ( ( current - > data & & data ! = __yon__config__default__strings - > data & & strcmp ( __yon__config__default__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 ) ;
}
}
}
}
}
@ -1941,9 +2106,11 @@ config_str yon_config_get_save_parameters_by_list(int *size, config_str paramete
config_str final = NULL ;
char * current_str = NULL ;
for ( int i = 0 ; i < params_size ; i + + ) {
int found = 0 ;
current_str = parameters [ i ] ;
for_config {
if ( ! strcmp ( temp - > key , current_str ) ) {
found = 1 ;
if ( ( ( yon_config_parameter * ) temp ) - > flag1 ! = - 2 ) {
char * action = NULL ;
config_str * current = NULL ;
@ -1974,6 +2141,20 @@ config_str yon_config_get_save_parameters_by_list(int *size, config_str paramete
}
}
}
if ( ! found ) {
if ( removed ) {
int position = yon_char_parsed_find_element ( removed , removed_size , ( ( yon_config_parameter * ) temp ) - > section ) ;
if ( position > = 0 ) {
char * string = yon_char_unite ( ( removed ) [ position ] , " " , yon_config_parameter_to_string ( ( yon_config_parameter * ) temp , 0 ) , NULL ) ;
free ( removed [ position ] ) ;
removed [ position ] = string ;
}
} else {
char * string = yon_char_unite ( " remove " , " " , parameters [ i ] , NULL ) ;
yon_char_parsed_add_or_create_if_exists ( removed , & removed_size , string ) ;
}
}
}
if ( updated & & removed ) {
final = yon_char_parsed_merge ( updated , updated_size , removed , removed_size , size ) ;
@ -2105,6 +2286,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 ] ) ;
@ -2271,6 +2456,16 @@ char *yon_config_get_parameter(config_str parameters, int size, char *param)
return NULL ;
}
int yon_config_change_key ( char * target , char * key ) {
if ( ! yon_char_is_empty ( target ) & & ! yon_char_is_empty ( key ) ) {
dictionary * dict = yon_dictionary_get ( ( dictionary * * ) & __yon__config__strings , target ) ;
if ( ! dict ) return 0 ;
free ( dict - > key ) ;
dict - > key = yon_char_new ( key ) ;
}
return 0 ;
}
char * yon_file_path_proceed_spaces ( char * path ) {
int size ;
config_str parsed = yon_char_parse ( path , & size , " / " ) ;