From 24547dae731fce618413a45014e7984ea5b315b7 Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 12 Dec 2011 01:59:13 +0000 Subject: implement -C (alternative config file) for apropos(1) and mandocdb(8); ok kristaps@ --- usr.bin/mandoc/manpath.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'usr.bin/mandoc/manpath.c') diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c index cbe70e5339a..86084a7aca5 100644 --- a/usr.bin/mandoc/manpath.c +++ b/usr.bin/mandoc/manpath.c @@ -1,4 +1,4 @@ -/* $Id: manpath.c,v 1.1 2011/11/26 16:41:35 schwarze Exp $ */ +/* $Id: manpath.c,v 1.2 2011/12/12 01:59:13 schwarze Exp $ */ /* * Copyright (c) 2011 Ingo Schwarze * Copyright (c) 2011 Kristaps Dzonsons @@ -33,7 +33,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); @@ -42,7 +43,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); } @@ -88,10 +89,10 @@ manpath_add(struct manpaths *dirs, const char *dir) } void -manpath_parseconf(struct manpaths *dirs) +manpath_parseconf(struct manpaths *dirs, const char *file) { - manpath_manconf(MAN_CONF_FILE, dirs); + manpath_manconf(dirs, file ? file : MAN_CONF_FILE); } void @@ -106,7 +107,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; -- cgit v1.2.3-59-g8ed1b