win32-dirent.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* classes: h_files */
  2. #ifndef SCM_WIN32_DIRENT_H
  3. #define SCM_WIN32_DIRENT_H
  4. /* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. */
  21. /* Directory stream type.
  22. The miscellaneous Unix `readdir' implementations read directory data
  23. into a buffer and return `struct dirent *' pointers into it. */
  24. #include <sys/types.h>
  25. struct dirstream
  26. {
  27. int fd; /* File descriptor. */
  28. char *data; /* Directory block. */
  29. size_t allocation; /* Space allocated for the block. */
  30. size_t size; /* Total valid data in the block. */
  31. size_t offset; /* Current offset into the block. */
  32. off_t filepos; /* Position of next entry to read. */
  33. char *mask; /* Initial file mask. */
  34. };
  35. struct dirent
  36. {
  37. long d_ino;
  38. off_t d_off;
  39. unsigned short int d_reclen;
  40. unsigned char d_type;
  41. char d_name[256];
  42. };
  43. #define d_fileno d_ino /* Backwards compatibility. */
  44. /* This is the data type of directory stream objects.
  45. The actual structure is opaque to users. */
  46. typedef struct dirstream DIR;
  47. DIR * opendir (const char * name);
  48. struct dirent * readdir (DIR * dir);
  49. int closedir (DIR * dir);
  50. void rewinddir (DIR * dir);
  51. void seekdir (DIR * dir, off_t offset);
  52. off_t telldir (DIR * dir);
  53. int dirfd (DIR * dir);
  54. #endif /* SCM_WIN32_DIRENT_H */