home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 18 / CD_ASCQ_18_111294_W.iso / dos / prg / c / ms_sh23 / emxinc / dirent.h
C/C++ Source or Header  |  1994-05-31  |  4KB  |  151 lines

  1. /*
  2.  * dirent.h:  definitions for SVR3 directory access routines
  3.  */
  4.  
  5. #ifndef _DIRENT_H
  6. #  define _DIRENT_H
  7.  
  8. #  include <sys/types.h>
  9. #  include <sys/dirent.h>
  10.  
  11. #  define _CDECL
  12. #  define _FAR_
  13.  
  14. #  if defined (MSDOS) && !defined (WIN32)
  15. #    ifndef __STDC__
  16. #      define __STDC__    1
  17. #    endif
  18.  
  19. #    ifndef __WATCOMC__
  20. #      undef _CDECL
  21. #      define _CDECL    cdecl
  22. #    endif
  23. #  endif
  24.  
  25. #  if defined (WIN32)
  26. #    undef _CDECL
  27. #    define _CDECL    __cdecl
  28. #  endif
  29.  
  30. #  ifdef __TURBOC__
  31. #    undef _CDECL
  32. #    define _CDECL    _Cdecl
  33. #  endif
  34.  
  35.  
  36. /* Need size_t definition */
  37.  
  38. #  if !defined(_SIZE_T_DEFINED) && !defined(__size_t) && !defined(_SIZE_T) && !defined(_SIZE_T_DEFINED_) 
  39.  
  40. typedef unsigned int    size_t;
  41.  
  42. #    define _SIZE_T_DEFINED
  43. #    define _SIZE_T_DEFINED_
  44. #    define _SIZE_T
  45. #    define __size_t
  46. #  endif
  47.  
  48. #  ifndef _BOOL_T_DEFINED
  49. typedef unsigned char    bool;
  50. #  define _BOOL_T_DEFINED
  51. #  endif
  52.  
  53. #  if defined (OS2) || defined (__OS2__) || defined (__EMX__)
  54. #    undef NAME_MAX
  55. #    undef PATH_MAX
  56. #    define NAME_MAX    256        /* Maximum file name length    */
  57. #    define PATH_MAX    256        /* Maximum path name length    */
  58. #  elif defined (WIN32)
  59. #    undef NAME_MAX
  60. #    undef PATH_MAX
  61. #    define PATH_MAX    260        /* max. length of full pathname */
  62. #    define NAME_MAX    256        /* max. length of file name component */
  63. #  elif defined (MSDOS)
  64. #    define NAME_MAX    13        /* Maximum file name length    */
  65. #    ifndef PATH_MAX
  66. #      define PATH_MAX    128        /* Maximum path name length    */
  67. #    endif
  68. #  else
  69. #    undef NAME_MAX
  70. #    undef PATH_MAX
  71. #    define NAME_MAX    256        /* Maximum file name length    */
  72. #    define PATH_MAX    1024        /* Maximum path name length    */
  73. #  endif
  74.  
  75.  
  76. #  define DIRBUF    8192    /* buffer size for fs-indep. dirs    */
  77.                 /* must in general be larger than the    */
  78.                 /* filesystem buffer size        */
  79.  
  80. #  if defined (MSDOS) || defined (__OS2__) || defined (__TURBOC__) || defined (WIN32) || defined (__EMX__)
  81.  
  82. /* MSDOS versions and OS2 ?.x version */
  83.  
  84. struct _dircontents {
  85.     char        *_d_entry;
  86.     struct _dircontents    *_d_next;
  87. };
  88.  
  89. typedef struct _dirdesc {
  90.     int            dd_id;    /* uniquely identify each open directory */
  91.     long        dd_loc;    /* where we are in directory entry is this */
  92.     struct _dircontents    *dd_contents;    /* pointer to contents of dir    */
  93.     struct _dircontents    *dd_cp;        /* pointer to current position    */
  94. } DIR;
  95.  
  96. #  else
  97.  
  98. /* UNIX versions */
  99.  
  100. typedef struct
  101. {
  102.     int        dd_fd;        /* file descriptor            */
  103.     int        dd_loc;        /* offset in block            */
  104.     int        dd_size;    /* amount of valid data            */
  105.     char    *dd_buf;    /* -> directory block            */
  106. } DIR;                /* stream data from opendir()        */
  107.  
  108. #  endif
  109.  
  110. /* Functions */
  111.  
  112. extern DIR _FAR_ * _FAR_ _CDECL    opendir    (const char _FAR_ *);
  113. extern struct dirent _FAR_ * _FAR_ _CDECL readdir (DIR _FAR_ *);
  114. extern void _FAR_ _CDECL    rewinddir (DIR _FAR_ *);
  115.  
  116. #  if !defined (MSDOS) && !defined (__OS2__) && !defined (WIN32)
  117. extern int _FAR_ _CDECL        getdents (int, char _FAR_ *, unsigned int);
  118. #  endif
  119.  
  120. extern int _FAR_ _CDECL        closedir (DIR _FAR_ *);
  121. extern void _FAR_ _CDECL    seekdir    (DIR _FAR_ *, off_t);
  122. extern off_t _FAR_ _CDECL    telldir    (DIR _FAR_ *);
  123.  
  124. extern int _FAR_ _CDECL        chdir (const char _FAR_ *);
  125. extern char _FAR_ * _FAR_ _CDECL getcwd (char _FAR_ *, size_t);
  126.  
  127. #  ifdef __TURBOC__
  128. extern int _FAR_ _CDECL        mkdir (const char _FAR_ *);
  129. #  elif defined (__32BIT__) && defined (__EMX__)
  130. extern int _FAR_ _CDECL        mkdir (const char _FAR_ *, long);
  131. #  else
  132. extern int _FAR_ _CDECL        mkdir (const char _FAR_ *, mode_t);
  133. #  endif
  134.  
  135. extern int _FAR_ _CDECL        rmdir (const char _FAR_ *);
  136. extern int _FAR_ _CDECL        scandir (char _FAR_ *,
  137.                      struct dirent ***,
  138.                      int (_FAR_ _CDECL *)(const void _FAR_ *, const void _FAR_ *),
  139.                      int (_FAR_ _CDECL *)(const void _FAR_ *, const void _FAR_ *));
  140.  
  141. #  if defined (MSDOS) || defined (__OS2__) || defined (WIN32)
  142. extern int _FAR_ _CDECL        _chdrive (int);
  143. extern int _FAR_ _CDECL        _getdrive (void);
  144. extern char _FAR_ * _FAR_ _CDECL _getdcwd (int, char _FAR_ *, int);
  145. #  endif
  146.  
  147. #  if defined (OS2) || defined (__OS2__) || defined (WIN32) || defined (__EMX__)
  148. extern bool            IsHPFSFileSystem (char _FAR_ *);
  149. #  endif
  150. #endif
  151.