base struct

This commit is contained in:
gazhonsepaskwa
2025-01-13 13:21:53 +01:00
parent a7e1a55200
commit 09c2cb5b3e
47 changed files with 1835 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/12 10:07:49 by nalebrun #+# #+# */
/* Updated: 2024/11/25 16:16:15 by nalebrun ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t dst_len;
size_t src_len;
size_t i;
if (!dst || !src)
return (0);
dst_len = ft_strlen(dst);
src_len = ft_strlen(src);
if (dstsize <= dst_len)
return (dstsize + src_len);
i = -1;
while (src[++i] && (dst_len + i) < (dstsize - 1))
dst[dst_len + i] = src[i];
dst[dst_len + i] = '\0';
return (dst_len + src_len);
}