projects
/
fio.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
zbd: Avoid duplicating the code for calculating the number of sectors with data
[fio.git]
/
oslib
/
strlcat.c
1
#ifndef CONFIG_STRLCAT
2
3
#include <string.h>
4
#include "strlcat.h"
5
6
size_t strlcat(char *dst, const char *src, size_t size)
7
{
8
size_t dstlen;
9
size_t srclen;
10
11
dstlen = strlen(dst);
12
size -= dstlen + 1;
13
14
/* return if no room */
15
if (!size)
16
return dstlen;
17
18
srclen = strlen(src);
19
if (srclen > size)
20
srclen = size;
21
22
memcpy(dst + dstlen, src, srclen);
23
dst[dstlen + srclen] = '\0';
24
25
return dstlen + srclen;
26
}
27
28
#endif