summaryrefslogtreecommitdiffstats
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
commit0b6c3d1f74b3bc4247a70775f078e90c11f771c8 (patch)
tree4fa1ec28f7aecf019e9d31bb8d003d5979b566e5 /main.c
parente1135199ed0839508bdba7d5991fc3319f06ee94 (diff)
downloadmandoc-0b6c3d1f74b3bc4247a70775f078e90c11f771c8.tar.gz
implement man(1) quirk: section argument without -s
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.c b/main.c
index 72056d2d..d547c113 100644
--- a/main.c
+++ b/main.c
@@ -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) */