diff -rupN ohcount.orig/src/sourcefile.c ohcount/src/sourcefile.c --- ohcount.orig/src/sourcefile.c 2009-07-31 00:51:37.000000000 +0200 +++ ohcount/src/sourcefile.c 2010-01-16 13:56:33.000000000 +0100 @@ -6,6 +6,10 @@ #include #include +#include +#include +#include + #include "detector.h" #include "diff.h" #include "languages.h" @@ -426,13 +430,15 @@ void ohcount_sourcefile_list_add_directo DIR *d = opendir(directory); if (d) { while ((file = readdir(d))) { + struct stat st; int length = strlen(file->d_name); strncpy(f_p, (const char *)file->d_name, length); *(f_p + length) = '\0'; - if (file->d_type == DT_DIR && *file->d_name != '.') // no hidden dirs + stat(filepath, &st); + if (S_ISDIR(st.st_mode) && *file->d_name != '.') // no hidden dirs ohcount_sourcefile_list_add_directory(list, filepath); - else if (file->d_type == DT_REG) + else if (S_ISREG(st.st_mode)) ohcount_sourcefile_list_add_file(list, filepath); } closedir(d);