[comp.os.minix] Fixes to more for minix

subelman@ttidca.UUCP (05/15/87)

There are at least two bugs in the version of more for minix posted by
Brandon Allbery (allbery@ncoast.UUCP). The first bug is: if you run
"more a b c" then after file a is displayed, instead of displaying b, you
get the tail end of a again.  The second bug is: if you use the ' command
to rewind the file, the first line contains at least one garbage character.
The fixes are given below as context diffs

---------------------- CUT HERE -----------------
*** more.c.orig	Thu May 14 20:45:11 1987
--- more.c	Thu May 14 20:45:38 1987
***************
*** 113,114
  	if (ibc == ibl) {
  		if ((ibl = read(fd, ibuf, sizeof ibuf)) <= 0)

--- 113,115 -----
  	if (ibc == ibl) {
+ 		ibc = 0;
  		if ((ibl = read(fd, ibuf, sizeof ibuf)) <= 0)
***************
*** 115,117
  			return 0;
- 		ibc = 0;
  	}

--- 116,117 -----
  			return 0;
  	}
***************
*** 126,128
  	}
! 	obuf[obc++] = c;
  }

--- 126,129 -----
  	}
! 	if (!isrewind)
! 		obuf[obc++] = c;
  }
***************
*** 130,134
  oflush() {
! 	if (isdone)
! 		obc = 0;
! 	else
  		lwrite(1, obuf, obc);

--- 131,133 -----
  oflush() {
! 	if (!isdone)
  		lwrite(1, obuf, obc);
***************
*** 134,135
  		lwrite(1, obuf, obc);
  }

--- 133,135 -----
  		lwrite(1, obuf, obc);
+ 	obc = 0;
  }
-- 
Ed Subelman		{csun|philabs|psivax|trwrb}!ttidca!subelman
Citicorp(+)TTI		(213) 450-9111, x2972
3100 Ocean Park Blvd.,	Santa Monica, CA  90405