1: #include <stdio.h>
   2: #include "bm.h"
   3: #include "Extern.h"
   4: MatchFound(Desc, BuffPos, Buffer, BuffEnd)
   5: struct PattDesc *Desc; /* state info about search for one string */
   6: long BuffPos; /* offset of first char of buffer into the file being searched */
   7: char *Buffer, /* pointer to the first character in the buffer */
   8:     *BuffEnd; /* pointer to the last character in the buffer */
   9: {
  10:     char *MLineBegin, *MLineEnd;
  11:     Desc->Success = 0;
  12:     /* Start points to first character after a successful match */
  13:     MLineBegin = MLineEnd = Desc->Start - 1;
  14:     while(MLineBegin >=Buffer && *MLineBegin != '\n') --MLineBegin;
  15:     ++MLineBegin;
  16:     while( MLineEnd <= BuffEnd && *MLineEnd != '\n') ++MLineEnd;
  17:     if (MLineEnd > BuffEnd) --MLineEnd;
  18:     /* fixed 25jun85 pdbain. suppress multiple matches of the same
  19: 	* pattern on one line */
  20:     Desc->Start = MLineEnd + 1;
  21:     /* check if exact match */
  22:     if (xFlag && !( Desc->PatLen == (*MLineEnd != '\n' ? ((MLineEnd -
  23:     MLineBegin) + 1) : (MLineEnd - MLineBegin))))
  24:         return(0); /* failure */
  25:     if (sFlag) return(1);
  26:     if (cFlag) {
  27:         ++MatchCount;
  28:         return(1);
  29:     } /* if */
  30:     PrintLine(BuffPos+(Desc->Start-Buffer),MLineBegin,MLineEnd);
  31:     return(1);
  32: } /* MatchFound */

Defined functions

MatchFound defined in line 4; used 2 times
Last modified: 1986-05-23
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2245
Valid CSS Valid XHTML 1.0 Strict