aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mansearch.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 /mansearch.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 'mansearch.c')
-rw-r--r--mansearch.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/mansearch.c b/mansearch.c
index a8a37a96..9c88fac8 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.47 2014/09/01 22:45:53 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.48 2014/09/03 18:09:14 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -80,7 +80,7 @@ struct expr {
struct match {
uint64_t pageid; /* identifier in database */
char *desc; /* manual page description */
- int form; /* 0 == catpage */
+ int form; /* bit field: formatted, zipped? */
};
static void buildnames(struct manpage *, sqlite3 *,
@@ -398,6 +398,7 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
{
char *newnames, *prevsec, *prevarch;
const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec;
+ const char *gzip;
size_t i;
int c;
@@ -463,16 +464,20 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
if (NULL != mpage->file)
continue;
- if (form) {
+ if (form & FORM_SRC) {
sep1 = "man";
fsec = sec;
} else {
sep1 = "cat";
fsec = "0";
}
+ if (form & FORM_GZ)
+ gzip = ".gz";
+ else
+ gzip = "";
sep2 = '\0' == *arch ? "" : "/";
- mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s",
- path, sep1, sec, sep2, arch, name, fsec);
+ mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s%s",
+ path, sep1, sec, sep2, arch, name, fsec, gzip);
}
if (SQLITE_DONE != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));