Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
5.3 KiB

  1. /* $NetBSD: fts.h,v 1.5 1994/12/28 01:41:50 mycroft Exp $ */
  2. /*
  3. * Copyright (c) 1989, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. All advertising materials mentioning features or use of this software
  15. * must display the following acknowledgement:
  16. * This product includes software developed by the University of
  17. * California, Berkeley and its contributors.
  18. * 4. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)fts.h 8.3 (Berkeley) 8/14/94
  35. */
  36. #ifndef _FTS_H_
  37. #define _FTS_H_
  38. typedef struct {
  39. struct _ftsent *fts_cur; /* current node */
  40. struct _ftsent *fts_child; /* linked list of children */
  41. struct _ftsent **fts_array; /* sort array */
  42. dev_t fts_dev; /* starting device # */
  43. char *fts_path; /* path for this descent */
  44. int fts_rfd; /* fd for root */
  45. int fts_pathlen; /* sizeof(path) */
  46. int fts_nitems; /* elements in the sort array */
  47. int (*fts_compar)(); /* compare function */
  48. #define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
  49. #define FTS_LOGICAL 0x002 /* logical walk */
  50. #define FTS_NOCHDIR 0x004 /* don't change directories */
  51. #define FTS_NOSTAT 0x008 /* don't get stat info */
  52. #define FTS_PHYSICAL 0x010 /* physical walk */
  53. #define FTS_SEEDOT 0x020 /* return dot and dot-dot */
  54. #define FTS_XDEV 0x040 /* don't cross devices */
  55. #define FTS_WHITEOUT 0x080 /* return whiteout information */
  56. #define FTS_OPTIONMASK 0x0ff /* valid user option mask */
  57. #define FTS_NAMEONLY 0x100 /* (private) child names only */
  58. #define FTS_STOP 0x200 /* (private) unrecoverable error */
  59. int fts_options; /* fts_open options, global flags */
  60. } FTS;
  61. typedef struct _ftsent {
  62. struct _ftsent *fts_cycle; /* cycle node */
  63. struct _ftsent *fts_parent; /* parent directory */
  64. struct _ftsent *fts_link; /* next file in directory */
  65. long fts_number; /* local numeric value */
  66. void *fts_pointer; /* local address value */
  67. char *fts_accpath; /* access path */
  68. char *fts_path; /* root path */
  69. int fts_errno; /* errno for this node */
  70. int fts_symfd; /* fd for symlink */
  71. u_short fts_pathlen; /* strlen(fts_path) */
  72. u_short fts_namelen; /* strlen(fts_name) */
  73. ino_t fts_ino; /* inode */
  74. dev_t fts_dev; /* device */
  75. nlink_t fts_nlink; /* link count */
  76. #define FTS_ROOTPARENTLEVEL -1
  77. #define FTS_ROOTLEVEL 0
  78. short fts_level; /* depth (-1 to N) */
  79. #define FTS_D 1 /* preorder directory */
  80. #define FTS_DC 2 /* directory that causes cycles */
  81. #define FTS_DEFAULT 3 /* none of the above */
  82. #define FTS_DNR 4 /* unreadable directory */
  83. #define FTS_DOT 5 /* dot or dot-dot */
  84. #define FTS_DP 6 /* postorder directory */
  85. #define FTS_ERR 7 /* error; errno is set */
  86. #define FTS_F 8 /* regular file */
  87. #define FTS_INIT 9 /* initialized only */
  88. #define FTS_NS 10 /* stat(2) failed */
  89. #define FTS_NSOK 11 /* no stat(2) requested */
  90. #define FTS_SL 12 /* symbolic link */
  91. #define FTS_SLNONE 13 /* symbolic link without target */
  92. #define FTS_W 14 /* whiteout object */
  93. u_short fts_info; /* user flags for FTSENT structure */
  94. #define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
  95. #define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
  96. #define FTS_ISW 0x04 /* this is a whiteout object */
  97. u_short fts_flags; /* private flags for FTSENT structure */
  98. #define FTS_AGAIN 1 /* read node again */
  99. #define FTS_FOLLOW 2 /* follow symbolic link */
  100. #define FTS_NOINSTR 3 /* no instructions */
  101. #define FTS_SKIP 4 /* discard node */
  102. u_short fts_instr; /* fts_set() instructions */
  103. struct stat *fts_statp; /* stat(2) information */
  104. char fts_name[1]; /* file name */
  105. } FTSENT;
  106. #include <sys/cdefs.h>
  107. __BEGIN_DECLS
  108. FTSENT *fts_children __P((FTS *, int));
  109. int fts_close __P((FTS *));
  110. FTS *fts_open __P((char * const *, int,
  111. int (*)(const FTSENT **, const FTSENT **)));
  112. FTSENT *fts_read __P((FTS *));
  113. int fts_set __P((FTS *, FTSENT *, int));
  114. __END_DECLS
  115. #endif /* !_FTS_H_ */