OSDN Git Service

1eb9cde6ac1ff56645ed850362dbd3561d1125f4
[linuxjm/LDP_man-pages.git] / draft / man3 / fts.3
1 .\"     $NetBSD: fts.3,v 1.13.2.1 1997/11/14 02:09:32 mrg Exp $
2 .\"
3 .\" Copyright (c) 1989, 1991, 1993, 1994
4 .\"     The Regents of the University of California.  All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\"    must display the following acknowledgement:
16 .\"     This product includes software developed by the University of
17 .\"     California, Berkeley and its contributors.
18 .\" 4. Neither the name of the University nor the names of its contributors
19 .\"    may be used to endorse or promote products derived from this software
20 .\"    without specific prior written permission.
21 .\"
22 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" SUCH DAMAGE.
33 .\"
34 .\"     @(#)fts.3       8.5 (Berkeley) 4/16/94
35 .\"
36 .\" 2007-12-08, mtk, Converted from mdoc to man macros
37 .\"
38 .\" Japanese Version Copyright (c) 2000 Yuichi SATO
39 .\"         all rights reserved.
40 .\" Translated Tue Jul 11 19:02:58 JST 2000
41 .\"         by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
42 .\"
43 .\"WORD:        hierarchy               ³¬ÁØ
44 .\"WORD:        traverse                ¤¿¤É¤ë
45 .\"WORD:        pointer                 ¥Ý¥¤¥ó¥¿
46 .\"WORD:        restore                 Éü¸µ¤¹¤ë
47 .\"WORD:        null-terminated         NULL ½ªÃ¼¤µ¤ì¤¿
48 .\"
49 .TH FTS 3 2007-12-28 "Linux" "Linux Programmer's Manual"
50 .\"O .SH NAME
51 .SH Ì¾Á°
52 .\"O fts, fts_open, fts_read, fts_children, fts_set, fts_close \- \
53 .\"O traverse a file hierarchy
54 fts, fts_open, fts_read, fts_children, fts_set, fts_close \- \
55 ¥Õ¥¡¥¤¥ë³¬Áؤò¤¿¤É¤ë
56 .\"O .SH SYNOPSIS
57 .SH ½ñ¼°
58 .nf
59 .B #include <sys/types.h>
60 .B #include <sys/stat.h>
61 .B #include <fts.h>
62 .sp
63 .BI "FTS *fts_open(char * const *" path_argv ", int " options ", "
64 .BI "              int (*" compar ")(const FTSENT **, const FTSENT **));"
65 .sp
66 .BI "FTSENT *fts_read(FTS *" ftsp );
67 .sp
68 .BI "FTSENT *fts_children(FTS *" ftsp ", int " options );
69 .sp
70 .BI "int fts_set(FTS *" ftsp ", FTSENT *" f ", int " options );
71 .sp
72 .BI "int fts_close(FTS *" ftsp );
73 .fi
74 .\"O .SH DESCRIPTION
75 .SH ÀâÌÀ
76 .\"O The
77 .\"O fts functions are provided for traversing
78 .\"O file hierarchies.
79 .\"O A simple overview is that the
80 .\"O .BR fts_open ()
81 .\"O function returns a "handle" on a file hierarchy, which is then supplied to
82 .\"O the other
83 .\"O fts functions.
84 fts ´Ø¿ô·²¤Ï¡¢¥Õ¥¡¥¤¥ë³¬Áؤò¤¿¤É¤ë¤¿¤á¤ËÄ󶡤µ¤ì¤Æ¤¤¤ë¡£
85 ´Êñ¤Ë³µÎ¬¤¹¤ë¤È¼¡¤Î¤è¤¦¤Ë¤Ê¤ë¡£
86 .BR fts_open ()
87 ´Ø¿ô¤Ï¡¢Â¾¤Î fts ´Ø¿ô·²¤ËÅϤ¹¤¿¤á¤Î¡¢¥Õ¥¡¥¤¥ë³¬ÁؤΡ֥ϥó¥É¥ë¡×¤òÊÖ¤¹¡£
88 .\"O The function
89 .\"O .BR fts_read ()
90 .\"O returns a pointer to a structure describing one of the files in the file
91 .\"O hierarchy.
92 .\"O The function
93 .\"O .BR fts_children ()
94 .\"O returns a pointer to a linked list of structures, each of which describes
95 .\"O one of the files contained in a directory in the hierarchy.
96 .\"O In general, directories are visited two distinguishable times; in preorder
97 .\"O (before any of their descendants are visited) and in postorder (after all
98 .\"O of their descendants have been visited).
99 .\"O Files are visited once.
100 .\"O It is possible to walk the hierarchy "logically" (ignoring symbolic links)
101 .\"O or physically (visiting symbolic links), order the walk of the hierarchy or
102 .\"O prune and/or revisit portions of the hierarchy.
103 .BR fts_read ()
104 ´Ø¿ô¤Ï¡¢¥Õ¥¡¥¤¥ë³¬ÁØÃæ¤Ë¤¢¤ë 1 ¤Ä¤Î¥Õ¥¡¥¤¥ë¤òµ­½Ò¤¹¤ë¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
105 .BR fts_children ()
106 ´Ø¿ô¤Ï¡¢³¬ÁØÃæ¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤òµ­½Ò¤¹¤ë¹½Â¤ÂΤÎ
107 ¥ê¥ó¥¯¥ê¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
108 °ìÈ̤˥ǥ£¥ì¥¯¥È¥ê¤Ï¡¢
109 preorder (ÀµÊý¸þ¡§²¼¤Î³¬ÁؤΥǥ£¥ì¥¯¥È¥ê¤ò¤¿¤É¤ëÁ°) ¤È
110 postorder (µÕÊý¸þ¡§²¼¤Î³¬ÁؤΥǥ£¥ì¥¯¥È¥ê¤ò¤¹¤Ù¤Æ¤¿¤É¤Ã¤¿¸å) ¤È¤¤¤¦¡¢
111 °Û¤Ê¤ëÊý¸þ¤Ç 2 ²ó¤¿¤É¤é¤ì¤ë¡£¥Õ¥¡¥¤¥ë¤Ï 1 ²ó¤¿¤É¤é¤ì¤ë¡£
112 ¥Ç¥£¥ì¥¯¥È¥ê³¬Áؤò¡ÖÏÀÍýŪ¤Ë¡×(¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥°¤ò̵»ë¤·¤Æ) °ÜÆ°¤¹¤ë¤³¤È¤â¡¢
113 ʪÍýŪ¤Ë (¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò¤¿¤É¤Ã¤Æ) °ÜÆ°¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¢¤ë¡£
114 ¤Þ¤¿¡¢³¬ÁØÃæ¤Î°ÜÆ°¤ÎÆ»¶Ú¤ò»Ø¼¨¤¹¤ë¤³¤È¡¦
115 ;ʬ¤Ê¤â¤Î¤ò¼è¤ê½ü¤¯¤³¤È¡¦³¬ÁؤΰìÉô¤òºÆ¤Ó¤¿¤É¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£
116 .PP
117 .\"O Two structures are defined (and typedef'd) in the include file
118 .\"O .IR <fts.h> .
119 .\"O The first is
120 .\"O .IR FTS ,
121 .\"O the structure that represents the file hierarchy itself.
122 .\"O The second is
123 .\"O .IR FTSENT ,
124 .\"O the structure that represents a file in the file
125 .\"O hierarchy.
126 .\"O Normally, an
127 .\"O .I FTSENT
128 .\"O structure is returned for every file in the file
129 .\"O hierarchy.
130 .\"O In this manual page, "file" and
131 .\"O "FTSENT structure"
132 .\"O are generally interchangeable.
133 .\"O The
134 .\"O .I FTSENT
135 .\"O structure contains at least the following fields, which are
136 .\"O described in greater detail below:
137 2 ¤Ä¤Î¹½Â¤ÂΤ¬¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
138 .I <fts.h>
139 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë (¤µ¤é¤Ë typedef ¤µ¤ì¤Æ¤¤¤ë)¡£
140 1 ¤ÄÌܤϡ¢¥Õ¥¡¥¤¥ë³¬Áؤ½¤Î¤â¤Î¤òɽ¸½¤¹¤ë
141 .I FTS
142 ¹½Â¤ÂΤǤ¢¤ë¡£
143 2 ¤ÄÌܤϡ¢¥Õ¥¡¥¤¥ë³¬ÁØÃæ¤Î¥Õ¥¡¥¤¥ë¤òɽ¸½¤¹¤ë
144 .I FTSENT
145 ¹½Â¤ÂΤǤ¢¤ë¡£
146 .I FTSENT
147 ¹½Â¤ÂΤÏÄ̾¥Õ¥¡¥¤¥ë³¬ÁØÃæ¤Î¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë¤ËÂФ·¤ÆÊÖ¤µ¤ì¤ë¡£
148 ¤³¤Î man ¥Ú¡¼¥¸¤Ç¤Ï¡¢¡Ö¥Õ¥¡¥¤¥ë¡×¤È
149 .RI ¡Ö FTSENT
150 ¹½Â¤ÂΡפò°ìÈ̤ËÆɤßÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
151 .I FTSENT
152 ¹½Â¤ÂΤϡ¢¾¯¤Ê¤¯¤È¤â¼¡¤Î¤è¤¦¤Ê¥Õ¥£¡¼¥ë¥É¤ò»ý¤Ã¤Æ¤ª¤ê¡¢
153 °Ê²¼¤Ç¤è¤ê¾Ü¤·¤¯ÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¡£
154 .in +4n
155 .nf
156
157 .\"O typedef struct _ftsent {
158 .\"O     unsigned short fts_info;     /* flags for FTSENT structure */
159 .\"O     char          *fts_accpath;  /* access path */
160 .\"O     char          *fts_path;     /* root path */
161 .\"O     short          fts_pathlen;  /* strlen(fts_path) */
162 .\"O     char          *fts_name;     /* filename */
163 .\"O     short          fts_namelen;  /* strlen(fts_name) */
164 .\"O     short          fts_level;    /* depth (\-1 to N) */
165 .\"O     int            fts_errno;    /* file errno */
166 .\"O     long           fts_number;   /* local numeric value */
167 .\"O     void          *fts_pointer;  /* local address value */
168 .\"O     struct ftsent *fts_parent;   /* parent directory */
169 .\"O     struct ftsent *fts_link;     /* next file structure */
170 .\"O     struct ftsent *fts_cycle;    /* cycle structure */
171 .\"O     struct stat   *fts_statp;    /* stat(2) information */
172 .\"O } FTSENT;
173 typedef struct _ftsent {
174     unsigned short fts_info;     /* FTSENT ¹½Â¤ÂΤΤ¿¤á¤Î¥Õ¥é¥° */
175     char          *fts_accpath;  /* ¥¢¥¯¥»¥¹¥Ñ¥¹ */
176     char          *fts_path;     /* ¥ë¡¼¥È¥Ñ¥¹ */
177     short          fts_pathlen;  /* fts_path ¤ÎŤµ */
178     char          *fts_name;     /* ¥Õ¥¡¥¤¥ë̾ */
179     short          fts_namelen;  /* fts_name ¤ÎŤµ */
180     short          fts_level;    /* ¿¼¤µ (\-1 ¡Á N) */
181     int            fts_errno;    /* ¥Õ¥¡¥¤¥ë¤Î¥¨¥é¡¼ÈÖ¹æ */
182     long           fts_number;   /* ¥í¡¼¥«¥ë¤ÊÈÖ¹æ */
183     void          *fts_pointer;  /* ¥í¡¼¥«¥ë¤Ê¥¢¥É¥ì¥¹ÈÖ¹æ */
184     struct ftsent *fts_parent;   /* ¿Æ¥Ç¥£¥ì¥¯¥È¥ê */
185     struct ftsent *fts_link;     /* ¼¡¤Î¥Õ¥¡¥¤¥ë¹½Â¤ÂΠ*/
186     struct ftsent *fts_cycle;    /* ½Û´Ä¤·¤Æ¤¤¤ë¹½Â¤ÂΠ*/
187     struct stat   *fts_statp;    /* stat(2) ¤Î¾ðÊó */
188 } FTSENT;
189 .fi
190 .in
191 .PP
192 .\"O These fields are defined as follows:
193 ¤³¤ì¤é¤Î¥Õ¥£¡¼¥ë¥É¤Ï¡¢¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
194 .\" .Bl -tag -width "fts_namelen"
195 .TP 12
196 .IR fts_info
197 .\"O One of the following flags describing the returned
198 .\"O .I FTSENT
199 .\"O structure and
200 .\"O the file it represents.
201 .\"O With the exception of directories without errors
202 .\"O .RB ( FTS_D ),
203 .\"O all of these
204 .\"O entries are terminal, that is, they will not be revisited, nor will any
205 .\"O of their descendants be visited.
206 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ï¡¢ÊÖ¤µ¤ì¤¿
207 .I FTSENT
208 ¹½Â¤ÂΤȥե¡¥¤¥ë¤òÀâÌÀ¤¹¤ë°Ê²¼¤Î¥Õ¥é¥°¤Î¤¤¤º¤ì¤«¤òɽ¤·¤Æ¤¤¤ë¡£
209 ¥¨¥é¡¼¤Î¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê
210 .RB ( FTS_D ),
211 ¤Î¾ì¹ç¤ÏÎã³°¤È¤·¤Æ¡¢¤½¤ì°Ê³°¤Î¤¹¤Ù¤Æ¤Î¥¨¥ó¥È¥ê¤Ï½ªÃ¼¤Ç¤¢¤ë¡£
212 ¤Ä¤Þ¤ê¡¢¥¨¥ó¥È¥ê¤ÏºÆ¤Ó¤¿¤É¤é¤ì¤ë¤³¤È¤â¤Ê¤¯¡¢
213 ¤½¤ì¤è¤ê²¼¤Î³¬Áؤ¬¤¿¤É¤é¤ì¤ë¤³¤È¤â¤Ê¤¤¡£
214 .\" .Bl  -tag -width FTS_DEFAULT
215 .RS 12
216 .TP 12
217 .BR FTS_D
218 .\"O A directory being visited in preorder.
219 preorder ¤Ç¤¿¤É¤é¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¡£
220 .TP
221 .BR FTS_DC
222 .\"O A directory that causes a cycle in the tree.
223 .\"O (The
224 .\"O .I fts_cycle
225 .\"O field of the
226 .\"O .I FTSENT
227 .\"O structure will be filled in as well.)
228 ¥Ä¥ê¡¼¤ÎÃæ¤Ç½Û´Ä¤·¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê¡£
229 .RI ( FTSENT
230 ¹½Â¤ÂΤÎ
231 .I fts_cycle
232 ¥Õ¥£¡¼¥ë¥É¤âƱÍͤËËä¤á¤é¤ì¤ë¡£)
233 .TP
234 .BR FTS_DEFAULT
235 .\"O Any
236 .\"O .I FTSENT
237 .\"O structure that represents a file type not explicitly described
238 .\"O by one of the other
239 .\"O .I fts_info
240 .\"O values.
241 ¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤òɽ¸½¤¹¤ë
242 .I FTSENT
243 ¹½Â¤ÂΤ¬¡¢
244 .I fts_info
245 ¤Î¾¤Î¤¤¤º¤ì¤«¤ÎÃͤÇÌÀ¼¨Åª¤ËÀâÌÀ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
246 .TP
247 .BR FTS_DNR
248 .\"O A directory which cannot be read.
249 .\"O This is an error return, and the
250 .\"O .I fts_errno
251 .\"O field will be set to indicate what caused the error.
252 Æɤ߹þ¤ß¤¬¤Ç¤­¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê¡£
253 ¤³¤ì¤Ï¥¨¥é¡¼¤Î¾ì¹ç¤ÎÊÖ¤êÃͤǤ¢¤ê¡¢
254 ²¿¤¬¥¨¥é¡¼¤òµ¯¤³¤·¤¿¤«¤ò¼¨¤¹¤¿¤á¤Ë
255 .I fts_errno
256 ¥Õ¥£¡¼¥ë¥É¤¬ÀßÄꤵ¤ì¤ë¡£
257 .TP
258 .BR FTS_DOT
259 .\"O A file named
260 .\"O "."
261 .\"O or
262 .\"O ".."
263 .\"O which was not specified as a filename to
264 .\"O .BR fts_open ()
265 .\"O (see
266 .\"O .BR FTS_SEEDOT ).
267 .BR fts_open ()
268 ¤Ø¤Î¥Õ¥¡¥¤¥ë̾¤È¤·¤Æ»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿
269 "." ¤Þ¤¿¤Ï ".."
270 ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë
271 .RB ( FTS_SEEDOT
272 ¤ò»²¾È¤¹¤ë¤³¤È)¡£
273 .TP
274 .BR FTS_DP
275 .\"O A directory being visited in postorder.
276 .\"O The contents of the
277 .\"O .I FTSENT
278 .\"O structure will be unchanged from when
279 .\"O it was returned in preorder, that is, with the
280 .\"O .I fts_info
281 .\"O field set to
282 .\"O .BR FTS_D .
283 postorder ¤Ç¤¿¤É¤é¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¡£
284 .I FTSENT
285 ¹½Â¤ÂΤÎÆâÍƤϡ¢preorder ¤Î¤È¤­¤ËÊÖ¤µ¤ì¤¿¾õÂÖ
286 (¤Ä¤Þ¤ê¡¢
287 .I fts_info
288 ¥Õ¥£¡¼¥ë¥É¤¬
289 .B FTS_D
290 ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾õÂÖ) ¤«¤éÊѹ¹¤µ¤ì¤Ê¤¤¡£
291 .TP
292 .B FTS_ERR
293 .\"O This is an error return, and the
294 .\"O .I fts_errno
295 .\"O field will be set to indicate what caused the error.
296 ¤³¤ì¤Ï¥¨¥é¡¼¤Î¾ì¹ç¤ÎÊÖ¤êÃͤǤ¢¤ê¡¢
297 .I fts_errno
298 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢²¿¤¬¥¨¥é¡¼¤òµ¯¤³¤·¤¿¤«¤ò¼¨¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
299 .TP
300 .B FTS_F
301 .\"O A regular file.
302 Ä̾ï¤Î¥Õ¥¡¥¤¥ë¡£
303 .TP
304 .B FTS_NS
305 .\"O A file for which no
306 .\"O .BR stat (2)
307 .\"O information was available.
308 .\"O The contents of the
309 .\"O .I fts_statp
310 .\"O field are undefined.
311 .\"O This is an error return, and the
312 .\"O .I fts_errno
313 .\"O field will be set to indicate what caused the error.
314 .BR stat (2)
315 ¾ðÊó¤¬ÆÀ¤é¤ì¤Ê¤«¤Ã¤¿¥Õ¥¡¥¤¥ë¡£
316 .I fts_statp
317 ¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
318 ¤³¤ì¤Ï¥¨¥é¡¼¤Î¾ì¹ç¤ÎÊÖ¤êÃͤǤ¢¤ê¡¢
319 .I fts_errno
320 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢²¿¤¬¥¨¥é¡¼¤òµ¯¤³¤·¤¿¤«¤ò¼¨¤¹ÃͤËÀßÄꤵ¤ì¤ë¡£
321 .TP
322 .B FTS_NSOK
323 .\"O A file for which no
324 .\"O .BR stat (2)
325 .\"O information was requested.
326 .\"O The contents of the
327 .\"O .I fts_statp
328 .\"O field are undefined.
329 .BR stat (2)
330 ¾ðÊó¤¬Í׵ᤵ¤ì¤Ê¤«¤Ã¤¿¥Õ¥¡¥¤¥ë¡£
331 .I fts_statp
332 ¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
333 .TP
334 .B FTS_SL
335 .\"O A symbolic link.
336 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¡£
337 .TP
338 .B FTS_SLNONE
339 .\"O A symbolic link with a non-existent target.
340 .\"O The contents of the
341 .\"O .I fts_statp
342 .\"O field reference the file characteristic information for the symbolic link
343 .\"O itself.
344 ¥ê¥ó¥¯Àè¤Î¸ºß¤·¤Ê¤¤¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¡£
345 .I fts_statp
346 ¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤϡ¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤½¤Î¤â¤Î¤Î¥Õ¥¡¥¤¥ëÆÃÀ­¾ðÊó¤ò»²¾È¤¹¤ë¡£
347 .\" .El
348 .RE
349 .TP
350 .IR fts_accpath
351 .\"O A path for accessing the file from the current directory.
352 ¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤«¤é¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¤Î¥Ñ¥¹¡£
353 .TP
354 .IR fts_path
355 .\"O The path for the file relative to the root of the traversal.
356 .\"O This path contains the path specified to
357 .\"O .BR fts_open ()
358 .\"O as a prefix.
359 ³¬Áؤò¤¿¤É¤ë¤È¤­¤Î¥ë¡¼¥È¤«¤é¤ß¤¿¥Õ¥¡¥¤¥ë¤ÎÁêÂÐŪ¤Ê¥Ñ¥¹¡£
360 ¤³¤Î¥Ñ¥¹¤Ë¤Ï¡¢
361 .BR fts_open ()
362 ¤Ë»ØÄꤷ¤¿¥Ñ¥¹¤¬¥×¥ì¥Õ¥£¥Ã¥¯¥¹¤È¤·¤Æ´Þ¤Þ¤ì¤ë¡£
363 .TP
364 .IR fts_pathlen
365 .\"O The length of the string referenced by
366 .\"O .IR fts_path .
367 .I fts_path
368 ¤Ç»²¾È¤µ¤ì¤ëʸ»úÎó¤ÎŤµ¡£
369 .TP
370 .IR fts_name
371 .\"O The name of the file.
372 ¥Õ¥¡¥¤¥ë¤Î̾Á°¡£
373 .TP
374 .IR fts_namelen
375 .\"O The length of the string referenced by
376 .\"O .IR fts_name .
377 .I fts_name
378 ¤Ç»²¾È¤µ¤ì¤ëʸ»úÎó¤ÎŤµ¡£
379 .TP
380 .IR fts_level
381 .\"O The depth of the traversal, numbered from \-1 to N, where this file
382 .\"O was found.
383 .\"O The
384 .\"O .I FTSENT
385 .\"O structure representing the parent of the starting point (or root)
386 .\"O of the traversal is numbered \-1, and the
387 .\"O .I FTSENT
388 .\"O structure for the root
389 .\"O itself is numbered 0.
390 ³¬Áؤò¤¿¤É¤Ã¤Æ¡¢¤³¤Î¥Õ¥¡¥¤¥ë¤¬¤ß¤Ä¤«¤Ã¤¿¿¼¤µ¡£
391 \-1 ¡Á N ¤Î¿ôÃͤÇɽ¤µ¤ì¤ë¡£
392 ³¬Áؤò¤¿¤É¤ë¤È¤­¤Î½ÐȯÅÀ (¥ë¡¼¥È) ¤Î¿Æ¥Ç¥£¥ì¥¯¥È¥ê¤òɽ¤¹
393 .I FTSENT
394 ¹½Â¤ÂΤǤϠ\-1 ¤È¤Ê¤ë¡£
395 ¤Þ¤¿¡¢¥ë¡¼¥È¼«¿È¤Î
396 .I FTSENT
397 ¹½Â¤ÂΤǤϠ0 ¤Ë¤Ê¤ë¡£
398 .TP
399 .IR fts_errno
400 .\"O Upon return of a
401 .\"O .I FTSENT
402 .\"O structure from the
403 .\"O .BR fts_children ()
404 .\"O or
405 .\"O .BR fts_read ()
406 .\"O functions, with its
407 .\"O .I fts_info
408 .\"O field set to
409 .\"O .BR FTS_DNR ,
410 .\"O .B FTS_ERR
411 .\"O or
412 .\"O .BR FTS_NS ,
413 .\"O the
414 .\"O .I fts_errno
415 .\"O field contains the value of the external variable
416 .\"O .I errno
417 .\"O specifying the cause of the error.
418 .\"O Otherwise, the contents of the
419 .\"O .I fts_errno
420 .\"O field are undefined.
421 ´Ø¿ô
422 .BR fts_children ()
423 ¤È
424 .BR fts_read ()
425 ¤«¤éÊÖ¤µ¤ì¤ë
426 .I FTSENT
427 ¹½Â¤ÂΤÎ
428 .I fts_info
429 ¥Õ¥£¡¼¥ë¥É¤¬
430 .BR FTS_DNR ,
431 .BR FTS_ERR ,
432 .B FTS_NS
433 ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
434 .I fts_errno
435 ¥Õ¥£¡¼¥ë¥É¤Ë¤Ï¥¨¥é¡¼¤Î¸¶°ø¤ò¼¨¤¹³°ÉôÊÑ¿ô
436 .I errno
437 ¤ÎÃͤ¬Æþ¤ë¡£
438 ¤½¤ì°Ê³°¤Î¾ì¹ç¡¢
439 .I fts_errno
440 ¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
441 .TP
442 .IR fts_number
443 .\"O This field is provided for the use of the application program and is
444 .\"O not modified by the
445 .\"O fts functions.
446 .\"O It is initialized to 0.
447 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é»ÈÍѤ¹¤ë¤¿¤á¤ËÄ󶡤µ¤ì¡¢
448 fts ´Ø¿ô·²¤Ç¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
449 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ï 0 ¤Ç½é´ü²½¤µ¤ì¤ë¡£
450 .TP
451 .IR fts_pointer
452 .\"O This field is provided for the use of the application program and is
453 .\"O not modified by the
454 .\"O fts functions.
455 .\"O It is initialized to
456 .\"O .BR NULL .
457 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é»ÈÍѤ¹¤ë¤¿¤á¤ËÄ󶡤µ¤ì¡¢
458 fts ´Ø¿ô·²¤Ç¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
459 ¤³¤Î¥Õ¥£¡¼¥ë¥É¤Ï
460 .B NULL
461 ¤Ç½é´ü²½¤µ¤ì¤ë¡£
462 .TP
463 .IR fts_parent
464 .\"O A pointer to the
465 .\"O .I FTSENT
466 .\"O structure referencing the file in the hierarchy
467 .\"O immediately above the current file, that is, the directory of which this
468 .\"O file is a member.
469 .\"O A parent structure for the initial entry point is provided as well,
470 .\"O however, only the
471 .\"O .IR fts_level ,
472 .\"O .I fts_number
473 .\"O and
474 .\"O .I fts_pointer
475 .\"O fields are guaranteed to be initialized.
476 ¸½ºß¤Î¥Õ¥¡¥¤¥ë¤Î¤¹¤°¾å¤Î³¬Áؤˤ¢¤ë¥Õ¥¡¥¤¥ë
477 (¤Ä¤Þ¤ê¡¢¸½ºß¤Î¥Õ¥¡¥¤¥ë¤¬¥á¥ó¥Ð¡¼¤Ë¤Ê¤Ã¤Æ¤¤¤ë¥Ç¥£¥ì¥¯¥È¥ê) ¤ò»²¾È¤¹¤ë
478 .I FTSENT
479 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¡£
480 ºÇ½é¤Î½ÐȯÅÀ¤ËÂФ·¤Æ¤â¡¢¿Æ¤È¤Ê¤ë¹½Â¤ÂΤÏÍ¿¤¨¤é¤ì¤ë¡£
481 ¤·¤«¤·¡¢
482 .IR fts_level ,
483 .IR fts_number ,
484 .I fts_pointer
485 ¥Õ¥£¡¼¥ë¥É¤Î¤ß¤Î½é´ü²½¤·¤«Êݾڤµ¤ì¤Ê¤¤¡£
486 .TP
487 .IR fts_link
488 .\"O Upon return from the
489 .\"O .BR fts_children ()
490 .\"O function, the
491 .\"O .I fts_link
492 .\"O field points to the next structure in the NULL-terminated linked list of
493 .\"O directory members.
494 .\"O Otherwise, the contents of the
495 .\"O .I fts_link
496 .\"O field are undefined.
497 .BR fts_children ()
498 ¤«¤éÊÖ¤µ¤ì¤ë¾ì¹ç¡¢
499 .I fts_link
500 ¥Õ¥£¡¼¥ë¥É¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥á¥ó¥Ð¡¼¤Î NUL ½ªÃ¼¤µ¤ì¤¿¥ê¥ó¥¯¥ê¥¹¥È¤Î·Á¼°¤Ç¡¢
501 ¼¡¤Î¹½Â¤ÂΤò»Ø¤·¼¨¤¹¡£
502 ¤½¤ì°Ê³°¤Î¾ì¹ç¡¢
503 .I fts_link
504 ¥Õ¥£¡¼¥ë¥É¤ÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
505 .TP
506 .IR fts_cycle
507 .\"O If a directory causes a cycle in the hierarchy (see
508 .\"O .BR FTS_DC ),
509 .\"O either because
510 .\"O of a hard link between two directories, or a symbolic link pointing to a
511 .\"O directory, the
512 .\"O .I fts_cycle
513 .\"O field of the structure will point to the
514 .\"O .I FTSENT
515 .\"O structure in the hierarchy that references the same file as the current
516 .\"O .I FTSENT
517 .\"O structure.
518 .\"O Otherwise, the contents of the
519 .\"O .I fts_cycle
520 .\"O field are undefined.
521 2 ¤Ä¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¥Ï¡¼¥É¥ê¥ó¥¯¤¬Ä¥¤é¤ì¤Æ¤¤¤ë¤¿¤á¡¢
522 ¤Þ¤¿¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬¤¢¤ë¥Ç¥£¥ì¥¯¥È¥ê¤ò»Ø¤·¤Æ¤¤¤ë¤¿¤á¤Ë¡¢
523 ¥Ç¥£¥ì¥¯¥È¥ê¤¬½Û´Ä¤¹¤ë³¬Áع½Â¤¤òºî¤Ã¤Æ¤¤¤ë¾ì¹ç
524 .RB ( FTS_DC
525 ¤ò»²¾È)¡¢
526 ¹½Â¤ÂΤÎ
527 .I fts_cycle
528 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢³¬ÁØÃæ¤Ç¸½ºß¤Î
529 .I FTSENT
530 ¹½Â¤ÂΤÈƱ¤¸¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë
531 .I FTSENT
532 ¹½Â¤ÂΤò»Ø¤·¼¨¤¹¡£
533 ¤½¤ì°Ê³°¤Î¾ì¹ç¡¢
534 .I fts_cycle
535 ¥Õ¥£¡¼¥ë¥É¤ÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
536 .TP
537 .IR fts_statp
538 .\"O A pointer to
539 .\"O .BR stat (2)
540 .\"O information for the file.
541 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î
542 .BR stat (2)
543 ¾ðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
544 .\" .El
545 .PP
546 .\"O A single buffer is used for all of the paths of all of the files in the
547 .\"O file hierarchy.
548 .\"O Therefore, the
549 .\"O .I fts_path
550 .\"O and
551 .\"O .I fts_accpath
552 .\"O fields are guaranteed to be
553 .\"O null-terminated
554 .\"O .I only
555 .\"O for the file most recently returned by
556 .\"O .BR fts_read ().
557 .\"O To use these fields to reference any files represented by other
558 .\"O .I FTSENT
559 .\"O structures will require that the path buffer be modified using the
560 .\"O information contained in that
561 .\"O .I FTSENT
562 .\"O structure's
563 .\"O .I fts_pathlen
564 .\"O field.
565 .\"O Any such modifications should be undone before further calls to
566 .\"O .BR fts_read ()
567 .\"O are attempted.
568 .\"O The
569 .\"O .I fts_name
570 .\"O field is always
571 .\"O null-terminated.
572 ¥Õ¥¡¥¤¥ë³¬ÁØÃæ¤Î¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë¤Î¥Ñ¥¹¤ËÂФ·¤Æ¡¢
573 ¤¿¤À 1 ¤Ä¤Î¥Ð¥Ã¥Õ¥¡¡¼¤¬»È¤ï¤ì¤ë¡£
574 ¤·¤¿¤¬¤Ã¤Æ¡¢
575 .I fts_path
576 ¤È
577 .I fts_accpath
578 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢
579 .BR fts_read ()
580 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤¿ºÇ¤â¿·¤·¤¤¥Õ¥¡¥¤¥ë¤ËÂФ·¤Æ¡Ö¤Î¤ß¡×
581 NULL ½ªÃ¼¤µ¤ì¤ë¤³¤È¤¬Êݾڤµ¤ì¤ë¡£
582 ¤³¤ì¤é¤Î¥Õ¥£¡¼¥ë¥É¤ò¡¢Â¾¤Î
583 .I FTSENT
584 ¹½Â¤ÂΤÇɽ¸½¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ò»²¾È¤¹¤ë¤¿¤á¤Ë»È¤¦¤Ë¤Ï¡¢
585 .I FTSENT
586 ¹½Â¤ÂΤÎ
587 .I fts_pathlen
588 ¥Õ¥£¡¼¥ë¥É¤Ë¤¢¤ë¾ðÊó¤ò»È¤Ã¤Æ¥Ñ¥¹¤Î¥Ð¥Ã¥Õ¥¡¡¼¤ò½¤Àµ¤¹¤ëɬÍפ¬¤¢¤ë¡£
589 ¤³¤ì¤é¤Î½¤Àµ¤Ï¡¢¤µ¤é¤Ë
590 .BR fts_read ()
591 ¤ò¸Æ¤Ó½Ð¤½¤¦¤È¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢¸µ¤ËÌᤷ¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
592 .I fts_name
593 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¾ï¤Ë
594 .B NUL
595 ½ªÃ¼¤µ¤ì¤ë¡£
596 .SS fts_open()
597 .\"O The
598 .\"O .BR fts_open ()
599 .\"O function takes a pointer to an array of character pointers naming one
600 .\"O or more paths which make up a logical file hierarchy to be traversed.
601 .\"O The array must be terminated by a
602 .\"O .B NULL
603 .\"O pointer.
604 .BR fts_open ()
605 ´Ø¿ô¤Ï¡¢Ê¸»úÎó¥Ý¥¤¥ó¥¿¤ÎÇÛÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò°ú¤­¿ô¤Ë¼è¤ë¡£
606 ¤³¤Îʸ»úÎó¥Ý¥¤¥ó¥¿¤Ï¡¢ÏÀÍý¥Õ¥¡¥¤¥ë³¬Áؤò¤Ä¤¯¤ë 1 ¤Ä°Ê¾å¤Î¥Ñ¥¹¤Î̾Á°¤Ë¤Ê¤ë¡£
607 ÇÛÎó¤Ï¡¢
608 .B NULL
609 ¥Ý¥¤¥ó¥¿¤Ç½ªÃ¼¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
610 .PP
611 .\"O There are
612 .\"O a number of options, at least one of which (either
613 .\"O .B FTS_LOGICAL
614 .\"O or
615 .\"O .BR FTS_PHYSICAL )
616 .\"O must be specified.
617 .\"O The options are selected by
618 .\"O .IR or ing
619 .\"O the following values:
620 ¿¤¯¤Î¥ª¥×¥·¥ç¥ó¤¬¤¢¤ê¡¢¾¯¤Ê¤¯¤È¤â 1 ¤Ä
621 .RB ( FTS_LOGICAL
622 ¤Þ¤¿¤Ï
623 .BR FTS_PHYSICAL )
624 ¤¬»ØÄꤵ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
625 ¼¡¤Î¥ª¥×¥·¥ç¥ó¤¬
626 .I or
627 ¤ò¤È¤Ã¤ÆÁªÂò¤µ¤ì¤ë¡£
628 .\" .Bl -tag -width "FTS_PHYSICAL"
629 .TP
630 .B FTS_COMFOLLOW
631 .\"O This option causes any symbolic link specified as a root path to be
632 .\"O followed immediately whether or not
633 .\"O .B FTS_LOGICAL
634 .\"O is also specified.
635 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
636 .B FTS_LOGICAL
637 ¤Î»ØÄê¤Ë¤«¤«¤ï¤é¤º¡¢
638 ¥ë¡¼¥È¥Ñ¥¹¤Ë»ØÄꤵ¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤ò¤¹¤°¤Ë¤¿¤É¤é¤»¤ë¡£
639 .TP
640 .B FTS_LOGICAL
641 .\"O This option causes the
642 .\"O fts routines to return
643 .\"O .I FTSENT
644 .\"O structures for the targets of symbolic links
645 .\"O instead of the symbolic links themselves.
646 .\"O If this option is set, the only symbolic links for which
647 .\"O .I FTSENT
648 .\"O structures
649 .\"O are returned to the application are those referencing non-existent files.
650 .\"O Either
651 .\"O .B FTS_LOGICAL
652 .\"O or
653 .\"O .B FTS_PHYSICAL
654 .\"O .I must
655 .\"O be provided to the
656 .\"O .BR fts_open ()
657 .\"O function.
658 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
659 fts ¥ë¡¼¥Á¥ó¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤½¤Î¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢
660 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬»Ø¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Î
661 .I FTSENT
662 ¹½Â¤ÂΤòÊÖ¤µ¤»¤ë¡£
663 ¤³¤Î¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤¿¾ì¹ç¡¢
664 .I FTSENT
665 ¹½Â¤ÂΤ¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËÊÖ¤µ¤ì¤ë¤è¤¦¤Ê
666 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î¤ß¤¬¡¢Â¸ºß¤·¤Ê¤¤¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
667 .B FTS_LOGICAL
668 ¤Þ¤¿¤Ï
669 .B FTS_PHYSICAL
670 ¤Î¤É¤Á¤é¤«¤ò¡¢
671 .BR fts_open ()
672 ´Ø¿ô¤ËÍ¿¤¨¤Ê¤±¤ì¤Ð¡Ö¤Ê¤é¤Ê¤¤¡×¡£
673 .TP
674 .B FTS_NOCHDIR
675 .\"O As a performance optimization, the
676 .\"O fts functions change directories as they walk the file hierarchy.
677 .\"O This has the side-effect that an application cannot rely on being
678 .\"O in any particular directory during the traversal.
679 .\"O The
680 .\"O .B FTS_NOCHDIR
681 .\"O option turns off this optimization, and the
682 .\"O fts functions will not change the current directory.
683 .\"O Note that applications should not themselves change their current directory
684 .\"O and try to access files unless
685 .\"O .B FTS_NOCHDIR
686 .\"O is specified and absolute
687 .\"O pathnames were provided as arguments to
688 .\"O .BR fts_open ().
689 ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÎºÇŬ²½¤Î¤¿¤á¡¢
690 fts ´Ø¿ô·²¤Ï¥Õ¥¡¥¤¥ë³¬Áؤò¤¿¤É¤ë¤È¤­¥Ç¥£¥ì¥¯¥È¥ê¤òÊѤ¨¤ë¡£
691 ¤³¤ì¤Ë¤Ï¡¢³¬Áؤò¤¿¤É¤Ã¤Æ¤¤¤ë´Ö¤Ï
692 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬¤¢¤ëÆÃÄê¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¤¤ë¤È¤¤¤¦¤³¤È¤Ë
693 °Í¸¤Ç¤­¤Ê¤¤¡¢¤È¤¤¤¦ÉûºîÍѤ¬¤¢¤ë¡£
694 .B FTS_NOCHDIR
695 ¥ª¥×¥·¥ç¥ó¤ÇºÇŬ²½¤ò̵¸ú¤Ë¤¹¤ë¤È¡¢
696 fts ´Ø¿ô·²¤Ï¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤òÊѹ¹¤·¤Ê¤¤¡£
697 .B FTS_NOCHDIR
698 ¤¬»ØÄꤵ¤ì¡¢¤«¤Ä
699 .BR fts_open ()
700 ¤Î°ú¤­¿ô¤È¤·¤ÆÀäÂХѥ¹Ì¾¤¬Í¿¤¨¤é¤ì¤¿¤È¤­°Ê³°¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢
701 ¼«¤é¥«¥ì¥ó¥È¥Ç¥£¥ì¥¯¥È¥ê¤òÊѹ¹¤·¤¿¤ê¡¢
702 ¥Õ¥¡¥¤¥ë¤Ë¥¢¥¯¥»¥¹¤·¤¿¤ê¤¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡¢¤È¤¤¤¦ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
703 .TP
704 .B FTS_NOSTAT
705 .\"O By default, returned
706 .\"O .I FTSENT
707 .\"O structures reference file characteristic information (the
708 .\"O .I statp
709 .\"O field) for each file visited.
710 .\"O This option relaxes that requirement as a performance optimization,
711 .\"O allowing the
712 .\"O fts functions to set the
713 .\"O .I fts_info
714 .\"O field to
715 .\"O .B FTS_NSOK
716 .\"O and leave the contents of the
717 .\"O .I statp
718 .\"O field undefined.
719 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢ÊÖ¤µ¤ì¤¿
720 .I FTSENT
721 ¹½Â¤ÂΤϡ¢¤¿¤É¤é¤ì¤¿³Æ¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¤Î¥Õ¥¡¥¤¥ëÆÃħ¾ðÊó
722 .I ( statp
723 ¥Õ¥£¡¼¥ë¥É) ¤ò»²¾È¤¹¤ë¡£
724 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
725 fts ´Ø¿ô·²¤¬
726 .I fts_info
727 ¥Õ¥£¡¼¥ë¥É¤ò
728 .B FTS_NSOK
729 ¤ËÀßÄꤷ
730 .I statp
731 ¤ÎÆâÍƤòÄêµÁ¤µ¤ì¤Ê¤¤¤Þ¤Þ¤Ë¤¹¤ë¤³¤È¤òµö¤¹¤³¤È¤Ë¤è¤ê¡¢
732 ¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ÎºÇŬ²½¤ËɬÍפʤâ¤Î¤ò´ËϤ¹¤ë¡£
733 .TP
734 .B FTS_PHYSICAL
735 .\"O This option causes the
736 .\"O fts routines to return
737 .\"O .I FTSENT
738 .\"O structures for symbolic links themselves instead
739 .\"O of the target files they point to.
740 .\"O If this option is set,
741 .\"O .I FTSENT
742 .\"O structures for all symbolic links in the
743 .\"O hierarchy are returned to the application.
744 .\"O Either
745 .\"O .B FTS_LOGICAL
746 .\"O or
747 .\"O .B FTS_PHYSICAL
748 .\"O .I must
749 .\"O be provided to the
750 .\"O .BR fts_open ()
751 .\"O function.
752 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
753 fts ¥ë¡¼¥Á¥ó¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬»Ø¤·¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ç¤Ï¤Ê¤¯¡¢
754 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¼«¿È¤Î
755 .I FTSENT
756 ¹½Â¤ÂΤòÊÖ¤µ¤»¤ë¡£
757 ¤³¤Î¥ª¥×¥·¥ç¥ó¤¬ÀßÄꤵ¤ì¤ë¤È¡¢³¬ÁØÃæ¤Î¤¹¤Ù¤Æ¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Î
758 .I FTSENT
759 ¹½Â¤ÂΤ¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ËÊÖ¤µ¤ì¤ë¡£
760 .B FTS_LOGICAL
761 ¤Þ¤¿¤Ï
762 .B FTS_PHYSICAL
763 ¤Î¤É¤Á¤é¤«¤ò
764 .BR fts_open ()
765 ´Ø¿ô¤ËÍ¿¤¨¤Ê¤±¤ì¤Ð¡Ö¤Ê¤é¤Ê¤¤¡×¡£
766 .TP
767 .B FTS_SEEDOT
768 .\"O By default, unless they are specified as path arguments to
769 .\"O .BR fts_open (),
770 .\"O any files named
771 .\"O "."
772 .\"O or
773 .\"O ".."
774 .\"O encountered in the file hierarchy are ignored.
775 .\"O This option causes the
776 .\"O fts routines to return
777 .\"O .I FTSENT
778 .\"O structures for them.
779 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢
780 .BR fts_open ()
781 ¤Î¥Ñ¥¹°ú¤­¿ô¤È¤·¤Æ»ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢¥Õ¥¡¥¤¥ë³¬ÁØÃæ¤Ë¤¢¤ë
782 "." ¤Þ¤¿¤Ï ".." ¤È¤¤¤¦Ì¾Á°¤Î¥Õ¥¡¥¤¥ë¤Ï̵»ë¤µ¤ì¤ë¡£
783 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
784 fts ¥ë¡¼¥Á¥ó¤Ë¤³¤ì¤é¤Î¥Õ¥¡¥¤¥ë¤Î
785 .I FTSENT
786 ¹½Â¤ÂΤòÊÖ¤µ¤»¤ë¡£
787 .TP
788 .B FTS_XDEV
789 .\"O This option prevents
790 .\"O fts from descending into directories that have a different device number
791 .\"O than the file from which the descent began.
792 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
793 fts ¤¬²¼¤ê»Ï¤á¤Î¥Õ¥¡¥¤¥ë¤È¤Ï°Û¤Ê¤ë¥Ç¥Ð¥¤¥¹ÈÖ¹æ¤ò»ý¤Ã¤Æ¤¤¤ë
794 ¥Ç¥£¥ì¥¯¥È¥ê¤Ë²¼¤ê¤ë¤Î¤òÁ˻ߤ¹¤ë¡£
795 .\" .El
796 .PP
797 .\"O The argument
798 .\"O .BR compar ()
799 .\"O specifies a user-defined function which may be used to order the traversal
800 .\"O of the hierarchy.
801 .\"O It
802 .\"O takes two pointers to pointers to
803 .\"O .I FTSENT
804 .\"O structures as arguments and
805 .\"O should return a negative value, zero, or a positive value to indicate
806 .\"O if the file referenced by its first argument comes before, in any order
807 .\"O with respect to, or after, the file referenced by its second argument.
808 .\"O The
809 .\"O .IR fts_accpath ,
810 .\"O .I fts_path
811 .\"O and
812 .\"O .I fts_pathlen
813 .\"O fields of the
814 .\"O .I FTSENT
815 .\"O structures may
816 .\"O .I never
817 .\"O be used in this comparison.
818 .\"O If the
819 .\"O .I fts_info
820 .\"O field is set to
821 .\"O .B FTS_NS
822 .\"O or
823 .\"O .BR FTS_NSOK ,
824 .\"O the
825 .\"O .I fts_statp
826 .\"O field may not either.
827 .\"O If the
828 .\"O .BR compar ()
829 .\"O argument is
830 .\"O .BR NULL ,
831 .\"O the directory traversal order is in the order listed in
832 .\"O .I path_argv
833 .\"O for the root paths, and in the order listed in the directory for
834 .\"O everything else.
835 °ú¤­¿ô
836 .BR compar ()
837 ¤Ï¡¢³¬Áؤò¤¿¤É¤ë½çÈÖ¤ò·è¤á¤ë¤Î¤Ë»È¤ï¤ì¤ë¥æ¡¼¥¶¡¼ÄêµÁ´Ø¿ô¤ò»ØÄꤹ¤ë¡£
838 ¤³¤Î´Ø¿ô¤Ï¡¢°ú¤­¿ô¤È¤·¤Æ
839 .I FTSENT
840 ¹½Â¤ÂΤΥݥ¤¥ó¥¿¤Î¥Ý¥¤¥ó¥¿¤ò 2 ¤Ä¤È¤ê¡¢
841 1 ÈÖÌܤΰú¤­¿ô¤Ç»²¾È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬
842 2 ÈÖÌܤΰú¤­¿ô¤Ç»²¾È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤è¤ê
843 Á°¤Ë¤¢¤ë¾ì¹ç¤ÏÉé¤ÎÃÍ¡¦Æ±¤¸¾ì¹ç¤Ï¥¼¥í¡¦¸å¤Ë¤¢¤ë¾ì¹ç¤ÏÀµ¤ÎÃͤò
844 ÊÖ¤µ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
845 .I FTSENT
846 ¹½Â¤ÂΤÎ
847 .IR fts_accpath ,
848 .IR fts_path ,
849 .I fts_pathlen
850 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¤³¤ÎÈæ³Ó¤Ë¡ÖÀäÂС׻ȤäƤϤ¤¤±¤Ê¤¤¡£
851 .I fts_info
852 ¥Õ¥£¡¼¥ë¥É¤¬
853 .B FTS_NS
854 ¤Þ¤¿¤Ï
855 .B FTS_NSOK
856 ¤ËÀßÄꤵ¤ì¤ë¾ì¹ç¡¢
857 .I fts_statp
858 ¥Õ¥£¡¼¥ë¥É¤Ï¤³¤ì¤é¤Î¤É¤Á¤é¤Ç¤â¤Ê¤¤¡£
859 .BR compar ()
860 °ú¤­¿ô¤¬
861 .B NULL
862 ¤Î¾ì¹ç¡¢¥Ç¥£¥ì¥¯¥È¥ê¤ò¤¿¤É¤ë½çÈ֤ϡ¢¥ë¡¼¥È¥Ñ¥¹¤Ë¤Ä¤¤¤Æ¤Ï
863 .I path_argv
864 ¤Î¤Ê¤«¤Ç¥ê¥¹¥È¤µ¤ì¤¿½çÈ֤ǡ¢
865 ¤½¤Î¾¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¤Ï¥Ç¥£¥ì¥¯¥È¥êÆâ¤Ç¥ê¥¹¥È¤µ¤ì¤¿½çÈ֤Ȥʤ롣
866 .SS fts_read()
867 .\"O The
868 .\"O .BR fts_read ()
869 .\"O function returns a pointer to an
870 .\"O .I FTSENT
871 .\"O structure describing a file in
872 .\"O the hierarchy.
873 .\"O Directories (that are readable and do not cause cycles) are visited at
874 .\"O least twice, once in preorder and once in postorder.
875 .\"O All other files are visited at least once.
876 .\"O (Hard links between directories that do not cause cycles or symbolic
877 .\"O links to symbolic links may cause files to be visited more than once,
878 .\"O or directories more than twice.)
879 .BR fts_read ()
880 ´Ø¿ô¤Ï¡¢³¬ÁØÃæ¤Î¥Õ¥¡¥¤¥ë¤òµ­½Ò¤¹¤ë
881 .I FTSENT
882 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
883 (Æɤ߹þ¤ß²Äǽ¤Ç¡¢½Û´Ä¤·¤Æ¤¤¤Ê¤¤) ¥Ç¥£¥ì¥¯¥È¥ê¤Ï¡¢
884 1 ²ó¤Ï preorder ¤Ç¡¢¤â¤¦ 1 ²ó¤Ï postorder ¤Ç¡¢¾¯¤Ê¤¯¤È¤â 2 ²ó¤¿¤É¤é¤ì¤ë¡£
885 ¾¤Î¥Õ¥¡¥¤¥ë¤Ï¡¢¾¯¤Ê¤¯¤È¤â 1 ²ó¤¿¤É¤é¤ì¤ë¡£
886 (¥Ç¥£¥ì¥¯¥È¥ê´Ö¤Î¥Ï¡¼¥É¥ê¥ó¥¯¤Ë¤è¤Ã¤Æ
887 ½Û´Ä¤ä¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ø¤Î¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬µ¯¤³¤é¤Ê¤¤¾ì¹ç¡¢
888 ¥Õ¥¡¥¤¥ë¤Ï 2 ²ó°Ê¾å¡¢¥Ç¥£¥ì¥¯¥È¥ê¤Ï 3 ²ó°Ê¾å¤¿¤É¤é¤ì¤ë¡£)
889 .PP
890 .\"O If all the members of the hierarchy have been returned,
891 .\"O .BR fts_read ()
892 .\"O returns
893 .\"O .B NULL
894 .\"O and sets the external variable
895 .\"O .I errno
896 .\"O to 0.
897 .\"O If an error unrelated to a file in the hierarchy occurs,
898 .\"O .BR fts_read ()
899 .\"O returns
900 .\"O .B NULL
901 .\"O and sets
902 .\"O .I errno
903 .\"O appropriately.
904 .\"O If an error related to a returned file occurs, a pointer to an
905 .\"O .I FTSENT
906 .\"O structure is returned, and
907 .\"O .I errno
908 .\"O may or may not have been set (see
909 .\"O .IR fts_info ).
910 ³¬ÁØÃæ¤Î¤¹¤Ù¤Æ¤Î¥á¥ó¥Ð¡¼¤¬ÊÖ¤µ¤ì¤¿¾ì¹ç¡¢
911 .BR fts_read ()
912 ¤Ï
913 .B NULL
914 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô
915 .I errno
916 ¤ò 0 ¤Ë¤¹¤ë¡£
917 ³¬ÁØÃæ¤Î¥Õ¥¡¥¤¥ë¤Ë´Ø·¸¤·¤Ê¤¤¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¡¢
918 .BR fts_read ()
919 ¤Ï
920 .B NULL
921 ¤òÊÖ¤·¡¢
922 .I errno
923 ¤ò¥¨¥é¡¼¤ËÂбþ¤·¤¿Ãͤˤ¹¤ë¡£
924 ³¬ÁØÃæ¤Î¥Õ¥¡¥¤¥ë¤Ë´Ø·¸¤·¤¿¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¡¢
925 .I FTSENT
926 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤¬ÊÖ¤µ¤ì¡¢
927 .I errno
928 ¤ÏÀßÄꤵ¤ì¤ë¾ì¹ç¤ÈÀßÄꤵ¤ì¤Ê¤¤¾ì¹ç¤¬¤¢¤ë
929 .RI ( fts_info
930 ¤ò»²¾È¤¹¤ë¤³¤È)¡£
931 .PP
932 .\"O The
933 .\"O .I FTSENT
934 .\"O structures returned by
935 .\"O .BR fts_read ()
936 .\"O may be overwritten after a call to
937 .\"O .BR fts_close ()
938 .\"O on the same file hierarchy stream, or, after a call to
939 .\"O .BR fts_read ()
940 .\"O on the same file hierarchy stream unless they represent a file of type
941 .\"O directory, in which case they will not be overwritten until after a call to
942 .\"O .BR fts_read ()
943 .\"O after the
944 .\"O .I FTSENT
945 .\"O structure has been returned by the function
946 .\"O .BR fts_read ()
947 .\"O in postorder.
948 .BR fts_read ()
949 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤ë
950 .I FTSENT
951 ¹½Â¤ÂΤϡ¢Æ±¤¸¥Õ¥¡¥¤¥ë³¬ÁØ¥¹¥È¥ê¡¼¥à¤Ø¤Î
952 .BR fts_close ()
953 ¤Î¸Æ½Ð¤·¤Î¸å¤Ë¾å½ñ¤­¤µ¤ì¤ë¡£
954 ¤Þ¤¿¡¢Æ±¤¸¥Õ¥¡¥¤¥ë³¬ÁØ¥¹¥È¥ê¡¼¥à¤Ø¤Î
955 .BR fts_read ()
956 ¤Î¸Æ½Ð¤·¤Î¸å¤Ç¤â¡¢¹½Â¤ÂΤ¬¥Ç¥£¥ì¥¯¥È¥ê¤òɽ¸½¤·¤Æ¤¤¤Ê¤¤¸Â¤ê¾å½ñ¤­¤µ¤ì¤ë¡£
957 ¤³¤Î¾ì¹ç¡¢
958 .BR fts_read ()
959 ´Ø¿ô¤Ë¤è¤Ã¤Æ postorder ¤Ç
960 .I FTSENT
961 ¹½Â¤ÂΤ¬ÊÖ¤µ¤ì¤¿¸å¡¢
962 .BR fts_read ()
963 ¤Î¸Æ½Ð¤·¤¬¤¢¤ë¤Þ¤Ç¡¢
964 ¤³¤ì¤é¤Î¹½Â¤ÂΤϾå½ñ¤­¤µ¤ì¤Ê¤¤¡£
965 .SS fts_children()
966 .\"O The
967 .\"O .BR fts_children ()
968 .\"O function returns a pointer to an
969 .\"O .I FTSENT
970 .\"O structure describing the first entry in a NULL-terminated linked list of
971 .\"O the files in the directory represented by the
972 .\"O .I FTSENT
973 .\"O structure most recently returned by
974 .\"O .BR fts_read ().
975 .\"O The list is linked through the
976 .\"O .I fts_link
977 .\"O field of the
978 .\"O .I FTSENT
979 .\"O structure, and is ordered by the user-specified comparison function, if any.
980 .\"O Repeated calls to
981 .\"O .BR fts_children ()
982 .\"O will recreate this linked list.
983 .BR fts_children ()
984 ´Ø¿ô¤Ï¡¢
985 .I FTSENT
986 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤òÊÖ¤¹¡£
987 ¤³¤Î¹½Â¤ÂΤϡ¢(
988 .BR fts_read ()
989 ¤ÇºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿
990 .I FTSENT
991 ¹½Â¤ÂΤÇɽ¸½¤µ¤ì¤ë¥Ç¥£¥ì¥¯¥È¥ê¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤Î)
992 NUL ½ªÃ¼¤µ¤ì¤¿¥ê¥ó¥¯¥ê¥¹¥È¤ÎºÇ½é¤Î¥¨¥ó¥È¥ê¤òµ­½Ò¤¹¤ë¡£
993 ¤³¤Î¥ê¥¹¥È¤Ï¡¢
994 .I FTSENT
995 ¹½Â¤ÂΤÎ
996 .I fts_link
997 ¥Õ¥£¡¼¥ë¥É¤ò»È¤Ã¤Æ¥ê¥ó¥¯¤µ¤ì¡¢
998 ¥æ¡¼¥¶¡¼»ØÄê¤ÎÈæ³Ó´Ø¿ô¤¬¤¢¤ë¾ì¹ç¤Ï¡¢¤½¤ì¤Ç½ç½ø¤Å¤±¤é¤ì¤ë¡£
999 .BR fts_children ()
1000 ¤Î¸Æ½Ð¤·¤ò·«¤êÊÖ¤¹¤³¤È¤Ç¡¢
1001 ¤³¤Î¥ê¥ó¥¯¥ê¥¹¥È¤ÏºÆÀ¸À®¤µ¤ì¤ë¡£
1002 .PP
1003 .\"O As a special case, if
1004 .\"O .BR fts_read ()
1005 .\"O has not yet been called for a hierarchy,
1006 .\"O .BR fts_children ()
1007 .\"O will return a pointer to the files in the logical directory specified to
1008 .\"O .BR fts_open (),
1009 .\"O that is, the arguments specified to
1010 .\"O .BR fts_open ().
1011 .\"O Otherwise, if the
1012 .\"O .I FTSENT
1013 .\"O structure most recently returned by
1014 .\"O .BR fts_read ()
1015 .\"O is not a directory being visited in preorder,
1016 .\"O or the directory does not contain any files,
1017 .\"O .BR fts_children ()
1018 .\"O returns
1019 .\"O .B NULL
1020 .\"O and sets
1021 .\"O .I errno
1022 .\"O to zero.
1023 .\"O If an error occurs,
1024 .\"O .BR fts_children ()
1025 .\"O returns
1026 .\"O .B NULL
1027 .\"O and sets
1028 .\"O .I errno
1029 .\"O appropriately.
1030 ÆÃÊ̤ʾì¹ç¤È¤·¤Æ¡¢
1031 .BR fts_read ()
1032 ¤¬¥Õ¥¡¥¤¥ë³¬ÁؤˤĤ¤¤Æ¸Æ¤Ð¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
1033 .BR fts_children ()
1034 ¤Ï
1035 .BR fts_open ()
1036 ¤Ë»ØÄꤵ¤ì¤¿ÏÀÍý¥Ç¥£¥ì¥¯¥È¥ê (¤Ä¤Þ¤ê¡¢
1037 .BR fts_open ()
1038 ¤Ë»ØÄꤵ¤ì¤¿°ú¤­¿ô) ¤ÎÃæ¤Ë¤¢¤ë¥Õ¥¡¥¤¥ë¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
1039 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ç¡¢
1040 .BR fts_read ()
1041 ¤Ë¤è¤Ã¤ÆºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿
1042 .I FTSENT
1043 ¹½Â¤ÂΤ¬ preorder ¤Ç¤¿¤É¤é¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤Ç¤Ê¤¤¾ì¹ç¤ä
1044 ²¿¤â´Þ¤ó¤Ç¤¤¤Ê¤¤¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç¤Ï¡¢
1045 .BR fts_children ()
1046 ¤Ï
1047 .B NULL
1048 ¤òÊÖ¤·¡¢
1049 .I errno
1050 ¤ò 0 ¤Ë¤¹¤ë¡£
1051 ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¡¢
1052 .BR fts_children ()
1053 ¤Ï
1054 .B NULL
1055 ¤òÊÖ¤·¡¢
1056 .I errno
1057 ¤ò¥¨¥é¡¼¤ËÂбþ¤·¤¿Ãͤˤ¹¤ë¡£
1058 .PP
1059 .\"O The
1060 .\"O .I FTSENT
1061 .\"O structures returned by
1062 .\"O .BR fts_children ()
1063 .\"O may be overwritten after a call to
1064 .\"O .BR fts_children (),
1065 .\"O .BR fts_close ()
1066 .\"O or
1067 .\"O .BR fts_read ()
1068 .\"O on the same file hierarchy stream.
1069 .BR fts_children ()
1070 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤ë
1071 .I FTSENT
1072 ¹½Â¤ÂΤϡ¢Æ±¤¸¥Õ¥¡¥¤¥ë³¬ÁØ¥¹¥È¥ê¡¼¥à¤Ø¤Î
1073 .BR fts_children (),
1074 .BR fts_close (),
1075 .BR fts_read ()
1076 ¤Î¸Æ½Ð¤·¤Î¸å¤Ë¾å½ñ¤­¤µ¤ì¤ë¾ì¹ç¤¬¤¢¤ë¡£
1077 .PP
1078 .\"O .I Option
1079 .\"O may be set to the following value:
1080 .I option
1081 ¤Ï¡¢¼¡¤ÎÃͤËÀßÄê¤Ç¤­¤ë¡£
1082 .\" .Bl -tag -width FTS_NAMEONLY
1083 .TP
1084 .B FTS_NAMEONLY
1085 .\"O Only the names of the files are needed.
1086 .\"O The contents of all the fields in the returned linked list of structures
1087 .\"O are undefined with the exception of the
1088 .\"O .I fts_name
1089 .\"O and
1090 .\"O .I fts_namelen
1091 .\"O fields.
1092 ¥Õ¥¡¥¤¥ë̾¤Î¤ß¤¬É¬ÍפȤµ¤ì¤Æ¤¤¤ë¡£
1093 ÊÖ¤µ¤ì¤¿¹½Â¤ÂΤΥê¥ó¥¯¥ê¥¹¥È¤Î
1094 .IR fts_name ,
1095 .I fts_namelen
1096 ¥Õ¥£¡¼¥ë¥É°Ê³°¤Î
1097 ¤¹¤Ù¤Æ¤Î¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤÏÄêµÁ¤µ¤ì¤Ê¤¤¡£
1098 .\" .El
1099 .SS fts_set()
1100 .\"O The function
1101 .\"O .BR fts_set ()
1102 .\"O allows the user application to determine further processing for the
1103 .\"O file
1104 .\"O .I f
1105 .\"O of the stream
1106 .\"O .IR ftsp .
1107 .\"O The
1108 .\"O .BR fts_set ()
1109 .\"O function
1110 .\"O returns 0 on success, and \-1 if an error occurs.
1111 .\"O .I Option
1112 .\"O must be set to one of the following values:
1113 ´Ø¿ô
1114 .BR fts_set ()
1115 ¤Ï¡¢¥æ¡¼¥¶¡¼¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤¬
1116 ¥¹¥È¥ê¡¼¥à
1117 .I ftsp
1118 ¤Î¥Õ¥¡¥¤¥ë
1119 .I f
1120 ¤Ë¤Ä¤¤¤Æ¹¹¤Ê¤ë½èÍý¤ò·èÄꤹ¤ë¤³¤Èµö¤¹¡£
1121 .BR fts_set ()
1122 ´Ø¿ô¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤ò¡¢¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
1123 .I option
1124 ¤Ï¡¢¼¡¤ÎÃͤΤ¤¤º¤ì¤« 1 ¤Ä¤ËÀßÄꤵ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1125 .\" .Bl -tag -width FTS_PHYSICAL
1126 .TP
1127 .B FTS_AGAIN
1128 .\"O Re-visit the file; any file type may be revisited.
1129 .\"O The next call to
1130 .\"O .BR fts_read ()
1131 .\"O will return the referenced file.
1132 .\"O The
1133 .\"O .I fts_stat
1134 .\"O and
1135 .\"O .I fts_info
1136 .\"O fields of the structure will be reinitialized at that time,
1137 .\"O but no other fields will have been changed.
1138 .\"O This option is meaningful only for the most recently returned
1139 .\"O file from
1140 .\"O .BR fts_read ().
1141 .\"O Normal use is for postorder directory visits, where it causes the
1142 .\"O directory to be revisited (in both preorder and postorder) as well as all
1143 .\"O of its descendants.
1144 ¥Õ¥¡¥¤¥ë¤òºÆ¤Ó¤¿¤É¤ë¡£¤¹¤Ù¤Æ¤Î¥Õ¥¡¥¤¥ë¥¿¥¤¥×¤¬ºÆ¤Ó¤¿¤É¤é¤ì¤ë¡£
1145 ¼¡¤Î
1146 .BR fts_read ()
1147 ¤Î¸Æ½Ð¤·¤Ë¤è¤ê¡¢»²¾È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬ÊÖ¤µ¤ì¤ë¡£
1148 ¹½Â¤ÂΤÎ
1149 .IR fts_stat ,
1150 .I fts_info
1151 ¥Õ¥£¡¼¥ë¥É¤Ï¤³¤Î»þ¤Ë½é´ü²½¤µ¤ì¤ë¤¬¡¢Â¾¤Î¥Õ¥£¡¼¥ë¥É¤ÏÊѹ¹¤µ¤ì¤Ê¤¤¡£
1152 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢
1153 .BR fts_read ()
1154 ¤Ë¤è¤Ã¤ÆºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¤Î¤ß°ÕÌ£¤ò»ý¤Ä¡£
1155 Ä̾ï¤Ï¡¢postorder ¤Ç¥Ç¥£¥ì¥¯¥È¥ê¤ò¤¿¤É¤ë¾ì¹ç¤Ë»ÈÍѤ·¡¢
1156 ¤½¤Î²¼¤Î³¬ÁؤÈƱÍͤˡ¢
1157 ¥Ç¥£¥ì¥¯¥È¥ê¤ò (preorder ¤È postorder ¤ÎξÊý¤Ç) ºÆ¤Ó¤¿¤É¤é¤»¤ë¡£
1158 .TP
1159 .B FTS_FOLLOW
1160 .\"O The referenced file must be a symbolic link.
1161 .\"O If the referenced file is the one most recently returned by
1162 .\"O .BR fts_read (),
1163 .\"O the next call to
1164
1165 .\"O .BR fts_read ()
1166 .\"O returns the file with the
1167 .\"O .I fts_info
1168 .\"O and
1169 .\"O .I fts_statp
1170 .\"O fields reinitialized to reflect the target of the symbolic link instead
1171 .\"O of the symbolic link itself.
1172 .\"O If the file is one of those most recently returned by
1173 .\"O .BR fts_children (),
1174 .\"O the
1175 .\"O .I fts_info
1176 .\"O and
1177 .\"O .I fts_statp
1178 .\"O fields of the structure, when returned by
1179 .\"O .BR fts_read (),
1180 .\"O will reflect the target of the symbolic link instead of the symbolic link
1181 .\"O itself.
1182 .\"O In either case, if the target of the symbolic link does not exist the
1183 .\"O fields of the returned structure will be unchanged and the
1184 .\"O .I fts_info
1185 .\"O field will be set to
1186 .\"O .BR FTS_SLNONE .
1187 .\"O .PP
1188 .\"O If the target of the link is a directory, the preorder return, followed
1189 .\"O by the return of all of its descendants, followed by a postorder return,
1190 .\"O is done.
1191 »²¾È¤µ¤ì¤Æ¤ë¥Õ¥¡¥¤¥ë¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1192 »²¾È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤¬
1193 .BR fts_read ()
1194 ¤Ë¤è¤Ã¤ÆºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿¤â¤Î¤Ç¤¢¤ë¾ì¹ç¡¢¼¡¤Î
1195 .BR fts_read ()
1196 ¤Î¸Æ½Ð¤·¤Ç¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤½¤Î¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢
1197 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬»Ø¤·¤Æ¤¤¤ëÀè¤òÈ¿±Ç¤¹¤ë¤è¤¦¤Ë
1198 .IR fts_info ,
1199 .I fts_statp
1200 ¤òºÆ¤Ó½é´ü²½¤·¤¿¥Õ¥¡¥¤¥ë¤¬ÊÖ¤µ¤ì¤ë¡£
1201 ¥Õ¥¡¥¤¥ë¤¬
1202 .BR fts_children ()
1203 ¤Ë¤è¤Ã¤ÆºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿¤â¤Î¤Î 1 ¤Ä¤Ç¤¢¤ë¾ì¹ç¡¢
1204 .BR fts_read ()
1205 ¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¤¿¤È¤­¡¢¹½Â¤ÂΤÎ
1206 .IR fts_info ,
1207 .I fts_statp
1208 ¥Õ¥£¡¼¥ë¥É¤Ï¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤½¤Î¤â¤Î¤Ç¤Ï¤Ê¤¯¡¢
1209 ¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬»Ø¤·¤Æ¤¤¤ëÀè¤òÈ¿±Ç¤¹¤ë¡£
1210 ¤É¤Á¤é¤Î¾ì¹ç¤Ç¤â¡¢¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬»Ø¤·¤Æ¤¤¤ëÀ褬¤Ê¤¤¤È¤­¤Ï¡¢
1211 ÊÖ¤µ¤ì¤¿¹½Â¤ÂΤΥե£¡¼¥ë¥É¤ÏÊѹ¹¤µ¤ì¤º¡¢
1212 .I fts_info
1213 ¥Õ¥£¡¼¥ë¥É¤¬
1214 .B FTS_SLNONE
1215 ¤ËÀßÄꤵ¤ì¤ë¡£
1216 .PP
1217 .\"O If the target of the link is a directory, the preorder return, followed
1218 .\"O by the return of all of its descendants, followed by a postorder return,
1219 .\"O is done.
1220 ¥ê¥ó¥¯À褬¥Ç¥£¥ì¥¯¥È¥ê¤Î¾ì¹ç¡¢
1221 ¥Õ¥¡¥¤¥ë¤¬ preorder ¤ÇÊÖ¤µ¤ì¤¿¸å¡¢²¼¤Î³¬ÁؤΤ¹¤Ù¤Æ¥Õ¥¡¥¤¥ë¤¬ÊÖ¤µ¤ì¡¢
1222 ¤½¤Î¸å¤Ç postorder ¤ÇÊÖ¤µ¤ì¤ë¡£
1223 .TP
1224 .B FTS_SKIP
1225 .\"O No descendants of this file are visited.
1226 .\"O The file may be one of those most recently returned by either
1227 .\"O .BR fts_children ()
1228 .\"O or
1229 .\"O .BR fts_read ().
1230 ¤³¤Î¥Õ¥¡¥¤¥ë¤Î²¼¤Î³¬ÁؤϤ¿¤É¤é¤ì¤Ê¤¤¡£
1231 ¤³¤Î¥Õ¥¡¥¤¥ë¤Ï¡¢
1232 .BR fts_children ()
1233 ¤Þ¤¿¤Ï
1234 .BR fts_read ()
1235 ¤Î¤É¤Á¤é¤«¤Ë¤è¤Ã¤ÆºÇ¤â¿·¤·¤¯ÊÖ¤µ¤ì¤¿¤â¤Î¤Î 1 ¤Ä¤Ç¤¢¤ë¡£
1236 .\" .El
1237 .SS fts_close()
1238 .\"O The
1239 .\"O .BR fts_close ()
1240 .\"O function closes a file hierarchy stream
1241 .\"O .I ftsp
1242 .\"O and restores the current directory to the directory from which
1243 .\"O .BR fts_open ()
1244 .\"O was called to open
1245 .\"O .IR ftsp .
1246 .\"O The
1247 .\"O .BR fts_close ()
1248 .\"O function
1249 .\"O returns 0 on success, and \-1 if an error occurs.
1250 .BR fts_close ()
1251 ´Ø¿ô¤Ï¡¢¥Õ¥¡¥¤¥ë³¬ÁØ¥¹¥È¥ê¡¼¥à
1252 .I ftsp
1253 ¤òÊĤ¸¤ë¡£¤½¤·¤Æ¡¢¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò
1254 .I ftsp
1255 ¤ò³«¤¯¤¿¤á¤Ë
1256 .BR fts_open ()
1257 ¤¬¸Æ¤Ð¤ì¤¿¥Ç¥£¥ì¥¯¥È¥ê¤ËÉü¸µ¤¹¤ë¡£
1258 .BR fts_close ()
1259 ´Ø¿ô¤Ï¡¢À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤ò¡¢¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
1260 .\"O .SS ERRORS
1261 .SS ¥¨¥é¡¼
1262 .\"O The function
1263 .\"O .BR fts_open ()
1264 .\"O may fail and set
1265 .\"O .I errno
1266 .\"O for any of the errors specified for the library functions
1267 .\"O .BR open (2)
1268 .\"O and
1269 .\"O .BR malloc (3).
1270 ´Ø¿ô
1271 .BR fts_open ()
1272 ¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢
1273 .I errno
1274 ¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
1275 .BR open (2)
1276 ¤È
1277 .BR malloc (3)
1278 ¤ËÂФ·¤Æ»ØÄꤵ¤ì¤ë¥¨¥é¡¼¤ËÀßÄꤵ¤ì¤ë¡£
1279 .PP
1280 .\"O The function
1281 .\"O .BR fts_close ()
1282 .\"O may fail and set
1283 .\"O .I errno
1284 .\"O for any of the errors specified for the library functions
1285 .\"O .BR chdir (2)
1286 .\"O and
1287 .\"O .BR close (2).
1288 ´Ø¿ô
1289 .BR fts_close ()
1290 ¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢
1291 .I errno
1292 ¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
1293 .BR chdir (2)
1294 ¤È
1295 .BR close (2)
1296 ¤ËÂФ·¤Æ»ØÄꤵ¤ì¤ë¥¨¥é¡¼¤ËÀßÄꤵ¤ì¤ë¡£
1297 .PP
1298 .\"O The functions
1299 .\"O .BR fts_read ()
1300 .\"O and
1301 .\"O .BR fts_children ()
1302 .\"O may fail and set
1303 .\"O .I errno
1304 .\"O for any of the errors specified for the library functions
1305 .\"O .BR chdir (2),
1306 .\"O .BR malloc (3),
1307 .\"O .BR opendir (3),
1308 .\"O .BR readdir (3)
1309 .\"O and
1310 .\"O .BR stat (2).
1311 ´Ø¿ô
1312 .BR fts_read ()
1313 ¤È
1314 .BR fts_children ()
1315 ¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢
1316 .I errno
1317 ¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô
1318 .BR chdir (2),
1319 .BR malloc (3),
1320 .BR opendir (3),
1321 .BR readdir (3),
1322 .BR stat (2)
1323 ¤ËÂФ·¤Æ»ØÄꤵ¤ì¤ë¥¨¥é¡¼¤ËÀßÄꤵ¤ì¤ë¡£
1324 .PP
1325 .\"O In addition,
1326 .\"O .BR fts_children (),
1327 .\"O .BR fts_open ()
1328 .\"O and
1329 .\"O .BR fts_set ()
1330 .\"O may fail and set
1331 .\"O .I errno
1332 .\"O as follows:
1333 ¹¹¤Ë¡¢
1334 .BR fts_children (),
1335 .BR fts_open (),
1336 .BR fts_set ()
1337 ¤¬¼ºÇÔ¤·¤¿¾ì¹ç¡¢
1338 .I errno
1339 ¤¬¼¡¤ÎÃͤˤµ¤ì¤ë¡£
1340 .TP
1341 .B EINVAL
1342 .\"O The options were invalid.
1343 ¥ª¥×¥·¥ç¥ó¤¬Ìµ¸ú¤Ç¤¢¤Ã¤¿¡£
1344 .\"O .SH VERSIONS
1345 .SH ¥Ð¡¼¥¸¥ç¥ó
1346 .\"O These functions are available in Linux since glibc2.
1347 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢Linux ¤Ç¤Ï glibc2 ¤«¤é»ÈÍѲÄǽ¤Ç¤¢¤ë¡£
1348 .\"O SH "CONFORMING TO"
1349 .SH ½àµò
1350 4.4BSD.
1351 .\" The following statement is years old, and seems no closer to
1352 .\" being true -- mtk
1353 .\"O .\" The
1354 .\"O .\" .I fts
1355 .\"O .\" utility is expected to be included in a future
1356 .\"O .\" POSIX.1
1357 .\"O .\" revision.
1358 .\" .I fts
1359 .\" ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤Ï¡¢¾­Íè¤Î
1360 .\" POSIX.1
1361 .\" ¥ê¥Ó¥¸¥ç¥ó¤Ë´Þ¤Þ¤ì¤ë¤È´üÂÔ¤µ¤ì¤Æ¤¤¤ë¡£
1362 .\"O .SH SEE ALSO
1363 .SH ´ØÏ¢¹àÌÜ
1364 .BR find (1),
1365 .BR chdir (2),
1366 .BR stat (2),
1367 .BR ftw (3),
1368 .BR qsort (3)