]> git.cameronkatri.com Git - mandoc.git/blobdiff - manpath.c
Fix a nasty typo that prevented .so links to gziped manuals
[mandoc.git] / manpath.c
index 0627f13d25adfce0c68d181de2da5b828e71977f..83c329ec9bbb6b2b2473f4046fcc6d8a08c08422 100644 (file)
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/*     $Id: manpath.c,v 1.29 2015/11/07 17:58:55 schwarze Exp $        */
+/*     $Id: manpath.c,v 1.30 2016/05/28 13:44:13 schwarze Exp $        */
 /*
  * Copyright (c) 2011, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -224,13 +224,12 @@ manconf_file(struct manconf *conf, const char *file)
 
        while ((linelen = getline(&line, &linesz, stream)) != -1) {
                cp = line;
-               ep = cp + linelen;
-               if (ep[-1] != '\n')
-                       break;
-               *--ep = '\0';
+               ep = cp + linelen - 1;
+               while (ep > cp && isspace((unsigned char)*ep))
+                       *ep-- = '\0';
                while (isspace((unsigned char)*cp))
                        cp++;
-               if (*cp == '#')
+               if (cp == ep || *cp == '#')
                        continue;
 
                for (tok = 0; tok < sizeof(toks)/sizeof(toks[0]); tok++) {