FAT | RFS | XFS | ZFS
readdir_stat()
PROTOTYPE
#include <posix.h>
struct dirent *readdir_stat(DIR *dirp, struct stat *info);
DESCRIPTION
readdir_stat() is a non-standard routine that combines the behavior of readdir() and stat(). It is an optimization since the name lookup otherwise required by stat() on the dirent structure’s d_name entry is omitted.
The readdir_stat() dirp parameter and return value are the same as for readdir(). The info parameter is the same as for stat(). See the readdir() and stat() pages for information on those.
EXAMPLE
/*-------------------------------------------------------------------*/
/* Loop through directory's file list. Recursively walk directories */
/* and dump regular files. */
/*-------------------------------------------------------------------*/
for (;;)
{
entry = readdir_stat(dir, &info);
if (entry == NULL)
break;
printf(" %s\n", entry->d_name);
if (S_ISDIR(info.st_mode))
{
if (strcmp(entry->d_name, ".") == 0)
continue;
if (strcmp(entry->d_name, "..") == 0)
continue;
vol_walk(entry->d_name);
}
else
file_dump(entry->d_name);
}