From 3ce47a9dfa43a52de9a48807739dd3cb2400ad7c Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Mon, 8 Oct 2012 20:31:09 +0200 Subject: [PATCH] fix parsing of rules --- dunst.c | 6 +++++- options.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dunst.c b/dunst.c index 4c9dbbd..0d4da00 100644 --- a/dunst.c +++ b/dunst.c @@ -1613,7 +1613,11 @@ void parse_dunstrc(char *cmdline_config_path) 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 || strcmp(cur_section, "shortcuts") == 0 || strcmp(cur_section, "urgency_low") == 0 diff --git a/options.c b/options.c index bb95790..78b0c55 100644 --- a/options.c +++ b/options.c @@ -126,6 +126,10 @@ char *next_section(char *section) if (section_count == 0) return NULL; + if (section == NULL) { + return sections[0].name; + } + for (int i = 0; i < section_count; i++) { if (strcmp(section, sections[i].name) == 0) { if (i + 1 >= section_count)