BSD 4_4 development
[unix-history] / usr / share / man / cat3 / fts.0
FTS(3) BSD Programmer's Manual FTS(3)
N\bNA\bAM\bME\bE
f\bft\bts\bs - traverse a file hierarchy
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b>
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/s\bst\bta\bat\bt.\b.h\bh>\b>
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<f\bft\bts\bs.\b.h\bh>\b>
_\bF_\bT_\bS _\b*
f\bft\bts\bs_\b_o\bop\bpe\ben\bn(_\bc_\bh_\ba_\br _\b* _\bc_\bo_\bn_\bs_\bt _\b*_\bp_\ba_\bt_\bh_\b__\ba_\br_\bg_\bv, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs,
_\bi_\bn_\bt _\b*_\bc_\bo_\bm_\bp_\ba_\br_\b(_\bc_\bo_\bn_\bs_\bt _\bF_\bT_\bS_\bE_\bN_\bT _\b*_\b*_\b, _\bc_\bo_\bn_\bs_\bt _\bF_\bT_\bS_\bE_\bN_\bT _\b*_\b*_\b));
_\bF_\bT_\bS_\bE_\bN_\bT _\b*
f\bft\bts\bs_\b_r\bre\bea\bad\bd(_\bF_\bT_\bS _\b*_\bf_\bt_\bs_\bp);
_\bF_\bT_\bS_\bE_\bN_\bT _\b*
f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn(_\bF_\bT_\bS _\b*_\bf_\bt_\bs_\bp, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
_\bi_\bn_\bt
f\bft\bts\bs_\b_s\bse\bet\bt(_\bF_\bT_\bS _\bf_\bt_\bs_\bp, _\bF_\bT_\bS_\bE_\bN_\bT _\b*_\bf, _\bi_\bn_\bt _\bo_\bp_\bt_\bi_\bo_\bn_\bs);
_\bi_\bn_\bt
f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be(_\bF_\bT_\bS _\b*_\bf_\bt_\bs_\bp);
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
The f\bft\bts\bs functions are provided for traversing UNIX file hierarchies. A
simple overview is that the f\bft\bts\bs_\b_o\bop\bpe\ben\bn() function returns a ``handle'' on a
file hierarchy, which is then supplied to the other f\bft\bts\bs functions. The
function f\bft\bts\bs_\b_r\bre\bea\bad\bd() returns a pointer to a structure describing one of
the files in the file hierarchy. The function f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() returns a
pointer to a linked list of structures, each of which describes one of
the files contained in a directory in the hierarchy. In general, direc-
tories are visited two distinguishable times; in pre-order (before any of
their descendants are visited) and in post-order (after all of their de-
scendants have been visited). Files are visited once. It is possible to
walk the hierarchy ``logically'' (ignoring symbolic links) or physically
(visiting symbolic links), order the walk of the hierarchy or prune
and/or re-visit portions of the hierarchy.
Two structures are defined (and typedef'd) in the include file <_\bf_\bt_\bs_\b._\bh>.
The first is _\bF_\bT_\bS, the structure that represents the file hierarchy it-
self. The second is _\bF_\bT_\bS_\bE_\bN_\bT, the structure that represents a file in the
file hierarchy. Normally, an _\bF_\bT_\bS_\bE_\bN_\bT structure is returned for every file
in the file hierarchy. In this manual page, ``file'' and ``_\bF_\bT_\bS_\bE_\bN_\bT
structure'' are generally interchangeable. The _\bF_\bT_\bS_\bE_\bN_\bT structure contains
at least the following fields, which are described in greater detail be-
low:
typedef struct _ftsent {
u_short fts_info; /* flags for FTSENT structure */
char *fts_accpath; /* access path */
char *fts_path; /* root path */
short fts_pathlen; /* strlen(fts_path) */
char *fts_name; /* file name */
short fts_namelen; /* strlen(fts_name) */
short fts_level; /* depth (-1 to N) */
int fts_error; /* file errno */
long fts_number; /* local numeric value */
void *fts_pointer; /* local address value */
struct ftsent *fts_parent; /* parent directory */
struct ftsent *fts_link; /* next file structure */
struct ftsent *fts_cycle; /* cycle structure */
struct stat *fts_statp; /* stat(2) information */
} FTSENT;
These fields are defined as follows:
_\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo One of the following flags describing the returned _\bF_\bT_\bS_\bE_\bN_\bT
structure and the file it represents. With the exception of
directories without errors (FTS_D), all of these entries are
terminal, that is, they will not be revisited, nor will any
of their descendants be visited.
FTS_D A directory being visited in pre-order.
FTS_DC A directory that causes a cycle in the tree.
(The _\bf_\bt_\bs_\b__\bc_\by_\bc_\bl_\be field of the _\bF_\bT_\bS_\bE_\bN_\bT structure
will be filled in as well.)
FTS_DEFAULT Any _\bF_\bT_\bS_\bE_\bN_\bT structure that represents a file
type not explicitly described by one of the
other _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo values.
FTS_DNR A directory which cannot be read. This is an
error return, and the _\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo field will be
set to indicate what caused the error.
FTS_DOT A file named `.' or `..' which was not speci-
fied as a file name to f\bft\bts\bs_\b_o\bop\bpe\ben\bn() (see
FTS_SEEDOT).
FTS_DP A directory being visited in post-order. The
contents of the _\bF_\bT_\bS_\bE_\bN_\bT structure will be un-
changed from when it was returned in pre-order,
i.e. with the _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo field set to FTS_D.
FTS_ERR This is an error return, and the _\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo
field will be set to indicate what caused the
error.
FTS_F A regular file.
FTS_NS A file for which no stat(2) information was
available. The contents of the _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp field
are undefined. This is an error return, and
the _\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo field will be set to indicate
what caused the error.
FTS_NSOK A file for which no stat(2) information was re-
quested. The contents of the _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp field
are undefined.
FTS_SL A symbolic link.
FTS_SLNONE A symbolic link with a non-existent target.
The contents of the _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp field reference
the file characteristic information for the
symbolic link itself.
_\bf_\bt_\bs_\b__\ba_\bc_\bc_\bp_\ba_\bt_\bh A path for accessing the file from the current directory.
_\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh The path for the file relative to the root of the traversal.
This path contains the path specified to f\bft\bts\bs_\b_o\bop\bpe\ben\bn() as a
prefix.
_\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh_\bl_\be_\bn The length of the string referenced by _\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh.
_\bf_\bt_\bs_\b__\bn_\ba_\bm_\be The name of the file.
_\bf_\bt_\bs_\b__\bn_\ba_\bm_\be_\bl_\be_\bn The length of the string referenced by _\bf_\bt_\bs_\b__\bn_\ba_\bm_\be.
_\bf_\bt_\bs_\b__\bl_\be_\bv_\be_\bl The depth of the traversal, numbered from -1 to N, where
this file was found. The _\bF_\bT_\bS_\bE_\bN_\bT structure representing the
parent of the starting point (or root) of the traversal is
numbered -1, and the _\bF_\bT_\bS_\bE_\bN_\bT structure for the root itself is
numbered 0.
_\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo Upon return of a _\bF_\bT_\bS_\bE_\bN_\bT structure from the f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() or
f\bft\bts\bs_\b_r\bre\bea\bad\bd() functions, with its _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo field set to
FTS_DNR, FTS_ERR or FTS_NS, the _\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo field contains the
value of the external variable _\be_\br_\br_\bn_\bo specifying the cause of
the error. Otherwise, the contents of the _\bf_\bt_\bs_\b__\be_\br_\br_\bn_\bo field
are undefined.
_\bf_\bt_\bs_\b__\bn_\bu_\bm_\bb_\be_\br This field is provided for the use of the application pro-
gram and is not modified by the f\bft\bts\bs functions. It is ini-
tialized to 0.
_\bf_\bt_\bs_\b__\bp_\bo_\bi_\bn_\bt_\be_\br This field is provided for the use of the application pro-
gram and is not modified by the f\bft\bts\bs functions. It is ini-
tialized to NULL.
_\bf_\bt_\bs_\b__\bp_\ba_\br_\be_\bn_\bt A pointer to the _\bF_\bT_\bS_\bE_\bN_\bT structure referencing the file in
the hierarchy immediately above the current file, i.e. the
directory of which this file is a member. A parent struc-
ture for the initial entry point is provided as well, howev-
er, only the _\bf_\bt_\bs_\b__\bl_\be_\bv_\be_\bl, _\bf_\bt_\bs_\b__\bn_\bu_\bm_\bb_\be_\br and _\bf_\bt_\bs_\b__\bp_\bo_\bi_\bn_\bt_\be_\br fields
are guaranteed to be initialized.
_\bf_\bt_\bs_\b__\bl_\bi_\bn_\bk Upon return from the f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() function, the _\bf_\bt_\bs_\b__\bl_\bi_\bn_\bk
field points to the next structure in the NULL-terminated
linked list of directory members. Otherwise, the contents
of the _\bf_\bt_\bs_\b__\bl_\bi_\bn_\bk field are undefined.
_\bf_\bt_\bs_\b__\bc_\by_\bc_\bl_\be If a directory causes a cycle in the hierarchy (see FTS_DC),
either because of a hard link between two directories, or a
symbolic link pointing to a directory, the _\bf_\bt_\bs_\b__\bc_\by_\bc_\bl_\be field
of the structure will point to the _\bF_\bT_\bS_\bE_\bN_\bT structure in the
hierarchy that references the same file as the current
_\bF_\bT_\bS_\bE_\bN_\bT structure. Otherwise, the contents of the _\bf_\bt_\bs_\b__\bc_\by_\bc_\bl_\be
field are undefined.
_\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp A pointer to stat(2) information for the file.
A single buffer is used for all of the paths of all of the files in the
file hierarchy. Therefore, the _\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh and _\bf_\bt_\bs_\b__\ba_\bc_\bc_\bp_\ba_\bt_\bh fields are guar-
anteed to be NULL-terminated _\bo_\bn_\bl_\by for the file most recently returned by
f\bft\bts\bs_\b_r\bre\bea\bad\bd(). To use these fields to reference any files represented by
other _\bF_\bT_\bS_\bE_\bN_\bT structures will require that the path buffer be modified us-
ing the information contained in that _\bF_\bT_\bS_\bE_\bN_\bT structure's _\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh_\bl_\be_\bn
field. Any such modifications should be undone before further calls to
f\bft\bts\bs_\b_r\bre\bea\bad\bd() are attempted. The _\bf_\bt_\bs_\b__\bn_\ba_\bm_\be field is always NULL-terminated.
F\bFT\bTS\bS_\b_O\bOP\bPE\bEN\bN
The f\bft\bts\bs_\b_o\bop\bpe\ben\bn() function takes a pointer to an array of character pointers
naming one or more paths which make up a logical file hierarchy to be
traversed. The array must be terminated by a NULL pointer.
There are a number of options, at least one of which (either FTS_LOGICAL
or FTS_PHYSICAL) must be specified. The options are selected by _\bo_\br'ing
the following values:
FTS_COMFOLLOW
This option causes any symbolic link specified as a root
path to be followed immediately whether or not FTS_LOGICAL
is also specified.
FTS_LOGICAL This option causes the f\bft\bts\bs routines to return _\bF_\bT_\bS_\bE_\bN_\bT struc-
tures for the targets of symbolic links instead of the sym-
bolic links themselves. If this option is set, the only
symbolic links for which _\bF_\bT_\bS_\bE_\bN_\bT structures are returned to
the application are those referencing non-existent files.
Either FTS_LOGICAL or FTS_PHYSICAL _\bm_\bu_\bs_\bt be provided to the
f\bft\bts\bs_\b_o\bop\bpe\ben\bn() function.
FTS_NOCHDIR As a performance optimization, the f\bft\bts\bs functions change di-
rectories as they walk the file hierarchy. This has the
side-effect that an application cannot rely on being in any
particular directory during the traversal. The FTS_NOCHDIR
option turns off this optimization, and the f\bft\bts\bs functions
will not change the current directory. Note that applica-
tions should not themselves change their current directory
and try to access files unless FTS_NOCHDIR is specified and
absolute pathnames were provided as arguments to
f\bft\bts\bs_\b_o\bop\bpe\ben\bn().
FTS_NOSTAT By default, returned _\bF_\bT_\bS_\bE_\bN_\bT structures reference file char-
acteristic information (the _\bs_\bt_\ba_\bt_\bp field) for each file vis-
ited. This option relaxes that requirement as a perfor-
mance optimization, allowing the f\bft\bts\bs functions to set the
_\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo field to FTS_NSOK and leave the contents of the
_\bs_\bt_\ba_\bt_\bp field undefined.
FTS_PHYSICAL This option causes the f\bft\bts\bs routines to return _\bF_\bT_\bS_\bE_\bN_\bT struc-
tures for symbolic links themselves instead of the target
files they point to. If this option is set, _\bF_\bT_\bS_\bE_\bN_\bT struc-
tures for all symbolic links in the hierarchy are returned
to the application. Either FTS_LOGICAL or FTS_PHYSICAL
_\bm_\bu_\bs_\bt be provided to the f\bft\bts\bs_\b_o\bop\bpe\ben\bn() function.
FTS_SEEDOT By default, unless they are specified as path arguments to
f\bft\bts\bs_\b_o\bop\bpe\ben\bn(), any files named `.' or `..' encountered in the
file hierarchy are ignored. This option causes the f\bft\bts\bs
routines to return _\bF_\bT_\bS_\bE_\bN_\bT structures for them.
FTS_XDEV This option prevents f\bft\bts\bs from descending into directories
that have a different device number than the file from
which the descent began.
The argument c\bco\bom\bmp\bpa\bar\br() specifies a user-defined function which may be used
to order the traversal of the hierarchy. It takes two pointers to point-
ers to _\bF_\bT_\bS_\bE_\bN_\bT structures as arguments and should return a negative value,
zero, or a positive value to indicate if the file referenced by its first
argument comes before, in any order with respect to, or after, the file
referenced by its second argument. The _\bf_\bt_\bs_\b__\ba_\bc_\bc_\bp_\ba_\bt_\bh, _\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh and
_\bf_\bt_\bs_\b__\bp_\ba_\bt_\bh_\bl_\be_\bn fields of the _\bF_\bT_\bS_\bE_\bN_\bT structures may _\bn_\be_\bv_\be_\br be used in this
comparison. If the _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo field is set to FTS_NS or FTS_NSOK, the
_\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp field may not either. If the c\bco\bom\bmp\bpa\bar\br() argument is NULL, the
directory traversal order is in the order listed in _\bp_\ba_\bt_\bh_\b__\ba_\br_\bg_\bv for the
root paths, and in the order listed in the directory for everything else.
F\bFT\bTS\bS_\b_R\bRE\bEA\bAD\bD
The f\bft\bts\bs_\b_r\bre\bea\bad\bd() function returns a pointer to an _\bF_\bT_\bS_\bE_\bN_\bT structure describ-
ing a file in the hierarchy. Directories (that are readable and do not
cause cycles) are visited at least twice, once in pre-order and once in
post-order. All other files are visited at least once. (Hard links be-
tween directories that do not cause cycles or symbolic links to symbolic
links may cause files to be visited more than once, or directories more
than twice.)
If all the members of the hierarchy have been returned, f\bft\bts\bs_\b_r\bre\bea\bad\bd() re-
turns NULL and sets the external variable _\be_\br_\br_\bn_\bo to 0. If an error unre-
lated to a file in the hierarchy occurs, f\bft\bts\bs_\b_r\bre\bea\bad\bd() returns NULL and sets
_\be_\br_\br_\bn_\bo appropriately. If an error related to a returned file occurs, a
pointer to an _\bF_\bT_\bS_\bE_\bN_\bT structure is returned, and _\be_\br_\br_\bn_\bo may or may not have
been set (see _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo).
The _\bF_\bT_\bS_\bE_\bN_\bT structures returned by f\bft\bts\bs_\b_r\bre\bea\bad\bd() may be overwritten after a
call to f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be() on the same file hierarchy stream, or, after a call
to f\bft\bts\bs_\b_r\bre\bea\bad\bd() on the same file hierarchy stream unless they represent a
file of type directory, in which case they will not be overwritten until
after a call to f\bft\bts\bs_\b_r\bre\bea\bad\bd() after the _\bF_\bT_\bS_\bE_\bN_\bT structure has been returned
by the function f\bft\bts\bs_\b_r\bre\bea\bad\bd() in post-order.
F\bFT\bTS\bS_\b_C\bCH\bHI\bIL\bLD\bDR\bRE\bEN\bN
The f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() function returns a pointer to an _\bF_\bT_\bS_\bE_\bN_\bT structure de-
scribing the first entry in a NULL-terminated linked list of the files in
the directory represented by the _\bF_\bT_\bS_\bE_\bN_\bT structure most recently returned
by f\bft\bts\bs_\b_r\bre\bea\bad\bd(). The list is linked through the _\bf_\bt_\bs_\b__\bl_\bi_\bn_\bk field of the
_\bF_\bT_\bS_\bE_\bN_\bT structure, and is ordered by the user-specified comparison func-
tion, if any. Repeated calls to f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() will recreate this linked
list.
As a special case, if f\bft\bts\bs_\b_r\bre\bea\bad\bd() has not yet been called for a hierarchy,
f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() will return a pointer to the files in the logical directo-
ry specified to f\bft\bts\bs_\b_o\bop\bpe\ben\bn(), i.e. the arguments specified to f\bft\bts\bs_\b_o\bop\bpe\ben\bn().
Otherwise, if the _\bF_\bT_\bS_\bE_\bN_\bT structure most recently returned by f\bft\bts\bs_\b_r\bre\bea\bad\bd()
is not a directory being visited in pre-order, or the directory does not
contain any files, f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() returns NULL and sets _\be_\br_\br_\bn_\bo to zero.
If an error occurs, f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() returns NULL and sets _\be_\br_\br_\bn_\bo appropri-
ately.
The _\bF_\bT_\bS_\bE_\bN_\bT structures returned by f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() may be overwritten after
a call to f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn(), f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be() or f\bft\bts\bs_\b_r\bre\bea\bad\bd() on the same file hi-
erarchy stream.
_\bO_\bp_\bt_\bi_\bo_\bn may be set to the following value:
FTS_NAMEONLY Only the names of the files are needed. The contents of
all the fields in the returned linked list of structures
are undefined with the exception of the _\bf_\bt_\bs_\b__\bn_\ba_\bm_\be and
_\bf_\bt_\bs_\b__\bn_\ba_\bm_\be_\bl_\be_\bn fields.
F\bFT\bTS\bS_\b_S\bSE\bET\bT
The function f\bft\bts\bs_\b_s\bse\bet\bt() allows the user application to determine further
processing for the file _\bf of the stream _\bf_\bt_\bs_\bp. The f\bft\bts\bs_\b_s\bse\bet\bt() function re-
turns 0 on success, and -1 if an error occurs. _\bO_\bp_\bt_\bi_\bo_\bn must be set to one
of the following values:
FTS_AGAIN Re-visit the file; any file type may be re-visited. The
next call to f\bft\bts\bs_\b_r\bre\bea\bad\bd() will return the referenced file.
The _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt and _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo fields of the structure will be
reinitialized at that time, but no other fields will have
been changed. This option is meaningful only for the most
recently returned file from f\bft\bts\bs_\b_r\bre\bea\bad\bd(). Normal use is for
post-order directory visits, where it causes the directory
to be re-visited (in both pre and post-order) as well as
all of its descendants.
FTS_FOLLOW The referenced file must be a symbolic link. If the refer-
enced file is the one most recently returned by f\bft\bts\bs_\b_r\bre\bea\bad\bd(),
the next call to f\bft\bts\bs_\b_r\bre\bea\bad\bd() returns the file with the
_\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo and _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp fields reinitialized to reflect the
target of the symbolic link instead of the symbolic link
itself. If the file is one of those most recently returned
by f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn(), the _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo and _\bf_\bt_\bs_\b__\bs_\bt_\ba_\bt_\bp fields of the
structure, when returned by f\bft\bts\bs_\b_r\bre\bea\bad\bd(), will reflect the
target of the symbolic link instead of the symbolic link
itself. In either case, if the target of the symbolic link
does not exist the fields of the returned structure will be
unchanged and the _\bf_\bt_\bs_\b__\bi_\bn_\bf_\bo field will be set to FTS_SLNONE.
If the target of the link is a directory, the pre-order re-
turn, followed by the return of all of its descendants,
followed by a post-order return, is done.
FTS_SKIP No descendants of this file are visited. The file may be
one of those most recently returned by either
f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() or f\bft\bts\bs_\b_r\bre\bea\bad\bd().
F\bFT\bTS\bS_\b_C\bCL\bLO\bOS\bSE\bE
The f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be() function closes a file hierarchy stream _\bf_\bt_\bs_\bp and restores
the current directory to the directory from which f\bft\bts\bs_\b_o\bop\bpe\ben\bn() was called
to open _\bf_\bt_\bs_\bp. The f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be() function returns 0 on success, and -1 if an
error occurs.
E\bER\bRR\bRO\bOR\bRS\bS
The function f\bft\bts\bs_\b_o\bop\bpe\ben\bn() may fail and set _\be_\br_\br_\bn_\bo for any of the errors
specified for the library functions open(2) and malloc(3).
The function f\bft\bts\bs_\b_c\bcl\blo\bos\bse\be() may fail and set _\be_\br_\br_\bn_\bo for any of the errors
specified for the library functions chdir(2) and close(2).
The functions f\bft\bts\bs_\b_r\bre\bea\bad\bd() and f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn() may fail and set _\be_\br_\br_\bn_\bo for
any of the errors specified for the library functions chdir(2),
malloc(3), opendir(3), readdir(3) and stat(2).
In addition, f\bft\bts\bs_\b_c\bch\bhi\bil\bld\bdr\bre\ben\bn(), f\bft\bts\bs_\b_o\bop\bpe\ben\bn() and f\bft\bts\bs_\b_s\bse\bet\bt() may fail and set
_\be_\br_\br_\bn_\bo as follows:
[EINVAL] The options were invalid.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
find(1), chdir(2), stat(2), qsort(3)
S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS
The f\bft\bts\bs utility is expected to be a superset of the IEEE Std1003.1-1988
(``POSIX'') specification.
4.4BSD June 4, 1993 6