Allow long lines in tint2conf
This commit is contained in:
parent
4d12abdb42
commit
639ccbf16c
3 changed files with 21 additions and 19 deletions
13
src/config.c
13
src/config.c
|
@ -1178,20 +1178,21 @@ void add_entry(char *key, char *value)
|
||||||
|
|
||||||
gboolean config_read_file(const char *path)
|
gboolean config_read_file(const char *path)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp = fopen(path, "r");
|
||||||
char line[512];
|
if (!fp)
|
||||||
char *key, *value;
|
|
||||||
|
|
||||||
if ((fp = fopen(path, "r")) == NULL)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
char* line = NULL;
|
||||||
|
size_t line_size = 0;
|
||||||
|
while (getline(&line, &line_size, fp) >= 0) {
|
||||||
|
char *key, *value;
|
||||||
if (parse_line(line, &key, &value)) {
|
if (parse_line(line, &key, &value)) {
|
||||||
add_entry(key, value);
|
add_entry(key, value);
|
||||||
free(key);
|
free(key);
|
||||||
free(value);
|
free(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(line);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
if (!read_panel_position) {
|
if (!read_panel_position) {
|
||||||
|
|
|
@ -643,6 +643,7 @@ void execp_timer_callback(void *arg)
|
||||||
close(pipe_fd[0]);
|
close(pipe_fd[0]);
|
||||||
return;
|
return;
|
||||||
} else if (child == 0) {
|
} else if (child == 0) {
|
||||||
|
fprintf(stderr, "Executing: %s\n", execp->backend->command);
|
||||||
// We are in the child
|
// We are in the child
|
||||||
close(pipe_fd[0]);
|
close(pipe_fd[0]);
|
||||||
dup2(pipe_fd[1], 1); // 1 is stdout
|
dup2(pipe_fd[1], 1); // 1 is stdout
|
||||||
|
|
|
@ -38,13 +38,6 @@ void config_read_file(const char *path)
|
||||||
background_create_new();
|
background_create_new();
|
||||||
gradient_create_new(GRADIENT_CONFIG_VERTICAL);
|
gradient_create_new(GRADIENT_CONFIG_VERTICAL);
|
||||||
|
|
||||||
FILE *fp;
|
|
||||||
char line[512];
|
|
||||||
char *key, *value;
|
|
||||||
|
|
||||||
if ((fp = fopen(path, "r")) == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
config_has_panel_items = 0;
|
config_has_panel_items = 0;
|
||||||
config_has_battery = 0;
|
config_has_battery = 0;
|
||||||
config_battery_enabled = 0;
|
config_battery_enabled = 0;
|
||||||
|
@ -54,14 +47,21 @@ void config_read_file(const char *path)
|
||||||
no_items_systray_enabled = 0;
|
no_items_systray_enabled = 0;
|
||||||
no_items_battery_enabled = 0;
|
no_items_battery_enabled = 0;
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
FILE *fp = fopen(path, "r");
|
||||||
if (parse_line(line, &key, &value)) {
|
if (fp) {
|
||||||
add_entry(key, value);
|
char* line = NULL;
|
||||||
free(key);
|
size_t line_size = 0;
|
||||||
free(value);
|
while (getline(&line, &line_size, fp) >= 0) {
|
||||||
|
char *key, *value;
|
||||||
|
if (parse_line(line, &key, &value)) {
|
||||||
|
add_entry(key, value);
|
||||||
|
free(key);
|
||||||
|
free(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
free(line);
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
finalize_gradient();
|
finalize_gradient();
|
||||||
finalize_bg();
|
finalize_bg();
|
||||||
|
|
Loading…
Reference in a new issue