fix parsing of rules

This commit is contained in:
Sascha Kruse 2012-10-08 20:31:09 +02:00
parent eaf0bc8308
commit 3ce47a9dfa
2 changed files with 9 additions and 1 deletions

View File

@ -1613,7 +1613,11 @@ void parse_dunstrc(char *cmdline_config_path)
char *cur_section = NULL; char *cur_section = NULL;
for (; cur_section; cur_section = next_section(cur_section)) { for (;;) {
cur_section = next_section(cur_section);
if (!cur_section)
break;
printf("%s\n", cur_section);
if (strcmp(cur_section, "global") == 0 if (strcmp(cur_section, "global") == 0
|| strcmp(cur_section, "shortcuts") == 0 || strcmp(cur_section, "shortcuts") == 0
|| strcmp(cur_section, "urgency_low") == 0 || strcmp(cur_section, "urgency_low") == 0

View File

@ -126,6 +126,10 @@ char *next_section(char *section)
if (section_count == 0) if (section_count == 0)
return NULL; return NULL;
if (section == NULL) {
return sections[0].name;
}
for (int i = 0; i < section_count; i++) { for (int i = 0; i < section_count; i++) {
if (strcmp(section, sections[i].name) == 0) { if (strcmp(section, sections[i].name) == 0) {
if (i + 1 >= section_count) if (i + 1 >= section_count)