From 12d5d0df5c4b958bbb5cc339a9e556c50136a974 Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 9 Nov 2024 01:57:10 -0500 Subject: fix gophermaps not terminating on final . --- parse.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parse.c b/parse.c index 8ea90f8..40f7a25 100644 --- a/parse.c +++ b/parse.c @@ -48,6 +48,7 @@ size_t scatss(char *buf, size_t i, size_t n, strv_t ss) { } int parse_gophermap_line(struct doc *d, strv_t ln) { + if (ln.n == 1 && ln.s[0] == '.') return 1; char url[512] = "gopher://"; size_t urln = 9; struct { @@ -63,8 +64,6 @@ int parse_gophermap_line(struct doc *d, strv_t ln) { strv_split(&ln, '\t', &bits.host); strv_split(&ln, '\t', &bits.port); switch (bits.item_type) { - case '.': - if (ln.n == 1) return 1; default: urln = scatss(url, urln, sizeof url, bits.host); if (urln < sizeof url) url[urln++] = ':'; -- cgit 1.4.1-2-gfad0