[net.bugs.4bsd] 4.2BSD lpd indentation bug

jeff@fluke.UUCP (Jeff Stearns) (10/23/84)

Index:	usr.lib/lpd/printjob.c 4.2BSD

Description:
	If a job is queued to a printer with a request that it be indented,
	subsequent printouts within the same queue run will be given the
	same indentation.

	The problem exists because the instantiation of /usr/lib/lpd which
	processes the queue doesn't reset all its variables after printing
	each job.  Specifically, it doesn't reset the indent amount to zero.

Repeat-By:
	Queue two files to a printer, asking that only the first be indented:
	  % lpr -i8 /tmp/foo; lpr /tmp/foo
	Note that BOTH printouts will be indented.

Fix:
	In the file usr.lib/lpd/printjob.c, find the function printit().
	Add the one new line shown below in context.

==========================================================================
	/*
         * Reset troff fonts.
         */
	for (i = 0; i < 4; i++)
		strcpy(fonts[i], ifonts[i]);

ADD-->	strcpy(indent, "-i0");     /* BUG FIX - reset indent amount to zero */

	/*
	 *      read the control file for work to do
	 *	.....
	 */
==========================================================================


	Jeff Stearns       (206) 356-5064
	John Fluke Mfg. Co.
	P.O. Box C9090  Everett WA  98043  
	{uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!jeff
-- 
	Jeff Stearns       (206) 356-5064
	John Fluke Mfg. Co.
	P.O. Box C9090  Everett WA  98043  
	{uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!jeff

crp@ccivax.UUCP (Chuck Privitera) (10/26/84)

As noted by fluke!jeff:

> Index:	usr.lib/lpd/printjob.c 4.2BSD
> 
> Description:
> 	If a job is queued to a printer with a request that it be indented,
> 	subsequent printouts within the same queue run will be given the
> 	same indentation.
> 
> 	The problem exists because the instantiation of /usr/lib/lpd which
> 	processes the queue doesn't reset all its variables after printing
> 	each job.  Specifically, it doesn't reset the indent amount to zero.
We fixed this one a long time ago. Forgot to post it to the net
though. Sorry. Lpd doesn't reset the page width passed on to pr(1)
either.  So in addition to Jeff's fix:
> Fix:
> 	In the file usr.lib/lpd/printjob.c, find the function printit().
> 	Add the one new line shown below in context.
> 
> ==========================================================================
> 	/*
>          * Reset troff fonts.
>          */
> 	for (i = 0; i < 4; i++)
> 		strcpy(fonts[i], ifonts[i]);
> 
> ADD-->	strcpy(indent, "-i0");     /* BUG FIX - reset indent amount to zero */
> 
> 	/*
> 	 *      read the control file for work to do
> 	 *	.....
> 	 */
> ==========================================================================
Add this line:

	sprintf(width, "-w%d", PW);	/* page width in characters */