X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/c6de44b989e9d7286337e4cbf4d82d919f9120e6..db7fc030e9e04c881f5f12a0e23baa8db4e20ee1:/lunaix-os/kernel/demos/dir_read.c?ds=sidebyside diff --git a/lunaix-os/kernel/demos/dir_read.c b/lunaix-os/kernel/demos/dir_read.c deleted file mode 100644 index e1ef7a2..0000000 --- a/lunaix-os/kernel/demos/dir_read.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include -#include - -void -_readdir_main() -{ - int fd = open("/dev/./../dev/.", 0); - if (fd == -1) { - printf("fail to open (%d)\n", geterrno()); - return; - } - - char path[129]; - int len = realpathat(fd, path, 128); - if (len < 0) { - printf("fail to read (%d)\n", geterrno()); - } else { - path[len] = 0; - printf("%s\n", path); - } - - struct dirent ent = { .d_offset = 0 }; - - while (readdir(fd, &ent) == 1) { - printf("%s\n", ent.d_name); - } - - close(fd); - - return; -} \ No newline at end of file