-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_strlcat.c
More file actions
32 lines (29 loc) · 1.18 KB
/
ft_strlcat.c
File metadata and controls
32 lines (29 loc) · 1.18 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcat.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fokrober <fokrober@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/21 19:10:15 by fokrober #+# #+# */
/* Updated: 2019/04/23 15:14:44 by fokrober ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcat(char *s1, const char *s2, size_t size)
{
size_t len;
size_t j;
len = ft_strlen(s1);
if (size <= len)
return (size + ft_strlen(s2));
j = 0;
size -= len + 1;
while (s2[j] && j < size)
{
s1[len + j] = s2[j];
j++;
}
s1[len + j] = '\0';
return (len + ft_strlen(s2));
}