pull/4/head
Igor Belitskiy 2 years ago
parent 05008594c1
commit 9ded4af3be

@ -966,4 +966,14 @@ static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer
if (!terminal) return;
if (pid == -1) printf("Error\n\n\n");
else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data));
}
/**[EN]
* int yon_config_save(char *command)
* Saves config with [command]
* [RU]
*/
int philos_config_save(char *command)
{
FILE *output = popen(command, "r");
return 1;
}

@ -108,4 +108,5 @@ void yon_terminal_integrated_launch(GtkWidget *terminal, char* command, void *en
dictionary *yon_dictionary_create_conneced(dictionary *targetdict);
void yon_int_array_append(int **source, int append);
static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data);
int philos_config_save(char *command);
#endif

@ -426,9 +426,41 @@ void str_split_value(char* values, int index) {
if (yon_char_find_count(key, "IOReadBandwidthMax") != 0) {
get_param_io_limit(arr_values, index_1, size,index, "IOReadBandwidthMax");
}
else {
int* array_limit = NULL;
char** array_disk = NULL;
int index11 = 0;
array_limit = philos_int_append(array_limit, &index11, -2);
index11--;
array_disk = yon_char_parsed_append(array_disk, &index11, NULL);
main_config.i_o_limit_read = yon_remalloc(main_config.i_o_limit_read, (main_config.size_tree_view + 1) * sizeof(int*));
main_config.i_o_limit_read_size = yon_remalloc(main_config.i_o_limit_read_size, (main_config.size_tree_view + 1) * sizeof(int*));
main_config.disk = yon_remalloc(main_config.disk, (main_config.size_tree_view + 1) * sizeof(char**));
philos_array_int_copy(&main_config.i_o_limit_read[main_config.size_tree_view], &array_limit);
philos_array_int_copy(&main_config.i_o_limit_read_size[main_config.size_tree_view], &array_limit);
yon_char_parsed_copy(&main_config.disk[main_config.size_tree_view], &array_disk);
philos_free_int_array(&array_limit, 1);
philos_free_string_array(&array_disk, 1);
}
if (yon_char_find_count(key, "IOWriteBandwidthMax") != 0) {
get_param_io_limit(arr_values, index_1, size,index, "IOWriteBandwidthMax");
}
else {
int* array_limit = NULL;
char** array_disk = NULL;
int index11 = 0;
array_limit = philos_int_append(array_limit, &index11, -2);
index11--;
array_disk = yon_char_parsed_append(array_disk, &index11, NULL);
main_config.i_o_limit_write = yon_remalloc(main_config.i_o_limit_write, (main_config.size_tree_view + 1) * sizeof(int*));
main_config.i_o_limit_write_size = yon_remalloc(main_config.i_o_limit_write_size, (main_config.size_tree_view + 1) * sizeof(int*));
main_config.disk = yon_remalloc(main_config.disk, (main_config.size_tree_view + 1) * sizeof(char**));
philos_array_int_copy(&main_config.i_o_limit_write[main_config.size_tree_view], &array_limit);
philos_array_int_copy(&main_config.i_o_limit_write_size[main_config.size_tree_view], &array_limit);
yon_char_parsed_copy(&main_config.disk[main_config.size_tree_view], &array_disk);
philos_free_int_array(&array_limit, 1);
philos_free_string_array(&array_disk, 1);
}
if (yon_char_find_count(key, "MemoryHigh") != 0) {
philos_set_pow_size_memory(yon_char_new(value), &main_config.soft_raw_limit_size, index, array_size_pow);
set_size_memory_integer(yon_char_new(value), &main_config.soft_raw_limit, index);
@ -516,6 +548,9 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
philos_free_string_array(&array_disk, index_n2);
philos_free_int_array(&array_limit_size, index_n2);
}
else {
}
}
void set_size_memory_integer(char* str_find, int** array_data, int index) {
@ -712,7 +747,6 @@ int tree_view_edit() {
philos_array_int_copy(&main_config.i_o_limit_write[index], edit_get_write_device());
philos_array_int_copy(&main_config.i_o_limit_write_size[index], edit_get_write_device_size_pow());
yon_char_parsed_copy(&main_config.disk[index], edit_get_select_device());
main_config.soft_raw_limit_size[index] = edit_get_soft_size();
main_config.hard_raw_limit_size[index] = edit_get_hard_size();
@ -844,11 +878,9 @@ void wrapper_edit_show() {
}
void main_edit_btn_save() {
if (get_edit_config) {
if (tree_view_edit(main_config.size_tree_view)) {
edit_init_windows();
add_on_destroy_subwindow(get_widget_edit()->Window);
}
if (tree_view_edit(main_config.size_tree_view)) {
edit_init_windows();
add_on_destroy_subwindow(get_widget_edit()->Window);
}
}
@ -962,7 +994,7 @@ char* save_format_value(int index) {
char split_simvol[2] = {0};
split_simvol[0] = 0;
split_simvol[1] = 0;
if (main_config.soft_raw_limit[index]==0) {
if (main_config.soft_raw_limit[index]>=0) {
char* value_size = philos_format_cfg_str_size_memory("MemoryHigh=", main_config.soft_raw_limit[index],main_config.soft_raw_limit_size[index]);
if (!strstr(value_size,"-")) {
value = yon_char_unite(value ,split_simvol, value_size, NULL);
@ -971,7 +1003,7 @@ char* save_format_value(int index) {
}
free(value_size);
}
if (main_config.hard_raw_limit[index]==0) {
if (main_config.hard_raw_limit[index]>=0) {
char* value_size = philos_format_cfg_str_size_memory("MemoryMax=", main_config.hard_raw_limit[index],main_config.hard_raw_limit_size[index]);
if (!strstr(value_size,"-")) {
value = yon_char_unite(value ,split_simvol, value_size, NULL);
@ -980,7 +1012,7 @@ char* save_format_value(int index) {
}
free(value_size);
}
if (main_config.swap[index]==0) {
if (main_config.swap[index]>=0) {
char* value_size = philos_format_cfg_str_size_memory("MemorySwapMax=", main_config.swap[index],main_config.swap_size[index]);
if (!strstr(value_size,"-")) {
value = yon_char_unite(value ,split_simvol, value_size, NULL);
@ -1042,13 +1074,13 @@ int template_format_str_save(dictionary* load_cfg, char* source_set_cmd, char* s
char* cmd_remove = template_format_str_remove_save(load_cfg, source_remove_cmd);
char* cmd_set = template_format_str_set_save(load_cfg, source_set_cmd);
if (cmd_set != NULL && cmd_remove != NULL) {
yon_config_save(yon_char_unite(cmd_set, "; " , cmd_remove, NULL));
philos_config_save(yon_char_unite(cmd_set, "; " , cmd_remove, NULL));
}
else if (cmd_remove != NULL) {
yon_config_save(cmd_remove);
philos_config_save(cmd_remove);
}
else if (cmd_set != NULL) {
yon_config_save(cmd_set);
philos_config_save(cmd_set);
}
else {
return 0;

Loading…
Cancel
Save