libftx/libft/ft_strlcat.c

26 lines
1.2 KiB
C
Raw Normal View History

2023-01-19 11:33:26 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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));
}