summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/manpath.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-12-19 02:26:33 +0000
committerschwarze <schwarze@openbsd.org>2011-12-19 02:26:33 +0000
commit18eee2d9c65b7a339eca76bab2f6c525890a56fe (patch)
tree257d386cd037c5dd4381aac331d2f011cbc53ff0 /usr.bin/mandoc/manpath.c
parentSync comments with latest cleanup changes (diff)
downloadwireguard-openbsd-18eee2d9c65b7a339eca76bab2f6c525890a56fe.tar.xz
wireguard-openbsd-18eee2d9c65b7a339eca76bab2f6c525890a56fe.zip
Improvements from kristaps@:
(1) Make the database format simpler and smaller by - storing the file type as a single character and - storing paths relative to the dir containing the database. The latter allows to move trees around. Both together typically save 15-25% of the index size. (2) Make sure apropos(1) "any" really covers all search keys. (3) Make manpath_parseline() static, drop manpath_parseconf() completely.
Diffstat (limited to 'usr.bin/mandoc/manpath.c')
-rw-r--r--usr.bin/mandoc/manpath.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/usr.bin/mandoc/manpath.c b/usr.bin/mandoc/manpath.c
index 86084a7aca5..ed58c403ccf 100644
--- a/usr.bin/mandoc/manpath.c
+++ b/usr.bin/mandoc/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.2 2011/12/12 01:59:13 schwarze Exp $ */
+/* $Id: manpath.c,v 1.3 2011/12/19 02:26:33 schwarze Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -16,7 +16,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
+#include <sys/param.h>
+
#include <assert.h>
#include <ctype.h>
#include <limits.h>
@@ -31,6 +32,7 @@
#define MAN_CONF_KEY "_whatdb"
static void manpath_add(struct manpaths *, const char *);
+static void manpath_parseline(struct manpaths *, char *);
void
manpath_parse(struct manpaths *dirs, const char *file,
@@ -43,7 +45,7 @@ manpath_parse(struct manpaths *dirs, const char *file,
defp = getenv("MANPATH");
if (NULL == defp)
- manpath_parseconf(dirs, file);
+ manpath_manconf(dirs, file ? file : MAN_CONF_FILE);
else
manpath_parseline(dirs, defp);
}
@@ -51,7 +53,7 @@ manpath_parse(struct manpaths *dirs, const char *file,
/*
* Parse a FULL pathname from a colon-separated list of arrays.
*/
-void
+static void
manpath_parseline(struct manpaths *dirs, char *path)
{
char *dir;
@@ -89,13 +91,6 @@ manpath_add(struct manpaths *dirs, const char *dir)
}
void
-manpath_parseconf(struct manpaths *dirs, const char *file)
-{
-
- manpath_manconf(dirs, file ? file : MAN_CONF_FILE);
-}
-
-void
manpath_free(struct manpaths *p)
{
int i;