=================================================================== RCS file: /cvs/mandoc/mandocdb.c,v retrieving revision 1.182 retrieving revision 1.185 diff -u -p -r1.182 -r1.185 --- mandoc/mandocdb.c 2015/01/03 12:55:25 1.182 +++ mandoc/mandocdb.c 2015/02/27 16:22:09 1.185 @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.182 2015/01/03 12:55:25 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.185 2015/02/27 16:22:09 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2015 Ingo Schwarze @@ -442,7 +442,7 @@ mandocdb(int argc, char *argv[]) exitcode = (int)MANDOCLEVEL_OK; mchars = mchars_alloc(); - mp = mparse_alloc(mparse_options, MANDOCLEVEL_FATAL, NULL, + mp = mparse_alloc(mparse_options, MANDOCLEVEL_BADARG, NULL, mchars, NULL); ohash_init(&mpages, 6, &mpages_info); ohash_init(&mlinks, 6, &mlinks_info); @@ -613,7 +613,11 @@ treescan(void) say(path, "&realpath"); continue; } - if (strstr(buf, basedir) != buf) { + if (strstr(buf, basedir) != buf +#ifdef HOMEBREWDIR + && strstr(buf, HOMEBREWDIR) != buf +#endif + ) { if (warnings) say("", "%s: outside base directory", buf); continue; @@ -668,7 +672,8 @@ treescan(void) say(path, "Skip pdf"); continue; } else if ( ! use_all && - ((FORM_SRC == dform && strcmp(fsec, dsec)) || + ((FORM_SRC == dform && + strncmp(fsec, dsec, strlen(dsec))) || (FORM_CAT == dform && strcmp(fsec, "0")))) { if (warnings) say(path, "Wrong filename suffix"); @@ -818,6 +823,10 @@ filescan(const char *file) start = buf; else if (strstr(buf, basedir) == buf) start = buf + strlen(basedir); +#ifdef HOMEBREWDIR + else if (strstr(buf, HOMEBREWDIR) == buf) + start = buf; +#endif else { exitcode = (int)MANDOCLEVEL_BADARG; say("", "%s: outside base directory", buf); @@ -1102,7 +1111,6 @@ mpages_merge(struct mparse *mp) char *cp; int fd; unsigned int pslot; - enum mandoclevel lvl; str_info.alloc = hash_alloc; str_info.calloc = hash_calloc; @@ -1136,14 +1144,12 @@ mpages_merge(struct mparse *mp) } /* - * Try interpreting the file as mdoc(7) or man(7) - * source code, unless it is already known to be - * formatted. Fall back to formatted mode. + * Interpret the file as mdoc(7) or man(7) source + * code, unless it is known to be formatted. */ if (mlink->dform != FORM_CAT || mlink->fform != FORM_CAT) { - lvl = mparse_readfd(mp, fd, mlink->file); - if (lvl < MANDOCLEVEL_FATAL) - mparse_result(mp, &mdoc, &man, &sodest); + mparse_readfd(mp, fd, mlink->file); + mparse_result(mp, &mdoc, &man, &sodest); } if (sodest != NULL) {