home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / winnt / dirent.h < prev    next >
C/C++ Source or Header  |  1995-12-11  |  2KB  |  97 lines

  1. /*
  2.  * dirent.h
  3.  */
  4.  
  5. #ifndef _DIRENT_H
  6. #  define _DIRENT_H
  7.  
  8. #  include <sys/types.h>
  9. #  include <limits.h>
  10.  
  11. #define MAXNAMLEN    255    /* maximum filename length        */
  12.  
  13. #ifndef NAME_MAX
  14. #define    NAME_MAX    (MAXNAMLEN - 1)
  15. #endif
  16.  
  17. struct dirent            /* data from getdents()/readdir()    */
  18. {
  19.     ino_t    d_ino;        /* inode number of entry        */
  20.     off_t    d_off;        /* offset of disk directory entry    */
  21.     wchar_t    d_reclen;    /* length of this record        */
  22.     char    d_name[MAXNAMLEN + 1];
  23. };
  24.  
  25.  
  26. /* The following nonportable ugliness could have been avoided by defining
  27.  * DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
  28.  * There shouldn't be any problem if you avoid using the DIRENTSIZ() macro.
  29.  */
  30.  
  31. #define    DIRENTBASESIZ        (((struct dirent *)0)->d_name \
  32.                 - (char *)&((struct dirent *)0)->d_ino)
  33.  
  34. #define    DIRENTSIZ(namlen)    ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
  35.                 / sizeof(long) * sizeof(long))
  36.  
  37.  
  38.  
  39. #  ifndef _BOOL_T_DEFINED
  40. typedef unsigned char    bool;
  41. #  define _BOOL_T_DEFINED
  42. #  endif
  43.  
  44. #  define DIRBUF    8192    /* buffer size for fs-indep. dirs    */
  45.                 /* must in general be larger than the    */
  46.                 /* filesystem buffer size        */
  47.  
  48. struct _dircontents {
  49.     char        *_d_entry;
  50.     struct _dircontents    *_d_next;
  51. };
  52.  
  53. typedef struct _dirdesc {
  54.     int            dd_id;    /* uniquely identify each open directory */
  55.     long        dd_loc;    /* where we are in directory entry is this */
  56.     struct _dircontents    *dd_contents;    /* pointer to contents of dir    */
  57.     struct _dircontents    *dd_cp;        /* pointer to current position    */
  58. } DIR;
  59.  
  60.  
  61. #if defined (__STDC__)
  62. #  define _PROTO(p)    p
  63. #else
  64. #  define _PROTO(p)    ()
  65. #  undef  const
  66. #  undef  volatile
  67. #endif
  68.  
  69. /* Functions */
  70.  
  71. extern DIR *        opendir    _PROTO ((const char *));
  72. extern struct dirent *     readdir _PROTO ((DIR *));
  73. extern void        rewinddir _PROTO ((DIR *));
  74.  
  75. extern int        closedir _PROTO ((DIR *));
  76. extern void        seekdir    _PROTO ((DIR *, off_t));
  77. extern off_t        telldir    _PROTO ((DIR *));
  78.  
  79. extern int        chdir _PROTO ((const char *));
  80. extern char *         getcwd _PROTO ((char *, size_t));
  81.  
  82. extern int        mkdir _PROTO ((const char *));
  83.  
  84. extern int        rmdir _PROTO ((const char *));
  85. extern int        scandir _PROTO ((char *,
  86.              struct dirent ***,
  87.              int (*)(const void *, const void *),
  88.              int (*)(const void *, const void *)));
  89.  
  90. extern int        _chdrive _PROTO ((int));
  91. extern int        _getdrive _PROTO ((void));
  92. extern char *         _getdcwd _PROTO ((int, char *, int));
  93.  
  94. extern bool        IsHPFSFileSystem _PROTO ((char *));
  95.  
  96. #endif
  97.