aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/catman.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-18 18:51:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-18 18:51:01 +0000
commit0d9470784d26b2926cea58b30ad4c1587cbedb14 (patch)
tree7837ecb7e92861752cb37561aae701eba52dc66c /catman.c
parent8ba55f016df3035abde0f0e18009fd202d208c7d (diff)
downloadmandoc-0d9470784d26b2926cea58b30ad4c1587cbedb14.tar.gz
mandoc-0d9470784d26b2926cea58b30ad4c1587cbedb14.tar.zst
mandoc-0d9470784d26b2926cea58b30ad4c1587cbedb14.zip
Give catman(8) the -C flag (like apropos and friends) and merge in some
documentation from apropos(1) to be consistent.
Diffstat (limited to 'catman.c')
-rw-r--r--catman.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/catman.c b/catman.c
index 2ac27e5a..aa185eb3 100644
--- a/catman.c
+++ b/catman.c
@@ -1,4 +1,4 @@
-/* $Id: catman.c,v 1.7 2011/12/16 12:06:35 kristaps Exp $ */
+/* $Id: catman.c,v 1.8 2011/12/18 18:51:01 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -66,7 +66,7 @@ int
main(int argc, char *argv[])
{
int ch;
- char *aux, *base;
+ char *aux, *base, *conf_file;
struct manpaths dirs;
char buf[MAXPATHLEN];
extern char *optarg;
@@ -81,8 +81,11 @@ main(int argc, char *argv[])
aux = base = NULL;
xstrlcpy(buf, "/var/www/cache/man.cgi", MAXPATHLEN);
- while (-1 != (ch = getopt(argc, argv, "fm:M:o:v")))
+ while (-1 != (ch = getopt(argc, argv, "C:fm:M:o:v")))
switch (ch) {
+ case ('C'):
+ conf_file = optarg;
+ break;
case ('f'):
force = 1;
break;
@@ -112,7 +115,7 @@ main(int argc, char *argv[])
}
memset(&dirs, 0, sizeof(struct manpaths));
- manpath_parse(&dirs, NULL, base, aux);
+ manpath_parse(&dirs, conf_file, base, aux);
ch = manup(&dirs, buf);
manpath_free(&dirs);
return(ch ? EXIT_SUCCESS : EXIT_FAILURE);
@@ -124,6 +127,7 @@ usage(void)
fprintf(stderr, "usage: %s "
"[-fv] "
+ "[-C file] "
"[-o path] "
"[-m manpath] "
"[-M manpath]\n",