FreeBSD/sys/dev/ppbus/ppbconf.c
/*
 * search_token()
 *
 * Search the first occurrence of a token within a string
 */
search_token()
Search the first occurrence of a token within a string
search_token () Search the first occurrence of a token within a string
static char *
search_token(char *str, int slen, char *token)
{
	int tlen, i;
#define UNKNOWN_LENGTH	-1
	if (slen == UNKNOWN_LENGTH)
		slen = strlen(str);
	tlen = strlen(token);
	if (tlen == 0)
		return (str);
	for (i = 0; i <= slen-tlen; i++) {
		if (strncmp(str + i, token, tlen) == 0)
			return (&str[i]);
	}
	return (NULL);
}
static char * search_token ( char * str , int slen , char * token ) { int tlen , i ; #define UNKNOWN_LENGTH 	-1 if ( slen == UNKNOWN_LENGTH ) slen = strlen ( str ) ; tlen = strlen ( token ) ; if ( tlen == 0 ) return ( str ) ; for ( i = 0 ; i <= slen - tlen ; i ++ ) { if ( strncmp ( str + i , token , tlen ) == 0 ) return ( & str [ i ] ) ; } return ( NULL ) ; }
search_token()
 Search the first occurrence of a token within a string
search_token () Search the first occurrence of a token within a string
/* get string's length */ /* get token's length */