mirror of
https://github.com/mirror/make.git
synced 2025-01-15 23:00:37 +08:00
* src/config.h.W32.template [W32]: Add support for dirent.d_type
* src/w32/include/dirent.h: Add DT_* values for dirent.d_type (struct dirent): Add d_type * src/w32/compat/durent.c (readdir): Set dirent.d_type based on Windows file attributes.
This commit is contained in:
parent
64f5375fe0
commit
34ee9adaed
@ -291,6 +291,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
/* Define to 1 if you have the 'strsignal' function. */
|
/* Define to 1 if you have the 'strsignal' function. */
|
||||||
/* #undef HAVE_STRSIGNAL */
|
/* #undef HAVE_STRSIGNAL */
|
||||||
|
|
||||||
|
/* Define to 1 if `d_type' is a member of `struct dirent'. */
|
||||||
|
#define HAVE_STRUCT_DIRENT_D_TYPE 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `isatty' function. */
|
/* Define to 1 if you have the `isatty' function. */
|
||||||
#define HAVE_ISATTY 1
|
#define HAVE_ISATTY 1
|
||||||
|
|
||||||
|
@ -135,6 +135,13 @@ readdir(DIR* pDir)
|
|||||||
pDir->dir_sdReturn.d_ino = (ino_t)-1;
|
pDir->dir_sdReturn.d_ino = (ino_t)-1;
|
||||||
strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
|
strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
|
||||||
|
|
||||||
|
if (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DEVICE)
|
||||||
|
pDir->dir_sdReturn.d_type = DT_CHR;
|
||||||
|
else if (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
pDir->dir_sdReturn.d_type = DT_DIR;
|
||||||
|
else
|
||||||
|
pDir->dir_sdReturn.d_type = DT_REG;
|
||||||
|
|
||||||
return &pDir->dir_sdReturn;
|
return &pDir->dir_sdReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,20 +33,46 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
|
|
||||||
#define __DIRENT_COOKIE 0xfefeabab
|
#define __DIRENT_COOKIE 0xfefeabab
|
||||||
|
|
||||||
|
/* File types for `d_type'.
|
||||||
|
Windows only supports DT_CHR, DT_DIR, and DT_REG. */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DT_UNKNOWN = 0,
|
||||||
|
# define DT_UNKNOWN DT_UNKNOWN
|
||||||
|
DT_FIFO = 1,
|
||||||
|
# define DT_FIFO DT_FIFO
|
||||||
|
DT_CHR = 2,
|
||||||
|
# define DT_CHR DT_CHR
|
||||||
|
DT_DIR = 4,
|
||||||
|
# define DT_DIR DT_DIR
|
||||||
|
DT_BLK = 6,
|
||||||
|
# define DT_BLK DT_BLK
|
||||||
|
DT_REG = 8,
|
||||||
|
# define DT_REG DT_REG
|
||||||
|
DT_LNK = 10,
|
||||||
|
# define DT_LNK DT_LNK
|
||||||
|
DT_SOCK = 12,
|
||||||
|
# define DT_SOCK DT_SOCK
|
||||||
|
DT_WHT = 14
|
||||||
|
# define DT_WHT DT_WHT
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct dirent
|
struct dirent
|
||||||
{
|
{
|
||||||
ino_t d_ino; /* unused - no equivalent on WINDOWS32 */
|
ino_t d_ino; /* unused - no equivalent on WINDOWS32. */
|
||||||
char d_name[NAME_MAX+1];
|
unsigned char d_type;
|
||||||
};
|
char d_name[NAME_MAX+1]; /* must come last due to dir.c assumptions. */
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct dir_struct {
|
typedef struct dir_struct
|
||||||
|
{
|
||||||
ULONG dir_ulCookie;
|
ULONG dir_ulCookie;
|
||||||
HANDLE dir_hDirHandle;
|
HANDLE dir_hDirHandle;
|
||||||
DWORD dir_nNumFiles;
|
DWORD dir_nNumFiles;
|
||||||
char dir_pDirectoryName[NAME_MAX+1];
|
char dir_pDirectoryName[NAME_MAX+1];
|
||||||
struct dirent dir_sdReturn;
|
struct dirent dir_sdReturn;
|
||||||
} DIR;
|
} DIR;
|
||||||
|
|
||||||
DIR *opendir(const char *);
|
DIR *opendir(const char *);
|
||||||
struct dirent *readdir(DIR *);
|
struct dirent *readdir(DIR *);
|
||||||
|
Loading…
Reference in New Issue
Block a user