ubase/util/strlcat.c

20 lines
331 B
C

#include <stdio.h>
#include <string.h>
#include "../util.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;
}