1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Read the next entry of a directory.
4 Copyright (C) 2011-2013 Free Software Foundation, Inc.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 #include "dirent-private.h"
33 struct dirent *result;
35 /* There is no need to add code to produce entries for "." and "..".
36 According to the POSIX:2008 section "4.12 Pathname Resolution"
37 <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html>
38 "." and ".." are syntactic entities.
40 "If entries for dot or dot-dot exist, one entry shall be returned
41 for dot and one entry shall be returned for dot-dot; otherwise,
42 they shall not be returned." */
47 /* End of directory already reached. */
52 if (!FindNextFile (dirp->current, &dirp->entry))
54 switch (GetLastError ())
56 case ERROR_NO_MORE_FILES:
72 if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
74 else if (dirp->entry.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
76 else if ((dirp->entry.dwFileAttributes
77 & ~(FILE_ATTRIBUTE_READONLY
78 | FILE_ATTRIBUTE_HIDDEN
79 | FILE_ATTRIBUTE_SYSTEM
80 | FILE_ATTRIBUTE_ARCHIVE
81 | FILE_ATTRIBUTE_NORMAL
82 | FILE_ATTRIBUTE_TEMPORARY
83 | FILE_ATTRIBUTE_SPARSE_FILE
84 | FILE_ATTRIBUTE_COMPRESSED
85 | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
86 | FILE_ATTRIBUTE_ENCRYPTED)) == 0)
87 /* Devices like COM1, LPT1, NUL would also have the attributes 0x20 but
88 they cannot occur here. */
93 /* Reuse the memory of dirp->entry for the result. */
96 ((char *) dirp->entry.cFileName - offsetof (struct dirent, d_name[0]));
97 result->d_type = type;