win32-dirent.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but 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 02110-1301 USA
  19. */
  20. /* Directory stream type.
  21. The miscellaneous Unix `readdir' implementations read directory data
  22. into a buffer and return `struct dirent *' pointers into it. */
  23. #include <sys/types.h>
  24. struct dirstream
  25. {
  26. int fd; /* File descriptor. */
  27. char *data; /* Directory block. */
  28. size_t allocation; /* Space allocated for the block. */
  29. size_t size; /* Total valid data in the block. */
  30. size_t offset; /* Current offset into the block. */
  31. off_t filepos; /* Position of next entry to read. */
  32. char *mask; /* Initial file mask. */
  33. };
  34. struct dirent
  35. {
  36. long d_ino;
  37. off_t d_off;
  38. unsigned short int d_reclen;
  39. unsigned char d_type;
  40. char d_name[256];
  41. };
  42. #define d_fileno d_ino /* Backwards compatibility. */
  43. /* This is the data type of directory stream objects.
  44. The actual structure is opaque to users. */
  45. typedef struct dirstream DIR;
  46. DIR * opendir (const char * name);
  47. struct dirent * readdir (DIR * dir);
  48. int closedir (DIR * dir);
  49. void rewinddir (DIR * dir);
  50. void seekdir (DIR * dir, off_t offset);
  51. off_t telldir (DIR * dir);
  52. int dirfd (DIR * dir);
  53. #endif /* SCM_WIN32_DIRENT_H */