source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: If a single page references the same non-existent manual more
@ 2017-07-02 21:19 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-07-02 21:19 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-07-02 21:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-02 21:19 mandoc: If a single page references the same non-existent manual more schwarze

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).