FreeRTOS-Plus/ThirdParty/WolfSSL-FIPS-Ready/wolfcrypt/src/wc_port.c
/* String token (delim) search. If str is null use nextp. */
String token (delim) search. If str is null use nextp.
String token ( delim ) search . If str is null use nextp .
char* wc_strtok(char *str, const char *delim, char **nextp)
{
    char* ret;
    int i, j;
    if (str == NULL && nextp)
        str = *nextp;
    if (str == NULL || *str == '\0')
        return NULL;
    for (i = 0; str[i]; i++) {
        for (j = 0; delim[j]; j++) {
            if (delim[j] == str[i])
                break;
        }
        if (!delim[j])
            break;
    }
    str += i;
    if (*str == '\0')
        return NULL;
    ret = str;
    for (i = 0; str[i]; i++) {
        for (j = 0; delim[j]; j++) {
            if (delim[j] == str[i])
                break;
        }
        if (delim[j] == str[i])
            break;
    }
    str += i;
    if (*str)
        *str++ = '\0';
    if (nextp)
        *nextp = str;
    return ret;
}
char * wc_strtok ( char * str , const char * delim , char * * nextp ) { char * ret ; int i , j ; if ( str == NULL && nextp ) str = * nextp ; if ( str == NULL || * str == ' \0 ' ) return NULL ; for ( i = 0 ; str [ i ] ; i ++ ) { for ( j = 0 ; delim [ j ] ; j ++ ) { if ( delim [ j ] == str [ i ] ) break ; } if ( ! delim [ j ] ) break ; } str += i ; if ( * str == ' \0 ' ) return NULL ; ret = str ; for ( i = 0 ; str [ i ] ; i ++ ) { for ( j = 0 ; delim [ j ] ; j ++ ) { if ( delim [ j ] == str [ i ] ) break ; } if ( delim [ j ] == str [ i ] ) break ; } str += i ; if ( * str ) * str ++ = ' \0 ' ; if ( nextp ) * nextp = str ; return ret ; }
String token (delim) search.
String token ( delim ) search .
/* Use next if str is NULL */ /* verify str input */ /* match on entire delim */ /* if end of string, not found so return NULL */ /* match on first delim */ /* null terminate found string */ /* return pointer to next */