[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/test/misc/dirent.c b/ap/build/uClibc/test/misc/dirent.c
new file mode 100644
index 0000000..491e3cf
--- /dev/null
+++ b/ap/build/uClibc/test/misc/dirent.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <dirent.h>
+
+#define _DTIFY(DT) [DT] #DT
+const char * const types[] = {
+ _DTIFY(DT_UNKNOWN),
+ _DTIFY(DT_FIFO),
+ _DTIFY(DT_CHR),
+ _DTIFY(DT_DIR),
+ _DTIFY(DT_BLK),
+ _DTIFY(DT_REG),
+ _DTIFY(DT_LNK),
+ _DTIFY(DT_SOCK),
+ _DTIFY(DT_WHT)
+};
+
+int main(int argc, char *argv[])
+{
+ DIR *dirh;
+ struct dirent *de;
+ const char *mydir = (argc == 1 ? "/" : argv[1]);
+
+ if ((dirh = opendir(mydir)) == NULL) {
+ perror("opendir");
+ return 1;
+ }
+
+ printf("readdir() says:\n");
+ while ((de = readdir(dirh)) != NULL)
+ printf("\tdir entry %s: %s\n", types[de->d_type], de->d_name);
+
+ closedir(dirh);
+
+ return 0;
+}