aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-12-12 02:00:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-12-12 02:00:49 +0000
commit6ca7be8f333b28c465a7b7d961bddcb31d59d72f (patch)
treee67531ef7f83c08f0c5eb984fa934e30675e4346 /mandocdb.c
parent424e4a7f6dd613adba96e61c70ed0ad508fc1d45 (diff)
downloadmandoc-6ca7be8f333b28c465a7b7d961bddcb31d59d72f.tar.gz
mandoc-6ca7be8f333b28c465a7b7d961bddcb31d59d72f.tar.zst
mandoc-6ca7be8f333b28c465a7b7d961bddcb31d59d72f.zip
implement -C (alternative config file) for apropos(1) and mandocdb(8),
including various tweaks to the whatis(8) manual; ok kristaps@
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/mandocdb.c b/mandocdb.c
index b7c7e0b3..fe9c01a7 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.33 2011/12/10 22:01:06 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.34 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -273,6 +273,7 @@ main(int argc, char *argv[])
struct manpaths dirs;
enum op op; /* current operation */
const char *dir;
+ char *conf_file;
char *cp;
char pbuf[PATH_MAX],
ibuf[MAXPATHLEN], /* index fname */
@@ -312,12 +313,16 @@ main(int argc, char *argv[])
maxrec = 0;
op = OP_NEW;
dir = NULL;
+ conf_file = NULL;
- while (-1 != (ch = getopt(argc, argv, "ad:u:v")))
+ while (-1 != (ch = getopt(argc, argv, "aC:d:u:v")))
switch (ch) {
case ('a'):
use_all = 1;
break;
+ case ('C'):
+ conf_file = optarg;
+ break;
case ('d'):
dir = optarg;
op = OP_UPDATE;
@@ -426,7 +431,7 @@ main(int argc, char *argv[])
dirs.paths[i] = mandoc_strdup(cp);
}
} else
- manpath_parse(&dirs, NULL, NULL);
+ manpath_parse(&dirs, conf_file, NULL, NULL);
for (i = 0; i < dirs.sz; i++) {
ibuf[0] = fbuf[0] = '\0';
@@ -1660,7 +1665,8 @@ usage(void)
{
fprintf(stderr, "usage: %s [-v] "
- "[-d dir [files...] |"
- " -u dir [files...] |"
- " dir...]\n", progname);
+ "[-C file] |"
+ " dir ... |"
+ " -d dir [file ...] |"
+ " -u dir [file ...]\n", progname);
}