grep replacement

David Collier-Brown daveb at geac.UUCP
Fri Jun 17 21:58:59 AEST 1988


In article <10078 at tekecs.TEK.COM> andrew at frip.gwd.tek.com (Andrew
Klossner) quotes someone to say:
>[]
>
>	"so far, gre will have only one limit, a line length of 64K.
>	(NO, i am not supporting arbitrary length lines (yet)!)"

   Well, arbitrary line lengths are easy.

  Initially
	allocate a cache
  When reading
	fgets a cache-full
	if the last character is not a \n
		increase the cache with realloc
		read some more


  A function to do this, called getline, was published recently in
the source groups.

--dave (remember my old .signature?) c-b
-- 
 David Collier-Brown.  {mnetor yunexus utgpu}!geac!daveb
 Geac Computers Ltd.,  | "His Majesty made you a major 
 350 Steelcase Road,   |  because he believed you would 
 Markham, Ontario.     |  know when not to obey his orders"



More information about the Comp.unix.wizards mailing list