|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -470,7 +469,7 @@ char *yon_cut(char *source, int size, int startpos)
|
|
|
|
|
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 +693,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 +949,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;
|
|
|
|
|
|