getmmapi - Metamorph API search routine

SYNOPSIS

#include <stdio.h>
#include "api3.h"

char  * getmmapi(mm,buf_start,buf_end,operation)
MMAPI * mm;
char  * buf_start;
char  * buf_end;
int     operation;


DESCRIPTION
The getmmapi() is passed the MMAPI * returned by openmmapi() function and performs the actual search of the data pointed to by the buf_start and buf_end pointers. The operation parameter can buf_end. Successive calls to getmmapi() with the operation be one of two values: SEARCHNEWBUF or CONTINUESEARCH. getmmapi() will return a (char *)NULL if it does not locate a hit within the buffer. If a hit is located it will return a pointer to the beginning of the hit.

If getmmapi() is called with the operation parameter set to SEARCHNEWBUF, it will begin its search at buf_start and search through the buffer until it locates a hit or until it reaches buf_end. Successive calls to getmmapi() with the operation parameter set to CONTINUESEARCH will locate all remaining hits within the bounds set by buf_start and buf_end.

Typically the sequence of events would look as follows:

{
 char *hit;
 char *my_buffer;
 int   my_buf_size;

 MMAPI *mm;

 ...

 for(hit=getmmapi(mm,my_buffer,my_buffer+my_buf_size,SEARCHNEWBUF);
     hit!=(char *)NULL;
     hit=getmmapi(mm,my_buffer,my_buffer+my_buf_size,CONTINUESEARCH)
    )
    {
     /* process the hit here */
    }
 ...

}


SEE ALSO

infommapi()


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.