1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Added strncat(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2012-03-04 18:12:54 +01:00
parent 73e2d9db3c
commit 6695da9229
2 changed files with 14 additions and 1 deletions

View file

@ -48,6 +48,7 @@ char* strcpy(char* restrict, const char* restrict);
char* strdup(const char*);
char* strerror(int);
size_t strlen(const char*);
char* strncat(char* restrict, const char* restrict, size_t);
int strncmp(const char*, const char*, size_t);
char* strncpy(char* restrict, const char* restrict, size_t);
char* strpbrk(const char*, const char*);
@ -64,7 +65,6 @@ char* stpncpy(char* restrict, const char* restrict, size_t);
int strcoll_l(const char*, const char*, locale_t);
char* strerror_l(int, locale_t);
int strerror_r(int, char*, size_t);
char* strncat(char* restrict, const char* restrict, size_t);
char* strndup(const char*, size_t);
size_t strnlen(const char*, size_t);
char* strsignal(int);

View file

@ -84,6 +84,19 @@ namespace Maxsi
return OriginalDest;
}
extern "C" char* strncat(char* dest, const char* src, size_t len)
{
size_t destlen = Length(dest);
size_t i;
for ( i = 0; i < len && src[i]; i++ )
{
dest[destlen + i] = src[i];
}
dest[destlen+i] = 0;
return dest;
}
DUAL_FUNCTION(int, strcmp, Compare, (const char* A, const char* B))
{
while ( true )