Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

rpmio/fts.c File Reference

#include "system.h"
#include "fts.h"
#include "rpmio.h"
#include "rpmurl.h"

Go to the source code of this file.

Defines

#define __set_errno(val)   (*__errno_location ()) = (val)
#define __open   open
#define __close   close
#define __fchdir   fchdir
#define ALIGNBYTES   (__alignof__ (long double) - 1)
#define ALIGN(p)   (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
#define MAX(a, b)
#define ISDOT(a)   (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
#define CLR(opt)   (sp->fts_options &= ~(opt))
#define ISSET(opt)   (sp->fts_options & (opt))
#define SET(opt)   (sp->fts_options |= (opt))
#define FCHDIR(sp, fd)   (!ISSET(FTS_NOCHDIR) && __fchdir(fd))
#define BCHILD   1 /* fts_children */
#define BNAMES   2 /* fts_children, names only */
#define BREAD   3 /* fts_read */
#define MAXPATHLEN   1024
#define NAPPEND(p)
#define __opendir2(path, flag)   (*sp->fts_opendir) (path)
#define ADJUST(p)

Functions

FTSENTfts_alloc (FTS *sp, const char *name, int namelen)
FTSENTfts_build (FTS *sp, int type)
void fts_lfree (FTSENT *head)
void fts_load (FTS *sp, FTSENT *p)
size_t fts_maxarglen (char *const *argv)
void fts_padjust (FTS *sp, FTSENT *head)
int fts_palloc (FTS *sp, size_t more)
FTSENTfts_sort (FTS *sp, FTSENT *head, int nitems)
u_short fts_stat (FTS *sp, FTSENT *p, int follow)
int fts_safe_changedir (FTS *sp, FTSENT *p, int fd, const char *path)
FTSFts_open (char *const *argv, int options, int(*compar)(const FTSENT **, const FTSENT **))
 Create a handle for file hierarchy traversal.

int Fts_close (FTS *sp)
 Destroy a file hierarchy traversal handle.

FTSENTFts_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.

FTSENTFts_children (FTS *sp, int instr)
 Return list of children of the current node.


Define Documentation

#define __close   close
 

Definition at line 68 of file fts.c.

#define __fchdir   fchdir
 

Definition at line 69 of file fts.c.

#define __open   open
 

Definition at line 67 of file fts.c.

#define __opendir2 path,
flag   )     (*sp->fts_opendir) (path)
 

Referenced by fts_build().

#define __set_errno val   )     (*__errno_location ()) = (val)
 

Definition at line 66 of file fts.c.

Referenced by Fts_children(), Fts_open(), fts_palloc(), and Fts_set().

#define ADJUST  ) 
 

Value:

do {                                                    \
        if ((p)->fts_accpath != (p)->fts_name) {                        \
                (p)->fts_accpath =                                      \
                    (char *)addr + ((p)->fts_accpath - (p)->fts_path);  \
        }                                                               \
        (p)->fts_path = addr;                                           \
} while (0)

Referenced by fts_padjust().

#define ALIGN  )     (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
 

Definition at line 80 of file fts.c.

#define ALIGNBYTES   (__alignof__ (long double) - 1)
 

Definition at line 76 of file fts.c.

Referenced by fts_alloc().

#define BCHILD   1 /* fts_children */
 

Definition at line 125 of file fts.c.

#define BNAMES   2 /* fts_children, names only */
 

Definition at line 127 of file fts.c.

#define BREAD   3 /* fts_read */
 

Definition at line 129 of file fts.c.

Referenced by fts_build().

#define CLR opt   )     (sp->fts_options &= ~(opt))
 

Definition at line 118 of file fts.c.

#define FCHDIR sp,
fd   )     (!ISSET(FTS_NOCHDIR) && __fchdir(fd))
 

Definition at line 122 of file fts.c.

#define ISDOT  )     (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
 

Definition at line 116 of file fts.c.

#define ISSET opt   )     (sp->fts_options & (opt))
 

Definition at line 119 of file fts.c.

#define MAX a,
 ) 
 

Value:

({ __typeof__ (a) _a = (a); \
                           __typeof__ (b) _b = (b); \
                           _a > _b ? _a : _b; })

Definition at line 111 of file fts.c.

#define MAXPATHLEN   1024
 

#define NAPPEND  ) 
 

Value:

(p->fts_path[p->fts_pathlen - 1] == '/'                         \
            ? p->fts_pathlen - 1 : p->fts_pathlen)

Definition at line 356 of file fts.c.

#define SET opt   )     (sp->fts_options |= (opt))
 

Definition at line 120 of file fts.c.


Function Documentation

FTSENT * fts_alloc FTS sp,
const char *  name,
int  namelen
[static]
 

Definition at line 1048 of file fts.c.

References ALIGNBYTES, and FTS_NOINSTR.

FTSENT * fts_build FTS sp,
int  type
[static]
 

Definition at line 658 of file fts.c.

References __opendir2, BREAD, errno, FTS_DNR, _ftsent::fts_errno, _ftsent::fts_info, and FTSENT.

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

< (private) child names only

< (private) unrecoverable error

< initialized only

< preorder directory

< (private) child names only

< (private) child names only

< don't change directories

Definition at line 574 of file fts.c.

References __set_errno, and FTS_NAMEONLY.

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

< don't change directories

Definition at line 300 of file fts.c.

References FTS::fts_cur, _ftsent::fts_level, _ftsent::fts_link, _ftsent::fts_parent, and FTS_ROOTLEVEL.

Referenced by main(), recurseDir(), and rpmfts_state().

void fts_lfree FTSENT head  )  [static]
 

Definition at line 1086 of file fts.c.

References _ftsent::fts_link.

void fts_load FTS sp,
FTSENT p
[static]
 

Definition at line 274 of file fts.c.

size_t fts_maxarglen char *const *  argv  )  [static]
 

Definition at line 1166 of file fts.c.

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

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)

< valid user option mask

< logical walk

< don't change directories

< don't change directories

< follow command line symlinks

< dot or dot-dot

< preorder directory

< initialized only

< don't change directories

< don't change directories

Definition at line 133 of file fts.c.

References __set_errno, FTS_OPTIONMASK, and FTSENT.

Referenced by main(), recurseDir(), and rpmfts_state().

void fts_padjust FTS sp,
FTSENT head
[static]
 

Definition at line 1142 of file fts.c.

References ADJUST, and FTS_ROOTLEVEL.

int fts_palloc FTS sp,
size_t  more
[static]
 

Definition at line 1106 of file fts.c.

References __set_errno, and FTS::fts_path.

FTSENT* Fts_read FTS sp  ) 
 

Return next node in the file hierarchy traversal.

Parameters:
sp file hierarchy state
Returns:
file set member

< (private) unrecoverable error

< no instructions

< read node again

< follow symbolic link

< symbolic link

< symbolic link without target

< preorder directory

< don't change directories

< error; errno is set

< followed a symlink to get here

< preorder directory

< discard node

< don't cross devices

< followed a symlink to get here

< postorder directory

< (private) child names only

< (private) child names only

< don't chdir .. to the parent

< (private) unrecoverable error

< don't change directories

< (private) unrecoverable error

< discard node

< follow symbolic link

< preorder directory

< don't change directories

< error; errno is set

< followed a symlink to get here

< no instructions

< don't change directories

< (private) unrecoverable error

< followed a symlink to get here

< don't change directories

< (private) unrecoverable error

< don't chdir .. to the parent

< (private) unrecoverable error

< error; errno is set

< postorder directory

Definition at line 361 of file fts.c.

References FTS_AGAIN, _ftsent::fts_info, FTS_NOINSTR, fts_stat(), and FTSENT.

Referenced by main(), recurseDir(), and rpmfts_step().

int fts_safe_changedir FTS sp,
FTSENT p,
int  fd,
const char *  path
[static]
 

Definition at line 1182 of file fts.c.

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

< read node again

< follow symbolic link

< no instructions

< discard node

Definition at line 560 of file fts.c.

References __set_errno, FTS_NOINSTR, and FTS_SKIP.

Referenced by ftsPrint(), and rpmfts_Set().

FTSENT * fts_sort FTS sp,
FTSENT head,
int  nitems
[static]
 

Definition at line 1010 of file fts.c.

References FTS::fts_array, and FTS::fts_nitems.

u_short fts_stat FTS sp,
FTSENT p,
int  follow
[static]
 

Definition at line 926 of file fts.c.

References FTS_W.

Referenced by Fts_read().


Generated on Tue Dec 28 15:17:18 2004 for rpm by doxygen 1.3.6