shithub: scc

ref: 3ffe44ba0b84317b63bfcdbfe4bc1418f0ae59ca
dir: /src/libc/string/strstr.c/

View raw version
#include <stddef.h>
#include <string.h>
#undef strstr

char *
strstr(const char *s1, const char *s2)
{
	const char *p;
	int c = *s2;

	if (c == '\0')
		return NULL;
	for (p = s1; p = strchr(p, c); ++p) {
		if (!strcmp(p, s2))
			return (char *) p;
	}
	return NULL;
}