From 6ca7be8f333b28c465a7b7d961bddcb31d59d72f Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 12 Dec 2011 02:00:49 +0000 Subject: implement -C (alternative config file) for apropos(1) and mandocdb(8), including various tweaks to the whatis(8) manual; ok kristaps@ --- manpath.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'manpath.c') 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 * Copyright (c) 2011 Kristaps Dzonsons @@ -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; -- cgit v1.2.3