Well, just glancing at your code for a couple of seconds, I founds some stuff (maybe you intended, maybe not). You use the constant looking constant BUFSIZE, but I don't see it declared anywhere.
Also, you may be a little confused with the return value of strcmp here:
Code:
if(strcmp(goodext1,extension) || strcmp(goodext2,extension))
Are you trying to test if these strings are alike? Because, if two strings are the same, strcmp returns 0, not a non-zero number. So, if you want to test if they are equal, it should be:
Code:
if(!strcmp(goodext1,extension) || strcmp(!goodext2,extension))
Or more easier readably:
Code:
if((strcmp(goodext1,extension) == 0) || (strcmp(goodext2,extension)==0))
Tell me if this is the problem. If not I'll study the code a little harder.