fs.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /** \file fs.h
  2. * \brief Header: fs compatibility definitions
  3. */
  4. /* Include file to use opendir/closedir/readdir */
  5. #ifndef MC_FS_H
  6. #define MC_FS_H
  7. #include <sys/types.h>
  8. #include <unistd.h>
  9. #include <sys/stat.h>
  10. /* Replacement for permission bits missing in sys/stat.h */
  11. #ifndef S_ISLNK
  12. # define S_ISLNK(x) 0
  13. #endif
  14. #ifndef S_ISSOCK
  15. # define S_ISSOCK(x) 0
  16. #endif
  17. #ifndef S_ISFIFO
  18. # define S_ISFIFO(x) 0
  19. #endif
  20. #ifndef S_ISCHR
  21. # define S_ISCHR(x) 0
  22. #endif
  23. #ifndef S_ISBLK
  24. # define S_ISBLK(x) 0
  25. #endif
  26. /* Door is something that only exists on Solaris */
  27. #ifndef S_ISDOOR
  28. # define S_ISDOOR(x) 0
  29. #endif
  30. /* Special named files are widely used in QNX6 */
  31. #ifndef S_ISNAM
  32. # define S_ISNAM(x) 0
  33. #endif
  34. #ifndef MAXPATHLEN
  35. # define MC_MAXPATHLEN 4096
  36. #else
  37. # define MC_MAXPATHLEN MAXPATHLEN
  38. #endif
  39. /* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
  40. #include <dirent.h>
  41. #define NLENGTH(dirent) (strlen ((dirent)->d_name))
  42. #define DIRENT_LENGTH_COMPUTED 1
  43. static inline void
  44. compute_namelen (struct dirent *dent __attribute__ ((unused)))
  45. {
  46. #ifdef DIRENT_LENGTH_COMPUTED
  47. return;
  48. #else
  49. dent->d_namlen = strlen (dent);
  50. #endif
  51. }
  52. #endif