-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
38 lines (35 loc) · 1.25 KB
/
ft_strlcat.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vduriez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/08/25 19:23:09 by vduriez #+# #+# */
/* Updated: 2020/08/26 12:24:50 by vduriez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t i;
size_t d_len;
i = 0;
while (i < size)
{
if (!dst[i])
{
i = 0;
d_len = ft_strlen(dst);
while (src[i] && i < (size - d_len) - 1)
{
dst[d_len + i] = src[i];
++i;
}
dst[d_len + i] = 0;
return (d_len + ft_strlen(src));
}
++i;
}
return (size + ft_strlen(src));
}