Parsing a part of a string of unknown length

If you want to search a string for a substring which starts with "abc" and ends with "xyz". then do this:

(1) write a function ( I'll call it fun_a( ) ), which looks for a specified character sequence, and returns the position of the first character where it occurs, or -1 if it doesn't occur anywhere.

int fun_a(  char*  string,    char*  substring )
{
}

(2) write another function fun_b( ) which does this.

int fun_b (  char* string,  char* substring1,  char* substring2 )
{
     int p= fun_a( string, substring1 );
    int q = fun_a( string, substring2 );
    if ( p >= 0 && q >=0 && q>p ) return p ;
    else return -1 ;
}