root/nt/inc/dirent.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


     1 /*
     2         <dirent.h> -- definitions for POSIX-compatible directory access
     3 
     4  * The code here is forced by the interface, and is not subject to
     5  * copyright, constituting the only possible expression of the
     6  * algorithm in this format.
     7  */
     8 
     9 #define DIRBLKSIZ       512             /* size of directory block */
    10 #ifdef WINDOWSNT
    11 #define MAXNAMLEN       255
    12 #else  /* not WINDOWSNT */
    13 #define MAXNAMLEN       15              /* maximum filename length */
    14 #endif /* not WINDOWSNT */
    15         /* NOTE:  MAXNAMLEN must be one less than a multiple of 4 */
    16 
    17 struct dirent                           /* data from readdir() */
    18         {
    19         long            d_ino;          /* inode number of entry */
    20         unsigned short  d_reclen;       /* length of this record */
    21         unsigned short  d_namlen;       /* length of string in d_name */
    22 #if __MINGW_MAJOR_VERSION >= 4
    23         /* MinGW.org runtime 4.x introduces a modified layout of
    24            'struct dirent', which makes it binary incompatible with
    25            previous versions.  To add insult to injury, the MinGW
    26            startup code calls 'readdir', which is implemented in
    27            w32.c.  So we need to define the same layout of this struct
    28            as the MinGW runtime does, or else command-line globbing
    29            will be broken.  (Versions of MinGW runtime after 4.0 are
    30            supposed not to call 'readdir' from startup code, but we
    31            had better be safe than sorry.)  */
    32         unsigned        d_type;         /* File attributes */
    33         /* The next 3 fields are declared 'time_t' in the MinGW 4.0
    34            headers, but 'time_t' is by default a 64-bit type in 4.x,
    35            and presumably the libmingwex library was compiled using
    36            that default definition.  So we must use 64-bit types here,
    37            even though our time_t is a 32-bit type.  What a mess!  */
    38         __int64         d_time_create;
    39         __int64         d_time_access;  /* always midnight local time */
    40         __int64         d_time_write;
    41         _fsize_t        d_size;
    42 #endif
    43         char            d_name[MAXNAMLEN * 4 + 1];      /* name of file */
    44         };
    45 
    46 typedef struct
    47         {
    48         int     dd_fd;                  /* file descriptor */
    49         int     dd_loc;                 /* offset in block */
    50         int     dd_size;                /* amount of valid data */
    51         char    dd_buf[DIRBLKSIZ];      /* directory block */
    52         }       DIR;                    /* stream data from opendir() */
    53 
    54 extern DIR              *opendir (const char *);
    55 extern struct dirent    *readdir (DIR *);
    56 extern void             seekdir (DIR *, long);
    57 extern void             closedir (DIR *);
    58 
    59 #define rewinddir( dirp )       seekdir( dirp, 0L )

/* [<][>][^][v][top][bottom][index][help] */