version 1.8, 2011/12/24 22:37:16 |
version 1.10, 2013/05/29 22:48:10 |
|
|
#include "config.h" |
#include "config.h" |
#endif |
#endif |
|
|
|
#ifdef USE_MANPATH |
#include <sys/param.h> |
#include <sys/param.h> |
|
#endif |
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
Line 74 manpath_parse(struct manpaths *dirs, const char *file, |
|
Line 76 manpath_parse(struct manpaths *dirs, const char *file, |
|
|
|
do { |
do { |
buf = mandoc_realloc(buf, bsz + 1024); |
buf = mandoc_realloc(buf, bsz + 1024); |
sz = fread(buf + (int)bsz, 1, 1024, stream); |
sz = fread(buf + bsz, 1, 1024, stream); |
bsz += sz; |
bsz += sz; |
} while (sz > 0); |
} while (sz > 0); |
|
|
Line 90 manpath_parse(struct manpaths *dirs, const char *file, |
|
Line 92 manpath_parse(struct manpaths *dirs, const char *file, |
|
char *insert; |
char *insert; |
|
|
/* Always prepend -m. */ |
/* Always prepend -m. */ |
manpath_parseline(dirs, auxp); |
manpath_parseline(dirs, auxp); |
|
|
/* If -M is given, it overrides everything else. */ |
/* If -M is given, it overrides everything else. */ |
if (NULL != defp) { |
if (NULL != defp) { |
manpath_parseline(dirs, defp); |
manpath_parseline(dirs, defp); |
Line 117 manpath_parse(struct manpaths *dirs, const char *file, |
|
Line 119 manpath_parse(struct manpaths *dirs, const char *file, |
|
} |
} |
|
|
/* Append man.conf(5) to MANPATH. */ |
/* Append man.conf(5) to MANPATH. */ |
if (':' == defp[(int)strlen(defp) - 1]) { |
if (':' == defp[strlen(defp) - 1]) { |
manpath_parseline(dirs, defp); |
manpath_parseline(dirs, defp); |
manpath_manconf(dirs, file); |
manpath_manconf(dirs, file); |
return; |
return; |
Line 162 manpath_add(struct manpaths *dirs, const char *dir) |
|
Line 164 manpath_add(struct manpaths *dirs, const char *dir) |
|
{ |
{ |
char buf[PATH_MAX]; |
char buf[PATH_MAX]; |
char *cp; |
char *cp; |
int i; |
size_t i; |
|
|
if (NULL == (cp = realpath(dir, buf))) |
if (NULL == (cp = realpath(dir, buf))) |
return; |
return; |
Line 173 manpath_add(struct manpaths *dirs, const char *dir) |
|
Line 175 manpath_add(struct manpaths *dirs, const char *dir) |
|
|
|
dirs->paths = mandoc_realloc |
dirs->paths = mandoc_realloc |
(dirs->paths, |
(dirs->paths, |
((size_t)dirs->sz + 1) * sizeof(char *)); |
(dirs->sz + 1) * sizeof(char *)); |
|
|
dirs->paths[dirs->sz++] = mandoc_strdup(cp); |
dirs->paths[dirs->sz++] = mandoc_strdup(cp); |
} |
} |
Line 181 manpath_add(struct manpaths *dirs, const char *dir) |
|
Line 183 manpath_add(struct manpaths *dirs, const char *dir) |
|
void |
void |
manpath_free(struct manpaths *p) |
manpath_free(struct manpaths *p) |
{ |
{ |
int i; |
size_t i; |
|
|
for (i = 0; i < p->sz; i++) |
for (i = 0; i < p->sz; i++) |
free(p->paths[i]); |
free(p->paths[i]); |