[net.unix-wizards] Diversions in Nroff

wartik@trwspp.UUCP (05/31/83)

Can someone please explain to me the behavior of nroff on the following
file?

	% cat foo
	.di XX
	hi there
	.di
	% nroff foo
	(66 blank lines)
	hi there
	(64 blank lines)
	%

Diversions are supposed to swallow up text, right?  This example
apparently is producing two pages of text, with "hi there" at the top
of the second page.  Why is "hi there" being printed at all?  Why are
there two pages?  We have both System III and 4.1BSD, and I've run this
file through both versions of nroff, with identical results.  Is this a
bug, or an esoteric property of diversions?

			Thanks in advance,
				-- Steve Wartik
				{decvax,ucbvax}!trw-unix!trwspp!wartik

david%isl@BRL-VGR.ARPA (06/07/83)

This message is empty.

eric%UCBARPA@berkeley@sri-unix.UUCP (06/08/83)

From:  Eric Allman <eric%UCBARPA@berkeley>

In the input:

	.di XX
	hi there
	.di

the "hi there" is still in the input buffer when the diversion is
closed.  Hence, it appears to be outside the diversion.  The input:

	.di XX
	hi there
	.br
	.di

works as expected.

eric