Effect a grep on the supplied exp to the input chain. Place all matching lines in the output chain

Return TypeFunction nameArguments
hzEcodeGrep(hzChain&,hzChain&,const char*,)

Declared in file: hzTextproc.h
Defined in file : hzRegex.cpp

Function Logic:

0:START 1:items 2:unknown 3:Return E_OK 4:unknown 5:Return E_ARGUMENT 6:unknown 7:unknown 8:items 9:S items 10:unknown 11:items items items 12:Return E_OK

Function body:

hzEcode Grep (hzChain& Zo)hzChain& Zi, const char* exp, 
{
   //  Category: Regular Expression
   //  
   //  Effect a grep on the supplied exp to the input chain. Place all matching lines in the output chain
   //  
   //  Arguments: 1) Zo The output chain being a list of matching lines
   //    2) Zi The input chain
   //    3) exp The test expression
   //  
   //  Returns: E_ARGUMENT If no search expression is supplied
   //     E_OK  In all other circumstances 
   _hzfunc(__func__) ;
   hzChain::Iter   zi ;    //  For iteration of the input
   hzChain         L ;     //  For isolating a line. This is then tested for the expression. If it passes, it is added as is to the output.
   hzString        S ;     //  Temp string
   Zo.Clear() ;
   if (!Zi.Size())
       return E_OK ;
   if (!exp || !exp[0])
       return E_ARGUMENT ;
   for (zi = Zi ; !zi.eof() ; zi++)
   {
       if (*zi != CHAR_NL)
           { L.AddByte(*zi) ; continue ; }
       //  Now have a line in L
       S = L ;
       L.Clear() ;
       if (!FormCheckCstr(*S, exp))
           continue ;
       //  Line has passed so add
       Zo << S ;
       Zo.AddByte(CHAR_NL) ;
       L.Clear() ;
   }
   return E_OK ;
}