version 1.47, 2014/09/01 22:45:53 |
version 1.49, 2014/11/11 19:04:55 |
|
|
struct match { |
struct match { |
uint64_t pageid; /* identifier in database */ |
uint64_t pageid; /* identifier in database */ |
char *desc; /* manual page description */ |
char *desc; /* manual page description */ |
int form; /* 0 == catpage */ |
int form; /* bit field: formatted, zipped? */ |
}; |
}; |
|
|
static void buildnames(struct manpage *, sqlite3 *, |
static void buildnames(struct manpage *, sqlite3 *, |
Line 352 mansearch(const struct mansearch *search, |
|
Line 352 mansearch(const struct mansearch *search, |
|
sqlite3_finalize(s2); |
sqlite3_finalize(s2); |
sqlite3_close(db); |
sqlite3_close(db); |
ohash_delete(&htab); |
ohash_delete(&htab); |
|
|
|
/* |
|
* In man(1) mode, prefer matches in earlier trees |
|
* over matches in later trees. |
|
*/ |
|
|
|
if (cur && search->firstmatch) |
|
break; |
} |
} |
qsort(*res, cur, sizeof(struct manpage), manpage_compare); |
qsort(*res, cur, sizeof(struct manpage), manpage_compare); |
rc = 1; |
rc = 1; |
Line 398 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
Line 406 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
{ |
{ |
char *newnames, *prevsec, *prevarch; |
char *newnames, *prevsec, *prevarch; |
const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec; |
const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec; |
|
const char *gzip; |
size_t i; |
size_t i; |
int c; |
int c; |
|
|
Line 463 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
Line 472 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
if (NULL != mpage->file) |
if (NULL != mpage->file) |
continue; |
continue; |
|
|
if (form) { |
if (form & FORM_SRC) { |
sep1 = "man"; |
sep1 = "man"; |
fsec = sec; |
fsec = sec; |
} else { |
} else { |
sep1 = "cat"; |
sep1 = "cat"; |
fsec = "0"; |
fsec = "0"; |
} |
} |
|
if (form & FORM_GZ) |
|
gzip = ".gz"; |
|
else |
|
gzip = ""; |
sep2 = '\0' == *arch ? "" : "/"; |
sep2 = '\0' == *arch ? "" : "/"; |
mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s", |
mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s%s", |
path, sep1, sec, sep2, arch, name, fsec); |
path, sep1, sec, sep2, arch, name, fsec, gzip); |
} |
} |
if (SQLITE_DONE != c) |
if (SQLITE_DONE != c) |
fprintf(stderr, "%s\n", sqlite3_errmsg(db)); |
fprintf(stderr, "%s\n", sqlite3_errmsg(db)); |