kernel/src/klibc/klibc.c
os_size_t os_strspn(char * s, char * accept) {
    char c = s[0];  // The character in s being checked
    int length = 0;

    // Check each character in s
    while (c != 0) {
        bool ok = false;

        // Check against each character in accept
        int i;
        for (i = 0; i < strlen(accept); i++) {
            if (c == accept[i]) { ok = true; }
        }

        if (ok == true) {
            // If c matched any character in accept, continue
            length++;
            c = s[length];
        } else {
            // If did not match any character in accept, we are done
            return length;
        }
    }
    return length;
}
/* Returns the length of the initial segment of s that only includes
 the characters in c.
 */
Returns the length of the initial segment of s that only includes
the characters in c.
Returns the length of the initial segment of s that only includes the characters in c .
os_size_t os_strspn(char * s, char * accept) {
    char c = s[0];  
    int length = 0;
    while (c != 0) {
        bool ok = false;
        int i;
        for (i = 0; i < strlen(accept); i++) {
            if (c == accept[i]) { ok = true; }
        }
        if (ok == true) {
            length++;
            c = s[length];
        } else {
            return length;
        }
    }
    return length;
}
os_size_t os_strspn ( char * s , char * accept ) { char c = s [ 0 ] ; int length = 0 ; while ( c != 0 ) { bool ok = false ; int i ; for ( i = 0 ; i < strlen ( accept ) ; i ++ ) { if ( c == accept [ i ] ) { ok = true ; } } if ( ok == true ) { length ++ ; c = s [ length ] ; } else { return length ; } } return length ; }
Returns the length of the initial segment of s that only includes
the characters in c.
Returns the length of the initial segment of s that only includes the characters in c .
// The character in s being checked // Check each character in s // Check against each character in accept // If c matched any character in accept, continue // If did not match any character in accept, we are done