xref: /freebsd/lib/libc/gen/fts.3 (revision dc36d6f9bb1753f3808552f3afd30eda9a7b206a)
158f0484fSRodney W. Grimes.\" Copyright (c) 1989, 1991, 1993, 1994
258f0484fSRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
358f0484fSRodney W. Grimes.\"
458f0484fSRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
558f0484fSRodney W. Grimes.\" modification, are permitted provided that the following conditions
658f0484fSRodney W. Grimes.\" are met:
758f0484fSRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
858f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
958f0484fSRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
1058f0484fSRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
1158f0484fSRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
1358f0484fSRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
1458f0484fSRodney W. Grimes.\"    without specific prior written permission.
1558f0484fSRodney W. Grimes.\"
1658f0484fSRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1758f0484fSRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1858f0484fSRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1958f0484fSRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2058f0484fSRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2158f0484fSRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2258f0484fSRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2358f0484fSRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2458f0484fSRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2558f0484fSRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2658f0484fSRodney W. Grimes.\" SUCH DAMAGE.
2758f0484fSRodney W. Grimes.\"
28f6e989a6SJilles Tjoelker.Dd January 12, 2014
2958f0484fSRodney W. Grimes.Dt FTS 3
3058f0484fSRodney W. Grimes.Os
3158f0484fSRodney W. Grimes.Sh NAME
3258f0484fSRodney W. Grimes.Nm fts
3358f0484fSRodney W. Grimes.Nd traverse a file hierarchy
3425bb73e0SAlexey Zelkin.Sh LIBRARY
3525bb73e0SAlexey Zelkin.Lb libc
3658f0484fSRodney W. Grimes.Sh SYNOPSIS
377d8983a2SRuslan Ermilov.In fts.h
3858f0484fSRodney W. Grimes.Ft FTS *
39283d23cbSJuli Mallett.Fn fts_open "char * const *path_argv" "int options" "int (*compar)(const FTSENT * const *, const FTSENT * const *)"
4058f0484fSRodney W. Grimes.Ft FTSENT *
4158f0484fSRodney W. Grimes.Fn fts_read "FTS *ftsp"
4258f0484fSRodney W. Grimes.Ft FTSENT *
4358f0484fSRodney W. Grimes.Fn fts_children "FTS *ftsp" "int options"
4458f0484fSRodney W. Grimes.Ft int
452d386814SMike Pritchard.Fn fts_set "FTS *ftsp" "FTSENT *f" "int options"
460d3bcc2eSGarrett Wollman.Ft void
470d3bcc2eSGarrett Wollman.Fn fts_set_clientptr "FTS *ftsp" "void *clientdata"
480d3bcc2eSGarrett Wollman.Ft void *
490d3bcc2eSGarrett Wollman.Fn fts_get_clientptr "FTS *ftsp"
500d3bcc2eSGarrett Wollman.Ft FTS *
510d3bcc2eSGarrett Wollman.Fn fts_get_stream "FTSENT *f"
5258f0484fSRodney W. Grimes.Ft int
5358f0484fSRodney W. Grimes.Fn fts_close "FTS *ftsp"
5458f0484fSRodney W. Grimes.Sh DESCRIPTION
5558f0484fSRodney W. GrimesThe
563b8ecdbbSRuslan Ermilov.Nm
5758f0484fSRodney W. Grimesfunctions are provided for traversing
581798791dSRuslan Ermilov.Ux
5958f0484fSRodney W. Grimesfile hierarchies.
6058f0484fSRodney W. GrimesA simple overview is that the
6158f0484fSRodney W. Grimes.Fn fts_open
62e1e5fdf6SAlexey Zelkinfunction returns a
63e1e5fdf6SAlexey Zelkin.Dq handle
64e1e5fdf6SAlexey Zelkinon a file hierarchy, which is then supplied to
6558f0484fSRodney W. Grimesthe other
663b8ecdbbSRuslan Ermilov.Nm
6758f0484fSRodney W. Grimesfunctions.
6858f0484fSRodney W. GrimesThe function
6958f0484fSRodney W. Grimes.Fn fts_read
7058f0484fSRodney W. Grimesreturns a pointer to a structure describing one of the files in the file
7158f0484fSRodney W. Grimeshierarchy.
7258f0484fSRodney W. GrimesThe function
7358f0484fSRodney W. Grimes.Fn fts_children
7458f0484fSRodney W. Grimesreturns a pointer to a linked list of structures, each of which describes
7558f0484fSRodney W. Grimesone of the files contained in a directory in the hierarchy.
7658f0484fSRodney W. GrimesIn general, directories are visited two distinguishable times; in pre-order
7758f0484fSRodney W. Grimes(before any of their descendants are visited) and in post-order (after all
7858f0484fSRodney W. Grimesof their descendants have been visited).
7958f0484fSRodney W. GrimesFiles are visited once.
80e1e5fdf6SAlexey ZelkinIt is possible to walk the hierarchy
81e1e5fdf6SAlexey Zelkin.Dq logically
82e1e5fdf6SAlexey Zelkin(ignoring symbolic links)
8358f0484fSRodney W. Grimesor physically (visiting symbolic links), order the walk of the hierarchy or
8458f0484fSRodney W. Grimesprune and/or re-visit portions of the hierarchy.
8558f0484fSRodney W. Grimes.Pp
8658f0484fSRodney W. GrimesTwo structures are defined (and typedef'd) in the include file
87fe08efe6SRuslan Ermilov.In fts.h .
8858f0484fSRodney W. GrimesThe first is
892efeeba5SRuslan Ermilov.Vt FTS ,
9058f0484fSRodney W. Grimesthe structure that represents the file hierarchy itself.
9158f0484fSRodney W. GrimesThe second is
922efeeba5SRuslan Ermilov.Vt FTSENT ,
9358f0484fSRodney W. Grimesthe structure that represents a file in the file
9458f0484fSRodney W. Grimeshierarchy.
9558f0484fSRodney W. GrimesNormally, an
962efeeba5SRuslan Ermilov.Vt FTSENT
9758f0484fSRodney W. Grimesstructure is returned for every file in the file
9858f0484fSRodney W. Grimeshierarchy.
99e1e5fdf6SAlexey ZelkinIn this manual page,
100e1e5fdf6SAlexey Zelkin.Dq file
101e1e5fdf6SAlexey Zelkinand
1022efeeba5SRuslan Ermilov.Dq Vt FTSENT No structure
10358f0484fSRodney W. Grimesare generally
10458f0484fSRodney W. Grimesinterchangeable.
1050d3bcc2eSGarrett Wollman.Pp
1060d3bcc2eSGarrett WollmanThe
1072efeeba5SRuslan Ermilov.Vt FTS
1080d3bcc2eSGarrett Wollmanstructure contains space for a single pointer, which may be used to
1090d3bcc2eSGarrett Wollmanstore application data or per-hierarchy state.
1100d3bcc2eSGarrett WollmanThe
1110d3bcc2eSGarrett Wollman.Fn fts_set_clientptr
1120d3bcc2eSGarrett Wollmanand
1130d3bcc2eSGarrett Wollman.Fn fts_get_clientptr
1140d3bcc2eSGarrett Wollmanfunctions may be used to set and retrieve this pointer.
1150d3bcc2eSGarrett WollmanThis is likely to be useful only when accessed from the sort
1160d3bcc2eSGarrett Wollmancomparison function, which can determine the original
1172efeeba5SRuslan Ermilov.Vt FTS
1180d3bcc2eSGarrett Wollmanstream of its arguments using the
1190d3bcc2eSGarrett Wollman.Fn fts_get_stream
1200d3bcc2eSGarrett Wollmanfunction.
1210d3bcc2eSGarrett WollmanThe two
1220d3bcc2eSGarrett Wollman.Li get
1230d3bcc2eSGarrett Wollmanfunctions are also available as macros of the same name.
1240d3bcc2eSGarrett Wollman.Pp
12558f0484fSRodney W. GrimesThe
1262efeeba5SRuslan Ermilov.Vt FTSENT
12758f0484fSRodney W. Grimesstructure contains at least the following fields, which are
12858f0484fSRodney W. Grimesdescribed in greater detail below:
12958f0484fSRodney W. Grimes.Bd -literal
13058f0484fSRodney W. Grimestypedef struct _ftsent {
13148aaad5fSYaroslav Tykhiy	int fts_info;			/* status for FTSENT structure */
13258f0484fSRodney W. Grimes	char *fts_accpath;		/* access path */
13358f0484fSRodney W. Grimes	char *fts_path;			/* root path */
13448aaad5fSYaroslav Tykhiy	size_t fts_pathlen;		/* strlen(fts_path) */
13558f0484fSRodney W. Grimes	char *fts_name;			/* file name */
13648aaad5fSYaroslav Tykhiy	size_t fts_namelen;		/* strlen(fts_name) */
13748aaad5fSYaroslav Tykhiy	long fts_level;			/* depth (\-1 to N) */
13858f0484fSRodney W. Grimes	int fts_errno;			/* file errno */
13948aaad5fSYaroslav Tykhiy	long long fts_number;		/* local numeric value */
14058f0484fSRodney W. Grimes	void *fts_pointer;		/* local address value */
14158f0484fSRodney W. Grimes	struct ftsent *fts_parent;	/* parent directory */
14258f0484fSRodney W. Grimes	struct ftsent *fts_link;	/* next file structure */
14358f0484fSRodney W. Grimes	struct ftsent *fts_cycle;	/* cycle structure */
14458f0484fSRodney W. Grimes	struct stat *fts_statp;		/* stat(2) information */
14558f0484fSRodney W. Grimes} FTSENT;
14658f0484fSRodney W. Grimes.Ed
14758f0484fSRodney W. Grimes.Pp
14858f0484fSRodney W. GrimesThese fields are defined as follows:
14958f0484fSRodney W. Grimes.Bl -tag -width "fts_namelen"
15058f0484fSRodney W. Grimes.It Fa fts_info
1517a6b3357SJohn PolstraOne of the following values describing the returned
1522efeeba5SRuslan Ermilov.Vt FTSENT
15358f0484fSRodney W. Grimesstructure and
15458f0484fSRodney W. Grimesthe file it represents.
15558f0484fSRodney W. GrimesWith the exception of directories without errors
15658f0484fSRodney W. Grimes.Pq Dv FTS_D ,
15758f0484fSRodney W. Grimesall of these
15858f0484fSRodney W. Grimesentries are terminal, that is, they will not be revisited, nor will any
15958f0484fSRodney W. Grimesof their descendants be visited.
16058f0484fSRodney W. Grimes.Bl  -tag -width FTS_DEFAULT
16158f0484fSRodney W. Grimes.It Dv FTS_D
16258f0484fSRodney W. GrimesA directory being visited in pre-order.
16358f0484fSRodney W. Grimes.It Dv FTS_DC
16458f0484fSRodney W. GrimesA directory that causes a cycle in the tree.
16558f0484fSRodney W. Grimes(The
16658f0484fSRodney W. Grimes.Fa fts_cycle
16758f0484fSRodney W. Grimesfield of the
1682efeeba5SRuslan Ermilov.Vt FTSENT
16958f0484fSRodney W. Grimesstructure will be filled in as well.)
17058f0484fSRodney W. Grimes.It Dv FTS_DEFAULT
17158f0484fSRodney W. GrimesAny
1722efeeba5SRuslan Ermilov.Vt FTSENT
17358f0484fSRodney W. Grimesstructure that represents a file type not explicitly described
17458f0484fSRodney W. Grimesby one of the other
17558f0484fSRodney W. Grimes.Fa fts_info
17658f0484fSRodney W. Grimesvalues.
17758f0484fSRodney W. Grimes.It Dv FTS_DNR
17858f0484fSRodney W. GrimesA directory which cannot be read.
17958f0484fSRodney W. GrimesThis is an error return, and the
18058f0484fSRodney W. Grimes.Fa fts_errno
18158f0484fSRodney W. Grimesfield will be set to indicate what caused the error.
18258f0484fSRodney W. Grimes.It Dv FTS_DOT
18358f0484fSRodney W. GrimesA file named
18442635956SRuslan Ermilov.Ql .\&
18558f0484fSRodney W. Grimesor
18642635956SRuslan Ermilov.Ql ..\&
18758f0484fSRodney W. Grimeswhich was not specified as a file name to
18858f0484fSRodney W. Grimes.Fn fts_open
18958f0484fSRodney W. Grimes(see
19058f0484fSRodney W. Grimes.Dv FTS_SEEDOT ) .
19158f0484fSRodney W. Grimes.It Dv FTS_DP
19258f0484fSRodney W. GrimesA directory being visited in post-order.
19358f0484fSRodney W. GrimesThe contents of the
1942efeeba5SRuslan Ermilov.Vt FTSENT
19558f0484fSRodney W. Grimesstructure will be unchanged from when
1968d6956fbSJaakko Heinonenthe directory was visited in pre-order, except for the
19758f0484fSRodney W. Grimes.Fa fts_info
1988d6956fbSJaakko Heinonenfield.
19958f0484fSRodney W. Grimes.It Dv FTS_ERR
20058f0484fSRodney W. GrimesThis is an error return, and the
20158f0484fSRodney W. Grimes.Fa fts_errno
20258f0484fSRodney W. Grimesfield will be set to indicate what caused the error.
20358f0484fSRodney W. Grimes.It Dv FTS_F
20458f0484fSRodney W. GrimesA regular file.
20558f0484fSRodney W. Grimes.It Dv FTS_NS
20658f0484fSRodney W. GrimesA file for which no
20758f0484fSRodney W. Grimes.Xr stat 2
20858f0484fSRodney W. Grimesinformation was available.
20958f0484fSRodney W. GrimesThe contents of the
21058f0484fSRodney W. Grimes.Fa fts_statp
21158f0484fSRodney W. Grimesfield are undefined.
21258f0484fSRodney W. GrimesThis is an error return, and the
21358f0484fSRodney W. Grimes.Fa fts_errno
21458f0484fSRodney W. Grimesfield will be set to indicate what caused the error.
21558f0484fSRodney W. Grimes.It Dv FTS_NSOK
21658f0484fSRodney W. GrimesA file for which no
21758f0484fSRodney W. Grimes.Xr stat 2
21858f0484fSRodney W. Grimesinformation was requested.
21958f0484fSRodney W. GrimesThe contents of the
22058f0484fSRodney W. Grimes.Fa fts_statp
22158f0484fSRodney W. Grimesfield are undefined.
22258f0484fSRodney W. Grimes.It Dv FTS_SL
22358f0484fSRodney W. GrimesA symbolic link.
22458f0484fSRodney W. Grimes.It Dv FTS_SLNONE
22558f0484fSRodney W. GrimesA symbolic link with a non-existent target.
22658f0484fSRodney W. GrimesThe contents of the
22758f0484fSRodney W. Grimes.Fa fts_statp
22858f0484fSRodney W. Grimesfield reference the file characteristic information for the symbolic link
22958f0484fSRodney W. Grimesitself.
23058f0484fSRodney W. Grimes.El
23158f0484fSRodney W. Grimes.It Fa fts_accpath
23258f0484fSRodney W. GrimesA path for accessing the file from the current directory.
23358f0484fSRodney W. Grimes.It Fa fts_path
23458f0484fSRodney W. GrimesThe path for the file relative to the root of the traversal.
23558f0484fSRodney W. GrimesThis path contains the path specified to
23658f0484fSRodney W. Grimes.Fn fts_open
23758f0484fSRodney W. Grimesas a prefix.
23858f0484fSRodney W. Grimes.It Fa fts_pathlen
23958f0484fSRodney W. GrimesThe length of the string referenced by
24058f0484fSRodney W. Grimes.Fa fts_path .
24158f0484fSRodney W. Grimes.It Fa fts_name
24258f0484fSRodney W. GrimesThe name of the file.
24358f0484fSRodney W. Grimes.It Fa fts_namelen
24458f0484fSRodney W. GrimesThe length of the string referenced by
24558f0484fSRodney W. Grimes.Fa fts_name .
24658f0484fSRodney W. Grimes.It Fa fts_level
24758f0484fSRodney W. GrimesThe depth of the traversal, numbered from \-1 to N, where this file
24858f0484fSRodney W. Grimeswas found.
24958f0484fSRodney W. GrimesThe
2502efeeba5SRuslan Ermilov.Vt FTSENT
25158f0484fSRodney W. Grimesstructure representing the parent of the starting point (or root)
2527d8983a2SRuslan Ermilovof the traversal is numbered
2537d8983a2SRuslan Ermilov.Dv FTS_ROOTPARENTLEVEL
2547d8983a2SRuslan Ermilov(\-1), and the
2552efeeba5SRuslan Ermilov.Vt FTSENT
25658f0484fSRodney W. Grimesstructure for the root
2577d8983a2SRuslan Ermilovitself is numbered
2587d8983a2SRuslan Ermilov.Dv FTS_ROOTLEVEL
2597d8983a2SRuslan Ermilov(0).
26058f0484fSRodney W. Grimes.It Fa fts_errno
26158f0484fSRodney W. GrimesUpon return of a
2622efeeba5SRuslan Ermilov.Vt FTSENT
26358f0484fSRodney W. Grimesstructure from the
26458f0484fSRodney W. Grimes.Fn fts_children
26558f0484fSRodney W. Grimesor
26658f0484fSRodney W. Grimes.Fn fts_read
26758f0484fSRodney W. Grimesfunctions, with its
26858f0484fSRodney W. Grimes.Fa fts_info
26958f0484fSRodney W. Grimesfield set to
27058f0484fSRodney W. Grimes.Dv FTS_DNR ,
27158f0484fSRodney W. Grimes.Dv FTS_ERR
27258f0484fSRodney W. Grimesor
27358f0484fSRodney W. Grimes.Dv FTS_NS ,
27458f0484fSRodney W. Grimesthe
27558f0484fSRodney W. Grimes.Fa fts_errno
27658f0484fSRodney W. Grimesfield contains the value of the external variable
27758f0484fSRodney W. Grimes.Va errno
27858f0484fSRodney W. Grimesspecifying the cause of the error.
27958f0484fSRodney W. GrimesOtherwise, the contents of the
28058f0484fSRodney W. Grimes.Fa fts_errno
28158f0484fSRodney W. Grimesfield are undefined.
28258f0484fSRodney W. Grimes.It Fa fts_number
28358f0484fSRodney W. GrimesThis field is provided for the use of the application program and is
28458f0484fSRodney W. Grimesnot modified by the
2853b8ecdbbSRuslan Ermilov.Nm
28658f0484fSRodney W. Grimesfunctions.
28758f0484fSRodney W. GrimesIt is initialized to 0.
28858f0484fSRodney W. Grimes.It Fa fts_pointer
28958f0484fSRodney W. GrimesThis field is provided for the use of the application program and is
29058f0484fSRodney W. Grimesnot modified by the
2913b8ecdbbSRuslan Ermilov.Nm
29258f0484fSRodney W. Grimesfunctions.
29358f0484fSRodney W. GrimesIt is initialized to
29458f0484fSRodney W. Grimes.Dv NULL .
29558f0484fSRodney W. Grimes.It Fa fts_parent
29658f0484fSRodney W. GrimesA pointer to the
2972efeeba5SRuslan Ermilov.Vt FTSENT
29858f0484fSRodney W. Grimesstructure referencing the file in the hierarchy
2991a0a9345SRuslan Ermilovimmediately above the current file, i.e., the directory of which this
30058f0484fSRodney W. Grimesfile is a member.
30158f0484fSRodney W. GrimesA parent structure for the initial entry point is provided as well,
30258f0484fSRodney W. Grimeshowever, only the
30358f0484fSRodney W. Grimes.Fa fts_level ,
30458f0484fSRodney W. Grimes.Fa fts_number
30558f0484fSRodney W. Grimesand
30658f0484fSRodney W. Grimes.Fa fts_pointer
30758f0484fSRodney W. Grimesfields are guaranteed to be initialized.
30858f0484fSRodney W. Grimes.It Fa fts_link
30958f0484fSRodney W. GrimesUpon return from the
31058f0484fSRodney W. Grimes.Fn fts_children
31158f0484fSRodney W. Grimesfunction, the
31258f0484fSRodney W. Grimes.Fa fts_link
31358f0484fSRodney W. Grimesfield points to the next structure in the NULL-terminated linked list of
31458f0484fSRodney W. Grimesdirectory members.
31558f0484fSRodney W. GrimesOtherwise, the contents of the
31658f0484fSRodney W. Grimes.Fa fts_link
31758f0484fSRodney W. Grimesfield are undefined.
31858f0484fSRodney W. Grimes.It Fa fts_cycle
31958f0484fSRodney W. GrimesIf a directory causes a cycle in the hierarchy (see
32058f0484fSRodney W. Grimes.Dv FTS_DC ) ,
32158f0484fSRodney W. Grimeseither because
32258f0484fSRodney W. Grimesof a hard link between two directories, or a symbolic link pointing to a
32358f0484fSRodney W. Grimesdirectory, the
32458f0484fSRodney W. Grimes.Fa fts_cycle
32558f0484fSRodney W. Grimesfield of the structure will point to the
3262efeeba5SRuslan Ermilov.Vt FTSENT
32758f0484fSRodney W. Grimesstructure in the hierarchy that references the same file as the current
3282efeeba5SRuslan Ermilov.Vt FTSENT
32958f0484fSRodney W. Grimesstructure.
33058f0484fSRodney W. GrimesOtherwise, the contents of the
33158f0484fSRodney W. Grimes.Fa fts_cycle
33258f0484fSRodney W. Grimesfield are undefined.
33358f0484fSRodney W. Grimes.It Fa fts_statp
33458f0484fSRodney W. GrimesA pointer to
33558f0484fSRodney W. Grimes.Xr stat 2
33658f0484fSRodney W. Grimesinformation for the file.
33758f0484fSRodney W. Grimes.El
33858f0484fSRodney W. Grimes.Pp
33958f0484fSRodney W. GrimesA single buffer is used for all of the paths of all of the files in the
34058f0484fSRodney W. Grimesfile hierarchy.
34158f0484fSRodney W. GrimesTherefore, the
34258f0484fSRodney W. Grimes.Fa fts_path
34358f0484fSRodney W. Grimesand
34458f0484fSRodney W. Grimes.Fa fts_accpath
34558f0484fSRodney W. Grimesfields are guaranteed to be
346df37b71cSJames Raynard.Dv NUL Ns -terminated
34758f0484fSRodney W. Grimes.Em only
34858f0484fSRodney W. Grimesfor the file most recently returned by
34958f0484fSRodney W. Grimes.Fn fts_read .
35058f0484fSRodney W. GrimesTo use these fields to reference any files represented by other
3512efeeba5SRuslan Ermilov.Vt FTSENT
35258f0484fSRodney W. Grimesstructures will require that the path buffer be modified using the
35358f0484fSRodney W. Grimesinformation contained in that
3542efeeba5SRuslan Ermilov.Vt FTSENT
35558f0484fSRodney W. Grimesstructure's
35658f0484fSRodney W. Grimes.Fa fts_pathlen
35758f0484fSRodney W. Grimesfield.
35858f0484fSRodney W. GrimesAny such modifications should be undone before further calls to
35958f0484fSRodney W. Grimes.Fn fts_read
36058f0484fSRodney W. Grimesare attempted.
36158f0484fSRodney W. GrimesThe
36258f0484fSRodney W. Grimes.Fa fts_name
36358f0484fSRodney W. Grimesfield is always
364df37b71cSJames Raynard.Dv NUL Ns -terminated .
36558f0484fSRodney W. Grimes.Sh FTS_OPEN
36658f0484fSRodney W. GrimesThe
36758f0484fSRodney W. Grimes.Fn fts_open
36858f0484fSRodney W. Grimesfunction takes a pointer to an array of character pointers naming one
36958f0484fSRodney W. Grimesor more paths which make up a logical file hierarchy to be traversed.
37058f0484fSRodney W. GrimesThe array must be terminated by a
37158f0484fSRodney W. Grimes.Dv NULL
37258f0484fSRodney W. Grimespointer.
37358f0484fSRodney W. Grimes.Pp
37458f0484fSRodney W. GrimesThere are
37558f0484fSRodney W. Grimesa number of options, at least one of which (either
37658f0484fSRodney W. Grimes.Dv FTS_LOGICAL
37758f0484fSRodney W. Grimesor
37858f0484fSRodney W. Grimes.Dv FTS_PHYSICAL )
37958f0484fSRodney W. Grimesmust be specified.
38058f0484fSRodney W. GrimesThe options are selected by
38158f0484fSRodney W. Grimes.Em or Ns 'ing
38258f0484fSRodney W. Grimesthe following values:
38358f0484fSRodney W. Grimes.Bl -tag -width "FTS_PHYSICAL"
38458f0484fSRodney W. Grimes.It Dv FTS_COMFOLLOW
38558f0484fSRodney W. GrimesThis option causes any symbolic link specified as a root path to be
38658f0484fSRodney W. Grimesfollowed immediately whether or not
38758f0484fSRodney W. Grimes.Dv FTS_LOGICAL
38858f0484fSRodney W. Grimesis also specified.
38958f0484fSRodney W. Grimes.It Dv FTS_LOGICAL
39058f0484fSRodney W. GrimesThis option causes the
3913b8ecdbbSRuslan Ermilov.Nm
39258f0484fSRodney W. Grimesroutines to return
3932efeeba5SRuslan Ermilov.Vt FTSENT
39458f0484fSRodney W. Grimesstructures for the targets of symbolic links
39558f0484fSRodney W. Grimesinstead of the symbolic links themselves.
39658f0484fSRodney W. GrimesIf this option is set, the only symbolic links for which
3972efeeba5SRuslan Ermilov.Vt FTSENT
39858f0484fSRodney W. Grimesstructures
39958f0484fSRodney W. Grimesare returned to the application are those referencing non-existent files.
40058f0484fSRodney W. GrimesEither
40158f0484fSRodney W. Grimes.Dv FTS_LOGICAL
40258f0484fSRodney W. Grimesor
40358f0484fSRodney W. Grimes.Dv FTS_PHYSICAL
40458f0484fSRodney W. Grimes.Em must
40558f0484fSRodney W. Grimesbe provided to the
40658f0484fSRodney W. Grimes.Fn fts_open
40758f0484fSRodney W. Grimesfunction.
40858f0484fSRodney W. Grimes.It Dv FTS_NOCHDIR
409012df285SJilles TjoelkerTo allow descending to arbitrary depths
410012df285SJilles Tjoelker(independent of
411012df285SJilles Tjoelker.Brq Dv PATH_MAX )
412012df285SJilles Tjoelkerand improve performance, the
4133b8ecdbbSRuslan Ermilov.Nm
41458f0484fSRodney W. Grimesfunctions change directories as they walk the file hierarchy.
41558f0484fSRodney W. GrimesThis has the side-effect that an application cannot rely on being
41658f0484fSRodney W. Grimesin any particular directory during the traversal.
41758f0484fSRodney W. GrimesThe
41858f0484fSRodney W. Grimes.Dv FTS_NOCHDIR
419012df285SJilles Tjoelkeroption turns off this feature, and the
4203b8ecdbbSRuslan Ermilov.Nm
42158f0484fSRodney W. Grimesfunctions will not change the current directory.
42258f0484fSRodney W. GrimesNote that applications should not themselves change their current directory
42358f0484fSRodney W. Grimesand try to access files unless
42458f0484fSRodney W. Grimes.Dv FTS_NOCHDIR
42558f0484fSRodney W. Grimesis specified and absolute
42658f0484fSRodney W. Grimespathnames were provided as arguments to
42758f0484fSRodney W. Grimes.Fn fts_open .
42858f0484fSRodney W. Grimes.It Dv FTS_NOSTAT
42958f0484fSRodney W. GrimesBy default, returned
4302efeeba5SRuslan Ermilov.Vt FTSENT
43158f0484fSRodney W. Grimesstructures reference file characteristic information (the
43258f0484fSRodney W. Grimes.Fa statp
43358f0484fSRodney W. Grimesfield) for each file visited.
43458f0484fSRodney W. GrimesThis option relaxes that requirement as a performance optimization,
43558f0484fSRodney W. Grimesallowing the
4363b8ecdbbSRuslan Ermilov.Nm
43758f0484fSRodney W. Grimesfunctions to set the
43858f0484fSRodney W. Grimes.Fa fts_info
43958f0484fSRodney W. Grimesfield to
44058f0484fSRodney W. Grimes.Dv FTS_NSOK
44158f0484fSRodney W. Grimesand leave the contents of the
44258f0484fSRodney W. Grimes.Fa statp
44358f0484fSRodney W. Grimesfield undefined.
44458f0484fSRodney W. Grimes.It Dv FTS_PHYSICAL
44558f0484fSRodney W. GrimesThis option causes the
4463b8ecdbbSRuslan Ermilov.Nm
44758f0484fSRodney W. Grimesroutines to return
4482efeeba5SRuslan Ermilov.Vt FTSENT
44958f0484fSRodney W. Grimesstructures for symbolic links themselves instead
45058f0484fSRodney W. Grimesof the target files they point to.
45158f0484fSRodney W. GrimesIf this option is set,
4522efeeba5SRuslan Ermilov.Vt FTSENT
45358f0484fSRodney W. Grimesstructures for all symbolic links in the
45458f0484fSRodney W. Grimeshierarchy are returned to the application.
45558f0484fSRodney W. GrimesEither
45658f0484fSRodney W. Grimes.Dv FTS_LOGICAL
45758f0484fSRodney W. Grimesor
45858f0484fSRodney W. Grimes.Dv FTS_PHYSICAL
45958f0484fSRodney W. Grimes.Em must
46058f0484fSRodney W. Grimesbe provided to the
46158f0484fSRodney W. Grimes.Fn fts_open
46258f0484fSRodney W. Grimesfunction.
46358f0484fSRodney W. Grimes.It Dv FTS_SEEDOT
46458f0484fSRodney W. GrimesBy default, unless they are specified as path arguments to
46558f0484fSRodney W. Grimes.Fn fts_open ,
46658f0484fSRodney W. Grimesany files named
46742635956SRuslan Ermilov.Ql .\&
46858f0484fSRodney W. Grimesor
46942635956SRuslan Ermilov.Ql ..\&
47058f0484fSRodney W. Grimesencountered in the file hierarchy are ignored.
47158f0484fSRodney W. GrimesThis option causes the
4723b8ecdbbSRuslan Ermilov.Nm
47358f0484fSRodney W. Grimesroutines to return
4742efeeba5SRuslan Ermilov.Vt FTSENT
47558f0484fSRodney W. Grimesstructures for them.
47658f0484fSRodney W. Grimes.It Dv FTS_XDEV
47758f0484fSRodney W. GrimesThis option prevents
4783b8ecdbbSRuslan Ermilov.Nm
47958f0484fSRodney W. Grimesfrom descending into directories that have a different device number
48058f0484fSRodney W. Grimesthan the file from which the descent began.
48158f0484fSRodney W. Grimes.El
48258f0484fSRodney W. Grimes.Pp
48358f0484fSRodney W. GrimesThe argument
48458f0484fSRodney W. Grimes.Fn compar
48558f0484fSRodney W. Grimesspecifies a user-defined function which may be used to order the traversal
48658f0484fSRodney W. Grimesof the hierarchy.
48758f0484fSRodney W. GrimesIt
48858f0484fSRodney W. Grimestakes two pointers to pointers to
4892efeeba5SRuslan Ermilov.Vt FTSENT
49058f0484fSRodney W. Grimesstructures as arguments and
49158f0484fSRodney W. Grimesshould return a negative value, zero, or a positive value to indicate
49258f0484fSRodney W. Grimesif the file referenced by its first argument comes before, in any order
49358f0484fSRodney W. Grimeswith respect to, or after, the file referenced by its second argument.
49458f0484fSRodney W. GrimesThe
49558f0484fSRodney W. Grimes.Fa fts_accpath ,
49658f0484fSRodney W. Grimes.Fa fts_path
49758f0484fSRodney W. Grimesand
49858f0484fSRodney W. Grimes.Fa fts_pathlen
49958f0484fSRodney W. Grimesfields of the
5002efeeba5SRuslan Ermilov.Vt FTSENT
50158f0484fSRodney W. Grimesstructures may
50258f0484fSRodney W. Grimes.Em never
50358f0484fSRodney W. Grimesbe used in this comparison.
50458f0484fSRodney W. GrimesIf the
50558f0484fSRodney W. Grimes.Fa fts_info
50658f0484fSRodney W. Grimesfield is set to
50758f0484fSRodney W. Grimes.Dv FTS_NS
50858f0484fSRodney W. Grimesor
50958f0484fSRodney W. Grimes.Dv FTS_NSOK ,
51058f0484fSRodney W. Grimesthe
51158f0484fSRodney W. Grimes.Fa fts_statp
51258f0484fSRodney W. Grimesfield may not either.
51358f0484fSRodney W. GrimesIf the
51458f0484fSRodney W. Grimes.Fn compar
51558f0484fSRodney W. Grimesargument is
51658f0484fSRodney W. Grimes.Dv NULL ,
51758f0484fSRodney W. Grimesthe directory traversal order is in the order listed in
51858f0484fSRodney W. Grimes.Fa path_argv
51958f0484fSRodney W. Grimesfor the root paths, and in the order listed in the directory for
52058f0484fSRodney W. Grimeseverything else.
52158f0484fSRodney W. Grimes.Sh FTS_READ
52258f0484fSRodney W. GrimesThe
52358f0484fSRodney W. Grimes.Fn fts_read
52458f0484fSRodney W. Grimesfunction returns a pointer to an
5252efeeba5SRuslan Ermilov.Vt FTSENT
52658f0484fSRodney W. Grimesstructure describing a file in
52758f0484fSRodney W. Grimesthe hierarchy.
52858f0484fSRodney W. GrimesDirectories (that are readable and do not cause cycles) are visited at
52958f0484fSRodney W. Grimesleast twice, once in pre-order and once in post-order.
53058f0484fSRodney W. GrimesAll other files are visited at least once.
53158f0484fSRodney W. Grimes(Hard links between directories that do not cause cycles or symbolic
53258f0484fSRodney W. Grimeslinks to symbolic links may cause files to be visited more than once,
53358f0484fSRodney W. Grimesor directories more than twice.)
53458f0484fSRodney W. Grimes.Pp
53558f0484fSRodney W. GrimesIf all the members of the hierarchy have been returned,
53658f0484fSRodney W. Grimes.Fn fts_read
53758f0484fSRodney W. Grimesreturns
53858f0484fSRodney W. Grimes.Dv NULL
53958f0484fSRodney W. Grimesand sets the external variable
54058f0484fSRodney W. Grimes.Va errno
54158f0484fSRodney W. Grimesto 0.
54258f0484fSRodney W. GrimesIf an error unrelated to a file in the hierarchy occurs,
54358f0484fSRodney W. Grimes.Fn fts_read
54458f0484fSRodney W. Grimesreturns
54558f0484fSRodney W. Grimes.Dv NULL
54658f0484fSRodney W. Grimesand sets
54758f0484fSRodney W. Grimes.Va errno
54858f0484fSRodney W. Grimesappropriately.
54958f0484fSRodney W. GrimesIf an error related to a returned file occurs, a pointer to an
5502efeeba5SRuslan Ermilov.Vt FTSENT
55158f0484fSRodney W. Grimesstructure is returned, and
55258f0484fSRodney W. Grimes.Va errno
55358f0484fSRodney W. Grimesmay or may not have been set (see
55458f0484fSRodney W. Grimes.Fa fts_info ) .
55558f0484fSRodney W. Grimes.Pp
55658f0484fSRodney W. GrimesThe
5572efeeba5SRuslan Ermilov.Vt FTSENT
55858f0484fSRodney W. Grimesstructures returned by
55958f0484fSRodney W. Grimes.Fn fts_read
56058f0484fSRodney W. Grimesmay be overwritten after a call to
56158f0484fSRodney W. Grimes.Fn fts_close
56258f0484fSRodney W. Grimeson the same file hierarchy stream, or, after a call to
56358f0484fSRodney W. Grimes.Fn fts_read
56458f0484fSRodney W. Grimeson the same file hierarchy stream unless they represent a file of type
56558f0484fSRodney W. Grimesdirectory, in which case they will not be overwritten until after a call to
56658f0484fSRodney W. Grimes.Fn fts_read
56758f0484fSRodney W. Grimesafter the
5682efeeba5SRuslan Ermilov.Vt FTSENT
56958f0484fSRodney W. Grimesstructure has been returned by the function
57058f0484fSRodney W. Grimes.Fn fts_read
57158f0484fSRodney W. Grimesin post-order.
57258f0484fSRodney W. Grimes.Sh FTS_CHILDREN
57358f0484fSRodney W. GrimesThe
57458f0484fSRodney W. Grimes.Fn fts_children
57558f0484fSRodney W. Grimesfunction returns a pointer to an
5762efeeba5SRuslan Ermilov.Vt FTSENT
57758f0484fSRodney W. Grimesstructure describing the first entry in a NULL-terminated linked list of
57858f0484fSRodney W. Grimesthe files in the directory represented by the
5792efeeba5SRuslan Ermilov.Vt FTSENT
58058f0484fSRodney W. Grimesstructure most recently returned by
58158f0484fSRodney W. Grimes.Fn fts_read .
58258f0484fSRodney W. GrimesThe list is linked through the
58358f0484fSRodney W. Grimes.Fa fts_link
58458f0484fSRodney W. Grimesfield of the
5852efeeba5SRuslan Ermilov.Vt FTSENT
58658f0484fSRodney W. Grimesstructure, and is ordered by the user-specified comparison function, if any.
58758f0484fSRodney W. GrimesRepeated calls to
58858f0484fSRodney W. Grimes.Fn fts_children
58958f0484fSRodney W. Grimeswill recreate this linked list.
59058f0484fSRodney W. Grimes.Pp
59158f0484fSRodney W. GrimesAs a special case, if
59258f0484fSRodney W. Grimes.Fn fts_read
59358f0484fSRodney W. Grimeshas not yet been called for a hierarchy,
59458f0484fSRodney W. Grimes.Fn fts_children
59558f0484fSRodney W. Grimeswill return a pointer to the files in the logical directory specified to
59658f0484fSRodney W. Grimes.Fn fts_open ,
5971a0a9345SRuslan Ermilovi.e., the arguments specified to
59858f0484fSRodney W. Grimes.Fn fts_open .
59958f0484fSRodney W. GrimesOtherwise, if the
6002efeeba5SRuslan Ermilov.Vt FTSENT
60158f0484fSRodney W. Grimesstructure most recently returned by
60258f0484fSRodney W. Grimes.Fn fts_read
60358f0484fSRodney W. Grimesis not a directory being visited in pre-order,
60458f0484fSRodney W. Grimesor the directory does not contain any files,
60558f0484fSRodney W. Grimes.Fn fts_children
60658f0484fSRodney W. Grimesreturns
60758f0484fSRodney W. Grimes.Dv NULL
60858f0484fSRodney W. Grimesand sets
60958f0484fSRodney W. Grimes.Va errno
61058f0484fSRodney W. Grimesto zero.
61158f0484fSRodney W. GrimesIf an error occurs,
61258f0484fSRodney W. Grimes.Fn fts_children
61358f0484fSRodney W. Grimesreturns
61458f0484fSRodney W. Grimes.Dv NULL
61558f0484fSRodney W. Grimesand sets
61658f0484fSRodney W. Grimes.Va errno
61758f0484fSRodney W. Grimesappropriately.
61858f0484fSRodney W. Grimes.Pp
61958f0484fSRodney W. GrimesThe
6202efeeba5SRuslan Ermilov.Vt FTSENT
62158f0484fSRodney W. Grimesstructures returned by
62258f0484fSRodney W. Grimes.Fn fts_children
62358f0484fSRodney W. Grimesmay be overwritten after a call to
62458f0484fSRodney W. Grimes.Fn fts_children ,
62558f0484fSRodney W. Grimes.Fn fts_close
62658f0484fSRodney W. Grimesor
62758f0484fSRodney W. Grimes.Fn fts_read
62858f0484fSRodney W. Grimeson the same file hierarchy stream.
62958f0484fSRodney W. Grimes.Pp
63058f0484fSRodney W. Grimes.Em Option
63158f0484fSRodney W. Grimesmay be set to the following value:
63258f0484fSRodney W. Grimes.Bl -tag -width FTS_NAMEONLY
63358f0484fSRodney W. Grimes.It Dv FTS_NAMEONLY
63458f0484fSRodney W. GrimesOnly the names of the files are needed.
63558f0484fSRodney W. GrimesThe contents of all the fields in the returned linked list of structures
63658f0484fSRodney W. Grimesare undefined with the exception of the
63758f0484fSRodney W. Grimes.Fa fts_name
63858f0484fSRodney W. Grimesand
63958f0484fSRodney W. Grimes.Fa fts_namelen
64058f0484fSRodney W. Grimesfields.
64158f0484fSRodney W. Grimes.El
64258f0484fSRodney W. Grimes.Sh FTS_SET
64358f0484fSRodney W. GrimesThe function
64458f0484fSRodney W. Grimes.Fn fts_set
64558f0484fSRodney W. Grimesallows the user application to determine further processing for the
64658f0484fSRodney W. Grimesfile
64758f0484fSRodney W. Grimes.Fa f
64858f0484fSRodney W. Grimesof the stream
64958f0484fSRodney W. Grimes.Fa ftsp .
65058f0484fSRodney W. GrimesThe
65158f0484fSRodney W. Grimes.Fn fts_set
65258f0484fSRodney W. Grimesfunction
65358f0484fSRodney W. Grimesreturns 0 on success, and \-1 if an error occurs.
65458f0484fSRodney W. Grimes.Em Option
65558f0484fSRodney W. Grimesmust be set to one of the following values:
65658f0484fSRodney W. Grimes.Bl -tag -width FTS_PHYSICAL
65758f0484fSRodney W. Grimes.It Dv FTS_AGAIN
65858f0484fSRodney W. GrimesRe-visit the file; any file type may be re-visited.
65958f0484fSRodney W. GrimesThe next call to
66058f0484fSRodney W. Grimes.Fn fts_read
66158f0484fSRodney W. Grimeswill return the referenced file.
66258f0484fSRodney W. GrimesThe
66358f0484fSRodney W. Grimes.Fa fts_stat
66458f0484fSRodney W. Grimesand
66558f0484fSRodney W. Grimes.Fa fts_info
66658f0484fSRodney W. Grimesfields of the structure will be reinitialized at that time,
66758f0484fSRodney W. Grimesbut no other fields will have been changed.
66858f0484fSRodney W. GrimesThis option is meaningful only for the most recently returned
66958f0484fSRodney W. Grimesfile from
67058f0484fSRodney W. Grimes.Fn fts_read .
67158f0484fSRodney W. GrimesNormal use is for post-order directory visits, where it causes the
67258f0484fSRodney W. Grimesdirectory to be re-visited (in both pre and post-order) as well as all
67358f0484fSRodney W. Grimesof its descendants.
67458f0484fSRodney W. Grimes.It Dv FTS_FOLLOW
67558f0484fSRodney W. GrimesThe referenced file must be a symbolic link.
67658f0484fSRodney W. GrimesIf the referenced file is the one most recently returned by
67758f0484fSRodney W. Grimes.Fn fts_read ,
67858f0484fSRodney W. Grimesthe next call to
67958f0484fSRodney W. Grimes.Fn fts_read
68058f0484fSRodney W. Grimesreturns the file with the
68158f0484fSRodney W. Grimes.Fa fts_info
68258f0484fSRodney W. Grimesand
68358f0484fSRodney W. Grimes.Fa fts_statp
68458f0484fSRodney W. Grimesfields reinitialized to reflect the target of the symbolic link instead
68558f0484fSRodney W. Grimesof the symbolic link itself.
68658f0484fSRodney W. GrimesIf the file is one of those most recently returned by
68758f0484fSRodney W. Grimes.Fn fts_children ,
68858f0484fSRodney W. Grimesthe
68958f0484fSRodney W. Grimes.Fa fts_info
69058f0484fSRodney W. Grimesand
69158f0484fSRodney W. Grimes.Fa fts_statp
69258f0484fSRodney W. Grimesfields of the structure, when returned by
69358f0484fSRodney W. Grimes.Fn fts_read ,
69458f0484fSRodney W. Grimeswill reflect the target of the symbolic link instead of the symbolic link
69558f0484fSRodney W. Grimesitself.
69658f0484fSRodney W. GrimesIn either case, if the target of the symbolic link does not exist the
69758f0484fSRodney W. Grimesfields of the returned structure will be unchanged and the
69858f0484fSRodney W. Grimes.Fa fts_info
69958f0484fSRodney W. Grimesfield will be set to
70058f0484fSRodney W. Grimes.Dv FTS_SLNONE .
70158f0484fSRodney W. Grimes.Pp
70258f0484fSRodney W. GrimesIf the target of the link is a directory, the pre-order return, followed
70358f0484fSRodney W. Grimesby the return of all of its descendants, followed by a post-order return,
70458f0484fSRodney W. Grimesis done.
70558f0484fSRodney W. Grimes.It Dv FTS_SKIP
70658f0484fSRodney W. GrimesNo descendants of this file are visited.
70758f0484fSRodney W. GrimesThe file may be one of those most recently returned by either
70858f0484fSRodney W. Grimes.Fn fts_children
70958f0484fSRodney W. Grimesor
71058f0484fSRodney W. Grimes.Fn fts_read .
71158f0484fSRodney W. Grimes.El
71258f0484fSRodney W. Grimes.Sh FTS_CLOSE
71358f0484fSRodney W. GrimesThe
71458f0484fSRodney W. Grimes.Fn fts_close
71558f0484fSRodney W. Grimesfunction closes a file hierarchy stream
71658f0484fSRodney W. Grimes.Fa ftsp
71758f0484fSRodney W. Grimesand restores the current directory to the directory from which
71858f0484fSRodney W. Grimes.Fn fts_open
71958f0484fSRodney W. Grimeswas called to open
72058f0484fSRodney W. Grimes.Fa ftsp .
72158f0484fSRodney W. GrimesThe
72258f0484fSRodney W. Grimes.Fn fts_close
72358f0484fSRodney W. Grimesfunction
72458f0484fSRodney W. Grimesreturns 0 on success, and \-1 if an error occurs.
72558f0484fSRodney W. Grimes.Sh ERRORS
72658f0484fSRodney W. GrimesThe function
72758f0484fSRodney W. Grimes.Fn fts_open
72858f0484fSRodney W. Grimesmay fail and set
72958f0484fSRodney W. Grimes.Va errno
73058f0484fSRodney W. Grimesfor any of the errors specified for the library functions
73158f0484fSRodney W. Grimes.Xr open 2
73258f0484fSRodney W. Grimesand
73358f0484fSRodney W. Grimes.Xr malloc 3 .
73458f0484fSRodney W. Grimes.Pp
73558f0484fSRodney W. GrimesThe function
73658f0484fSRodney W. Grimes.Fn fts_close
73758f0484fSRodney W. Grimesmay fail and set
73858f0484fSRodney W. Grimes.Va errno
73958f0484fSRodney W. Grimesfor any of the errors specified for the library functions
74058f0484fSRodney W. Grimes.Xr chdir 2
74158f0484fSRodney W. Grimesand
74258f0484fSRodney W. Grimes.Xr close 2 .
74358f0484fSRodney W. Grimes.Pp
74458f0484fSRodney W. GrimesThe functions
74558f0484fSRodney W. Grimes.Fn fts_read
74658f0484fSRodney W. Grimesand
74758f0484fSRodney W. Grimes.Fn fts_children
74858f0484fSRodney W. Grimesmay fail and set
74958f0484fSRodney W. Grimes.Va errno
75058f0484fSRodney W. Grimesfor any of the errors specified for the library functions
75158f0484fSRodney W. Grimes.Xr chdir 2 ,
75258f0484fSRodney W. Grimes.Xr malloc 3 ,
75358f0484fSRodney W. Grimes.Xr opendir 3 ,
75458f0484fSRodney W. Grimes.Xr readdir 3
75558f0484fSRodney W. Grimesand
75658f0484fSRodney W. Grimes.Xr stat 2 .
75758f0484fSRodney W. Grimes.Pp
75858f0484fSRodney W. GrimesIn addition,
75958f0484fSRodney W. Grimes.Fn fts_children ,
76058f0484fSRodney W. Grimes.Fn fts_open
76158f0484fSRodney W. Grimesand
76258f0484fSRodney W. Grimes.Fn fts_set
76358f0484fSRodney W. Grimesmay fail and set
76458f0484fSRodney W. Grimes.Va errno
76558f0484fSRodney W. Grimesas follows:
76658f0484fSRodney W. Grimes.Bl -tag -width Er
76758f0484fSRodney W. Grimes.It Bq Er EINVAL
7688b8a820dSXin LIThe options were invalid, or the list were empty.
76958f0484fSRodney W. Grimes.El
77058f0484fSRodney W. Grimes.Sh SEE ALSO
77158f0484fSRodney W. Grimes.Xr find 1 ,
77258f0484fSRodney W. Grimes.Xr chdir 2 ,
77358f0484fSRodney W. Grimes.Xr stat 2 ,
7741fd0f50aSTim J. Robbins.Xr ftw 3 ,
77558f0484fSRodney W. Grimes.Xr qsort 3
7760d3bcc2eSGarrett Wollman.Sh HISTORY
77758f0484fSRodney W. GrimesThe
7783b8ecdbbSRuslan Ermilov.Nm
7790d3bcc2eSGarrett Wollmaninterface was first introduced in
7800d3bcc2eSGarrett Wollman.Bx 4.4 .
7810d3bcc2eSGarrett WollmanThe
7820d3bcc2eSGarrett Wollman.Fn fts_get_clientptr ,
7830d3bcc2eSGarrett Wollman.Fn fts_get_stream ,
7840d3bcc2eSGarrett Wollmanand
7850d3bcc2eSGarrett Wollman.Fn fts_set_clientptr
7860d3bcc2eSGarrett Wollmanfunctions were introduced in
7870d3bcc2eSGarrett Wollman.Fx 5.0 ,
7880d3bcc2eSGarrett Wollmanprincipally to provide for alternative interfaces to the
7890d3bcc2eSGarrett Wollman.Nm
7900d3bcc2eSGarrett Wollmanfunctionality using different data structures.
791145c674dSJilles Tjoelker.Sh BUGS
792145c674dSJilles TjoelkerThe
793145c674dSJilles Tjoelker.Fn fts_open
794145c674dSJilles Tjoelkerfunction will automatically set the
795145c674dSJilles Tjoelker.Dv FTS_NOCHDIR
796145c674dSJilles Tjoelkeroption if the
797145c674dSJilles Tjoelker.Dv FTS_LOGICAL
798145c674dSJilles Tjoelkeroption is provided, or if it cannot
799145c674dSJilles Tjoelker.Xr open 2
800145c674dSJilles Tjoelkerthe current directory.
801