Replace lsdir system call by readdir, isdir system calls,
[pintos-anon] / src / tests / filesys / extended / dir-lsdir.c
1 /* Lists the contents of a directory using readdir. */
2
3 #include <syscall.h>
4 #include "tests/lib.h"
5 #include "tests/main.h"
6
7 void
8 test_main (void) 
9 {
10   int fd;
11   char name[READDIR_MAX_LEN + 1];
12
13   CHECK ((fd = open (".")) > 1, "open .");
14   CHECK (isdir (fd), "isdir(.)");
15
16   while (readdir (fd, name))
17     msg ("readdir: \"%s\"", name);
18
19   msg ("close .");
20   close (fd);
21 }