compat / vcbuild / include / dirent.hon commit Merge branch 'en/rebase-against-rebase-fix' into maint (061219f)
   1/*
   2 * DIRENT.H (formerly DIRLIB.H)
   3 * This file has no copyright assigned and is placed in the Public Domain.
   4 * This file is a part of the mingw-runtime package.
   5 *
   6 * The mingw-runtime package and its code is distributed in the hope that it
   7 * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR
   8 * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to
   9 * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10 *
  11 * You are free to use this package and its code without limitation.
  12 */
  13#ifndef _DIRENT_H_
  14#define _DIRENT_H_
  15#include <io.h>
  16
  17#define PATH_MAX 512
  18
  19#define __MINGW_NOTHROW
  20
  21#ifndef RC_INVOKED
  22
  23#ifdef __cplusplus
  24extern "C" {
  25#endif
  26
  27struct dirent
  28{
  29        long            d_ino;          /* Always zero. */
  30        unsigned short  d_reclen;       /* Always zero. */
  31        unsigned short  d_namlen;       /* Length of name in d_name. */
  32        char            d_name[FILENAME_MAX]; /* File name. */
  33};
  34
  35/*
  36 * This is an internal data structure. Good programmers will not use it
  37 * except as an argument to one of the functions below.
  38 * dd_stat field is now int (was short in older versions).
  39 */
  40typedef struct
  41{
  42        /* disk transfer area for this dir */
  43        struct _finddata_t      dd_dta;
  44
  45        /* dirent struct to return from dir (NOTE: this makes this thread
  46         * safe as long as only one thread uses a particular DIR struct at
  47         * a time) */
  48        struct dirent           dd_dir;
  49
  50        /* _findnext handle */
  51        long                    dd_handle;
  52
  53        /*
  54         * Status of search:
  55         *   0 = not started yet (next entry to read is first entry)
  56         *  -1 = off the end
  57         *   positive = 0 based index of next entry
  58         */
  59        int                     dd_stat;
  60
  61        /* given path for dir with search pattern (struct is extended) */
  62        char                    dd_name[PATH_MAX+3];
  63} DIR;
  64
  65DIR* __cdecl __MINGW_NOTHROW opendir (const char*);
  66struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);
  67int __cdecl __MINGW_NOTHROW closedir (DIR*);
  68void __cdecl __MINGW_NOTHROW rewinddir (DIR*);
  69long __cdecl __MINGW_NOTHROW telldir (DIR*);
  70void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);
  71
  72
  73/* wide char versions */
  74
  75struct _wdirent
  76{
  77        long            d_ino;          /* Always zero. */
  78        unsigned short  d_reclen;       /* Always zero. */
  79        unsigned short  d_namlen;       /* Length of name in d_name. */
  80        wchar_t         d_name[FILENAME_MAX]; /* File name. */
  81};
  82
  83/*
  84 * This is an internal data structure. Good programmers will not use it
  85 * except as an argument to one of the functions below.
  86 */
  87typedef struct
  88{
  89        /* disk transfer area for this dir */
  90        //struct _wfinddata_t   dd_dta;
  91
  92        /* dirent struct to return from dir (NOTE: this makes this thread
  93         * safe as long as only one thread uses a particular DIR struct at
  94         * a time) */
  95        struct _wdirent         dd_dir;
  96
  97        /* _findnext handle */
  98        long                    dd_handle;
  99
 100        /*
 101         * Status of search:
 102         *   0 = not started yet (next entry to read is first entry)
 103         *  -1 = off the end
 104         *   positive = 0 based index of next entry
 105         */
 106        int                     dd_stat;
 107
 108        /* given path for dir with search pattern (struct is extended) */
 109        wchar_t                 dd_name[1];
 110} _WDIR;
 111
 112
 113
 114_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);
 115struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);
 116int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);
 117void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);
 118long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);
 119void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);
 120
 121
 122#ifdef  __cplusplus
 123}
 124#endif
 125
 126#endif  /* Not RC_INVOKED */
 127
 128#endif  /* Not _DIRENT_H_ */