-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
27 lines (24 loc) · 1.14 KB
/
ft_strlcpy.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ide-spir <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/04 14:55:27 by ide-spir #+# #+# */
/* Updated: 2022/01/04 15:03:45 by ide-spir ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *restrict dst, const char *restrict src, size_t dstsize)
{
char *tmp;
if (!dstsize)
return (ft_strlen(src));
tmp = (char *)src;
dstsize--;
while (*src && dstsize--)
*dst++ = *src++;
*dst = '\0';
return (ft_strlen(tmp));
}