int checkFileExtension(char* fileName, char* fileExtensions)
{
    char* fileExtension = fileExtensions;

    if ( *fileName )
    {
        while ( *fileExtension )
        {
            int fileNameLength = strlen(fileName);
            int extensionLength = strlen(fileExtension);
            if ( fileNameLength >= extensionLength )
            {
                char* a = fileName + fileNameLength - extensionLength;
                char* b = fileExtension;
                while ( *a && toupper(*a++) == toupper(*b++) )
                    ;
                if ( !*a )
                    return true;
            }
            fileExtension += extensionLength + 1;
        }
    }
    return false;
}

void printExtensions(char* extensions)
{
    while( *extensions )
    {
        printf(, extensions);
        extensions += strlen(extensions) + 1;
    }
}

bool test(char* fileName, char* extension, bool expectedResult)
{
    bool result = checkFileExtension(fileName,extension);
    bool returnValue = result == expectedResult;
    printf(, 
        fileName,
        result         ?    : ,
        expectedResult ?    : , 
        returnValue    ?  :  );
    return returnValue;
}

int main(void)
{
    static char extensions[] = ;

    setlocale(LC_ALL,);

    printExtensions(extensions);
    printf();

    if ( test(,         extensions,true )
    &&   test(,      extensions,true )
    &&   test(,        extensions,false)
    &&   test(,   extensions,false)
    &&   test(,          extensions,false)
    &&   test(,             extensions,false)
    &&   test(,extensions,true )
    &&   test(,    extensions,false) 
    &&   test(,           extensions,false)
    )
        printf(, );
    else
        printf(, );

    printf(, );
    getchar();
    return 0;
}