# rpmio/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
## Defines
#define | _FTS_H 1
#define | __THROW
#define | FTS_COMFOLLOW 0x0001
#define | FTS_LOGICAL 0x0002
#define | FTS_NOCHDIR 0x0004
#define | FTS_NOSTAT 0x0008
#define | FTS_PHYSICAL 0x0010
#define | FTS_SEEDOT 0x0020
#define | FTS_XDEV 0x0040
#define | FTS_WHITEOUT 0x0080
#define | FTS_OPTIONMASK 0x00ff
#define | FTS_NAMEONLY 0x0100
#define | FTS_STOP 0x0200
#define | FTS_ROOTPARENTLEVEL -1
#define | FTS_ROOTLEVEL 0
#define | FTS_D 1
#define | FTS_DC 2
#define | FTS_DEFAULT 3
#define | FTS_DNR 4
#define | FTS_DOT 5
#define | FTS_DP 6
#define | FTS_ERR 7
#define | FTS_F 8
#define | FTS_INIT 9
#define | FTS_NS 10
#define | FTS_NSOK 11
#define | FTS_SL 12
#define | FTS_SLNONE 13
#define | FTS_W 14
#define | FTS_DONTCHDIR 0x01
#define | FTS_SYMFOLLOW 0x02
#define | FTS_AGAIN 1
#define | FTS_FOLLOW 2
#define | FTS_NOINSTR 3
#define | FTS_SKIP 4
## Typedefs
typedef struct _ftsent | FTSENT
## Functions
FTSENT * | Fts_children (FTS *sp, int instr)
| Return list of children of the current node.
int | Fts_close (FTS *sp)
| Destroy a file hierarchy traversal handle.
FTS * | Fts_open (char *const *argv, int options, int(*compar)(const FTSENT **, const FTSENT **))
| Create a handle for file hierarchy traversal.
FTSENT * | Fts_read (FTS *sp)
| Return next node in the file hierarchy traversal.
int | Fts_set (FTS *sp, FTSENT *p, int instr)
| Modify the traversal for a file set member.

## Define Documentation

#define __THROW

Definition at line 38 of file fts.h.

#define _FTS_H 1

Definition at line 33 of file fts.h.

#define FTS_AGAIN 1

Definition at line 144 of file fts.h.

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

#define FTS_COMFOLLOW 0x0001

Definition at line 82 of file fts.h.

Referenced by Fts_open(), recurseDir(), rpmcliArgIter(), rpmcliInstall(), rpmcliSign(), rpmfts_initialize(), rpmfts_new(), and rpmReSign().

#define FTS_D 1

Definition at line 124 of file fts.h.

Referenced by fts_build(), Fts_children(), Fts_open(), Fts_read(), fts_stat(), recurseDir(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_DC 2

Definition at line 125 of file fts.h.

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

#define FTS_DEFAULT 3

Definition at line 126 of file fts.h.

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

#define FTS_DNR 4

Definition at line 127 of file fts.h.

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

#define FTS_DONTCHDIR 0x01

Definition at line 140 of file fts.h.

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

#define FTS_DOT 5

Definition at line 128 of file fts.h.

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

#define FTS_DP 6

Definition at line 129 of file fts.h.

Referenced by fts_build(), Fts_read(), recurseDir(), rpmfts_initialize(), rpmfts_new(), and rpmgiWalkPathFilter().

#define FTS_ERR 7

Definition at line 130 of file fts.h.

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

#define FTS_F 8

Definition at line 131 of file fts.h.

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

#define FTS_FOLLOW 2

Definition at line 145 of file fts.h.

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

#define FTS_INIT 9

Definition at line 132 of file fts.h.

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

#define FTS_LOGICAL 0x0002

Definition at line 83 of file fts.h.

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

#define FTS_NAMEONLY 0x0100

Definition at line 92 of file fts.h.

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

#define FTS_NOCHDIR 0x0004

Definition at line 84 of file fts.h.

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

#define FTS_NOINSTR 3

Definition at line 146 of file fts.h.

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

#define FTS_NOSTAT 0x0008

Definition at line 85 of file fts.h.

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

#define FTS_NS 10

Definition at line 133 of file fts.h.

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

#define FTS_NSOK 11

Definition at line 134 of file fts.h.

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

#define FTS_OPTIONMASK 0x00ff

Definition at line 90 of file fts.h.

Referenced by Fts_open(), and rpmfts_new().

#define FTS_PHYSICAL 0x0010

Definition at line 86 of file fts.h.

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

#define FTS_ROOTLEVEL 0

Definition at line 121 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 120 of file fts.h.

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

#define FTS_SEEDOT 0x0020

Definition at line 87 of file fts.h.

Referenced by fts_build(), and rpmfts_new().

#define FTS_SKIP 4

Definition at line 147 of file fts.h.

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

#define FTS_SL 12

Definition at line 135 of file fts.h.

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

#define FTS_SLNONE 13

Definition at line 136 of file fts.h.

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

#define FTS_STOP 0x0200

Definition at line 93 of file fts.h.

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

#define FTS_SYMFOLLOW 0x02

Definition at line 141 of file fts.h.

Referenced by Fts_read(), and rpmfts_new().

#define FTS_W 14

Definition at line 137 of file fts.h.

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

#define FTS_WHITEOUT 0x0080

Definition at line 89 of file fts.h.

Referenced by fts_build(), and rpmfts_new().

#define FTS_XDEV 0x0040

Definition at line 88 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 628 of file fts.c.

References __close, __fchdir, __open, __set_errno, 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 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 363 of file fts.c.

References __close, __fchdir, __set_errno, 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 recurseDir(), rpmfts_state(), rpmgiFree(), 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 198 of file fts.c.

References __open, __set_errno, 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_stat(), FTS::fts_stat, ISSET, Lstat(), MAXPATHLEN, 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 recurseDir(), 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 420 of file fts.c.

References __close, __open, __set_errno, 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, NAPPEND, next, and SET.

Referenced by recurseDir(), 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 616 of file fts.c.

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

Referenced by rpmfts_Set().