1 /*
2  *  Copyright (C) 1991, 1992  Linus Torvalds
3  */
4 
5 #include <xen/string.h>
6 
7 /**
8  * strstr - Find the first substring in a %NUL terminated string
9  * @s1: The string to be searched
10  * @s2: The string to search for
11  */
12 char *(strstr)(const char *s1, const char *s2)
13 {
14 	size_t l1, l2 = strlen(s2);
15 
16 	if (!l2)
17 		return (char *)s1;
18 
19 	for (l1 = strlen(s1); l1 >= l2; --l1, ++s1)
20 		if (!memcmp(s1, s2, l2))
21 			return (char *)s1;
22 
23 	return NULL;
24 }
25 
26 /*
27  * Local variables:
28  * mode: C
29  * c-file-style: "BSD"
30  * c-basic-offset: 8
31  * tab-width: 8
32  * indent-tabs-mode: t
33  * End:
34  */
35