1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibC: Add POSIX spec comments for string APIs

This commit is contained in:
Brian Gianforcaro 2021-12-21 15:56:28 -08:00 committed by Brian Gianforcaro
parent 0f53e0aaea
commit 11a12c2312
2 changed files with 30 additions and 0 deletions

View file

@ -28,6 +28,7 @@ static char foldcase(char ch)
return ch;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html
int strcasecmp(const char* s1, const char* s2)
{
for (; foldcase(*s1) == foldcase(*s2); ++s1, ++s2) {
@ -37,6 +38,7 @@ int strcasecmp(const char* s1, const char* s2)
return foldcase(*(const unsigned char*)s1) < foldcase(*(const unsigned char*)s2) ? -1 : 1;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncasecmp.html
int strncasecmp(const char* s1, const char* s2, size_t n)
{
if (!n)