home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / sys / Dirent.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  1.6 KB  |  71 lines

  1. /* Copyright (C) 1986-1994 by Digital Mars. $Revision: 1.1.1.1 $ */
  2.  
  3. #if __SC__ || __RCC__
  4. #pragma once
  5. #endif
  6.  
  7. #ifndef __SYS_DIRENT_H
  8. #define __SYS_DIRENT_H 1
  9.  
  10. #if __cplusplus
  11. extern "C"
  12. {
  13. #endif
  14.  
  15. #if __OS2__ && __INTSIZE == 4
  16. #define __CLIB    __stdcall
  17. #else
  18. #define __CLIB    __cdecl
  19. #endif
  20.  
  21. #if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
  22. #define MAXNAMLEN    512        /* maximum filename length */
  23. #define DIRBUF        2048        /* buffer size for fs-indep. dirs */
  24. #endif
  25.  
  26. #include <sys/types.h>
  27.  
  28. typedef struct    /* #ifdefs protect opaque type's members */
  29.     {
  30.     int        dd_fd;        /* file descriptor */
  31.     int        dd_loc;        /* location offset in block */
  32.     int        dd_size;    /* amount of valid data */
  33.     char        *dd_buf;    /* directory block */
  34.     } DIR;            /* stream data from opendir() */
  35.  
  36. DIR * __CLIB opendir(const char *);
  37. struct dirent * __CLIB readdir(DIR *);
  38.  
  39. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
  40. long __CLIB telldir(DIR *);
  41. void __CLIB seekdir(DIR *,long);
  42. #endif 
  43.  
  44. void __CLIB rewinddir(DIR *);
  45. int __CLIB closedir(DIR *);
  46.  
  47. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
  48. #define rewinddir(dirp)    seekdir(dirp,0L)
  49. #endif
  50.  
  51. /* File-system independent directory entry. */
  52. struct dirent {
  53.     ino_t        d_ino;        /* "inode number" of entry */
  54.     off_t        d_off;        /* offset of disk directory entry */
  55.     unsigned short    d_reclen;    /* length of this record */
  56.     char        d_name[1];    /* name of file */
  57. };
  58.  
  59. typedef    struct    dirent    dirent_t;
  60.  
  61. #if !defined(_POSIX_SOURCE)
  62. int __CLIB getdents(int, struct dirent *, unsigned);
  63. #endif 
  64.  
  65. #if __cplusplus
  66. }
  67. #endif
  68.  
  69. #endif
  70.  
  71.