version 1.2, 2011/12/12 01:59:13 |
version 1.3, 2011/12/19 02:26:33 |
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/param.h> |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <limits.h> |
#include <limits.h> |
|
|
#define MAN_CONF_KEY "_whatdb" |
#define MAN_CONF_KEY "_whatdb" |
|
|
static void manpath_add(struct manpaths *, const char *); |
static void manpath_add(struct manpaths *, const char *); |
|
static void manpath_parseline(struct manpaths *, char *); |
|
|
void |
void |
manpath_parse(struct manpaths *dirs, const char *file, |
manpath_parse(struct manpaths *dirs, const char *file, |
|
|
defp = getenv("MANPATH"); |
defp = getenv("MANPATH"); |
|
|
if (NULL == defp) |
if (NULL == defp) |
manpath_parseconf(dirs, file); |
manpath_manconf(dirs, file ? file : MAN_CONF_FILE); |
else |
else |
manpath_parseline(dirs, defp); |
manpath_parseline(dirs, defp); |
} |
} |
|
|
/* |
/* |
* Parse a FULL pathname from a colon-separated list of arrays. |
* Parse a FULL pathname from a colon-separated list of arrays. |
*/ |
*/ |
void |
static void |
manpath_parseline(struct manpaths *dirs, char *path) |
manpath_parseline(struct manpaths *dirs, char *path) |
{ |
{ |
char *dir; |
char *dir; |
|
|
((size_t)dirs->sz + 1) * sizeof(char *)); |
((size_t)dirs->sz + 1) * sizeof(char *)); |
|
|
dirs->paths[dirs->sz++] = mandoc_strdup(cp); |
dirs->paths[dirs->sz++] = mandoc_strdup(cp); |
} |
|
|
|
void |
|
manpath_parseconf(struct manpaths *dirs, const char *file) |
|
{ |
|
|
|
manpath_manconf(dirs, file ? file : MAN_CONF_FILE); |
|
} |
} |
|
|
void |
void |