-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strlcat.c
More file actions
38 lines (35 loc) · 1.22 KB
/
ft_strlcat.c
File metadata and controls
38 lines (35 loc) · 1.22 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
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bguzel <bguzel@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/11 16:14:44 by bguzel #+# #+# */
/* Updated: 2022/10/28 13:43:17 by bguzel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
{
size_t i;
size_t len;
len = ft_strlen(src);
i = 0;
if (dstsize == 0)
return (len);
while (*dst && dstsize)
{
i++;
dst++;
dstsize--;
}
while (*src && 1 < dstsize)
{
*dst++ = *src++;
dstsize--;
}
if (dstsize != 0)
*dst = '\0';
return (len + i);
}