-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
36 lines (33 loc) · 1.27 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
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ogdurkan <[email protected]. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/07 15:36:49 by ogdurkan #+# #+# */
/* Updated: 2022/10/07 15:36:51 by ogdurkan ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t i;
size_t a;
size_t sizedst;
size_t sizesrc;
sizedst = ft_strlen(dst);
sizesrc = ft_strlen(src);
a = ft_strlen(dst);
if (dstsize <= sizedst)
return (dstsize + sizesrc);
i = 0;
while (src[i] != '\0' && a < dstsize - 1)
{
dst[a] = src[i];
a++;
i++;
}
dst[a] = '\0';
return (sizedst + sizesrc);
}