-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_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: yxu <yxu@student.42tokyo.jp> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/08/13 22:54:44 by yxu #+# #+# */
/* Updated: 2023/09/26 15:29:19 by yxu ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
size_t ft_strlcpy(char *dst, const char *src, size_t dstsize)
{
size_t n;
size_t len;
len = ft_strlen(src);
if (dstsize == 0)
return (len);
n = dstsize;
while (*src && (--n > 0))
*dst++ = *src++;
*dst = '\0';
return (len);
}