version 1.182, 2015/01/03 12:55:25 |
version 1.186, 2015/03/13 00:19:41 |
Line 442 mandocdb(int argc, char *argv[]) |
|
Line 442 mandocdb(int argc, char *argv[]) |
|
|
|
exitcode = (int)MANDOCLEVEL_OK; |
exitcode = (int)MANDOCLEVEL_OK; |
mchars = mchars_alloc(); |
mchars = mchars_alloc(); |
mp = mparse_alloc(mparse_options, MANDOCLEVEL_FATAL, NULL, |
mp = mparse_alloc(mparse_options, MANDOCLEVEL_BADARG, NULL, |
mchars, NULL); |
mchars, NULL); |
ohash_init(&mpages, 6, &mpages_info); |
ohash_init(&mpages, 6, &mpages_info); |
ohash_init(&mlinks, 6, &mlinks_info); |
ohash_init(&mlinks, 6, &mlinks_info); |
|
|
say(path, "&realpath"); |
say(path, "&realpath"); |
continue; |
continue; |
} |
} |
if (strstr(buf, basedir) != buf) { |
if (strstr(buf, basedir) != buf |
|
#ifdef HOMEBREWDIR |
|
&& strstr(buf, HOMEBREWDIR) != buf |
|
#endif |
|
) { |
if (warnings) say("", |
if (warnings) say("", |
"%s: outside base directory", buf); |
"%s: outside base directory", buf); |
continue; |
continue; |
|
|
say(path, "Skip pdf"); |
say(path, "Skip pdf"); |
continue; |
continue; |
} else if ( ! use_all && |
} else if ( ! use_all && |
((FORM_SRC == dform && strcmp(fsec, dsec)) || |
((FORM_SRC == dform && |
|
strncmp(fsec, dsec, strlen(dsec))) || |
(FORM_CAT == dform && strcmp(fsec, "0")))) { |
(FORM_CAT == dform && strcmp(fsec, "0")))) { |
if (warnings) |
if (warnings) |
say(path, "Wrong filename suffix"); |
say(path, "Wrong filename suffix"); |
Line 818 filescan(const char *file) |
|
Line 823 filescan(const char *file) |
|
start = buf; |
start = buf; |
else if (strstr(buf, basedir) == buf) |
else if (strstr(buf, basedir) == buf) |
start = buf + strlen(basedir); |
start = buf + strlen(basedir); |
|
#ifdef HOMEBREWDIR |
|
else if (strstr(buf, HOMEBREWDIR) == buf) |
|
start = buf; |
|
#endif |
else { |
else { |
exitcode = (int)MANDOCLEVEL_BADARG; |
exitcode = (int)MANDOCLEVEL_BADARG; |
say("", "%s: outside base directory", buf); |
say("", "%s: outside base directory", buf); |
Line 933 mlink_add(struct mlink *mlink, const struct stat *st) |
|
Line 942 mlink_add(struct mlink *mlink, const struct stat *st) |
|
assert(NULL == ohash_find(&mlinks, slot)); |
assert(NULL == ohash_find(&mlinks, slot)); |
ohash_insert(&mlinks, slot, mlink); |
ohash_insert(&mlinks, slot, mlink); |
|
|
|
memset(&inodev, 0, sizeof(inodev)); /* Clear padding. */ |
inodev.st_ino = st->st_ino; |
inodev.st_ino = st->st_ino; |
inodev.st_dev = st->st_dev; |
inodev.st_dev = st->st_dev; |
slot = ohash_lookup_memory(&mpages, (char *)&inodev, |
slot = ohash_lookup_memory(&mpages, (char *)&inodev, |
Line 1102 mpages_merge(struct mparse *mp) |
|
Line 1112 mpages_merge(struct mparse *mp) |
|
char *cp; |
char *cp; |
int fd; |
int fd; |
unsigned int pslot; |
unsigned int pslot; |
enum mandoclevel lvl; |
|
|
|
str_info.alloc = hash_alloc; |
str_info.alloc = hash_alloc; |
str_info.calloc = hash_calloc; |
str_info.calloc = hash_calloc; |
Line 1136 mpages_merge(struct mparse *mp) |
|
Line 1145 mpages_merge(struct mparse *mp) |
|
} |
} |
|
|
/* |
/* |
* Try interpreting the file as mdoc(7) or man(7) |
* Interpret the file as mdoc(7) or man(7) source |
* source code, unless it is already known to be |
* code, unless it is known to be formatted. |
* formatted. Fall back to formatted mode. |
|
*/ |
*/ |
if (mlink->dform != FORM_CAT || mlink->fform != FORM_CAT) { |
if (mlink->dform != FORM_CAT || mlink->fform != FORM_CAT) { |
lvl = mparse_readfd(mp, fd, mlink->file); |
mparse_readfd(mp, fd, mlink->file); |
if (lvl < MANDOCLEVEL_FATAL) |
mparse_result(mp, &mdoc, &man, &sodest); |
mparse_result(mp, &mdoc, &man, &sodest); |
|
} |
} |
|
|
if (sodest != NULL) { |
if (sodest != NULL) { |