#define _CRT_SECURE_NO_DEPRECATE #include #include #include #include #include #include "portability.h" #include "toku_os.h" #include int verbose; static int walk(const char *dirname) { DIR *d; struct dirent *dirent; int dotfound = 0, dotdotfound = 0, otherfound = 0; d = opendir(dirname); if (d == NULL) return -1; while ((dirent = readdir(d))) { if (verbose) printf("%p %s\n", dirent, dirent->d_name); if (strcmp(dirent->d_name, ".") == 0) dotfound++; else if (strcmp(dirent->d_name, "..") == 0) dotdotfound++; else otherfound++; } closedir(d); assert(dotfound == 1 && dotdotfound == 1); return otherfound; } int main(int argc, char *argv[]) { int i; int found; int fd; int r; for (i=1; i= 0); close(fd); } found = walk(TESTDIR); assert(found == N); // walk and remove files return 0; }