-
Notifications
You must be signed in to change notification settings - Fork 4
/
ft_strlcat.c
23 lines (20 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aalvarez <aalvarez@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/21 13:03:28 by aalvarez #+# #+# */
/* Updated: 2024/06/21 13:12:48 by aalvarez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t dst_len;
dst_len = ft_strlen(dst);
if (size <= dst_len)
return (size + ft_strlen(src));
return (dst_len + ft_strlcpy(dst + dst_len, src, size - dst_len));
}