|
|
|
@ -142,7 +142,7 @@ config_str philos_list_group(int* size) {
|
|
|
|
|
unsigned short uid_max = philos_read_uid_min_max(file_source_login_min_max, str_uid_max);
|
|
|
|
|
config_str str_users = malloc(1);
|
|
|
|
|
while (1) {
|
|
|
|
|
errno = 0; // so we can distinguish errors from no more entries
|
|
|
|
|
errno = 0;
|
|
|
|
|
struct passwd* entry = getpwent();
|
|
|
|
|
if (!entry) {
|
|
|
|
|
if (errno) {
|
|
|
|
@ -211,7 +211,7 @@ config_str philos_list_user(int* size) {
|
|
|
|
|
unsigned short uid_max = philos_read_uid_min_max(file_source_login_min_max, str_uid_max);
|
|
|
|
|
config_str str_users = malloc(1);
|
|
|
|
|
while (1) {
|
|
|
|
|
errno = 0; // so we can distinguish errors from no more entries
|
|
|
|
|
errno = 0;
|
|
|
|
|
struct passwd* entry = getpwent();
|
|
|
|
|
if (!entry) {
|
|
|
|
|
if (errno) {
|
|
|
|
@ -219,9 +219,7 @@ config_str philos_list_user(int* size) {
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
//if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) {
|
|
|
|
|
str_users = yon_char_parsed_append(str_users, size, entry->pw_name);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
endpwent();
|
|
|
|
|
return str_users;
|
|
|
|
@ -261,7 +259,6 @@ char* philos_str_remove(char *str, const char *sub) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void philos_split_size_memory(char* str_value, int* size, char* pow_memory) {
|
|
|
|
|
// pow_memory = yon_char_new(str_value);
|
|
|
|
|
(*size) = atoi(yon_char_divide_search(pow_memory, " ", -1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -359,7 +356,7 @@ char* philos_pard_array_add_cmd(char* cmd, temp_config* _config, char* key, int*
|
|
|
|
|
if (_config->disk && _config->size && array_io && array_io_pow_size) {
|
|
|
|
|
int index_find = 0;
|
|
|
|
|
for (int index = 0; index < _config->size; index++) {
|
|
|
|
|
if (array_io_pow_size[index] != -1 && array_io[index]!=-2 && array_io[index]!=-1) {
|
|
|
|
|
if (array_io_pow_size[index] >= 0 && array_io[index]>= 0) {
|
|
|
|
|
char* num_and_pow_size = philos_format_cfg_str_size_memory(" ", array_io[index], array_io_pow_size[index]);
|
|
|
|
|
if (!strstr(num_and_pow_size, "-")) {
|
|
|
|
|
cmd_new = yon_char_unite(cmd_new,
|
|
|
|
@ -504,6 +501,7 @@ void philos_temp_config_init(temp_config* _config) {
|
|
|
|
|
_config->i_o_limit_write_size = NULL;
|
|
|
|
|
_config->size = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// flag_check_array = 0 READ
|
|
|
|
|
// flag_check_array = 1 WRITE
|
|
|
|
|
void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _config, int flag_check_array) {
|
|
|
|
@ -526,7 +524,7 @@ void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _confi
|
|
|
|
|
|
|
|
|
|
if (index_find != -1) {
|
|
|
|
|
if (flag_check_array==0) {
|
|
|
|
|
if (_config->i_o_limit_read[index_find]==-2 || _config->i_o_limit_read[index_find]==-1) {
|
|
|
|
|
if (_config->i_o_limit_read[index_find]<0 || _config->i_o_limit_read_size[index_find]<0) {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->chbTempRead), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinTempRead), 0);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cbtTempRead), 0);
|
|
|
|
@ -539,7 +537,7 @@ void philos_update_device_to_entry(temp_set_window *widgets, temp_config* _confi
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (flag_check_array==1) {
|
|
|
|
|
if (_config->i_o_limit_write[index_find]==-2 || _config->i_o_limit_write[index_find]==-1) {
|
|
|
|
|
if (_config->i_o_limit_write[index_find]<0 || _config->i_o_limit_write_size[index_find]<0) {
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->chbTempWrite), 0);
|
|
|
|
|
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->spinTempWrite), 0);
|
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cbtTempWrite), 0);
|
|
|
|
@ -631,7 +629,6 @@ void philos_temp_add_disk(temp_set_window *widgets, temp_config* _config) {
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Редактирование
|
|
|
|
|
//_config->disk[index_find] = yon_char_new(disk);
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->chbTempRead))) {
|
|
|
|
|
_config->i_o_limit_read_size[index_find] =(int)gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtTempRead));
|
|
|
|
|
_config->i_o_limit_read[index_find] = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinTempRead));
|
|
|
|
@ -749,7 +746,7 @@ void philos_fill_combo_box_text(GtkWidget *cbt, config_str list_data, int size)
|
|
|
|
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(cbt), list_data[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Mem Size pow
|
|
|
|
|
|
|
|
|
|
void philos_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value) {
|
|
|
|
|
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
|
|
|
|
|
guint value_spin = gtk_spin_button_get_digits(GTK_SPIN_BUTTON(spin));
|
|
|
|
|