-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strstr.c
More file actions
executable file
·41 lines (38 loc) · 1.3 KB
/
Copy pathft_strstr.c
File metadata and controls
executable file
·41 lines (38 loc) · 1.3 KB
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
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: patrisor <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/26 20:55:07 by patrisor #+# #+# */
/* Updated: 2019/03/09 16:59:26 by patrisor ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/libft.h"
char *ft_strstr(const char *big, const char *little)
{
int i;
int j;
int k;
int good;
if (!ft_strlen(little))
return ((char *)big);
i = -1;
good = 0;
while (*(big + ++i) && !good)
{
if (*(big + i) == *(little + 0))
{
j = 0;
k = i;
good = 1;
while (*(little + j))
if (*(little + j++) != *(big + k++))
good = 0;
if (good)
return ((char *)big + i);
}
}
return (NULL);
}