-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
33 lines (31 loc) · 1.19 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dbrophy <dbrophy@student.42.us.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/28 23:44:11 by dbrophy #+# #+# */
/* Updated: 2019/10/29 12:21:27 by dbrophy ### ########.fr */
/* */
/* ************************************************************************** */
unsigned int ft_strlcat(char *dest, const char *src, unsigned int size)
{
unsigned int out;
unsigned int l;
l = 0;
while (*(dest++) && (l < size))
l++;
out = l;
dest--;
while ((0 != *src) && (out + 1 < size))
{
*(dest++) = *(src++);
out++;
}
while (*(src++))
out++;
if (size > l)
*dest = 0;
return (out);
}