~sircmpwn/public-inbox

scdoc: Section needs to be explicitly defined v1 PROPOSED

Damien Tardy-Panis: 1
 Section needs to be explicitly defined

 2 files changed, 7 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/public-inbox/patches/9995/mbox | git am -3
Learn more about email & git

[PATCH scdoc] Section needs to be explicitly defined Export this patch

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 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 1e95838..c55cfa3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,7 @@ static int parse_section(struct parser *p) {
			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 1634877..05c8e2d 100755
--- a/test/preamble
+++ b/test/preamble
@@ -13,6 +13,12 @@ test
EOF
end 1

begin "Expects a section within the parentheses"
scdoc <<EOF >/dev/null
test()
EOF
end 1

begin "Expects name to alphanumeric"
scdoc <<EOF >/dev/null
!!!!(8)
--
2.25.1
View this thread in the archives