-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strstr.c
More file actions
38 lines (35 loc) · 1.24 KB
/
ft_strstr.c
File metadata and controls
38 lines (35 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strstr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yyefimov <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/11 11:45:05 by yyefimov #+# #+# */
/* Updated: 2016/12/02 11:21:48 by yyefimov ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strstr(const char *s1, const char *s2)
{
char *src;
char *find;
src = (char *)s1;
find = (char *)s2;
if ((!*s1) && (!*s2))
return ((char *)s1);
while (*s1)
{
src = (char *)s1;
find = (char *)s2;
while (*s1 && find && *s1 == *find)
{
s1++;
find++;
}
if (!*find)
return (src);
s1 = (char *)src + 1;
}
return (NULL);
}