home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / DIRENT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  2.6 KB  |  119 lines

  1. /*  dirent.h
  2.  
  3.     Definitions for POSIX directory operations.
  4.  
  5. */
  6.  
  7. /* $Copyright: 1991$ */
  8. /* $Revision:   8.1  $ */
  9.  
  10. #ifndef __DIRENT_H
  11. #define __DIRENT_H
  12.  
  13. #if !defined(___DEFS_H)
  14. #include <_defs.h>
  15. #endif
  16.  
  17. #ifndef NULL
  18. #include <_null.h>
  19. #endif
  20.  
  21. #if defined(__WIN32__)
  22. #include <windows.h>  /* For WIN32_FIND_DATA */
  23. #endif
  24.  
  25.  
  26. #if !defined(RC_INVOKED)
  27.  
  28. #if defined(__STDC__)
  29. #pragma warn -nak
  30. #endif
  31.  
  32. #pragma pack(push, 1)
  33.  
  34. #endif  /* !RC_INVOKED */
  35.  
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41.  
  42. /* dirent structure returned by readdir().
  43.  */
  44. struct dirent
  45. {
  46. #if defined(__OS2__)
  47.     char        d_name[256];
  48. #elif defined(__WIN32__) || defined(__DPMI32__)
  49.     char        d_name[260];
  50. #else
  51.     char        d_name[13];
  52. #endif
  53. };
  54.  
  55. #if !defined(__FLAT__)
  56.  
  57. /* _DIR type returned by _opendir().  The first two members cannot
  58.  * be separated, because they make up the DOS DTA structure used
  59.  * by _findfirst() and _findnext().
  60.  */
  61. typedef struct
  62. {
  63.     char           _d_reserved[30];      /* reserved part of DTA */
  64.     struct dirent  _d_dirent;            /* filename part of DTA */
  65.     char    _FAR  *_d_dirname;           /* directory name */
  66.     char           _d_first;             /* first file flag */
  67.     unsigned char  _d_magic;             /* magic cookie for verifying handle */
  68. } DIR;
  69.  
  70. #else    /* defined __FLAT__ */
  71.  
  72.  
  73. /* DIR type returned by opendir().  The members of this structure
  74.  * must not be accessed by application programs.
  75.  */
  76. typedef struct
  77. {
  78.     unsigned long _d_hdir;              /* directory handle */
  79.     char         *_d_dirname;           /* directory name */
  80.     unsigned      _d_magic;             /* magic cookie for verifying handle */
  81.     unsigned      _d_nfiles;            /* no. of files remaining in buf */
  82. #if defined(__OS2__)
  83.     char         *_d_bufp;              /* next entry in buffer */
  84.     char          _d_buf[512];          /* buffer for found filenames */
  85. #endif
  86. #if defined(__WIN32__)
  87.     char          _d_buf[sizeof(WIN32_FIND_DATA)];  /* buffer for a single file */
  88. #endif
  89. } DIR;
  90.  
  91. #endif  /* __FLAT__ */
  92.  
  93. /* Prototypes.
  94.  */
  95. DIR            _FAR * _RTLENTRY _EXPFUNC opendir  (const char _FAR *__dirname);
  96. struct dirent  _FAR * _RTLENTRY _EXPFUNC readdir  (DIR _FAR *__dir);
  97. int                   _RTLENTRY _EXPFUNC closedir (DIR _FAR *__dir);
  98. void                  _RTLENTRY _EXPFUNC rewinddir(DIR _FAR *__dir);
  99.  
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103.  
  104.  
  105. #if !defined(RC_INVOKED)
  106.  
  107. /* restore default packing */
  108. #pragma pack(pop)
  109.  
  110. #if defined(__STDC__)
  111. #pragma warn .nak
  112. #endif
  113.  
  114. #endif  /* !RC_INVOKED */
  115.  
  116.  
  117. #endif  /* __DIRENT_H */
  118.  
  119.