diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-01 13:20:38 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-01-01 13:20:38 +0000 |
commit | 24d115716dc1ebda43f32d59379e15eca1a026c2 (patch) | |
tree | b723beef99283b9756da3062e63b33aa5242f62e | |
parent | 6df40660334ce30ad0e4ca8fb65a8e002fb9cd22 (diff) | |
download | mandoc-24d115716dc1ebda43f32d59379e15eca1a026c2.tar.gz mandoc-24d115716dc1ebda43f32d59379e15eca1a026c2.tar.zst mandoc-24d115716dc1ebda43f32d59379e15eca1a026c2.zip |
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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.210 2014/12/31 16:52:39 schwarze Exp $ */ +/* $Id: main.c,v 1.211 2015/01/01 13:20:38 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -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'))) { |