-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
35 lines (32 loc) · 1.16 KB
/
ft_strlcpy.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/21 15:56:24 by nvienot #+# #+# */
/* Updated: 2018/11/22 18:56:39 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t size)
{
size_t d;
size_t s;
d = 0;
s = 0;
if (!dst || !src)
return (0);
while (src[d] && size > 1)
{
dst[d] = src[s];
d++;
s++;
size--;
}
if (size >= 1)
dst[d] = '\0';
d = ft_strlen(src);
return (d);
}