/*  --- Copyright University of Sussex 1993. All rights reserved. ----------
 >  File:           C.vms/lib/auto/grep.p
 >  Purpose:        search a set of files for a string
 >  Author:         Unknown, ??? (see revisions)
 >  Documentation:
 >  Related Files:
 */
compile_mode :pop11 +strict;

section;

define vars macro grep;
lvars x char;
	0 -> x;
	until (nextchar(itemread) ->> char) == termin or char == `\n` do
		char; x + 1 -> x
	enduntil;
	consstring(x) -> x;
	pr(newline);    ;;; in case used in VED.
	sysobeylist([% 'grep :== $search', 'grep ' >< x%])
enddefine;

endsection;


/*  --- Revision History ---------------------------------------------------
--- Mark Rubinstein, Aug  5 1985 - sectioned, lvarsed and moved into VMS only
	section.
 */
