summaryrefslogtreecommitdiff
path: root/test/misc/dirent.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/misc/dirent.c')
-rw-r--r--test/misc/dirent.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/misc/dirent.c b/test/misc/dirent.c
new file mode 100644
index 000000000..885990bf2
--- /dev/null
+++ b/test/misc/dirent.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+int main(int argc, char **argv)
+{
+
+ DIR *dirh;
+ struct dirent *dirp;
+ static char mydir[20] = "/tmp";
+
+ if ((dirh = opendir(mydir)) == NULL) {
+ perror("opendir");
+ return 1;
+ }
+
+ for (dirp = readdir(dirh); dirp != NULL; dirp = readdir(dirh)) {
+ printf("Got dir entry: %s\n",dirp->d_name);
+ }
+
+ closedir(dirh);
+ return 0;
+}
+