aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-08-22 18:07:15 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-08-22 18:07:15 +0000
commit8185697eb44d98e59f7b64385db3030f90f56ea3 (patch)
tree1f09fd2f03382ebe1ab053fe43183433dc3cb6b7 /main.c
parent88bf3594b42b8f39f93f35faccdd3f9e6f5e14a0 (diff)
downloadmandoc-8185697eb44d98e59f7b64385db3030f90f56ea3.tar.gz
mandoc-8185697eb44d98e59f7b64385db3030f90f56ea3.tar.zst
mandoc-8185697eb44d98e59f7b64385db3030f90f56ea3.zip
implement man(1) quirk: section argument without -s
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/main.c b/main.c
index adf3d0ff..e949afd3 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.184 2014/08/22 04:52:55 schwarze Exp $ */
+/* $Id: main.c,v 1.185 2014/08/22 18:07:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -21,6 +21,7 @@
#include <sys/types.h>
#include <assert.h>
+#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
@@ -227,6 +228,8 @@ main(int argc, char *argv[])
if (show_usage)
usage(search.argmode);
+ /* Postprocess options. */
+
if (outmode == OUTMODE_DEF) {
switch (search.argmode) {
case ARG_FILE:
@@ -242,12 +245,25 @@ main(int argc, char *argv[])
}
}
+ /* Parse arguments. */
+
argc -= optind;
argv += optind;
#if HAVE_SQLITE3
auxargv = NULL;
#endif
+ /* Quirk for a man(1) section argument without -s. */
+
+ if (search.argmode == ARG_NAME &&
+ argv[0] != NULL &&
+ isdigit((unsigned char)argv[0][0]) &&
+ (argv[0][1] == '\0' || !strcmp(argv[0], "3p"))) {
+ search.sec = argv[0];
+ argv++;
+ argc--;
+ }
+
rc = MANDOCLEVEL_OK;
/* man(1), whatis(1), apropos(1) */