-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
31 lines (28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tluzing <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/31 13:22:19 by tluzing #+# #+# */
/* Updated: 2018/05/31 15:16:37 by tluzing ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t j;
size_t k;
size_t d_len;
j = ft_strlen(src) + size;
k = ft_strlen(src) + ft_strlen(dst);
if (j <= k)
return (j);
j -= k + 1;
d_len = ft_strlen(dst);
while (j-- && *src)
dst[d_len++] = *src++;
dst[d_len] = '\0';
return (k);
}