-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
32 lines (29 loc) · 1.16 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: thifranc <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/20 16:37:16 by thifranc #+# #+# */
/* Updated: 2016/02/20 17:08:33 by thifranc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t i;
size_t x;
i = 0;
while (dst[i] && i < size)
i++;
x = i;
while (src[i - x] && i < size - 1)
{
dst[i] = src[i - x];
i++;
}
if (i < size)
dst[i] = '\0';
return (x + ft_strlen(src));
}