1 /* public domain rewrite of strstr(3) */
3 #include "ruby/missing.h"
5 size_t strlen(const char*);
8 strstr(const char *haystack
, const char *needle
)
13 if (*needle
== 0) return (char *)haystack
;
14 hend
= haystack
+ strlen(haystack
) - strlen(needle
) + 1;
15 while (haystack
< hend
) {
16 if (*haystack
== *needle
) {
20 if (*b
== 0) return (char *)haystack
;