char *search( k, pat, text )
int k;
char *pat, *text;
{ int j, m, count;
m = strlen(pat);
if( m <= k ) return( text );
for( ; *text != EOS; text++ ) {
for( count=j=0; j < m && count <= k; j++ )
if( pat[j] != text[j] ) count++;
if( count <= k ) return( text );
}
return( NULL );
}
|