-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strstr.c
39 lines (36 loc) · 1.21 KB
/
ft_strstr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ivolosci <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/22 21:10:46 by ivolosci #+# #+# */
/* Updated: 2017/11/22 21:10:48 by ivolosci ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(const char *big, const char *little)
{
int b;
int l;
int p;
if (!little[0])
return ((char *)big);
b = 0;
l = 0;
while (big[b])
{
if (big[b] == little[l])
{
p = b;
while (big[b++] == little[l++])
if (!little[l])
return ((char *)big + p);
b = p;
l = 0;
}
b++;
}
return (0);
}