manpath.c revision 260e9a87725c090ba5835b1f9f0b62fa2f96036f
/* $Id: manpath.c,v 1.19 2014/11/27 00:30:40 schwarze Exp $ */
/*
* Copyright (c) 2011, 2014 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mandoc_aux.h"
#include "manpath.h"
#define MAN_CONF_FILE "/etc/man.conf"
#define MAN_CONF_KEY "_whatdb"
static void manpath_add(struct manpaths *, const char *, int);
static void manpath_parseline(struct manpaths *, char *, int);
void
{
#if HAVE_MANPATH
char *buf;
if (file) {
}
if (auxp) {
}
if (defp) {
}
/* Open manpath(1). Ignore errors. */
return;
bsz = 0;
/* Read in as much output as we can. */
do {
} while (sz > 0);
}
#else
char *insert;
/* Always prepend -m. */
/* If -M is given, it overrides everything else. */
return;
}
/* MANPATH and man.conf(5) cooperate. */
/* No MANPATH; use man.conf(5) only. */
return;
}
/* Prepend man.conf(5) to MANPATH. */
if (':' == defp[0]) {
return;
}
/* Append man.conf(5) to MANPATH. */
return;
}
/* Insert man.conf(5) into MANPATH. */
*insert++ = '\0';
return;
}
/* MANPATH overrides man.conf(5) completely. */
#endif
}
/*
* Parse a FULL pathname from a colon-separated list of arrays.
*/
static void
{
char *dir;
return;
}
/*
* Add a directory to the array, ignoring bad directories.
* Grow the array one-by-one for simplicity's sake.
*/
static void
{
char *cp;
size_t i;
if (complain) {
}
return;
}
return;
if (complain) {
}
return;
}
}
void
manpath_free(struct manpaths *p)
{
size_t i;
for (i = 0; i < p->sz; i++)
}
void
{
char *p, *q;
return;
break;
p[len] = '\0';
while (isspace((unsigned char)*p))
p++;
continue;
p += keysz;
while (isspace((unsigned char)*p))
p++;
if ('\0' == *p)
continue;
continue;
*q = '\0';
manpath_add(dirs, p, 0);
}
}