-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strstr.c
39 lines (36 loc) · 1.32 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpylypen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 11:59:57 by dpylypen #+# #+# */
/* Updated: 2016/12/02 17:54:57 by dpylypen ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(const char *big, const char *little)
{
char *ptr_little;
char *ptr_big;
if (*little == '\n' || *little == '\0')
return ((char *)big);
while (*big)
{
ptr_little = (char *)little;
if (*big == *ptr_little)
{
ptr_big = (char *)big;
while (*ptr_big == *ptr_little || !(*ptr_little))
{
if (!(*ptr_little))
return ((char *)big);
ptr_big++;
ptr_little++;
}
}
big++;
}
return (0);
}