Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man For an argument to be interpreted as a local fil...
details: https://anonhg.NetBSD.org/src/rev/3382065f3196
branches: trunk
changeset: 331557:3382065f3196
user: apb <apb%NetBSD.org@localhost>
date: Thu Aug 14 15:31:12 2014 +0000
description:
For an argument to be interpreted as a local file name, bypassing the
search rules in man.conf or MANPATH, it must begin with "/", "./", or
"../". Simply testing whether it contains "/" is wrong, because it
breaks usage like "man 8 vax/boot".
This reverts revision 1.57 dated 2013-10-06,
"Be more permissive in interpreting man pages as filenames".
diffstat:
usr.bin/man/man.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r e70dabbf749f -r 3382065f3196 usr.bin/man/man.c
--- a/usr.bin/man/man.c Thu Aug 14 15:16:20 2014 +0000
+++ b/usr.bin/man/man.c Thu Aug 14 15:31:12 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: man.c,v 1.61 2014/02/17 03:10:12 uwe Exp $ */
+/* $NetBSD: man.c,v 1.62 2014/08/14 15:31:12 apb Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: man.c,v 1.61 2014/02/17 03:10:12 uwe Exp $");
+__RCSID("$NetBSD: man.c,v 1.62 2014/08/14 15:31:12 apb Exp $");
#endif
#endif /* not lint */
@@ -574,10 +574,14 @@
*eptr = '\0';
/*
- * If 'page' contains a slash then it's
- * interpreted as a file specification.
+ * If 'page' is given with an absolute path,
+ * or a relative path explicitly beginning with "./"
+ * or "../", then interpret it as a file specification.
*/
- if (strchr(page, '/') != NULL) {
+ if ((page[0] == '/')
+ || (page[0] == '.' && page[1] == '/')
+ || (page[0] == '.' && page[1] == '.' && page[2] == '/')
+ ) {
/* check if file actually exists */
(void)strlcpy(buf, escpage, sizeof(buf));
error = glob(buf, GLOB_APPEND | GLOB_BRACE | GLOB_NOSORT, NULL, pg);
Home |
Main Index |
Thread Index |
Old Index