[net.unix-wizards] End macro

aam (03/23/83)

Art Zemon's problem with t/nroff end macros seems to be a bug.  If you
are in fill mode and there is a partial line of text pending, you survive
the page break.  If there isn't anything pending, you don't.  For example,
the following will print "survived page break" on stderr:

	.de EM
	.fi
	a bit of text
	'bp
	.tm survived page break
	..
	.em EM
	Something to force transition to page 1

Change the .fi to a .nf and it doesn't print anymore:

	.de EM
	.nf
	a bit of text
	'bp
	.tm survived page break    (will never print)
	..
	.em EM
	Something to force transition to page 1

The following change seems to fix the problem without otherwise damaging
t/nroff - though frankly I don't understand the code well enough to know
WHY it works.

*** n7.old	Mon Mar 21 12:07:56 1983
--- n7.new	Mon Mar 21 12:08:12 1983
***************
*** 1,5
  #include "tdef.h"
  extern
  #include "d.h"
  extern
  #include "v.h"

--- 1,10 -----
+ /*
+  * HCR: AAM-1, 17 March 1983
+  *	- Fix bug involving page breaks in end macros.
+  */
+ 
  #include "tdef.h"
  extern
  #include "d.h"
  extern
  #include "v.h"
***************
*** 417,427
  	lss = j;
  	if(v.nl < pl)goto nl2;
  nl1:
  	ejf = dip->hnl = v.nl = 0;
  	ejl = frame;
! 	if(donef){
  		if((!nc && !wch) || ndone)done1(0);
  		ndone++;
  		donef = 0;
  		if(frame == stk)nflush++;
  	}

--- 422,432 -----
  	lss = j;
  	if(v.nl < pl)goto nl2;
  nl1:
  	ejf = dip->hnl = v.nl = 0;
  	ejl = frame;
! 	if(donef > 0){	/* AAM-1 */
  		if((!nc && !wch) || ndone)done1(0);
  		ndone++;
  		donef = 0;
  		if(frame == stk)nflush++;
  	}
***************

Has anyone else ever run into this problem?  Is there a better fix?

			Allen McIntosh
			...decvax!hcr!aam
			...allegra!utzoo!hcr!aam