man: fix literal file suffix parsing regression
authorFranco Fichtner <franco@lastsummer.de>
Sun, 6 Oct 2013 17:07:27 +0000 (19:07 +0200)
committerFranco Fichtner <franco@lastsummer.de>
Sun, 6 Oct 2013 17:31:55 +0000 (19:31 +0200)
Some man pages have dots in their names, apparently.  Fixes
the following invoke:

    # man ./man.conf.5

This, however, doesn't fix parsing of e.g. "./man..conf.4.5".
Instead the suffix list should be searched for a real match
while also preserving their matching order.  In the meantime,
please don't do this (ever).

Noticed-by: Thomas Klausner via NetBSD
usr.bin/man/man.c

index aaf4bba..6ea0df2 100644 (file)
@@ -556,7 +556,8 @@ manual(char *page, struct manstate *mp, glob_t *pg)
 
                /* clip suffix for the suffix check below */
                p = strrchr(escpage, '/');
-               p = strchr(p, '.');
+               while ((p = strchr(p, '.')) && !isdigit(p[1]))
+                       ++p;
                if (p)
                        p[0] = '\0';