-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
executable file
·37 lines (34 loc) · 1.35 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
37
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_strlcat.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: brobicho <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2017/12/04 03:19:58 by brobicho #+# ## ## #+# */
/* Updated: 2017/12/04 03:19:58 by brobicho ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t size)
{
unsigned long i;
unsigned long srclen;
unsigned long dstlen;
i = 0;
dstlen = ft_strlen(dst);
srclen = ft_strlen(src);
if (size <= dstlen)
return (srclen + size);
while (dst[i] && i < size - 1)
i++;
while (i < size - 1 && *src)
{
dst[i] = *src;
src++;
i++;
}
dst[i] = '\0';
return (dstlen + srclen);
}