-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
33 lines (30 loc) · 1.29 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
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aahlyel <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/10 03:03:40 by aahlyel #+# #+# */
/* Updated: 2022/10/26 18:23:42 by aahlyel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t dstlen;
size_t returnlen;
size_t i;
i = -1;
returnlen = ft_strlen(src);
if (!dstsize)
return (returnlen);
dstlen = ft_strlen(dst);
if (dstlen > dstsize)
return (returnlen + dstsize);
returnlen += dstlen;
while (*src && dstlen < dstsize - 1)
*(dst + dstlen++) = *(src++);
*(dst + dstlen) = '\0';
return (returnlen);
}