-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
36 lines (33 loc) · 1.21 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: nvienot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/12 16:28:24 by nvienot #+# #+# */
/* Updated: 2018/11/13 17:17:22 by nvienot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
size_t d;
size_t s;
d = 0;
s = 0;
while (dst[d] != '\0' && d < size)
d++;
if (dst[d] == '\0')
{
while (src[s] != '\0' && (d + s) < size - 1)
{
dst[d + s] = src[s];
s++;
}
dst[d + s] = '\0';
}
while (src[s] != '\0')
s++;
return (d + s);
}