From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: If a single page references the same non-existent manual more
Date: Sun, 2 Jul 2017 16:19:00 -0500 (EST) [thread overview]
Message-ID: <10650682903154335693.enqueue@fantadrom.bsd.lv> (raw)
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
reply other threads:[~2017-07-02 21:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10650682903154335693.enqueue@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).