Chameleon

Chameleon Svn Source Tree

Root/branches/meklort/i386/modules/klibc/strlcat.c

Source at commit 655 created 13 years 4 months ago.
By meklort, Modules update. removed hardcoding for dyld_stub_bunder in modules.c Added a subset of klibc for a more complete c library implimentation. Added a subset of uclibc++ for an initial c++ implimentation. Note: cout / cin / file io has been disabled. Also note that exceptions and rtti is disabled. Modified the helow world code foa small c++ test.
1/*
2 * strlcat.c
3 */
4
5#include <string.h>
6
7size_t strlcat(char *dst, const char *src, size_t size)
8{
9size_t bytes = 0;
10char *q = dst;
11const char *p = src;
12char ch;
13
14while (bytes < size && *q) {
15q++;
16bytes++;
17}
18if (bytes == size)
19return (bytes + strlen(src));
20
21while ((ch = *p++)) {
22if (bytes + 1 < size)
23*q++ = ch;
24
25bytes++;
26}
27
28*q = '\0';
29return bytes;
30}
31

Archive Download this file

Revision: 655