/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does.  */
size_t strlcpy(char *dest, const char *src, size_t size)
/* Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). It does not pad out the result like strncpy() does.  */
size_t strlcpy(char *dest, const char *src, size_t size)
{
	size_t ret = __strend(src) - src;
	if (size) {
		size_t len = (ret >= size) ? size-1 : ret;
		dest[len] = '\0';
		__builtin_memcpy(dest, src, len);
	}
	return ret;
}