(readdir_ignoring_dot_and_dotdot): New inline function, from remove.c.

This commit is contained in:
Jim Meyering committed 2004-04-18 13:09:27 +00:00
1 parent e71f800ae0
commit de48260615
1 file changed
+12
+12
View File
@@ -572,6 +572,18 @@ uid_t getuid ();
(Basename[0] == '.' && (Basename[1] == '\0' \
|| (Basename[1] == '.' && Basename[2] == '\0')))
/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */
static inline struct dirent const *
readdir_ignoring_dot_and_dotdot (DIR *dirp)
{
while (1)
{
struct dirent const *dp = readdir (dirp);
if (dp == NULL || ! DOT_OR_DOTDOT (dp->d_name))
return dp;
}
}
#if SETVBUF_REVERSED
# define SETVBUF(Stream, Buffer, Type, Size) \
setvbuf (Stream, Type, Buffer, Size)