dirent.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __DIRENT_H
  10. #define __DIRENT_H
  11. #pragma lib "/$M/lib/ape/libap.a"
  12. /*
  13. * this must be a power of 2 and a multiple of all the ones in the system
  14. */
  15. #define MAXNAMLEN 255
  16. struct dirent {
  17. char d_name[MAXNAMLEN + 1];
  18. };
  19. typedef struct _dirdesc {
  20. int dd_fd; /* file descriptor */
  21. int32_t dd_loc; /* buf offset of entry from last readdir() */
  22. int32_t dd_size; /* amount of valid data in buffer */
  23. char *dd_buf; /* directory data buffer */
  24. void *dirs;
  25. int dirsize;
  26. int dirloc;
  27. } DIR;
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /*
  32. * functions defined on directories
  33. */
  34. DIR *opendir(const char *);
  35. struct dirent *readdir(DIR *);
  36. void rewinddir(DIR *);
  37. int closedir(DIR *);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif