-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
31 lines (28 loc) · 1.2 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: srheede <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/27 07:57:26 by srheede #+# #+# */
/* Updated: 2018/05/31 15:48:57 by srheede ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
unsigned int i;
unsigned int j;
int k;
i = ft_strlen(src) + dstsize;
j = ft_strlen(src) + ft_strlen(dst);
if (i <= j)
return (i);
i -= j + 1;
k = ft_strlen(dst);
while (i-- && *src)
dst[k++] = *src++;
dst[k] = '\0';
return (j);
}