Browse Source

string: add and test strpbrk (DONE)

master
Lephenixnoir 8 months ago
parent
commit
8ffc104798
Signed by: Lephenixnoir GPG Key ID: 1BBA026E13FC0495
  1. 1
      CMakeLists.txt
  2. 2
      STATUS
  3. 10
      src/libc/string/strpbrk.c

1
CMakeLists.txt

@ -150,6 +150,7 @@ set(SOURCES
src/libc/string/strncpy.c
src/libc/string/strndup.c
src/libc/string/strnlen.c
src/libc/string/strpbrk.c
src/libc/string/strrchr.c
src/libc/string/strspn.c
src/libc/string/strxfrm.c)

2
STATUS

@ -123,7 +123,7 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
7.21.5.1 memchr: DONE
7.21.5.2 strchr: DONE
7.21.5.3 strcspn: DONE
! 7.21.5.4 strpbrk: TODO
7.21.5.4 strpbrk: DONE
7.21.5.5 strrchr: DONE
7.21.5.6 strspn: DONE
! 7.21.5.7 strstr: TODO

10
src/libc/string/strpbrk.c

@ -0,0 +1,10 @@
#include <string.h>
char *strpbrk(char const *str, char const *accept)
{
for(size_t i = 0; str[i]; i++) {
if(strchr(accept, str[i])) return (char *)&str[i];
}
return NULL;
}
Loading…
Cancel
Save