1 /* strlcpy( char *, const char *, size_t )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 #pragma weak strlcpy = _PDCLIB_strlcpy
12 size_t _PDCLIB_strlcpy(
14 const char *restrict src,
17 size_t _PDCLIB_strlcpy(
19 const char *restrict src,
23 while(needed < dstsize && (dst[needed] = src[needed]))
28 if (needed > dstsize && dstsize)
37 #include "_PDCLIB_test.h"
44 TESTCASE_NOREG( strlcpy(NULL, "a", 0) == 2 );
45 TESTCASE_NOREG( strlcpy(destbuf, "a", 10) == 2 );
46 TESTCASE_NOREG( strcmp(destbuf, "a") == 0 );
47 TESTCASE_NOREG( strlcpy(destbuf, "helloworld", 10) == 11 );
48 TESTCASE_NOREG( strcmp(destbuf, "helloworl") == 0 );