From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id 25504433 for ; Sun, 2 Jul 2017 16:19:00 -0500 (EST) Date: Sun, 2 Jul 2017 16:19:00 -0500 (EST) Message-Id: <10650682903154335693.enqueue@fantadrom.bsd.lv> X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: If a single page references the same non-existent manual more X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- 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. Modified Files: -------------- mandoc: main.c mandoc_xr.c mandoc_xr.h Revision Data ------------- Index: main.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/main.c,v retrieving revision 1.297 retrieving revision 1.298 diff -Lmain.c -Lmain.c -u -p -r1.297 -r1.298 --- main.c +++ main.c @@ -844,7 +844,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); Index: mandoc_xr.h =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc_xr.h,v retrieving revision 1.2 retrieving revision 1.3 diff -Lmandoc_xr.h -Lmandoc_xr.h -u -p -r1.2 -r1.3 --- mandoc_xr.h +++ mandoc_xr.h @@ -21,6 +21,7 @@ struct mandoc_xr { char *name; int line; /* Or -1 for this page's own names. */ int pos; + int count; char hashkey[]; }; Index: mandoc_xr.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/mandoc_xr.c,v retrieving revision 1.2 retrieving revision 1.3 diff -Lmandoc_xr.c -Lmandoc_xr.c -u -p -r1.2 -r1.3 --- mandoc_xr.c +++ mandoc_xr.c @@ -81,6 +81,7 @@ mandoc_xr_add(const char *sec, const cha xr->name = xr->hashkey + ssz; xr->line = line; xr->pos = pos; + xr->count = 1; memcpy(xr->sec, sec, ssz); memcpy(xr->name, name, nsz); @@ -97,6 +98,7 @@ mandoc_xr_add(const char *sec, const cha return 0; } + oxr->count++; ret = (oxr->line == -1) ^ (xr->line == -1); if (xr->line == -1) oxr->line = -1; -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv