-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strlcat.c
More file actions
31 lines (28 loc) · 1.19 KB
/
ft_strlcat.c
File metadata and controls
31 lines (28 loc) · 1.19 KB
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: lpalacio <lpalacio@student.42madrid> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/03 19:28:13 by lpalacio #+# #+# */
/* Updated: 2022/10/03 19:29:41 by lpalacio ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t d;
size_t n;
d = ft_strlen(dst);
n = 0;
if (dstsize <= d)
return (dstsize + ft_strlen(src));
while ((d + n) < (dstsize - 1) && src[n] != 0)
{
dst[d + n] = src[n];
n++;
}
dst[d + n] = 0;
return (d + ft_strlen(src));
}