-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
34 lines (31 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jsprouts <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/20 20:58:59 by jsprouts #+# #+# */
/* Updated: 2019/09/21 16:14:17 by jsprouts ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t lnd;
size_t lns;
size_t i;
i = 0;
lnd = ft_strlen(dst);
lns = ft_strlen(src);
if (size <= lnd)
lns += size;
else
lns += lnd;
while ((src[i] != 0) && (size > lnd + 1))
{
dst[lnd++] = src[i++];
}
dst[lnd] = 0;
return (lns);
}