diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-01-01 13:18:24 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2015-01-01 13:18:24 +0000 |
commit | 758cb6e1c84dd6c8d32d623cdd31090fa87c6a92 (patch) | |
tree | 739c60d959858db2d8e3a4d966c530e159ef15a4 /usr.bin | |
parent | 7422ddc0a0bb0d1a167b15a15a7b72b984325930 (diff) |
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>.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mandoc/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index d6d82c04467..e0ee7167956 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.116 2014/12/31 16:50:54 schwarze Exp $ */ +/* $OpenBSD: main.c,v 1.117 2015/01/01 13:18:23 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -284,7 +284,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'))) { |