-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcat.c
32 lines (29 loc) · 1.22 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elraira- <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/09 13:46:50 by elraira- #+# #+# */
/* Updated: 2021/08/20 03:31:50 by elraira- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dest, const char *src, size_t n)
{
size_t srcsize;
size_t destsize;
if (!dest || !src)
return (0);
srcsize = ft_strlen(src);
destsize = ft_strlen(dest);
if (n < destsize)
return (srcsize + n);
else
{
dest = dest + destsize;
ft_strlcpy(dest, src, n - destsize);
return (srcsize + destsize);
}
}