summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-25 17:49:52 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-25 17:49:52 +0000
commit2008dee5c827764c4952cdd2279b165f6b5cfb33 (patch)
tree155d9b4ce5273a67519d2684f65af96966f0b5ba
parentb7365608ef06a71f7d9658905a3ceb25eeb5089b (diff)
downloadmandoc-2008dee5c827764c4952cdd2279b165f6b5cfb33.tar.gz
Continue changing mandoc.{index,db} into whatis.{index,db}. Use mandocdb.h
to do so.
-rw-r--r--Makefile2
-rw-r--r--catman.c32
-rw-r--r--cgi.c4
3 files changed, 27 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index dd938c96..bf4b0edc 100644
--- a/Makefile
+++ b/Makefile
@@ -337,7 +337,7 @@ $(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h
CATMAN_OBJS = catman.o manpath.o
CATMAN_LNS = catman.ln manpath.ln
-$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h
+$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h
DEMANDOC_OBJS = demandoc.o
DEMANDOC_LNS = demandoc.ln
diff --git a/catman.c b/catman.c
index 599fc0df..2f1549a6 100644
--- a/catman.c
+++ b/catman.c
@@ -38,6 +38,7 @@
#endif
#include "manpath.h"
+#include "mandocdb.h"
#define xstrlcpy(_dst, _src, _sz) \
do if (strlcpy((_dst), (_src), (_sz)) >= (_sz)) { \
@@ -216,7 +217,8 @@ indexhtml(char *src, size_t ssz, char *dst, size_t dsz)
pid = -1;
xstrlcpy(fname, dst, MAXPATHLEN);
- xstrlcat(fname, "/mandoc.index", MAXPATHLEN);
+ xstrlcat(fname, "/", MAXPATHLEN);
+ xstrlcat(fname, MANDOC_IDX, MAXPATHLEN);
idx = dbopen(fname, O_RDONLY, 0, DB_RECNO, NULL);
if (NULL == idx) {
@@ -292,8 +294,11 @@ update(char *dst, char *src)
dsz = strlen(dst);
ssz = strlen(src);
- xstrlcat(src, "/mandoc.db", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.db", MAXPATHLEN);
+ xstrlcat(src, "/", MAXPATHLEN);
+ xstrlcat(dst, "/", MAXPATHLEN);
+
+ xstrlcat(src, MANDOC_DB, MAXPATHLEN);
+ xstrlcat(dst, MANDOC_DB, MAXPATHLEN);
if ( ! filecpy(dst, src))
return(-1);
@@ -302,8 +307,11 @@ update(char *dst, char *src)
dst[(int)dsz] = src[(int)ssz] = '\0';
- xstrlcat(src, "/mandoc.index", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.index", MAXPATHLEN);
+ xstrlcat(src, "/", MAXPATHLEN);
+ xstrlcat(dst, "/", MAXPATHLEN);
+
+ xstrlcat(src, MANDOC_IDX, MAXPATHLEN);
+ xstrlcat(dst, MANDOC_IDX, MAXPATHLEN);
if ( ! filecpy(dst, src))
return(-1);
@@ -330,8 +338,11 @@ treecpy(char *dst, char *src)
dsz = strlen(dst);
ssz = strlen(src);
- xstrlcat(src, "/mandoc.index", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.index", MAXPATHLEN);
+ xstrlcat(src, "/", MAXPATHLEN);
+ xstrlcat(dst, "/", MAXPATHLEN);
+
+ xstrlcat(src, MANDOC_IDX, MAXPATHLEN);
+ xstrlcat(dst, MANDOC_IDX, MAXPATHLEN);
if (-1 == (rc = isnewer(dst, src)))
return(0);
@@ -341,8 +352,11 @@ treecpy(char *dst, char *src)
if (1 == rc)
return(update(dst, src));
- xstrlcat(src, "/mandoc.db", MAXPATHLEN);
- xstrlcat(dst, "/mandoc.db", MAXPATHLEN);
+ xstrlcat(src, "/", MAXPATHLEN);
+ xstrlcat(dst, "/", MAXPATHLEN);
+
+ xstrlcat(src, MANDOC_DB, MAXPATHLEN);
+ xstrlcat(dst, MANDOC_DB, MAXPATHLEN);
if (-1 == (rc = isnewer(dst, src)))
return(0);
diff --git a/cgi.c b/cgi.c
index 9551e459..629a0429 100644
--- a/cgi.c
+++ b/cgi.c
@@ -41,6 +41,7 @@
#include "man.h"
#include "main.h"
#include "manpath.h"
+#include "mandocdb.h"
#ifdef __linux__
# include <db_185.h>
@@ -843,7 +844,8 @@ pg_show(const struct req *req, char *path)
sz = strlcpy(file, ps.paths[vol], MAXPATHLEN);
assert(sz < MAXPATHLEN);
- strlcat(file, "/mandoc.index", MAXPATHLEN);
+ strlcat(file, "/", MAXPATHLEN);
+ strlcat(file, MANDOC_IDX, MAXPATHLEN);
/* Open the index recno(3) database. */