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

Added strnlen(3).

This commit is contained in:
Jonas 'Sortie' Termansen 2012-03-10 23:04:49 +01:00
parent 9ed2031dd2
commit bdd8b2a77a
2 changed files with 8 additions and 1 deletions

View file

@ -51,6 +51,7 @@ 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);
size_t strnlen(const char*, size_t);
char* strpbrk(const char*, const char*);
char* strrchr(const char*, int);
size_t strspn(const char*, const char*);
@ -66,7 +67,6 @@ int strcoll_l(const char*, const char*, locale_t);
char* strerror_l(int, locale_t);
int strerror_r(int, char*, size_t);
char* strndup(const char*, size_t);
size_t strnlen(const char*, size_t);
char* strsignal(int);
size_t strxfrm(char* restrict, const char* restrict, size_t);
size_t strxfrm_l(char* restrict, const char* restrict, size_t, locale_t);

View file

@ -45,6 +45,13 @@ namespace Maxsi
return Result;
}
extern "C" size_t strnlen(const char* str, size_t maxlen)
{
size_t result;
for ( result = 0; maxlen - result && str[result]; result++ ) { }
return result;
}
DUAL_FUNCTION(char*, strcpy, Copy, (char* Dest, const char* Src))
{
char* OriginalDest = Dest;