summaryrefslogtreecommitdiff
path: root/usr.bin/man
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2013-10-06 16:43:41 +0000
committerchristos <christos@NetBSD.org>2013-10-06 16:43:41 +0000
commitbbdbae1e2cef40327691c092d4736e01547a2926 (patch)
tree71dca31d288712d9985ce660e664a61267c8a8d3 /usr.bin/man
parentb4be1e74afb6944c938ccb1b18a016e5c39c2486 (diff)
Recognize .gz and .bz2 suffixes so $ man ./man.1.gz works. From Franco Fichter
via dfly.
Diffstat (limited to 'usr.bin/man')
-rw-r--r--usr.bin/man/man.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c
index c736c38dcef..9b3532c16d7 100644
--- a/usr.bin/man/man.c
+++ b/usr.bin/man/man.c
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.57 2013/10/06 16:29:26 christos Exp $ */
+/* $NetBSD: man.c,v 1.58 2013/10/06 16:43:41 christos Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.57 2013/10/06 16:29:26 christos Exp $");
+__RCSID("$NetBSD: man.c,v 1.58 2013/10/06 16:43:41 christos Exp $");
#endif
#endif /* not lint */
@@ -555,9 +555,14 @@ manual(char *page, struct manstate *mp, glob_t *pg)
goto notfound;
/* clip suffix for the suffix check below */
- p = strrchr(escpage, '.');
- if (p && p[0] == '.' && isdigit((unsigned char)p[1]))
- p[0] = '\0';
+ if ((p = strrchr(escpage, '.')) != NULL) {
+ if (strcmp(p, ".gz") == 0 || strcmp(p, ".bz2") == 0) {
+ *p = '\0';
+ p = strrchr(escpage, '.');
+ }
+ if (p && isdigit((unsigned char)p[1]))
+ *p = '\0';
+ }
found = 0;
for (cnt = pg->gl_pathc - pg->gl_matchc;