-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
33 lines (30 loc) · 1.21 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: marvin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/02 09:58:30 by ariahi #+# #+# */
/* Updated: 2022/08/15 17:23:51 by marvin ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strlcat(char *dst, const char *src, int dstsize)
{
int i;
int j;
i = 0;
j = 0;
while (dst[i] && i < dstsize)
i++;
if (i == dstsize || dstsize < 0)
return (i + ft_strlen(src));
while (src[j] && j < (dstsize - i - 1))
{
dst[i + j] = src[j];
j++;
}
dst[i + j] = '\0';
return (i + ft_strlen(src));
}