summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-01-01 13:20:38 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-01-01 13:20:38 +0000
commit78a4b29f991e8b77a145ee53064c23efc539dd5d (patch)
tree8fdd3575a38bf5835e469617925ad418e22c65da
parent38b2729bc2c5ed252afdea49c5cda45a80a57f6e (diff)
downloadmandoc-78a4b29f991e8b77a145ee53064c23efc539dd5d.tar.gz
If man(1) only has one single argument, always interpret it as a name,
never as a section. Who would have thought that people call their manual pages 7z(1), 9c(1), 9p(1), and 9p(3)... Patch from Sebastien Marie <semarie dash openbsd at latrappe dot fr>.
-rw-r--r--main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.c b/main.c
index 86d70b67..6a646581 100644
--- a/main.c
+++ b/main.c
@@ -310,7 +310,8 @@ main(int argc, char *argv[])
argv = help_argv;
argc = 1;
}
- } else if (((uc = argv[0]) != NULL) &&
+ } else if (argc > 1 &&
+ ((uc = argv[0]) != NULL) &&
((isdigit(uc[0]) && (uc[1] == '\0' ||
(isalpha(uc[1]) && uc[2] == '\0'))) ||
(uc[0] == 'n' && uc[1] == '\0'))) {