=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.295 retrieving revision 1.297 diff -u -p -r1.295 -r1.297 --- mandoc/main.c 2017/07/01 12:02:31 1.295 +++ mandoc/main.c 2017/07/02 15:31:59 1.297 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.295 2017/07/01 12:02:31 schwarze Exp $ */ +/* $Id: main.c,v 1.297 2017/07/02 15:31:59 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze @@ -663,14 +663,23 @@ fs_lookup(const struct manpaths *paths, size_t ipath, if (globres == 0) file = mandoc_strdup(*globinfo.gl_pathv); globfree(&globinfo); - if (globres != 0) + if (globres == 0) + goto found; + if (res != NULL || ipath + 1 != paths->sz) return 0; + mandoc_asprintf(&file, "%s.%s", name, sec); + globres = access(file, R_OK); + free(file); + return globres != -1; + found: warnx("outdated mandoc.db lacks %s(%s) entry, run %s %s", name, sec, BINM_MAKEWHATIS, paths->paths[ipath]); - if (res == NULL) + if (res == NULL) { + free(file); return 1; + } *res = mandoc_reallocarray(*res, ++*ressz, sizeof(struct manpage)); page = *res + (*ressz - 1); page->file = file; @@ -754,8 +763,7 @@ parse(struct curparse *curp, int fd, const char *file) if (man == NULL) return; - if (curp->mmin < MANDOCERR_STYLE) - mandoc_xr_reset(); + mandoc_xr_reset(); if (man->macroset == MACROSET_MDOC) { if (curp->outtype != OUTT_TREE || !curp->outopts->noval) mdoc_validate(man); @@ -807,7 +815,8 @@ parse(struct curparse *curp, int fd, const char *file) break; } } - check_xr(file); + if (curp->mmin < MANDOCERR_STYLE) + check_xr(file); mparse_updaterc(curp->mp, &rc); } @@ -824,6 +833,8 @@ check_xr(const char *file) manpath_base(&paths); for (xr = mandoc_xr_get(); xr != NULL; xr = xr->next) { + if (xr->line == -1) + continue; search.arch = NULL; search.sec = xr->sec; search.outkey = NULL;