version 1.10, 2013/05/29 22:48:10 |
version 1.17, 2014/08/16 19:00:01 |
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
*/ |
*/ |
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
#include "config.h" |
#endif |
|
|
|
#ifdef USE_MANPATH |
#include <sys/types.h> |
#include <sys/param.h> |
|
#endif |
|
|
|
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
#include "mandoc.h" |
#include "mandoc_aux.h" |
#include "manpath.h" |
#include "manpath.h" |
|
|
#define MAN_CONF_FILE "/etc/man.conf" |
#define MAN_CONF_FILE "/etc/man.conf" |
|
|
manpath_parse(struct manpaths *dirs, const char *file, |
manpath_parse(struct manpaths *dirs, const char *file, |
char *defp, char *auxp) |
char *defp, char *auxp) |
{ |
{ |
#ifdef USE_MANPATH |
#if HAVE_MANPATH |
char cmd[(MAXPATHLEN * 3) + 20]; |
char cmd[(PATH_MAX * 3) + 20]; |
FILE *stream; |
FILE *stream; |
char *buf; |
char *buf; |
size_t sz, bsz; |
size_t sz, bsz; |
Line 173 manpath_add(struct manpaths *dirs, const char *dir) |
|
Line 169 manpath_add(struct manpaths *dirs, const char *dir) |
|
if (0 == strcmp(dirs->paths[i], dir)) |
if (0 == strcmp(dirs->paths[i], dir)) |
return; |
return; |
|
|
dirs->paths = mandoc_realloc |
dirs->paths = mandoc_reallocarray(dirs->paths, |
(dirs->paths, |
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 213 manpath_manconf(struct manpaths *dirs, const char *fil |
|
Line 208 manpath_manconf(struct manpaths *dirs, const char *fil |
|
if (strncmp(MAN_CONF_KEY, p, keysz)) |
if (strncmp(MAN_CONF_KEY, p, keysz)) |
continue; |
continue; |
p += keysz; |
p += keysz; |
while (isspace(*p)) |
while (isspace((unsigned char)*p)) |
p++; |
p++; |
if ('\0' == *p) |
if ('\0' == *p) |
continue; |
continue; |