If you were using std::string instead of char arrays, you could easily do (dirname == ".") because of C++ operator overloading.
Here's how you'd do it with std::string
(Edit: but judging from the other posts it looks like you're coding in C so I guess you can't use this)
1 2 3 4 5 6
#include <string>
std::string dirname = ".";
if (dirname == "." || dirname == "..")
{
//not a directory, etc
}