version 1.18, 2014/01/06 03:02:46 |
version 1.19, 2014/01/06 03:52:13 |
Line 125 static const struct type types[] = { |
|
Line 125 static const struct type types[] = { |
|
}; |
}; |
|
|
static void buildnames(struct manpage *, sqlite3 *, |
static void buildnames(struct manpage *, sqlite3 *, |
sqlite3_stmt *, uint64_t, const char *); |
sqlite3_stmt *, uint64_t, |
|
const char *, int form); |
static char *buildoutput(sqlite3 *, sqlite3_stmt *, |
static char *buildoutput(sqlite3 *, sqlite3_stmt *, |
uint64_t, uint64_t); |
uint64_t, uint64_t); |
static void *hash_alloc(size_t, void *); |
static void *hash_alloc(size_t, void *); |
Line 319 mansearch(const struct mansearch *search, |
|
Line 320 mansearch(const struct mansearch *search, |
|
} |
} |
mpage = *res + cur; |
mpage = *res + cur; |
mpage->form = mp->form; |
mpage->form = mp->form; |
buildnames(mpage, db, s, mp->id, paths->paths[i]); |
buildnames(mpage, db, s, mp->id, |
|
paths->paths[i], mp->form); |
mpage->output = outbit ? |
mpage->output = outbit ? |
buildoutput(db, s2, mp->id, outbit) : NULL; |
buildoutput(db, s2, mp->id, outbit) : NULL; |
|
|
|
|
|
|
static void |
static void |
buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s, |
buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s, |
uint64_t id, const char *path) |
uint64_t id, const char *path, int form) |
{ |
{ |
char *newnames; |
char *newnames; |
const char *oldnames, *sep1, *name, *sec, *sep2, *arch; |
const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec; |
size_t i; |
size_t i; |
int c; |
int c; |
|
|
Line 365 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
Line 367 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
oldnames = mpage->names; |
oldnames = mpage->names; |
sep1 = ", "; |
sep1 = ", "; |
} |
} |
sec = sqlite3_column_text(s, 1); |
sec = sqlite3_column_text(s, 0); |
arch = sqlite3_column_text(s, 2); |
arch = sqlite3_column_text(s, 1); |
name = sqlite3_column_text(s, 3); |
name = sqlite3_column_text(s, 2); |
sep2 = '\0' == *arch ? "" : "/"; |
sep2 = '\0' == *arch ? "" : "/"; |
if (-1 == asprintf(&newnames, "%s%s%s(%s%s%s)", |
if (-1 == asprintf(&newnames, "%s%s%s(%s%s%s)", |
oldnames, sep1, name, sec, sep2, arch)) { |
oldnames, sep1, name, sec, sep2, arch)) { |
Line 382 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
Line 384 buildnames(struct manpage *mpage, sqlite3 *db, sqlite3 |
|
if (NULL != mpage->file) |
if (NULL != mpage->file) |
continue; |
continue; |
|
|
name = sqlite3_column_text(s, 0); |
if (form) { |
if (-1 == asprintf(&mpage->file, "%s/%s", path, name)) { |
sep1 = "man"; |
|
fsec = sec; |
|
} else { |
|
sep1 = "cat"; |
|
fsec = "0"; |
|
} |
|
if (-1 == asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s", |
|
path, sep1, sec, sep2, arch, name, fsec)) { |
perror(0); |
perror(0); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} |
} |