-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
28 lines (25 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mesafi <mesafi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/01 22:24:10 by mesafi #+# #+# */
/* Updated: 2020/01/20 13:31:07 by mesafi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t dlen;
size_t slen;
dlen = ft_strlen(dst);
slen = ft_strlen(src);
if (size > dlen)
{
ft_memccpy(dst + dlen, src, 0, size - dlen - 1);
*(dst + size - 1) = '\0';
}
return (size < dlen ? size + slen : slen + dlen);
}