Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/notes Don't lose groff's stderr when creating TOC.



details:   https://anonhg.NetBSD.org/src/rev/edf100df38b2
branches:  trunk
changeset: 461489:edf100df38b2
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Nov 27 22:41:41 2019 +0000

description:
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.

diffstat:

 distrib/notes/Makefile.inc |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 3a58365dd4ee -r edf100df38b2 distrib/notes/Makefile.inc
--- a/distrib/notes/Makefile.inc        Wed Nov 27 21:37:27 2019 +0000
+++ b/distrib/notes/Makefile.inc        Wed Nov 27 22:41:41 2019 +0000
@@ -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 <ross%NetBSD.org@localhost>
@@ -105,9 +105,12 @@
 # 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



Home | Main Index | Thread Index | Old Index