summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-01 09:47:24 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-01 09:47:24 +0000
commit1ad6d7311961fac841acd8e08dbb1476822628fb (patch)
tree4596d09888a7c594252616e1d6320b4180c1644e /usr.bin/mandoc/mdoc_validate.c
parent263f76facd2a5dcc7f2ea79c5f186d6fe3099856 (diff)
Basic reporting of .Xrs to manual pages that don't exist
in the base system, inspired by mdoclint(1). We are able to do this because (1) the -mdoc parser, the -Tlint validator, and the man(1) manual page lookup code are all in the same program and (2) the mandoc.db(5) database format allows fast lookup. Feedback from, previous versions tested by, and OK jmc@. A few features will be added to this in the tree, step by step.
Diffstat (limited to 'usr.bin/mandoc/mdoc_validate.c')
-rw-r--r--usr.bin/mandoc/mdoc_validate.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index 573b6829133..f0b1d6fccc3 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_validate.c,v 1.260 2017/06/29 15:21:46 schwarze Exp $ */
+/* $OpenBSD: mdoc_validate.c,v 1.261 2017/07/01 09:47:23 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -31,6 +31,7 @@
#include "mandoc_aux.h"
#include "mandoc.h"
+#include "mandoc_xr.h"
#include "roff.h"
#include "mdoc.h"
#include "libmandoc.h"
@@ -2321,8 +2322,11 @@ post_xr(POST_ARGS)
if (nch->next == NULL) {
mandoc_vmsg(MANDOCERR_XR_NOSEC, mdoc->parse,
n->line, n->pos, "Xr %s", nch->string);
- } else
+ } else {
assert(nch->next == n->last);
+ mandoc_xr_add(nch->next->string, nch->string,
+ nch->line, nch->pos);
+ }
post_delim(mdoc);
}