mirror of git://git.suckless.org/ubase
19 lines
310 B
C
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;
|
||
|
}
|