aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
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) */