Module Name:    src
Committed By:   uwe
Date:           Wed Nov 27 22:41:42 UTC 2019

Modified Files:
        src/distrib/notes: Makefile.inc

Log Message:
Don't lose groff's stderr when creating TOC.

Divert only the .Ti lines to the TOC file.  Keep the rest, it may
contain useful messages (like the empty line bug in macros that was
messing up page numbers).

TODO: Since we already depend on groff extensions, we should just use
.open/.write to emit the TOC directly.  But commit this for now in
case I run out of round tuits.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/distrib/notes/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/notes/Makefile.inc
diff -u src/distrib/notes/Makefile.inc:1.48 src/distrib/notes/Makefile.inc:1.49
--- src/distrib/notes/Makefile.inc:1.48	Wed Nov 27 19:07:31 2019
+++ src/distrib/notes/Makefile.inc	Wed Nov 27 22:41:41 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.48 2019/11/27 19:07:31 uwe Exp $
+#	$NetBSD: Makefile.inc,v 1.49 2019/11/27 22:41:41 uwe Exp $
 #
 
 # Ross Harvey <r...@netbsd.org>
@@ -105,9 +105,12 @@ ${TARG}.more: ${SRCS} ${TOC.more} ${DIST
 # Rules to build the table of contents (.toc) files.
 # They are generated twice to take into account the
 # space taken by the TOC itself.
-#
 
-TOCPROC=	   2>&1 >/dev/null | ${TOOL_GREP} -e '^\.Ti'
+# TOC is emitted with .tm on groff's stderr, divert those lines to stdout.
+# NB: /dev/stderr is nawk's internal designation, not /dev/stderr file.
+# TODO: use .open/.write instead.
+TOCPROC = 2>&1 >/dev/null | \
+	${TOOL_AWK} '{ if ($$1 == ".Ti") print; else print > "/dev/stderr"; }'
 
 ${TARG}.PostScript.toc: ${SRCS}
 	${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} ${TOCPROC} > $@.tmp

Reply via email to