=================================================================== RCS file: /cvs/mandoc/manpath.c,v retrieving revision 1.1 retrieving revision 1.3 diff -u -p -r1.1 -r1.3 --- mandoc/manpath.c 2011/11/23 09:47:38 1.1 +++ mandoc/manpath.c 2011/11/24 10:44:56 1.3 @@ -1,4 +1,4 @@ -/* $Id: manpath.c,v 1.1 2011/11/23 09:47:38 kristaps Exp $ */ +/* $Id: manpath.c,v 1.3 2011/11/24 10:44:56 kristaps Exp $ */ /* * Copyright (c) 2011 Ingo Schwarze * Copyright (c) 2011 Kristaps Dzonsons @@ -92,8 +92,8 @@ manpath_add(struct manpaths *dirs, const char *dir) void manpath_parseconf(struct manpaths *dirs) { - FILE *stream; #ifdef USE_MANPATH + FILE *stream; char *buf; size_t sz, bsz; @@ -123,13 +123,32 @@ manpath_parseconf(struct manpaths *dirs) free(buf); pclose(stream); #else + manpath_manconf(MAN_CONF_FILE, dirs); +#endif +} + +void +manpath_free(struct manpaths *p) +{ + int i; + + for (i = 0; i < p->sz; i++) + free(p->paths[i]); + + free(p->paths); +} + +void +manpath_manconf(const char *file, struct manpaths *dirs) +{ + FILE *stream; char *p, *q; size_t len, keysz; keysz = strlen(MAN_CONF_KEY); assert(keysz > 0); - if (NULL == (stream = fopen(MAN_CONF_FILE, "r"))) + if (NULL == (stream = fopen(file, "r"))) return; while (NULL != (p = fgetln(stream, &len))) { @@ -152,16 +171,4 @@ manpath_parseconf(struct manpaths *dirs) } fclose(stream); -#endif -} - -void -manpath_free(struct manpaths *p) -{ - int i; - - for (i = 0; i < p->sz; i++) - free(p->paths[i]); - - free(p->paths); }