home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / OS2 / MAN11A.ZIP / src / include / dirent.h next >
C/C++ Source or Header  |  1993-12-01  |  3KB  |  102 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 <limits.h>
  10. #include <sys/dirent.h>
  11. #include <sys/proto.h>
  12. #include <sys/null.h>
  13.  
  14. /* Need size_t definition */
  15.  
  16. #if !defined(_SIZE_T_DEFINED) && !defined(__size_t) && !defined(_SIZE_T) && !defined(_SIZE_T_DEFINED_) 
  17.  
  18. typedef unsigned int    size_t;
  19.  
  20. #  define _SIZE_T_DEFINED
  21. #  define _SIZE_T_DEFINED_
  22. #  define _SIZE_T
  23. #  define __size_t
  24. #endif
  25.  
  26. #ifndef _BOOL_T_DEFINED
  27. typedef unsigned char    bool;
  28. #define _BOOL_T_DEFINED
  29. #endif
  30.  
  31. #define    DIRBUF    8192        /* buffer size for fs-indep. dirs    */
  32.                 /* must in general be larger than the    */
  33.                 /* filesystem buffer size        */
  34.  
  35. #if defined (MSDOS) || defined (__OS2__) || defined (__TURBOC__)
  36.  
  37. /* MSDOS versions and OS2 ?.x version */
  38.  
  39. struct _dircontents {
  40.     char        *_d_entry;
  41.     struct _dircontents    *_d_next;
  42. };
  43.  
  44. typedef struct _dirdesc {
  45.     int            dd_id;    /* uniquely identify each open directory */
  46.     long        dd_loc;    /* where we are in directory entry is this */
  47.     struct _dircontents    *dd_contents;    /* pointer to contents of dir    */
  48.     struct _dircontents    *dd_cp;        /* pointer to current position    */
  49. } DIR;
  50.  
  51. #else
  52.  
  53. /* UNIX versions */
  54.  
  55. typedef struct
  56. {
  57.     int        dd_fd;        /* file descriptor            */
  58.     int        dd_loc;        /* offset in block            */
  59.     int        dd_size;    /* amount of valid data            */
  60.     char    *dd_buf;    /* -> directory block            */
  61. } DIR;                /* stream data from opendir()        */
  62.  
  63. #endif
  64.  
  65. /* Functions */
  66.  
  67. extern DIR _FAR_ * _FAR_ _CDECL    opendir    _PROTO ((const char _FAR_ *));
  68. extern struct dirent _FAR_ * _FAR_ _CDECL readdir _PROTO ((DIR _FAR_ *));
  69. extern void _FAR_ _CDECL    rewinddir _PROTO ((DIR _FAR_ *));
  70.  
  71. #  if !defined (MSDOS) && !defined (__OS2__)
  72. extern int _FAR_ _CDECL        getdents _PROTO ((int, char _FAR_ *,
  73.                           unsigned int));
  74. #  endif
  75.  
  76. extern int _FAR_ _CDECL        closedir _PROTO ((DIR _FAR_ *));
  77. extern void _FAR_ _CDECL    seekdir    _PROTO ((DIR _FAR_ *, off_t));
  78. extern off_t _FAR_ _CDECL    telldir    _PROTO ((DIR _FAR_ *));
  79.  
  80. extern int _FAR_ _CDECL        chdir _PROTO ((const char _FAR_ *));
  81. extern char _FAR_ * _FAR_ _CDECL getcwd _PROTO ((char _FAR_ *, int));
  82. #ifdef __TURBOC__
  83. extern int _FAR_ _CDECL        mkdir _PROTO ((const char _FAR_ *));
  84. #else
  85. extern int _FAR_ _CDECL        mkdir _PROTO ((const char _FAR_ *, mode_t));
  86. #endif
  87. extern int _FAR_ _CDECL        rmdir _PROTO ((const char _FAR_ *));
  88. extern int _FAR_ _CDECL        scandir _PROTO ((char _FAR_ *,
  89.                          struct dirent ***,
  90.                          int (_FAR_ _CDECL *)(const void _FAR_ *, const void _FAR_ *),
  91.                          int (_FAR_ _CDECL *)(const void _FAR_ *, const void _FAR_ *)));
  92.  
  93. #  if defined (MSDOS) || defined (__OS2__)
  94. extern int _FAR_ _CDECL        _chdrive _PROTO ((int));
  95. extern int _FAR_ _CDECL        _getdrive _PROTO ((void));
  96. extern char _FAR_ * _FAR_ _CDECL _getdcwd _PROTO ((int, char _FAR_ *, int));
  97. #    if defined (OS2) || defined (__OS2__)
  98. extern bool            IsHPFSFileSystem _PROTO ((char _FAR_ *));
  99. #    endif
  100. #  endif
  101. #endif
  102.