From 2990ce9b390ec1e2bfa1c043c406878e8aff86dd Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 21 Dec 2017 11:18:28 +0000 Subject: Big 2.6.3.0 reorganization - Add libposixplz, update headers - Add memmem and friends - Add textmessage to libunixonacid - Update some sysdeps tests --- src/libstddjb/byte_search.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/libstddjb/byte_search.c (limited to 'src/libstddjb/byte_search.c') diff --git a/src/libstddjb/byte_search.c b/src/libstddjb/byte_search.c new file mode 100644 index 0000000..286d806 --- /dev/null +++ b/src/libstddjb/byte_search.c @@ -0,0 +1,11 @@ +/* ISC license. */ + +#include +#include +#include + +size_t byte_search (char const *haystack, size_t hlen, char const *needle, size_t nlen) +{ + char *p = memmem(haystack, hlen, needle, nlen) ; + return p ? p - haystack : hlen + 1 - nlen ; +} -- cgit v1.2.3