aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manpath.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-11-24 10:43:55 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-11-24 10:43:55 +0000
commit2a49c75c52a1e488bee53810342812dd48f32a79 (patch)
treeaf389bd7d19afcb541520d1574ffc96fe60fce82 /manpath.c
parent398166afdb1000ee46de9463b6e85a51372ed43c (diff)
downloadmandoc-2a49c75c52a1e488bee53810342812dd48f32a79.tar.gz
mandoc-2a49c75c52a1e488bee53810342812dd48f32a79.tar.zst
mandoc-2a49c75c52a1e488bee53810342812dd48f32a79.zip
Export the manpath_manconf() function, slightly reorderng manpath.c while
doing so. This will be used by a jailed man.cgi, as the cache built by manup(8) creates a man.conf for it to use.
Diffstat (limited to 'manpath.c')
-rw-r--r--manpath.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/manpath.c b/manpath.c
index b38148a5..7d5492bf 100644
--- a/manpath.c
+++ b/manpath.c
@@ -1,4 +1,4 @@
-/* $Id: manpath.c,v 1.1 2011/11/23 09:47:38 kristaps Exp $ */
+/* $Id: manpath.c,v 1.2 2011/11/24 10:43:55 kristaps Exp $ */
/*
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -92,8 +92,8 @@ manpath_add(struct manpaths *dirs, const char *dir)
void
manpath_parseconf(struct manpaths *dirs)
{
- FILE *stream;
#ifdef USE_MANPATH
+ FILE *stream;
char *buf;
size_t sz, bsz;
@@ -123,6 +123,25 @@ manpath_parseconf(struct manpaths *dirs)
free(buf);
pclose(stream);
#else
+ manpath_manconf(dirs);
+#endif
+}
+
+void
+manpath_free(struct manpaths *p)
+{
+ int i;
+
+ for (i = 0; i < p->sz; i++)
+ free(p->paths[i]);
+
+ free(p->paths);
+}
+
+void
+manpath_manconf(struct manpaths *dirs)
+{
+ FILE *stream;
char *p, *q;
size_t len, keysz;
@@ -152,16 +171,4 @@ manpath_parseconf(struct manpaths *dirs)
}
fclose(stream);
-#endif
-}
-
-void
-manpath_free(struct manpaths *p)
-{
- int i;
-
- for (i = 0; i < p->sz; i++)
- free(p->paths[i]);
-
- free(p->paths);
}