ftw.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * This file is part of the mingw-w64 runtime package.
  3. * No warranty is given; refer to the file DISCLAIMER within this package.
  4. */
  5. #ifndef _FTW_HXX
  6. #define _FTW_HXX
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. struct FTW {
  13. int base;
  14. int level;
  15. };
  16. /* A regular file. */
  17. #define FTW_F 0
  18. /* A directory. */
  19. #define FTW_D 1
  20. /* An unreadable directory. */
  21. #define FTW_DNR 2
  22. /* An unstatable file. */
  23. #define FTW_NS 3
  24. /* A symbolic link (not supported). */
  25. #define FTW_SL 4
  26. /* A directory (all subdirs are visited). */
  27. #define FTW_DP 5
  28. /* A symbolic link naming non-existing file (not supported). */
  29. #define FTW_SLN 6
  30. /* Do a physical walk (ignore symlinks). */
  31. #define FTW_PHYS 1
  32. /* Do report only files on same device as the argument (partial supported). */
  33. #define FTW_MOUNT 2
  34. /* Change to current directory while processing (unsupported). */
  35. #define FTW_CHDIR 4
  36. /* Do report files in directory before the directory itself.*/
  37. #define FTW_DEPTH 8
  38. /* Tell callback to return FTW_* values instead of zero to continue and non-zero to terminate. */
  39. #define FTW_ACTIONRETVAL 16
  40. /* Continue with next sibling or with the first child-directory. */
  41. #define FTW_CONTINUE 0
  42. /* Return from ftw or nftw with FTW_STOP as return value. */
  43. #define FTW_STOP 1
  44. /* Valid only for FTW_D: Don't walk through the subtree. */
  45. #define FTW_SKIP_SUBTREE 2
  46. /* Continue with FTW_DP callback for current directory (if FTW_DEPTH) and then its siblings. */
  47. #define FTW_SKIP_SIBLINGS 3
  48. int ftw (const char *, int (*) (const char *, const struct stat *, int), int);
  49. int ftw64 (const char *, int (*) (const char *, const struct stat64 *, int), int);
  50. int nftw (const char *, int (*) (const char *, const struct stat *, int , struct FTW *), int, int);
  51. int nftw64 (const char *, int (*) (const char *, const struct stat64 *, int , struct FTW *), int, int);
  52. #ifdef __cplusplus
  53. }
  54. #endif
  55. #endif