diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2011-12-12 02:00:49 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2011-12-12 02:00:49 +0000 |
commit | c42838fef393e5adf1aa518e01ad6d6a81fdacac (patch) | |
tree | 4159f03b7d7c3896b82b9ac86577327883c89771 /mandocdb.c | |
parent | 21233e404785a217f2bc0d3060f79f76911b9e1e (diff) | |
download | mandoc-c42838fef393e5adf1aa518e01ad6d6a81fdacac.tar.gz |
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.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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); } |