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

# rpmio/fts.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 1989, 1993
    00003  *      The Regents of the University of California.  All rights reserved.
    00004  *
    00005  * Redistribution and use in source and binary forms, with or without
    00006  * modification, are permitted provided that the following conditions
    00007  * are met:
    00008  * 1. Redistributions of source code must retain the above copyright
    00009  *    notice, this list of conditions and the following disclaimer.
    00010  * 2. Redistributions in binary form must reproduce the above copyright
    00011  *    notice, this list of conditions and the following disclaimer in the
    00012  *    documentation and/or other materials provided with the distribution.
    00013  * 4. Neither the name of the University nor the names of its contributors
    00014  *    may be used to endorse or promote products derived from this software
    00015  *    without specific prior written permission.
    00016  *
    00017  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00027  * SUCH DAMAGE.
    00028  *
    00029  *      @(#)fts.h       8.3 (Berkeley) 8/14/94
    00030  */
    00031
    00032 #ifndef _FTS_H
    00033 #define _FTS_H 1
    00034
    00035 #if defined(__GLIBC__)
    00036 #include <features.h>
    00037 #else
    00038
    00039 #   define __THROW
    00040 #ifdef  __cplusplus
    00041 # define __BEGIN_DECLS  extern "C" {
    00042 # define __END_DECLS    }
    00043 #else
    00044 # define __BEGIN_DECLS
    00045 # define __END_DECLS
    00046 #endif
    00047
    00048 #if defined(hpux)
    00049 # define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
    00050 # define        _INCLUDE_POSIX_SOURCE
    00051 # define        _LARGEFILE64_SOURCE
    00052 #endif
    00053
    00054 #endif
    00055
    00056 #include <sys/types.h>
    00057 #include <sys/stat.h>
    00058 #include <dirent.h>
    00059
    00060 /* The fts interface is incompatible with the LFS interface which
    00061    transparently uses the 64-bit file access functions.  */
    00062
    00063 #ifdef __USE_FILE_OFFSET64
    00064 # error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
    00065 #endif
    00066
    00067
    00068 typedef struct {
    00069 /*@owned@*/
    00070         struct _ftsent *fts_cur;
    00071 /*@owned@*/ /*@null@*/
    00072         struct _ftsent *fts_child;
    00073 /*@owned@*/ /*@null@*/
    00074         struct _ftsent **fts_array;
    00075         dev_t fts_dev;
    00076 /*@owned@*/
    00077         char *fts_path;
    00078         int fts_rfd;
    00079         int fts_pathlen;
    00080         int fts_nitems;
    00081 /*@null@*/
    00082         int (*fts_compar) (const void *, const void *)
    00083                 /*@*/;
    00085         DIR * (*fts_opendir) (const char * path)
    00086                 /*@globals fileSystem @*/
    00087                 /*@modifies fileSystem @*/;
    00088         struct dirent * (*fts_readdir) (DIR * dir)
    00089                 /*@globals fileSystem @*/
    00090                 /*@modifies *dir, fileSystem @*/;
    00091         int (*fts_closedir) (/*@only@*/ DIR * dir)
    00092                 /*@globals fileSystem @*/
    00093                 /*@modifies *dir, fileSystem @*/;
    00094         int (*fts_stat) (const char * path, /*@out@*/ struct stat * st)
    00095                 /*@globals fileSystem @*/
    00096                 /*@modifies *st, fileSystem @*/;
    00097         int (*fts_lstat) (const char * path, /*@out@*/ struct stat * st)
    00098                 /*@globals fileSystem @*/
    00099                 /*@modifies *st, fileSystem @*/;
    00100
    00101 #define FTS_COMFOLLOW   0x0001
    00102 #define FTS_LOGICAL     0x0002
    00103 #define FTS_NOCHDIR     0x0004
    00104 #define FTS_NOSTAT      0x0008
    00105 #define FTS_PHYSICAL    0x0010
    00106 #define FTS_SEEDOT      0x0020
    00107 #define FTS_XDEV        0x0040
    00108 #define FTS_WHITEOUT    0x0080
    00109 #define FTS_OPTIONMASK  0x00ff
    00111 #define FTS_NAMEONLY    0x0100
    00112 #define FTS_STOP        0x0200
    00113         int fts_options;
    00114 } FTS;
    00115
    00116 typedef struct _ftsent {
    00117 /*@dependent@*/
    00118         struct _ftsent *fts_cycle;
    00119 /*@dependent@*/
    00120         struct _ftsent *fts_parent;
    00121 /*@dependent@*/
    00122         struct _ftsent *fts_link;
    00123         long fts_number;
    00124         void *fts_pointer;
    00125 /*@dependent@*/
    00126         char *fts_accpath;
    00127 /*@dependent@*/
    00128         char *fts_path;
    00129         int fts_errno;
    00130         int fts_symfd;
    00131         u_short fts_pathlen;
    00132         u_short fts_namelen;
    00134         ino_t fts_ino;
    00135         dev_t fts_dev;
    00136         nlink_t fts_nlink;
    00138 #define FTS_ROOTPARENTLEVEL     -1
    00139 #define FTS_ROOTLEVEL            0
    00140         short fts_level;
    00142 #define FTS_D            1
    00143 #define FTS_DC           2
    00144 #define FTS_DEFAULT      3
    00145 #define FTS_DNR          4
    00146 #define FTS_DOT          5
    00147 #define FTS_DP           6
    00148 #define FTS_ERR          7
    00149 #define FTS_F            8
    00150 #define FTS_INIT         9
    00151 #define FTS_NS          10
    00152 #define FTS_NSOK        11
    00153 #define FTS_SL          12
    00154 #define FTS_SLNONE      13
    00155 #define FTS_W           14
    00156         u_short fts_info;
    00158 #define FTS_DONTCHDIR    0x01
    00159 #define FTS_SYMFOLLOW    0x02
    00160         u_short fts_flags;
    00162 #define FTS_AGAIN        1
    00163 #define FTS_FOLLOW       2
    00164 #define FTS_NOINSTR      3
    00165 #define FTS_SKIP         4
    00166         u_short fts_instr;
    00168 /*@dependent@*/
    00169         struct stat *fts_statp;
    00170         char fts_name[1];
    00171 } FTSENT;
    00172
    00173 __BEGIN_DECLS
    00174
    00181 /*@unused@*/ /*@dependent@*/
    00182 FTSENT  *Fts_children (FTS * sp, int instr) __THROW
    00183         /*@globals fileSystem, internalState @*/
    00184         /*@modifies *sp, fileSystem, internalState @*/;
    00185
    00191 /*@unused@*/
    00192 int      Fts_close (/*@only@*/ FTS * sp) __THROW
    00193         /*@globals fileSystem, internalState @*/
    00194         /*@modifies *sp, fileSystem, internalState @*/;
    00195
    00203 /*@unused@*/ /*@only@*/
    00204 FTS     *Fts_open (char * const * argv, int options,
    00205                    /*@null@*/
    00206                    int (*compar) (const FTSENT **, const FTSENT **)) __THROW
    00207         /*@*/;
    00208
    00214 /*@unused@*/ /*@null@*/
    00215 FTSENT  *Fts_read (FTS * sp) __THROW
    00216         /*@globals fileSystem, internalState @*/
    00217         /*@modifies *sp, fileSystem, internalState @*/;
    00218
    00226 /*@unused@*/
    00227 int      Fts_set (FTS * sp, FTSENT * p, int instr) __THROW
    00228         /*@modifies *p @*/;
    00229
    00230 __END_DECLS
    00231
    00232 #endif /* fts.h */