Subversion Repositories DevTools

Rev

Rev 227 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
#include "unistd.h"
2
#include "dirent.h"
3
 
4
int
5
main(int argc, char *argv[])
6
{
7
        struct dirent *ent;
8
        DIR *dir;
9
 
10
        while (argc-- > 1)
11
        {
12
                ++argv;
13
                printf("OPEN(%s)\n", argv[0]);
14
                if ((dir = opendir(argv[0])) == NULL)
15
                {
16
                        perror("open");
17
                        exit(3);
18
                }
19
 
20
                while ((ent = readdir(dir)) != NULL)
21
                {
22
                        printf("%s\n", ent->d_name);
23
                }
24
 
25
                printf("CLOSE(%s)\n", argv[0]);
26
                closedir(dir);
27
                dir = NULL;
28
        }
29
        return (0);
30
}
31