kernel/src/klibc/klibc.c
char * __strchrnul(char * s, char c) {
    os_size_t *w, k;

    if (!c) return (char *)s + strlen(s);

    for (; (uintptr_t)s % ALIGN; s++)
        if (!*s || *(unsigned char *)s == c) return (char *)s;
    k = ONES * c;
    for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
        ;
    for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
        ;
    return (char *)s;
}
/* Returns a pointer to the first instance of c in s, like indexOf().
 If c is not found, then return a pointer to the NULL character at
 the end of String s.
 */
Returns a pointer to the first instance of c in s, like indexOf().
If c is not found, then return a pointer to the NULL character at
the end of String s.
Returns a pointer to the first instance of c in s like indexOf () . If c is not found then return a pointer to the NULL character at the end of String s .
char * __strchrnul(char * s, char c) {
    os_size_t *w, k;
    if (!c) return (char *)s + strlen(s);
    for (; (uintptr_t)s % ALIGN; s++)
        if (!*s || *(unsigned char *)s == c) return (char *)s;
    k = ONES * c;
    for (w = (void *)s; !HASZERO(*w) && !HASZERO(*w ^ k); w++)
        ;
    for (s = (void *)w; *s && *(unsigned char *)s != c; s++)
        ;
    return (char *)s;
}
char * __strchrnul ( char * s , char c ) { os_size_t * w , k ; if ( ! c ) return ( char * ) s + strlen ( s ) ; for ( ; ( uintptr_t ) s % ALIGN ; s ++ ) if ( ! * s || * ( unsigned char * ) s == c ) return ( char * ) s ; k = ONES * c ; for ( w = ( void * ) s ; ! HASZERO ( * w ) && ! HASZERO ( * w ^ k ) ; w ++ ) ; for ( s = ( void * ) w ; * s && * ( unsigned char * ) s != c ; s ++ ) ; return ( char * ) s ; }
Returns a pointer to the first instance of c in s, like indexOf().
Returns a pointer to the first instance of c in s like indexOf () .