| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

strfind_r

#include "sflfind.h"
char *
strfind_r (const char *string,          /*  String containing data           */
           const char *pattern)         /*  Pattern to search for            */

Synopsis

Searches for a pattern in a string using the Boyer-Moore- Horspool-Sunday algorithm. The string and pattern are null- terminated strings. Returns a pointer to the pattern if found within the string, or NULL if the pattern was not found. This function is meant to handle character data, and is most effective when you work with large strings. To search binary data use memfind(). Will not work on multibyte characters. Reentrant.

Examples

    char *result;

    result = strfind_r ("abracadabra", "cad");
    if (result)
        puts (result);

Source Code - (sflfind.c)

{
    size_t
        searchbuf [256];                /*  One-time search buffer           */
    Bool
        secondtime = FALSE;             /*  Search buffer init needed        */

    ASSERT (string);                    /*  Expect non-NULL pointers, but    */
    ASSERT (pattern);                   /*  fall through if not debugging    */

    return (char *) memfind rb (string,    strlen (string),
                                pattern,   strlen (pattern),
                                searchbuf, &secondtime);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation