aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2019-05-03 09:39:25 +0000
committerIngo Schwarze <schwarze@openbsd.org>2019-05-03 09:39:25 +0000
commit62d11ac9d45a60fc14ef1ef718240c2d6174c974 (patch)
treef7b583594b697cb0239fab895072ad9d0a49c00c /main.c
parentd01c0c49e94a1aa06cfb7222d031a4d3e1f2e18a (diff)
downloadmandoc-62d11ac9d45a60fc14ef1ef718240c2d6174c974.tar.gz
mandoc-62d11ac9d45a60fc14ef1ef718240c2d6174c974.tar.zst
mandoc-62d11ac9d45a60fc14ef1ef718240c2d6174c974.zip
In man(1) mode, when the first argument starts with a digit,
optionally followed by a letter, and at least one more argument follows, interpret the first argument as a section name even when additional characters follow after the digit and letter. This is needed because many operating systems have section names consisting of a digit followed by more than one letter - for example Illumos, Solaris, Linux, even NetBSD. There is very little risk of regressions: in the whole corpus of manual pages on man.openbsd.org, there isn't a single manual page name starting with a digit. And even if programs like "0ad" or "4channels" had manual pages, "man 0ad" and "man -a cat 0ad" would still work, only "man -a 0ad cat" will fail with "man: No entry for cat in section 0ad of the manual." Fixing one of the issues reported by Lorenzo Beretta <loreb at github> as part of https://github.com/void-linux/void-packages/issues/9868 .
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index bbc82bf9..339f7e8b 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.323 2019/04/30 18:51:57 schwarze Exp $ */
+/* $Id: main.c,v 1.324 2019/05/03 09:39:25 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
@@ -355,7 +355,7 @@ main(int argc, char *argv[])
} else if (argc > 1 &&
((uc = (unsigned char *)argv[0]) != NULL) &&
((isdigit(uc[0]) && (uc[1] == '\0' ||
- (isalpha(uc[1]) && uc[2] == '\0'))) ||
+ isalpha(uc[1]))) ||
(uc[0] == 'n' && uc[1] == '\0'))) {
search.sec = (char *)uc;
argv++;