[comp.os.minix] Diffs for pr adjacent blank line problem

hgm@beta.UUCP (Harry McGavran) (05/12/87)

"pr" doesn't handle adjacent lines containing only '\n'.
They aren't included in the pagelength accumulation, so pages
containing them end up longer. Also the "-n" option fails on these
lines.  Here are the context diffs for one possible fix for that.

As usual, I claim these changes aren't suitable for anything.

------------------------------Cut here--------------------------------
*** pr.c	Tue May 12 10:46:51 1987
--- pr_c.new	Tue May 12 10:46:46 1987
***************
*** 254,262 ****
    	while (lines && c != EOF) {
    		if (number)
    			printf("%d\t", linenr++);
!   		do {
    			putchar(c);
!   		} while ((c = getc(filep)) != '\n' && c != EOF);
    		putchar('\n');
    		lines--;
  		c = getc(filep);
--- 254,263 ----
  	while (lines && c != EOF) {
  		if (number)
  			printf("%d\t", linenr++);
! 		while (c != '\n' && c != EOF) {
  			putchar(c);
! 			c = getc(filep);
! 		}
  		putchar('\n');
  		lines--;
  		c = getc(filep);
--------------------------------Cut here-----------------------------

Harry McGavran
hgm@LANL.GOV
Los Alamos National Laboratory
MS-B294, Group C-8
Los Alamos, New Mexico 87545
505/667-4050