diff options
Diffstat (limited to 'src/lib/string.C')
-rw-r--r-- | src/lib/string.C | 83 |
1 files changed, 61 insertions, 22 deletions
diff --git a/src/lib/string.C b/src/lib/string.C index 0e1095c63..18cfec530 100644 --- a/src/lib/string.C +++ b/src/lib/string.C @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/lib/string.C $ -// -// IBM CONFIDENTIAL -// -// COPYRIGHT International Business Machines Corp. 2011 -// -// p1 -// -// Object Code Only (OCO) source materials -// Licensed Internal Code Source Materials -// IBM HostBoot Licensed Internal Code -// -// The source code for this program is not published or other- -// wise divested of its trade secrets, irrespective of what has -// been deposited with the U.S. Copyright Office. -// -// Origin: 30 -// -// IBM_PROLOG_END +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/lib/string.C $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2011-2012 + * + * p1 + * + * Object Code Only (OCO) source materials + * Licensed Internal Code Source Materials + * IBM HostBoot Licensed Internal Code + * + * The source code for this program is not published or other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ #include <string.h> extern "C" void *memset(void *vdest, int ch, size_t len) @@ -201,6 +202,44 @@ extern "C" size_t strlen(const char* a) return length; } +extern "C" char* strcat(char* d, const char* s) +{ + char* _d = d; + while(*_d) + { + _d++; + } + + while(*s) + { + *_d = *s; + _d++; s++; + } + *_d = '\0'; + + return d; +} + +extern "C" char* strncat(char* d, const char* s, size_t n) +{ + char* _d = d; + while(*_d) + { + _d++; + } + + while((*s) && (0 != n)) + { + *_d = *s; + _d++; s++; + n--; + } + *_d = '\0'; + + return d; +} + + extern "C" char* strchr(const char* s, int c) { while((*s != '\0') && (*s != c)) |