42_cube3D/libftx/libft/ft_strlcat.c
Camille Chauvet 537283e940 add: libftx
2023-04-26 11:02:44 +00:00

26 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/27 17:02:13 by cchauvet #+# #+# */
/* Updated: 2022/09/28 17:11:29 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dest, const char *src, size_t size)
{
size_t len_dest;
if (size == 0)
return (ft_strlen(src));
len_dest = ft_strlen(dest);
if (len_dest >= size)
return (ft_strlen(src) + (size));
return (len_dest + ft_strlcpy(dest + len_dest, src, size - len_dest));
}