-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_strlcat.c
33 lines (30 loc) · 1.19 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abello-r <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/10 17:31:27 by abello-r #+# #+# */
/* Updated: 2020/01/26 12:11:57 by abello-r ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t len;
size_t i;
len = 0;
i = 0;
while (dst[i] && i < dstsize)
i++;
len = i;
while (src[i - len] && i + 1 < dstsize)
{
dst[i] = src[i - len];
i++;
}
if (len < dstsize)
dst[i] = '\0';
return (len + ft_strlen(src));
}