X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Flibc.so_src%2Fstring.c;h=3d30f1c6e23b50d4e93623a6ac65b096d5525575;hb=1104e2b282cbd3d7b563169e773927860eaa3f4f;hp=3cadee900fc586215180203f2fe2a91eed8481bc;hpb=fb3abbad5dfd71ea2b190d0b33d9c57e879fb15a;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/libc.so_src/string.c b/Usermode/Libraries/libc.so_src/string.c index 3cadee90..3d30f1c6 100644 --- a/Usermode/Libraries/libc.so_src/string.c +++ b/Usermode/Libraries/libc.so_src/string.c @@ -100,6 +100,18 @@ EXPORT char *strcat(char *dst, const char *src) return dst; } +EXPORT char *strncat(char *dst, const char *src, size_t n) +{ + char *to = dst; + // Find the end + while(*to) to++; + // Copy + while(*src && n--) *to++ = *src++; + // End string + *to = '\0'; + return dst; +} + /** * \brief Get the length of a string */ @@ -273,7 +285,7 @@ EXPORT void *memmove(void *dest, const void *src, size_t count) char *sp = (char *)src; char *dp = (char *)dest; // Check if the areas overlap - if( (intptr_t)src < (intptr_t)dest && (intptr_t)dest < (intptr_t)src+count ) + if( (uintptr_t)src < (uintptr_t)dest && (uintptr_t)dest < (uintptr_t)src+count ) for(;count--;) dp[count] = sp[count]; else