-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_strlcpy.c
28 lines (25 loc) · 1.12 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
28
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strlcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anpayot <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/05 14:56:15 by anpayot #+# #+# */
/* Updated: 2024/10/10 15:21:47 by anpayot ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
const char *src_start = src;
if (dstsize)
{
while (*src && dstsize-- > 1)
*dst++ = *src++;
*dst = '\0';
}
while (*src++)
;
return (src - src_start - 1);
}