[net.lang.c] Grep routine

davy (03/10/83)

#N:pur-ee:15500012:000:979
pur-ee!davy    Mar  9 22:16:00 1983


	Has anyone out there got a subroutine which performs the task
	which "grep" or (preferably) "egrep" does?  Basically, I want
	a subroutine which I can call like:

		grep(fd, pattern, begin, end)
		int fd;
		char *pattern;
		int *begin, *end;

	where:
		fd is a file descriptor to the file in question
		pattern is the regular expression
		begin is the byte position in the file at which to start
		end is the byte position in the file at which to end

	and the routine stores the beginning and ending byte positions
	of the matching string in begin and end when it finds it.
		
	I realize that this stuff could be swiped out of an editor source,
	or that grep itself could be modified, but if someone has already
	done this, I'm not going to reinvent the wheel.

	If you have a routine similar to what I want, or know of one, please
	mail me at:

			decvax!pur-ee!davy
			ucbvax!pur-ee!davy
			ihnss!pur-ee!davy
			inuxc!pur-ee!davy

Reach out and GREP someone,
--Dave Curry

davy (03/12/83)

#R:pur-ee:15500012:pur-ee:15500013:000:330
pur-ee!davy    Mar 11 09:23:00 1983



	Well, it seems I asked a dumb question.  I had asked if anyone 
	had a grep routine that could be called from a C program.  I have
	since been informed (many times over) that the routines "re_comp"
	and "re_exec" from regex(3) perform just that.

	Thanks to everyone who responded (please, no more!)

--Dave Curry
pur-ee!davy