Исправлен парсер

pull/24/head
Igor Belitskiy 2 years ago
parent 91b81894a0
commit 9d6f7337f7

@ -9,10 +9,12 @@ void load_template_load_cfg(config_all* _all_config, char* cmd) {
load_free_vector(_all_config, &_all_config->v_user);
load_free_vector(_all_config, &_all_config->v_group);
load_free_vector(_all_config, &_all_config->v_project);
free_remove_vector(_all_config, &_all_config->v_remove);
vector_init(&_all_config->v_user);
vector_init(&_all_config->v_group);
vector_init(&_all_config->v_project);
vector_init(&_all_config->v_disk_status);
vector_init(&_all_config->v_remove);
for (int index = 0; index < size; index++) {
char* str_key_value = yon_char_new(cfg[index]);
char* str_key = yon_char_divide_search(str_key_value, "=",-1);
@ -45,6 +47,7 @@ void load_template_load_cfg(config_all* _all_config, char* cmd) {
}
_all_config->flag_set_data = 0;
_all_config->flag_not_data = 1;
_all_config->flag_save = 0;
}
@ -123,12 +126,12 @@ void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index) {
}
void load_pars_values_status(disk_status* _config, char* key, char* value) {
_config->device = yon_char_new(value);
if (strstr(key,"enable")) {
_config->device = yon_char_new(key);
if (strstr(value,"enable")) {
_config->status = 1;
return;
}
else if (strstr(key,"disable")) {
else if (strstr(value,"disable")) {
_config->status = 0;
return;
}
@ -178,5 +181,17 @@ void load_free_vector(config_all* _all_config, vector* vec_config) {
}
void free_remove_vector(config_all* _all_config, vector* vec_remove) {
if (_all_config->flag_not_data == 1) {
if (vec_remove->vectorList.total > 0) {
for (int i = 0; i < vec_remove->vectorList.total; i++) {
char* str_remove = (char*)vec_remove->pfVectorGet(vec_remove, i);
free(str_remove);
}
vec_remove->pfVectorFree(vec_remove);
}
}
}

@ -11,6 +11,6 @@ void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index);
void load_pars_values(config_u_g_p* _config, char* str_value, int index);
void load_free_vector(config_all* _all_config,vector* vec_config);
void load_pars_values_status(disk_status* _config, char* key, char* value);
void free_remove_vector(config_all* _all_config, vector* vec_remove);
#endif
Loading…
Cancel
Save