* Added simple test app for readdir() to see how it fills out the dirent

and the private DIR parts.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26860 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-07 14:25:06 +00:00
parent 49a7b6198d
commit ed7c4a3e9a
2 changed files with 34 additions and 1 deletions
+5 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src tests system libroot posix ;
UsePrivateHeaders syslog_daemon ;
UsePrivateHeaders libroot syslog_daemon ;
SimpleTest SyslogTest
: SyslogTest.cpp syslog.cpp
@@ -10,6 +10,10 @@ SimpleTest clearenv
: clearenv.cpp
;
SimpleTest dirent_test
: dirent_test.cpp
;
SimpleTest flock_test
: flock_test.cpp
;
@@ -0,0 +1,29 @@
/*
* Copyright 2008, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <dirent.h>
#include <stdio.h>
#include <dirent_private.h>
int
main(int argc, char** argv)
{
DIR* dir = opendir(".");
while (true) {
dirent* dirent = readdir(dir);
if (dirent == NULL)
break;
printf("Entry: dev %ld, ino %Ld, name \"%s\"\n", dirent->d_dev,
dirent->d_ino, dirent->d_name);
printf(" left: %u, next: %d\n", dir->entries_left, dir->next_entry);
}
closedir(dir);
return 0;
}