(root)/
make-4.4/
src/
w32/
include/
dirent.h
       1  /* Windows version of dirent.h
       2  Copyright (C) 1996-2022 Free Software Foundation, Inc.
       3  This file is part of GNU Make.
       4  
       5  GNU Make is free software; you can redistribute it and/or modify it under the
       6  terms of the GNU General Public License as published by the Free Software
       7  Foundation; either version 3 of the License, or (at your option) any later
       8  version.
       9  
      10  GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
      11  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
      12  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
      13  
      14  You should have received a copy of the GNU General Public License along with
      15  this program.  If not, see <https://www.gnu.org/licenses/>.  */
      16  
      17  #ifndef _DIRENT_H
      18  #define _DIRENT_H
      19  
      20  #ifdef __MINGW32__
      21  # include <windows.h>
      22  # include_next <dirent.h>
      23  #else
      24  
      25  #include <stdlib.h>
      26  #include <windows.h>
      27  #include <limits.h>
      28  #include <sys/types.h>
      29  
      30  #ifndef NAME_MAX
      31  #define NAME_MAX 255
      32  #endif
      33  
      34  #define __DIRENT_COOKIE 0xfefeabab
      35  
      36  /* File types for `d_type'.
      37     Windows only supports DT_CHR, DT_DIR, and DT_REG.  */
      38  enum
      39    {
      40      DT_UNKNOWN = 0,
      41  # define DT_UNKNOWN     DT_UNKNOWN
      42      DT_FIFO = 1,
      43  # define DT_FIFO        DT_FIFO
      44      DT_CHR = 2,
      45  # define DT_CHR         DT_CHR
      46      DT_DIR = 4,
      47  # define DT_DIR         DT_DIR
      48      DT_BLK = 6,
      49  # define DT_BLK         DT_BLK
      50      DT_REG = 8,
      51  # define DT_REG         DT_REG
      52      DT_LNK = 10,
      53  # define DT_LNK         DT_LNK
      54      DT_SOCK = 12,
      55  # define DT_SOCK        DT_SOCK
      56      DT_WHT = 14
      57  # define DT_WHT         DT_WHT
      58    };
      59  
      60  
      61  struct dirent
      62    {
      63      ino_t d_ino;             /* unused - no equivalent on WINDOWS32.  */
      64      unsigned char d_type;
      65      char d_name[NAME_MAX+1]; /* must come last due to dir.c assumptions.  */
      66    };
      67  
      68  typedef struct dir_struct
      69    {
      70      ULONG   dir_ulCookie;
      71      HANDLE  dir_hDirHandle;
      72      DWORD   dir_nNumFiles;
      73      char    dir_pDirectoryName[NAME_MAX+1];
      74      struct dirent dir_sdReturn;
      75    } DIR;
      76  
      77  DIR *opendir(const char *);
      78  struct dirent *readdir(DIR *);
      79  void rewinddir(DIR *);
      80  void closedir(DIR *);
      81  void seekdir(DIR *, long);
      82  
      83  #endif  /* !__MINGW32__ */
      84  #endif