X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=filebrowser%2Fdir.c;h=ff317e59abd4aebaa4f9ceb9a854cacab07b3f60;hb=4eec2ced245a4f86a63ca03781250cc6c82cddf2;hp=820422ede9423d19fc85471c2d3e0183167fe705;hpb=8c9c9b75176c6135bd37d190e20b6e1818ff108f;p=xboard.git diff --git a/filebrowser/dir.c b/filebrowser/dir.c index 820422e..ff317e5 100644 --- a/filebrowser/dir.c +++ b/filebrowser/dir.c @@ -26,14 +26,12 @@ #include #include /* for qsort */ -#include "../config.h" /* to check for dirent.h */ +#include "config.h" /* to check for dirent.h */ #ifdef SEL_FILE_IGNORE_CASE #include #endif /* def SEL_FILE_IGNORE_CASE */ -#include "selfile.h" - #ifdef HAVE_DIRENT_H #include #else @@ -43,6 +41,8 @@ #include +#include "selfile.h" + #ifdef SEL_FILE_IGNORE_CASE int SFcompareEntries(p, q) @@ -121,14 +121,13 @@ SFgetDir(dir) (void) stat(".", &statBuf); dir->mtime = statBuf.st_mtime; - (void) readdir(dirp); /* throw away "." */ + while (dp = readdir(dirp)) { + struct stat statBuf; + if(!strcmp(dp->d_name, ".")) continue; /* Throw away "." */ + if(!strcmp(dp->d_name, "..")) continue; /* Throw away ".." */ #ifndef S_IFLNK - (void) readdir(dirp); /* throw away ".." */ #endif /* ndef S_IFLNK */ - - while (dp = readdir(dirp)) { - struct stat statBuf; if (i >= alloc) { alloc = 2 * (alloc + 1); result = (SFEntry *) XtRealloc((char *) result,