aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manpath.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 /manpath.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 'manpath.c')
-rw-r--r--manpath.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/manpath.c b/manpath.c
index 7ce672e2..1ed7f9c5 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.4 2011/11/26 22:38:11 schwarze Exp $ */
+/* $Id: manpath.c,v 1.5 2011/12/12 02:00:49 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -36,7 +36,8 @@
static void manpath_add(struct manpaths *, const char *);
void
-manpath_parse(struct manpaths *dirs, char *defp, char *auxp)
+manpath_parse(struct manpaths *dirs, const char *file,
+ char *defp, char *auxp)
{
manpath_parseline(dirs, auxp);
@@ -45,7 +46,7 @@ manpath_parse(struct manpaths *dirs, char *defp, char *auxp)
defp = getenv("MANPATH");
if (NULL == defp)
- manpath_parseconf(dirs);
+ manpath_parseconf(dirs, file);
else
manpath_parseline(dirs, defp);
}
@@ -91,7 +92,7 @@ manpath_add(struct manpaths *dirs, const char *dir)
}
void
-manpath_parseconf(struct manpaths *dirs)
+manpath_parseconf(struct manpaths *dirs, const char *file)
{
#ifdef USE_MANPATH
FILE *stream;
@@ -124,7 +125,7 @@ manpath_parseconf(struct manpaths *dirs)
free(buf);
pclose(stream);
#else
- manpath_manconf(MAN_CONF_FILE, dirs);
+ manpath_manconf(dirs, file ? file : MAN_CONF_FILE);
#endif
}
@@ -140,7 +141,7 @@ manpath_free(struct manpaths *p)
}
void
-manpath_manconf(const char *file, struct manpaths *dirs)
+manpath_manconf(struct manpaths *dirs, const char *file)
{
FILE *stream;
char *p, *q;