Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
378 bytes
|
Rev | Line | |
---|
[e16e8f2] | 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 | |
---|
| 20 | while ((ch = *p++)) { |
---|
| 21 | if (bytes < size) |
---|
| 22 | *q++ = ch; |
---|
| 23 | |
---|
| 24 | bytes++; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | *q = '\0'; |
---|
| 28 | return bytes; |
---|
| 29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.