-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
30 lines (27 loc) · 1.24 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vportell <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/31 15:58:10 by vportell #+# #+# */
/* Updated: 2016/11/03 13:42:15 by vportell ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
int i;
int dst_size;
int src_size;
dst_size = ft_strlen(dst);
src_size = ft_strlen(src);
i = -1;
if (dst_size > (int)size)
return (size + src_size);
while (src[++i] && i < (int)size - dst_size - 1)
dst[i + dst_size] = src[i];
dst[i + dst_size] = '\0';
return (src_size + dst_size);
}