ubase/util/strlcat.c
2013-09-04 11:35:36 +01:00

19 lines
310 B
C

#include <stdio.h>
#include <string.h>
size_t
strlcat(char *dest, const char *src, size_t count)
{
size_t dsize = strlen(dest);
size_t len = strlen(src);
size_t res = dsize + len;
dest += dsize;
count -= dsize;
if (len >= count)
len = count-1;
memcpy(dest, src, len);
dest[len] = 0;
return res;
}