summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/main.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-02 21:17:13 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-02 21:17:13 +0000
commit3952e67e7c4d2dc2e2b454f7ab0000f34582c292 (patch)
treed87718a092f8ba9a7d11c0c65c77eb8b4f395a3f /usr.bin/mandoc/main.c
parent783af77d309e5eebb6f4d96fa7ae07cda61c1c9e (diff)
If a single page references the same non-existent manual more than
once, print "(N times)" after the message "referenced manual not found", to lessen the risk that people fix the first instance and miss the others; jmc@ confirmed that this is useful.
Diffstat (limited to 'usr.bin/mandoc/main.c')
-rw-r--r--usr.bin/mandoc/main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index ed40dff9fa9..20b6b1e4ccc 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.200 2017/07/02 15:31:48 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.201 2017/07/02 21:17:12 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -814,7 +814,11 @@ check_xr(const char *file)
continue;
if (fs_search(&search, &paths, 1, &xr->name, NULL, &sz))
continue;
- mandoc_asprintf(&cp, "Xr %s %s", xr->name, xr->sec);
+ if (xr->count == 1)
+ mandoc_asprintf(&cp, "Xr %s %s", xr->name, xr->sec);
+ else
+ mandoc_asprintf(&cp, "Xr %s %s (%d times)",
+ xr->name, xr->sec, xr->count);
mmsg(MANDOCERR_XR_BAD, MANDOCLEVEL_STYLE,
file, xr->line, xr->pos + 1, cp);
free(cp);