From f92821066656139515728a69942c07e2e59482a5 Mon Sep 17 00:00:00 2001 From: schwarze Date: Thu, 1 Jan 2015 13:18:23 +0000 Subject: [PATCH] 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 . --- usr.bin/mandoc/main.c | 5 +++-- 1 file 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 * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze @@ -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'))) { -- 2.20.1