fts.h File Reference
`#include <sys/types.h>`
`#include <sys/stat.h>`
`#include <dirent.h>`
Include dependency graph for fts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | FTS
struct | _ftsent

## Macros

#define | __THROW
#define | FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
#define | FTS_LOGICAL 0x0002 /* logical walk */
#define | FTS_NOCHDIR 0x0004 /* don't change directories */
#define | FTS_NOSTAT 0x0008 /* don't get stat info */
#define | FTS_PHYSICAL 0x0010 /* physical walk */
#define | FTS_SEEDOT 0x0020 /* return dot and dot-dot */
#define | FTS_XDEV 0x0040 /* don't cross devices */
#define | FTS_WHITEOUT 0x0080 /* return whiteout information */
#define | FTS_OPTIONMASK 0x00ff /* valid user option mask */
#define | FTS_NAMEONLY 0x0100 /* (private) child names only */
#define | FTS_STOP 0x0200 /* (private) unrecoverable error */
#define | FTS_ROOTPARENTLEVEL -1
#define | FTS_ROOTLEVEL 0
#define | FTS_D 1 /* preorder directory */
#define | FTS_DC 2 /* directory that causes cycles */
#define | FTS_DEFAULT 3 /* none of the above */
#define | FTS_DNR 4 /* unreadable directory */
#define | FTS_DOT 5 /* dot or dot-dot */
#define | FTS_DP 6 /* postorder directory */
#define | FTS_ERR 7 /* error; errno is set */
#define | FTS_F 8 /* regular file */
#define | FTS_INIT 9 /* initialized only */
#define | FTS_NS 10 /* stat(2) failed */
#define | FTS_NSOK 11 /* no stat(2) requested */
#define | FTS_SL 12 /* symbolic link */
#define | FTS_SLNONE 13 /* symbolic link without target */
#define | FTS_W 14 /* whiteout object */
#define | FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
#define | FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
#define | FTS_AGAIN 1 /* read node again */
#define | FTS_FOLLOW 2 /* follow symbolic link */
#define | FTS_NOINSTR 3 /* no instructions */
#define | FTS_SKIP 4 /* discard node */

## Typedefs

typedef struct _ftsent | FTSENT

## Functions

FTSENT * | Fts_children (FTS *sp, int instr)
| Return list of children of the current node. More...
int | Fts_close (FTS *sp)
| Destroy a file hierarchy traversal handle. More...
FTS * | Fts_open (char *const *argv, int options, int(*compar)(const FTSENT **, const FTSENT **))
| Create a handle for file hierarchy traversal. More...
FTSENT * | Fts_read (FTS *sp)
| Return next node in the file hierarchy traversal. More...
int | Fts_set (FTS *sp, FTSENT *p, int instr)
| Modify the traversal for a file set member. More...

## Variables

int | _fts_debug

## Macro Definition Documentation

#define __THROW

Definition at line 38 of file fts.h.

#define FTS_AGAIN 1 /* read node again */

Definition at line 149 of file fts.h.

Referenced by Fts_read(), Fts_set(), and rpmfts_new().

#define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */

Definition at line 87 of file fts.h.

Referenced by Fts_open(), main(), mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmcliWalkFirst(), rpmfts_initialize(), rpmfts_new(), and rpmReSign().

#define FTS_D 1 /* preorder directory */

Definition at line 129 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), Fts_children(), Fts_open(), Fts_read(), fts_stat(), mtreeCWalk(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DC 2 /* directory that causes cycles */

Definition at line 130 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), fts_stat(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DEFAULT 3 /* none of the above */

Definition at line 131 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_stat(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DNR 4 /* unreadable directory */

Definition at line 132 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */

Definition at line 145 of file fts.h.

Referenced by fts_build(), Fts_read(), and rpmfts_new().

#define FTS_DOT 5 /* dot or dot-dot */

Definition at line 133 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), Fts_open(), fts_stat(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DP 6 /* postorder directory */

Definition at line 134 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), Fts_read(), mtreeCWalk(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_initialize(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_ERR 7 /* error; errno is set */

Definition at line 135 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), Fts_read(), mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_F 8 /* regular file */

Definition at line 136 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_stat(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_FOLLOW 2 /* follow symbolic link */

Definition at line 150 of file fts.h.

Referenced by Fts_read(), Fts_set(), and rpmfts_new().

#define FTS_INIT 9 /* initialized only */

Definition at line 137 of file fts.h.

Referenced by cacheWalkPathFilter(), Fts_children(), Fts_open(), recurseDir(), rpmcliWalkFirst(), and rpmgiWalkPathFilter().

#define FTS_LOGICAL 0x0002 /* logical walk */

Definition at line 88 of file fts.h.

Referenced by Fts_open(), fts_stat(), main(), mtreeArgCallback(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmcliWalkFirst(), rpmfts_initialize(), rpmfts_new(), and rpmReSign().

#define FTS_NAMEONLY 0x0100 /* (private) child names only */

Definition at line 97 of file fts.h.

Referenced by Fts_children(), Fts_read(), and rpmfts_new().

#define FTS_NOCHDIR 0x0004 /* don't change directories */

Definition at line 89 of file fts.h.

Referenced by fts_build(), Fts_children(), Fts_close(), Fts_open(), Fts_read(), fts_safe_changedir(), main(), mtreeCWalk(), mtreeVWalk(), recurseDir(), and rpmfts_new().

#define FTS_NOINSTR 3 /* no instructions */

Definition at line 151 of file fts.h.

Referenced by fts_alloc(), Fts_read(), Fts_set(), and rpmfts_new().

#define FTS_NOSTAT 0x0008 /* don't get stat info */

Definition at line 90 of file fts.h.

Referenced by fts_alloc(), fts_build(), fts_stat(), main(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmcliWalkFirst(), rpmfts_initialize(), rpmfts_new(), and rpmReSign().

#define FTS_NS 10 /* stat(2) failed */

Definition at line 138 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), fts_stat(), mtreeCWalk(), mtreeVWalk(), recurseDir(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_NSOK 11 /* no stat(2) requested */

Definition at line 139 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_build(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_OPTIONMASK 0x00ff /* valid user option mask */

Definition at line 95 of file fts.h.

Referenced by Fts_open(), and rpmfts_new().

#define FTS_PHYSICAL 0x0010 /* physical walk */

Definition at line 91 of file fts.h.

Referenced by fts_build(), main(), mtreeArgCallback(), recurseDir(), and rpmfts_new().

#define FTS_ROOTLEVEL 0

Definition at line 126 of file fts.h.

Referenced by fts_build(), Fts_children(), Fts_close(), Fts_open(), fts_padjust(), Fts_read(), fts_stat(), and rpmfts_new().

#define FTS_ROOTPARENTLEVEL -1

Definition at line 125 of file fts.h.

Referenced by Fts_open(), Fts_read(), and rpmfts_new().

#define FTS_SEEDOT 0x0020 /* return dot and dot-dot */

Definition at line 92 of file fts.h.

Referenced by fts_build(), and rpmfts_new().

#define FTS_SKIP 4 /* discard node */

Definition at line 152 of file fts.h.

Referenced by cacheWalkPathFilter(), Fts_read(), Fts_set(), mtreeCWalk(), mtreeVWalk(), rpmcliWalkFirst(), rpmdcCWalk(), and rpmfts_new().

#define FTS_SL 12 /* symbolic link */

Definition at line 140 of file fts.h.

Referenced by cacheWalkPathFilter(), Fts_read(), fts_stat(), mtreeVisitF(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_SLNONE 13 /* symbolic link without target */

Definition at line 141 of file fts.h.

Referenced by cacheWalkPathFilter(), Fts_read(), fts_stat(), mtreeVisitF(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_STOP 0x0200 /* (private) unrecoverable error */

Definition at line 98 of file fts.h.

Referenced by fts_build(), Fts_children(), Fts_read(), and rpmfts_new().

#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */

Definition at line 146 of file fts.h.

Referenced by Fts_read(), and rpmfts_new().

#define FTS_W 14 /* whiteout object */

Definition at line 142 of file fts.h.

Referenced by cacheWalkPathFilter(), fts_stat(), recurseDir(), rpmcliWalkFirst(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_WHITEOUT 0x0080 /* return whiteout information */

Definition at line 94 of file fts.h.

Referenced by fts_build(), and rpmfts_new().

#define FTS_XDEV 0x0040 /* don't cross devices */

Definition at line 93 of file fts.h.

Referenced by Fts_read(), and rpmfts_new().

## Typedef Documentation

typedef struct _ftsent FTSENT

## Function Documentation

FTSENT* Fts_children | ( | FTS * | sp,
|  | int | instr
| ) |  |

Return list of children of the current node.

Parameters

  sp | file hierarchy state
  instr |

Returns
  file set member

Definition at line 651 of file fts.c.

References __close, __fchdir, __open, __set_errno, _fts_debug, BCHILD, BNAMES, _ftsent::fts_accpath, fts_build(), FTS::fts_child, FTS::fts_cur, FTS_D, _ftsent::fts_info, FTS_INIT, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_NAMEONLY, FTS_NOCHDIR, FTS_ROOTLEVEL, FTS_STOP, ISSET, and SET.

Referenced by mtreeVisitD(), and rpmfts_Children().

int Fts_close | ( | FTS * | sp | ) |

Destroy a file hierarchy traversal handle.

Parameters

  sp | file hierarchy state

Returns
  0 on sucess, -1 on error

Definition at line 375 of file fts.c.

References __close, __fchdir, __set_errno, _fts_debug, errno, FTS::fts_array, FTS::fts_child, FTS::fts_cur, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_NOCHDIR, _ftsent::fts_parent, FTS::fts_path, FTS::fts_rfd, FTS_ROOTLEVEL, and ISSET.

Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_state(), rpmgiFini(), and rpmgiNext().

FTS* Fts_open | ( | char *const * | argv,
|  | int | options,
|  | int(*)(const FTSENT **, const FTSENT **) | compar
| ) |  |

Create a handle for file hierarchy traversal.

Parameters

  argv | paths that compose a logical file hierarchy
  options | traversal options
  compar | traversal ordering (or NULL)

Returns
  file hierarchy state (or NULL on error)

Definition at line 203 of file fts.c.

References __open, __set_errno, _fts_debug, Closedir(), _ftsent::fts_accpath, fts_alloc(), FTS::fts_closedir, FTS_COMFOLLOW, FTS::fts_compar, FTS::fts_cur, FTS_D, FTS_DOT, _ftsent::fts_info, FTS_INIT, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, FTS_LOGICAL, FTS::fts_lstat, fts_maxarglen(), _ftsent::fts_name, FTS_NOCHDIR, FTS::fts_opendir, FTS_OPTIONMASK, FTS::fts_options, fts_palloc(), _ftsent::fts_parent, FTS::fts_path, FTS::fts_readdir, FTS::fts_rfd, FTS_ROOTLEVEL, FTS_ROOTPARENTLEVEL, fts_sort(), FTS::fts_stat, fts_stat(), ISSET, Lstat(), MAXPATHLEN, nitems, Opendir(), Readdir(), SET, Stat(), URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlIsURL().

Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_state(), and rpmgiNext().

FTSENT* Fts_read | ( | FTS * | sp | ) |

Return next node in the file hierarchy traversal.

Parameters

  sp | file hierarchy state

Returns
  file set member

Definition at line 435 of file fts.c.

References __close, __open, __set_errno, _fts_debug, BREAD, CLR, errno, FCHDIR, _ftsent::fts_accpath, FTS_AGAIN, fts_build(), FTS::fts_child, FTS::fts_cur, FTS_D, FTS::fts_dev, _ftsent::fts_dev, FTS_DONTCHDIR, FTS_DP, FTS_ERR, _ftsent::fts_errno, _ftsent::fts_flags, FTS_FOLLOW, _ftsent::fts_info, _ftsent::fts_instr, _ftsent::fts_level, fts_lfree(), _ftsent::fts_link, fts_load(), _ftsent::fts_name, _ftsent::fts_namelen, FTS_NAMEONLY, FTS_NOCHDIR, FTS_NOINSTR, _ftsent::fts_parent, FTS::fts_path, _ftsent::fts_pathlen, FTS::fts_rfd, FTS_ROOTLEVEL, FTS_ROOTPARENTLEVEL, fts_safe_changedir(), FTS_SKIP, FTS_SL, FTS_SLNONE, fts_stat(), FTS_STOP, _ftsent::fts_symfd, FTS_SYMFOLLOW, FTS_XDEV, ISSET, name, NAPPEND, and SET.

Referenced by mtreeCWalk(), mtreeVWalk(), recurseDir(), repoGetFileList(), rpmcliWalkFirst(), rpmdcCWalk(), rpmfts_step(), and rpmgiWalkReadHeader().

int Fts_set | ( | FTS * | sp,
|  | FTSENT * | p,
|  | int | instr
| ) |  |

Modify the traversal for a file set member.

Parameters

  sp | file hierarchy state
  p | file set member
  instr | new disposition for file set member

Returns
  0 on sucess, -1 on error

Definition at line 634 of file fts.c.

References __set_errno, _fts_debug, FTS_AGAIN, FTS_FOLLOW, _ftsent::fts_instr, FTS_NOINSTR, and FTS_SKIP.

Referenced by cacheWalkPathFilter(), mtreeCWalk(), mtreeVWalk(), rpmcliWalkFirst(), rpmdcCWalk(), and rpmfts_Set().

## Variable Documentation

int _fts_debug

Definition at line 161 of file fts.c.