version 1.169, 2014/11/19 20:40:51 |
version 1.171, 2014/11/27 01:58:21 |
Line 1084 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1084 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
struct man *man; |
struct man *man; |
char *sodest; |
char *sodest; |
char *cp; |
char *cp; |
pid_t child_pid; |
|
int fd; |
int fd; |
unsigned int pslot; |
unsigned int pslot; |
enum mandoclevel lvl; |
enum mandoclevel lvl; |
Line 1094 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1093 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
str_info.free = hash_free; |
str_info.free = hash_free; |
str_info.key_offset = offsetof(struct str, key); |
str_info.key_offset = offsetof(struct str, key); |
|
|
if (0 == nodb) |
if ( ! nodb) |
SQL_EXEC("BEGIN TRANSACTION"); |
SQL_EXEC("BEGIN TRANSACTION"); |
|
|
mpage = ohash_first(&mpages, &pslot); |
mpage = ohash_first(&mpages, &pslot); |
while (NULL != mpage) { |
while (mpage != NULL) { |
mlinks_undupe(mpage); |
mlinks_undupe(mpage); |
if (NULL == mpage->mlinks) { |
if (mpage->mlinks == NULL) { |
mpage = ohash_next(&mpages, &pslot); |
mpage = ohash_next(&mpages, &pslot); |
continue; |
continue; |
} |
} |
Line 1112 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1111 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
mdoc = NULL; |
mdoc = NULL; |
man = NULL; |
man = NULL; |
sodest = NULL; |
sodest = NULL; |
child_pid = 0; |
|
|
|
mparse_open(mp, &fd, mpage->mlinks->file, &child_pid); |
mparse_open(mp, &fd, mpage->mlinks->file); |
if (fd == -1) { |
if (fd == -1) { |
say(mpage->mlinks->file, "&open"); |
say(mpage->mlinks->file, "&open"); |
goto nextpage; |
goto nextpage; |
Line 1125 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1123 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
* source code, unless it is already known to be |
* source code, unless it is already known to be |
* formatted. Fall back to formatted mode. |
* formatted. Fall back to formatted mode. |
*/ |
*/ |
if (FORM_CAT != mpage->mlinks->dform || |
if (mpage->mlinks->dform != FORM_CAT || |
FORM_CAT != mpage->mlinks->fform) { |
mpage->mlinks->fform != FORM_CAT) { |
lvl = mparse_readfd(mp, fd, mpage->mlinks->file); |
lvl = mparse_readfd(mp, fd, mpage->mlinks->file); |
if (lvl < MANDOCLEVEL_FATAL) |
if (lvl < MANDOCLEVEL_FATAL) |
mparse_result(mp, &mdoc, &man, &sodest); |
mparse_result(mp, &mdoc, &man, &sodest); |
} |
} |
|
|
if (NULL != sodest) { |
if (sodest != NULL) { |
mlink_dest = ohash_find(&mlinks, |
mlink_dest = ohash_find(&mlinks, |
ohash_qlookup(&mlinks, sodest)); |
ohash_qlookup(&mlinks, sodest)); |
if (NULL != mlink_dest) { |
if (mlink_dest == NULL) { |
|
mandoc_asprintf(&cp, "%s.gz", sodest); |
|
mlink_dest = ohash_find(&mlinks, |
|
ohash_qlookup(&mlinks, cp)); |
|
free(cp); |
|
} |
|
if (mlink_dest != NULL) { |
|
|
/* The .so target exists. */ |
/* The .so target exists. */ |
|
|
Line 1156 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1160 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
if (mpage_dest->pageid) |
if (mpage_dest->pageid) |
dbadd_mlink_name(mlink); |
dbadd_mlink_name(mlink); |
|
|
if (NULL == mlink->next) |
if (mlink->next == NULL) |
break; |
break; |
mlink = mlink->next; |
mlink = mlink->next; |
} |
} |
Line 1168 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1172 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
mpage->mlinks = NULL; |
mpage->mlinks = NULL; |
} |
} |
goto nextpage; |
goto nextpage; |
} else if (NULL != mdoc) { |
} else if (mdoc != NULL) { |
mpage->form = FORM_SRC; |
mpage->form = FORM_SRC; |
mpage->sec = mdoc_meta(mdoc)->msec; |
mpage->sec = mdoc_meta(mdoc)->msec; |
mpage->sec = mandoc_strdup( |
mpage->sec = mandoc_strdup( |
NULL == mpage->sec ? "" : mpage->sec); |
mpage->sec == NULL ? "" : mpage->sec); |
mpage->arch = mdoc_meta(mdoc)->arch; |
mpage->arch = mdoc_meta(mdoc)->arch; |
mpage->arch = mandoc_strdup( |
mpage->arch = mandoc_strdup( |
NULL == mpage->arch ? "" : mpage->arch); |
mpage->arch == NULL ? "" : mpage->arch); |
mpage->title = |
mpage->title = |
mandoc_strdup(mdoc_meta(mdoc)->title); |
mandoc_strdup(mdoc_meta(mdoc)->title); |
} else if (NULL != man) { |
} else if (man != NULL) { |
mpage->form = FORM_SRC; |
mpage->form = FORM_SRC; |
mpage->sec = |
mpage->sec = |
mandoc_strdup(man_meta(man)->msec); |
mandoc_strdup(man_meta(man)->msec); |
Line 1195 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1199 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
mpage->title = |
mpage->title = |
mandoc_strdup(mpage->mlinks->name); |
mandoc_strdup(mpage->mlinks->name); |
} |
} |
if (mpage->mlinks->gzip) |
|
mpage->form |= FORM_GZ; |
|
putkey(mpage, mpage->sec, TYPE_sec); |
putkey(mpage, mpage->sec, TYPE_sec); |
if (*mpage->arch != '\0') |
if (*mpage->arch != '\0') |
putkey(mpage, mpage->arch, TYPE_arch); |
putkey(mpage, mpage->arch, TYPE_arch); |
Line 1231 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
Line 1233 mpages_merge(struct mchars *mc, struct mparse *mp) |
|
dbadd(mpage, mc); |
dbadd(mpage, mc); |
|
|
nextpage: |
nextpage: |
if (child_pid && |
if (mparse_wait(mp) != MANDOCLEVEL_OK) { |
mparse_wait(mp, child_pid) != MANDOCLEVEL_OK) { |
|
exitcode = (int)MANDOCLEVEL_SYSERR; |
exitcode = (int)MANDOCLEVEL_SYSERR; |
say(mpage->mlinks->file, "&wait gunzip"); |
say(mpage->mlinks->file, "&wait gunzip"); |
} |
} |