byte_search.c (289B)
1 /* ISC license. */ 2 3 #include <string.h> 4 #include <skalibs/posixplz.h> 5 #include <skalibs/bytestr.h> 6 7 size_t byte_search (char const *haystack, size_t hlen, char const *needle, size_t nlen) 8 { 9 char *p = memmem(haystack, hlen, needle, nlen) ; 10 return p ? p - haystack : hlen + 1 - nlen ; 11 }