chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
allow multiple values to be matched with KEY=="value1|value2"
[elogind.git]
/
klibc
/
klibc
/
strlcat.c
1
/*
2
* strlcat.c
3
*/
4
5
#include <string.h>
6
#include <klibc/compiler.h>
7
8
size_t strlcat(char *dst, const char *src, size_t size)
9
{
10
size_t bytes = 0;
11
char *q = dst;
12
const char *p = src;
13
char ch;
14
15
while ( bytes < size && *q ) {
16
q++;
17
bytes++;
18
}
19
if (bytes == size)
20
return (bytes + strlen(src));
21
22
while ( (ch = *p++) ) {
23
if ( bytes+1 < size )
24
*q++ = ch;
25
26
bytes++;
27
}
28
29
*q = '\0';
30
return bytes;
31
}
32
33