Add the identifying header
[kugel-rb.git] / apps / plugins / lua / strstr.c
blob2db47f4adf012c7629bb98f3652f8b5dad6a1ac4
1 #include "rocklibc.h"
3 char *strstr(const char *haystack, const char *needle) {
4 size_t nl=strlen(needle);
5 size_t hl=strlen(haystack);
6 int i;
7 if (!nl) goto found;
8 if (nl>hl) return 0;
9 for (i=hl-nl+1; __likely(i); --i) {
10 if (*haystack==*needle && !memcmp(haystack,needle,nl))
11 found:
12 return (char*)haystack;
13 ++haystack;
15 return 0;