1#include <string.h>
23
size_t gitstrlcpy(char *dest, const char *src, size_t size)
4{
5size_t ret = strlen(src);
67
if (size) {
8size_t len = (ret >= size) ? size - 1 : ret;
9memcpy(dest, src, len);
10dest[len] = '\0';
11}
12return ret;
13}