Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

bm_free(3) [netbsd man page]

BM(3)							   BSD Library Functions Manual 						     BM(3)

NAME
bm_comp, bm_exec, bm_free -- Boyer-Moore string search LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <bm.h> bm_pat * bm_comp(u_char *pattern, size_t patlen, u_char freq[256]); u_char * bm_exec(bm_pat *pdesc, u_char *text, size_t len); void bm_free(bm_pat *pdesc); DESCRIPTION
These routines implement an efficient mechanism to find an occurrence of a byte string within another byte string. bm_comp() evaluates the patlen bytes starting at pattern, and returns a pointer to a structure describing them. The bytes referenced by pattern may be of any value. The search takes advantage of the frequency distribution of the bytes in the text to be searched. If specified, freq should be an array of 256 values, with higher values indicating that the corresponding character occurs more frequently. (A less than optimal frequency distribu- tion can only result in less than optimal performance, not incorrect results.) If freq is NULL, a system default table is used. bm_exec() returns a pointer to the leftmost occurrence of the string given to bm_comp() within text, or NULL if none occurs. The number of bytes in text must be specified by len. Space allocated for the returned description is discarded by calling bm_free() with the returned description as an argument. The asymptotic speed of bm_exec() is O(len/patlen). SEE ALSO
regexp(3), strstr(3) Hume and Sunday, "Fast String Searching", Software Practice and Experience, Vol. 21, 11, pp. 1221-48, November 1991. BSD
April 8, 2001 BSD

Check Out this Related Man Page

MEMCHR(3)						   BSD Library Functions Manual 						 MEMCHR(3)

NAME
memchr -- locate byte in byte string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> void * memchr(const void *b, int c, size_t len); void * memrchr(const void *b, int c, size_t len); DESCRIPTION
The memchr() function locates the first occurrence of c (converted to an unsigned char) in string b. The memrchr() function behaves like memchr(), except that it locates the last occurrence of c in string b. RETURN VALUES
The memchr() and memrchr() functions return a pointer to the byte located, or NULL if no such byte exists within len bytes. SEE ALSO
memmem(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3), wmemchr(3) STANDARDS
The memchr() function conforms to ISO/IEC 9899:1990 (``ISO C90''). The memrchr() function is a GNU extension and conforms to no standard. HISTORY
The memrchr() function first appeared in GNU libc 2.1.91, this implementation first appeared in FreeBSD 6.4, coming from OpenBSD 4.3. BSD
April 9, 2008 BSD
Man Page