mirror of
git://git.suckless.org/ubase
synced 2024-12-24 23:52:34 +00:00
20 lines
331 B
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;
|
|
}
|