geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit ca5a2fc2bbcaf990979b29c43c8f0e4b69c2761e
parent c015b09cb45af558167c6dc2053c6c20810a97ad
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 10 Oct 2017 20:00:49 +0200

Add pipe escaping to descriptions of items.

Diffstat:
ind.c | 11+++++++++--
index.gph | 1+
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ind.c b/ind.c @@ -236,18 +236,25 @@ addelem(Elems *e, char *s) Elems * getadv(char *str) { - char *b, *e, *o; + char *b, *e, *o, *bo; Elems *ret; ret = xcalloc(1, sizeof(Elems)); if (str[0] == '[') { o = xstrdup(str); b = o + 1; - while ((e = strchr(b, '|')) != nil) { + bo = b; + while ((e = strchr(bo, '|')) != nil) { + if (e != bo && e[-1] == '\\') { + memmove(&e[-1], e, strlen(e)); + bo = e; + continue; + } *e = '\0'; e++; addelem(ret, b); b = e; + bo = b; } e = strchr(b, ']'); diff --git a/index.gph b/index.gph @@ -3,4 +3,5 @@ tcomment [1|R-36|/|server|port] [0|file - comment|/file.dat|server|port] [h|http://www.heise.de|URL:http://www.heise.de|server|port] +[0|some \| escape and [ special characters ] test|error|server|port]