sbase/util/strlcat.c

20 lines
331 B
C
Raw Normal View History

2013-09-04 10:27:29 +00:00
#include <stdio.h>
#include <string.h>
#include "../util.h"
2013-09-04 10:27:29 +00:00
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;
}