-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_strlcat.c
executable file
·36 lines (33 loc) · 1.25 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: aemebiku <aemebiku@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/06/26 15:41:48 by aemebiku #+# #+# */
/* Updated: 2014/06/26 15:41:49 by aemebiku ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t i;
size_t len1;
size_t len2;
i = 0;
len1 = ft_strlen(dst);
len2 = ft_strlen(src);
if (size > (len1 + 1))
{
while (i < (size - len1 - 1))
{
dst[len1 + i] = src[i];
i++;
}
dst[len1 + i] = '\0';
}
if (size >= len1)
return (len1 + len2);
return ((len1 + len2) - (len1 - size));
}