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 44bcfd8e6f0ce9919b41fba0b2245660780d2224
parent dd5de127a721468b97bc4b7741cdb76f17812b8a
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon,  3 Sep 2018 21:57:09 +0200

Save finding a realpath on various item types with different semantics.

Thanks Evil_Bob for pointing this out!

Diffstat:
ind.c | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/ind.c b/ind.c @@ -422,7 +422,20 @@ printelem(int fd, Elems *el, char *file, char *base, char *addr, char *port) free(el->e[4]); el->e[4] = xstrdup(port); } - if (el->e[2][0] != '/' && !strncmp(el->e[2], "URL:", 4)) { + + /* + * Ignore if the path is from base, if it might be some h type with + * some URL and ignore various types that have different semantics but + * to point to some file or directory. + */ + if (el->e[2][0] != '/' + && strncmp(el->e[2], "URL:", 4) + && el->e[0][0] != 'i' + && el->e[0][0] != '2' + && el->e[0][0] != '3' + && el->e[0][0] != '8' + && el->e[0][0] != 'w' + && el->e[0][0] != 'T') { path = file + strlen(base); if ((p = strrchr(path, '/'))) len = p - path;