LibC: add strchrnul()

this is a gnu libc extension
This commit is contained in:
2023-06-11 20:18:03 +03:00
parent c7ec19c25c
commit 297141f321
2 changed files with 12 additions and 0 deletions

View File

@@ -303,6 +303,17 @@ char* strchr(const char* str, int c)
return (*str == c) ? (char*)str : nullptr;
}
char* strchrnul(const char* str, int c)
{
while (*str)
{
if (*str == c)
return (char*)str;
str++;
}
return (char*)str;
}
char* strncpy(char* __restrict__ dest, const char* __restrict__ src, size_t n)
{
size_t i;