libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / libroot / posix / string / strlcpy.c
blob04e387b2c2047e89bc5ed02983d499f8e204ef9e
1 /*
2 ** Copyright 2002, Manuel J. Petit. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
6 #include <sys/types.h>
7 #include <string.h>
10 size_t
11 strlcpy(char *dst, char const *src, size_t s)
13 size_t i= 0;
15 if (!s)
16 return strlen(src);
18 for (i = 0; ((i < s - 1) && src[i]); i++) {
19 dst[i] = src[i];
22 dst[i] = 0;
24 return i + strlen(src + i);