aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mansearch.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-11-27 01:58:21 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-11-27 01:58:21 +0000
commit63db09932dec56e5bb940db7c81df9660ab0c0d0 (patch)
treea852f77178f67800eb09ea634d99cee835f51a8a /mansearch.c
parent9fc2749bb963451e94e2b2163e7e5e43fcd6a264 (diff)
downloadmandoc-63db09932dec56e5bb940db7c81df9660ab0c0d0.tar.gz
mandoc-63db09932dec56e5bb940db7c81df9660ab0c0d0.tar.zst
mandoc-63db09932dec56e5bb940db7c81df9660ab0c0d0.zip
Make makewhatis(8) understand .so links to .gz pages.
Drop the FORM_GZ annotation in the mpages table; it is conceptually wrong because it ought to be in the mlinks table: An uncompressed .so link file can point to a compressed manual page file and vice versa. Besides, it is no longer needed because mparse_open() handles it all. Sprinkle some KNF while here.
Diffstat (limited to 'mansearch.c')
-rw-r--r--mansearch.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/mansearch.c b/mansearch.c
index 39841cab..77d4c074 100644
--- a/mansearch.c
+++ b/mansearch.c
@@ -1,4 +1,4 @@
-/* $Id: mansearch.c,v 1.50 2014/11/18 01:15:21 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.51 2014/11/27 01:58:21 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -410,7 +410,6 @@ 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;
@@ -473,7 +472,7 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
/* Also save the first file name encountered. */
- if (NULL != mpage->file)
+ if (mpage->file != NULL)
continue;
if (form & FORM_SRC) {
@@ -483,22 +482,18 @@ buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s,
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%s",
- path, sep1, sec, sep2, arch, name, fsec, gzip);
+ sep2 = *arch == '\0' ? "" : "/";
+ mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s",
+ path, sep1, sec, sep2, arch, name, fsec);
}
- if (SQLITE_DONE != c)
+ if (c != SQLITE_DONE)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
sqlite3_reset(s);
/* Append one final section to the names. */
- if (NULL != prevsec) {
- sep2 = '\0' == *prevarch ? "" : "/";
+ if (prevsec != NULL) {
+ sep2 = *prevarch == '\0' ? "" : "/";
mandoc_asprintf(&newnames, "%s(%s%s%s)",
mpage->names, prevsec, sep2, prevarch);
free(mpage->names);