-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_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: telias-p <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/13 18:30:18 by telias-p #+# #+# */
/* Updated: 2021/04/05 20:28:33 by telias-p ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dest, const char *src, size_t destsize)
{
size_t d;
size_t i;
if (destsize <= ft_strlen(dest))
return (destsize + ft_strlen(src));
d = ft_strlen(dest);
i = 0;
while (src[i] != '\0' && d + 1 < destsize)
{
dest[d] = src[i];
d++;
i++;
}
dest[d] = '\0';
return (ft_strlen(dest) + ft_strlen(&src[i]));
}