#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

int
main (int argc, char **argv)
{
        DIR             *fd;
        struct dirent   *ent;
        int             counter = 0;

        fd = opendir(argv[1]);
        if (!fd) {
                perror("opendir");
                return !0;
        }

        for (;;) {
                ent = readdir(fd);
                if (!ent) {
                        break;
                }
                printf ("0x%016llx %d %.*s\n", ent->d_off, ent->d_type,
                        sizeof(ent->d_name), ent->d_name);
                if (++counter > 100000) {
                        break;
                }
        }

        return 0;
}
