-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_next_line_utils.c
41 lines (36 loc) · 1.24 KB
/
get_next_line_utils.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
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/29 20:01:39 by apuchill #+# #+# */
/* Updated: 2020/04/19 19:10:20 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
size_t ft_strlen(const char *s)
{
size_t l;
l = 0;
while (s[l] != 0)
l++;
return (l);
}
char *ft_strdup(const char *s1)
{
char *s2;
size_t size;
size_t i;
size = ft_strlen(s1) + 1;
if (!(s2 = (char *)malloc(size)))
return (0);
i = 0;
while (i < size)
{
((unsigned char *)s2)[i] = ((unsigned char *)s1)[i];
i++;
}
return (s2);
}