aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-03 18:09:14 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-03 18:09:14 +0000
commit248398820acb6a81f0d92b7a33dc1e449dda483b (patch)
tree93066814e716198d92cc1458fab4a2eca07bea9a /mandocdb.c
parent02046d75d7ec4c27ec31d04e15c9d9fe018a01ab (diff)
downloadmandoc-248398820acb6a81f0d92b7a33dc1e449dda483b.tar.gz
mandoc-248398820acb6a81f0d92b7a33dc1e449dda483b.tar.zst
mandoc-248398820acb6a81f0d92b7a33dc1e449dda483b.zip
If a manual page is installed gzip(1)ed, let makewhatis(8) take
note in mandoc.db(5), such that man(1) -w and apropos(1) -w can report the correct filename. This is a prerequisite for letting apropos -a and man support gzip'ed manuals in the future, which doesn't work yet.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 7ad55a50..e1c744d7 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.160 2014/09/01 23:47:59 schwarze Exp $ */
+/* $OpenBSD$ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -83,12 +83,6 @@ enum op {
OP_TEST /* change no databases, report potential problems */
};
-enum form {
- FORM_NONE, /* format is unknown */
- FORM_SRC, /* format is -man or -mdoc */
- FORM_CAT /* format is cat */
-};
-
struct str {
char *rendered; /* key in UTF-8 or ASCII form */
const struct mpage *mpage; /* if set, the owning parse */
@@ -104,24 +98,24 @@ struct inodev {
struct mpage {
struct inodev inodev; /* used for hashing routine */
int64_t pageid; /* pageid in mpages SQL table */
- enum form form; /* format from file content */
char *sec; /* section from file content */
char *arch; /* architecture from file content */
char *title; /* title from file content */
char *desc; /* description from file content */
struct mlink *mlinks; /* singly linked list */
+ int form; /* format from file content */
};
struct mlink {
char file[PATH_MAX]; /* filename rel. to manpath */
- enum form dform; /* format from directory */
- enum form fform; /* format from file name suffix */
char *dsec; /* section from directory */
char *arch; /* architecture from directory */
char *name; /* name from file name (not empty) */
char *fsec; /* section from file name suffix */
struct mlink *next; /* singly linked list */
struct mpage *mpage; /* parent */
+ int dform; /* format from directory */
+ int fform; /* format from file name suffix */
int gzip; /* filename has a .gz suffix */
};
@@ -838,6 +832,7 @@ filescan(const char *file)
}
mlink = mandoc_calloc(1, sizeof(struct mlink));
+ mlink->dform = FORM_NONE;
if (strlcpy(mlink->file, start, sizeof(mlink->file)) >=
sizeof(mlink->file)) {
say(start, "Filename too long");
@@ -1226,6 +1221,8 @@ mpages_merge(struct mchars *mc, struct mparse *mp)
mpage->title =
mandoc_strdup(mpage->mlinks->name);
}
+ if (mpage->mlinks->gzip)
+ mpage->form |= FORM_GZ;
putkey(mpage, mpage->sec, TYPE_sec);
putkey(mpage, '\0' == *mpage->arch ?
any : mpage->arch, TYPE_arch);
@@ -2057,7 +2054,7 @@ dbadd(struct mpage *mpage, struct mchars *mc)
i = 1;
SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, key->rendered);
- SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, FORM_SRC == mpage->form);
+ SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, mpage->form);
SQL_STEP(stmts[STMT_INSERT_PAGE]);
mpage->pageid = sqlite3_last_insert_rowid(db);
sqlite3_reset(stmts[STMT_INSERT_PAGE]);