-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
32 lines (29 loc) · 1.22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ulyildiz <ulyildiz@student.42kocaeli.co +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/11 09:43:20 by ulyildiz #+# #+# */
/* Updated: 2023/10/17 20:52:38 by ulyildiz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t i;
size_t j;
size_t d;
d = ft_strlen(dst);
j = 0;
i = 0;
if (dstsize <= d)
return (dstsize + ft_strlen(src));
while (dst[i] != '\0')
i++;
while (src[j] != '\0' && j < dstsize - d - 1)
dst[i++] = src[j++];
dst[i] = '\0';
return (d + ft_strlen(src));
}