From 656484e0ab06f86e2f4a35cd6abf6614017bccf8 Mon Sep 17 00:00:00 2001 From: Damien Tardy-Panis Date: Wed, 11 Mar 2020 16:12:00 +0100 Subject: [PATCH] Section needs to be explicitly defined The absence of value between the section parentheses resulted in the section being 0 (header files), which is unlikely to be the one wanted --- src/main.c | 2 +- test/preamble | 6 ++++++ diff --git a/src/main.c b/src/main.c index 1e95838bab6a6c41411b1c42cf0f4e5418832c83..c55cfa33063b1cf021f9a38bd77ee15df1d40e4e 100644 --- a/src/main.c +++ b/src/main.c @@ -24,7 +24,7 @@ if (ch < 0x80 && isdigit(ch)) { int ret = str_append_ch(section, ch); assert(ret != -1); } else if (ch == ')') { - if (!section->str) { + if (section->len == 0) { break; } int sec = strtol(section->str, NULL, 10); diff --git a/test/preamble b/test/preamble index 1634877dd85f8be2a6b713997571ca738f77d95c..05c8e2d5771c2153e331c8d3d6762dad6bd816a3 100755 --- a/test/preamble +++ b/test/preamble @@ -13,6 +13,12 @@ test EOF end 1 +begin "Expects a section within the parentheses" +scdoc </dev/null +test() +EOF +end 1 + begin "Expects name to alphanumeric" scdoc </dev/null !!!!(8) -- 2.48.1