1f08c3bdfSopenharmony_ci/*
2f08c3bdfSopenharmony_ci *
3f08c3bdfSopenharmony_ci *   Copyright (c) International Business Machines  Corp., 2002
4f08c3bdfSopenharmony_ci *
5f08c3bdfSopenharmony_ci *   This program is free software;  you can redistribute it and/or modify
6f08c3bdfSopenharmony_ci *   it under the terms of the GNU General Public License as published by
7f08c3bdfSopenharmony_ci *   the Free Software Foundation; either version 2 of the License, or
8f08c3bdfSopenharmony_ci *   (at your option) any later version.
9f08c3bdfSopenharmony_ci *
10f08c3bdfSopenharmony_ci *   This program is distributed in the hope that it will be useful,
11f08c3bdfSopenharmony_ci *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12f08c3bdfSopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13f08c3bdfSopenharmony_ci *   the GNU General Public License for more details.
14f08c3bdfSopenharmony_ci *
15f08c3bdfSopenharmony_ci *   You should have received a copy of the GNU General Public License
16f08c3bdfSopenharmony_ci *   along with this program;  if not, write to the Free Software
17f08c3bdfSopenharmony_ci *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18f08c3bdfSopenharmony_ci */
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci/* 10/31/2002   Port to LTP     robbiew@us.ibm.com */
21f08c3bdfSopenharmony_ci/* 06/30/2001   Port to Linux   nsharoff@us.ibm.com */
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_ci/*
24f08c3bdfSopenharmony_ci * NAME
25f08c3bdfSopenharmony_ci *	nftw.c - Test of nftw()
26f08c3bdfSopenharmony_ci */
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ci#include <pwd.h>
29f08c3bdfSopenharmony_ci#include "nftw.h"
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_civoid setup(void);
32f08c3bdfSopenharmony_civoid blenter(void);
33f08c3bdfSopenharmony_civoid blexit(void);
34f08c3bdfSopenharmony_civoid anyfail(void);
35f08c3bdfSopenharmony_ci
36f08c3bdfSopenharmony_cichar progname[] = "nftw.c";
37f08c3bdfSopenharmony_ci
38f08c3bdfSopenharmony_ci/** LTP Port **/
39f08c3bdfSopenharmony_ci#define FAILED 0
40f08c3bdfSopenharmony_ci#define PASSED 1
41f08c3bdfSopenharmony_ci
42f08c3bdfSopenharmony_ciint local_flag = PASSED;
43f08c3bdfSopenharmony_ciint block_number;
44f08c3bdfSopenharmony_ci
45f08c3bdfSopenharmony_ciFILE *temp;
46f08c3bdfSopenharmony_cichar *TCID = "nftw01";
47f08c3bdfSopenharmony_ciint TST_TOTAL = 10;
48f08c3bdfSopenharmony_ci
49f08c3bdfSopenharmony_cistruct passwd *ltpuser;		/* password struct for ltpuser */
50f08c3bdfSopenharmony_ci/**************/
51f08c3bdfSopenharmony_ci
52f08c3bdfSopenharmony_ci/* Used for error return for some library routines */
53f08c3bdfSopenharmony_ciint s2;
54f08c3bdfSopenharmony_ci
55f08c3bdfSopenharmony_ci/* error messages formatted here. */
56f08c3bdfSopenharmony_cichar ebuf[ERR_BUF_SIZ];
57f08c3bdfSopenharmony_ci
58f08c3bdfSopenharmony_ci/*
59f08c3bdfSopenharmony_ci * Local data declarations.
60f08c3bdfSopenharmony_ci */
61f08c3bdfSopenharmony_cichar *dirlist[NDIRLISTENTS];
62f08c3bdfSopenharmony_ci
63f08c3bdfSopenharmony_ciint visit;
64f08c3bdfSopenharmony_ciint next_fd[4];
65f08c3bdfSopenharmony_ci
66f08c3bdfSopenharmony_cipathdata pathdat[] = {
67f08c3bdfSopenharmony_ci	{
68f08c3bdfSopenharmony_ci	 "./tmp/data",
69f08c3bdfSopenharmony_ci	 S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH,
70f08c3bdfSopenharmony_ci	 DIR, ""}, {
71f08c3bdfSopenharmony_ci		    "./tmp/byebye",
72f08c3bdfSopenharmony_ci		    S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
73f08c3bdfSopenharmony_ci		    REG, "byebye!\n"}, {
74f08c3bdfSopenharmony_ci					"./tmp/data/d333",
75f08c3bdfSopenharmony_ci					S_IRWXU | S_IRWXG | S_IRWXO,
76f08c3bdfSopenharmony_ci					DIR, ""}, {
77f08c3bdfSopenharmony_ci						   "./tmp/data/d666",
78f08c3bdfSopenharmony_ci						   S_IRWXU | S_IRWXG | S_IRWXO,
79f08c3bdfSopenharmony_ci						   DIR, ""}, {
80f08c3bdfSopenharmony_ci							      "./tmp/data/d777",
81f08c3bdfSopenharmony_ci							      S_IRWXU | S_IRWXG
82f08c3bdfSopenharmony_ci							      | S_IRWXO,
83f08c3bdfSopenharmony_ci							      DIR, ""}, {
84f08c3bdfSopenharmony_ci									 "./tmp/data/dirg",
85f08c3bdfSopenharmony_ci									 S_IRWXU
86f08c3bdfSopenharmony_ci									 |
87f08c3bdfSopenharmony_ci									 S_IRWXG
88f08c3bdfSopenharmony_ci									 |
89f08c3bdfSopenharmony_ci									 S_IROTH
90f08c3bdfSopenharmony_ci									 |
91f08c3bdfSopenharmony_ci									 S_IWOTH,
92f08c3bdfSopenharmony_ci									 DIR,
93f08c3bdfSopenharmony_ci									 ""}, {
94f08c3bdfSopenharmony_ci									       "./tmp/data/dirh",
95f08c3bdfSopenharmony_ci									       S_IRWXU
96f08c3bdfSopenharmony_ci									       |
97f08c3bdfSopenharmony_ci									       S_IRWXG
98f08c3bdfSopenharmony_ci									       |
99f08c3bdfSopenharmony_ci									       S_IROTH
100f08c3bdfSopenharmony_ci									       |
101f08c3bdfSopenharmony_ci									       S_IWOTH,
102f08c3bdfSopenharmony_ci									       DIR,
103f08c3bdfSopenharmony_ci									       ""},
104f08c3bdfSopenharmony_ci	{
105f08c3bdfSopenharmony_ci	 "./tmp/data/dirl",
106f08c3bdfSopenharmony_ci	 S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
107f08c3bdfSopenharmony_ci	 DIR, ""}, {
108f08c3bdfSopenharmony_ci		    "./tmp/data/d333/errs",
109f08c3bdfSopenharmony_ci		    S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
110f08c3bdfSopenharmony_ci		    REG, "Do not eat yellow snow!\n"}, {
111f08c3bdfSopenharmony_ci							"./tmp/data/d666/errs",
112f08c3bdfSopenharmony_ci							S_IRWXU | S_IRWXG |
113f08c3bdfSopenharmony_ci							S_IROTH | S_IWOTH,
114f08c3bdfSopenharmony_ci							REG,
115f08c3bdfSopenharmony_ci							"Do not eat yellow snow!\n"},
116f08c3bdfSopenharmony_ci	{
117f08c3bdfSopenharmony_ci	 "./tmp/data/d777/errs",
118f08c3bdfSopenharmony_ci	 S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
119f08c3bdfSopenharmony_ci	 REG, "Do not eat yellow snow!\n"}, {
120f08c3bdfSopenharmony_ci					     "./tmp/data/dirg/filebad",
121f08c3bdfSopenharmony_ci					     S_IRUSR | S_IWUSR | S_IRGRP |
122f08c3bdfSopenharmony_ci					     S_IROTH,
123f08c3bdfSopenharmony_ci					     REG, ""}, {
124f08c3bdfSopenharmony_ci							"./tmp/data/dirg/fileok",
125f08c3bdfSopenharmony_ci							S_IRUSR | S_IWUSR |
126f08c3bdfSopenharmony_ci							S_IRGRP | S_IROTH,
127f08c3bdfSopenharmony_ci							REG, ""}, {
128f08c3bdfSopenharmony_ci								   "./tmp/data/dirg/symlink",
129f08c3bdfSopenharmony_ci								   S_IRWXU |
130f08c3bdfSopenharmony_ci								   S_IRWXG |
131f08c3bdfSopenharmony_ci								   S_IRWXO,
132f08c3bdfSopenharmony_ci								   SYM,
133f08c3bdfSopenharmony_ci								   "../../byebye"},
134f08c3bdfSopenharmony_ci	{
135f08c3bdfSopenharmony_ci	 "./tmp/data/dirg/dir_left.1",
136f08c3bdfSopenharmony_ci	 S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
137f08c3bdfSopenharmony_ci	 DIR, ""}, {
138f08c3bdfSopenharmony_ci		    "./tmp/data/dirg/dir_left.1/dir_left.2",
139f08c3bdfSopenharmony_ci		    S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
140f08c3bdfSopenharmony_ci		    DIR, ""}, {
141f08c3bdfSopenharmony_ci			       "./tmp/data/dirg/dir_right.1",
142f08c3bdfSopenharmony_ci			       S_IRWXU | S_IRWXG | S_IRWXO,
143f08c3bdfSopenharmony_ci			       DIR, ""}, {
144f08c3bdfSopenharmony_ci					  "./tmp/data/dirg/dir_left.1/dir_left.2/left.3",
145f08c3bdfSopenharmony_ci					  S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
146f08c3bdfSopenharmony_ci					  | S_IROTH,
147f08c3bdfSopenharmony_ci					  REG, ""}, {
148f08c3bdfSopenharmony_ci						     "./tmp/data/dirh/dir_left.1",
149f08c3bdfSopenharmony_ci						     S_IRWXU | S_IRWXG | S_IROTH
150f08c3bdfSopenharmony_ci						     | S_IWOTH,
151f08c3bdfSopenharmony_ci						     DIR, ""}, {
152f08c3bdfSopenharmony_ci								"./tmp/data/dirh/dir_right.1",
153f08c3bdfSopenharmony_ci								S_IRWXU |
154f08c3bdfSopenharmony_ci								S_IRWXG |
155f08c3bdfSopenharmony_ci								S_IROTH |
156f08c3bdfSopenharmony_ci								S_IWOTH,
157f08c3bdfSopenharmony_ci								DIR, ""}, {
158f08c3bdfSopenharmony_ci									   "./tmp/data/dirh/dir_left.1/dir_left.2",
159f08c3bdfSopenharmony_ci									   S_IRWXU
160f08c3bdfSopenharmony_ci									   |
161f08c3bdfSopenharmony_ci									   S_IRWXG
162f08c3bdfSopenharmony_ci									   |
163f08c3bdfSopenharmony_ci									   S_IROTH
164f08c3bdfSopenharmony_ci									   |
165f08c3bdfSopenharmony_ci									   S_IWOTH,
166f08c3bdfSopenharmony_ci									   DIR,
167f08c3bdfSopenharmony_ci									   ""},
168f08c3bdfSopenharmony_ci	{
169f08c3bdfSopenharmony_ci	 "./tmp/data/dirh/dir_left.1/dir_left.2/left.3",
170f08c3bdfSopenharmony_ci	 S_IRWXU | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH,
171f08c3bdfSopenharmony_ci	 REG, "left leaf\n"}, {
172f08c3bdfSopenharmony_ci			       "./tmp/data/dirh/dir_right.1/dir_right.2",
173f08c3bdfSopenharmony_ci			       S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
174f08c3bdfSopenharmony_ci			       DIR, ""}, {
175f08c3bdfSopenharmony_ci					  "./tmp/data/dirh/dir_right.1/dir_right.2/right.3",
176f08c3bdfSopenharmony_ci					  S_IRWXU | S_IRGRP | S_IWGRP | S_IROTH
177f08c3bdfSopenharmony_ci					  | S_IWOTH,
178f08c3bdfSopenharmony_ci					  REG, "right leaf\n"}, {
179f08c3bdfSopenharmony_ci								 "./tmp/data/dirl/dir_left.1",
180f08c3bdfSopenharmony_ci								 S_IRWXU |
181f08c3bdfSopenharmony_ci								 S_IRWXG |
182f08c3bdfSopenharmony_ci								 S_IROTH |
183f08c3bdfSopenharmony_ci								 S_IWOTH,
184f08c3bdfSopenharmony_ci								 DIR, ""}, {
185f08c3bdfSopenharmony_ci									    "./tmp/data/dirl/dir_left.1/dir_left.2",
186f08c3bdfSopenharmony_ci									    S_IRWXU
187f08c3bdfSopenharmony_ci									    |
188f08c3bdfSopenharmony_ci									    S_IRWXG
189f08c3bdfSopenharmony_ci									    |
190f08c3bdfSopenharmony_ci									    S_IROTH
191f08c3bdfSopenharmony_ci									    |
192f08c3bdfSopenharmony_ci									    S_IWOTH,
193f08c3bdfSopenharmony_ci									    DIR,
194f08c3bdfSopenharmony_ci									    ""},
195f08c3bdfSopenharmony_ci	{
196f08c3bdfSopenharmony_ci	 "./tmp/data/dirl/dir_left.1/dir_left.2/left.3",
197f08c3bdfSopenharmony_ci	 0,
198f08c3bdfSopenharmony_ci	 SYM, "../../../dirh"}, {
199f08c3bdfSopenharmony_ci				 "./tmp/data/dirl/dir_right.1",
200f08c3bdfSopenharmony_ci				 S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH,
201f08c3bdfSopenharmony_ci				 DIR, ""}, {
202f08c3bdfSopenharmony_ci					    "./tmp/data/dirl/dir_right.1/dir_right.2",
203f08c3bdfSopenharmony_ci					    S_IRWXU | S_IRWXG | S_IROTH |
204f08c3bdfSopenharmony_ci					    S_IWOTH,
205f08c3bdfSopenharmony_ci					    DIR, ""}, {
206f08c3bdfSopenharmony_ci						       "./tmp/data/dirl/dir_right.1/dir_right.2/right.3",
207f08c3bdfSopenharmony_ci						       0,
208f08c3bdfSopenharmony_ci						       SYM, "../dir_right.2"}, {
209f08c3bdfSopenharmony_ci										"./tmp/data/loop",
210f08c3bdfSopenharmony_ci										0,
211f08c3bdfSopenharmony_ci										SYM,
212f08c3bdfSopenharmony_ci										"./loop"}
213f08c3bdfSopenharmony_ci};
214f08c3bdfSopenharmony_ci
215f08c3bdfSopenharmony_cichar *goodlist[] = {
216f08c3bdfSopenharmony_ci	"/dirh",
217f08c3bdfSopenharmony_ci	"/dirh/dir_left.1",
218f08c3bdfSopenharmony_ci	"/dirh/dir_right.1",
219f08c3bdfSopenharmony_ci	"/dirh/dir_left.1/dir_left.2",
220f08c3bdfSopenharmony_ci	"/dirh/dir_right.1/dir_right.2",
221f08c3bdfSopenharmony_ci	"/dirh/dir_left.1/dir_left.2/left.3",
222f08c3bdfSopenharmony_ci	"/dirh/dir_right.1/dir_right.2/right.3"
223f08c3bdfSopenharmony_ci};
224f08c3bdfSopenharmony_ci
225f08c3bdfSopenharmony_cistruct list badlist[] = {
226f08c3bdfSopenharmony_ci	{"/dirg", FTW_D},
227f08c3bdfSopenharmony_ci	{"/dirg/dir_left.1", FTW_D},
228f08c3bdfSopenharmony_ci	/* not FTW_NS in following since stat can't fail if file exists */
229f08c3bdfSopenharmony_ci	{"/dirg/filebad", FTW_F},
230f08c3bdfSopenharmony_ci	{"/dirg/fileok", FTW_F},
231f08c3bdfSopenharmony_ci	{"/dirg/symlink", FTW_SL},
232f08c3bdfSopenharmony_ci	{"/dirg/dir_right.1", FTW_DNR},
233f08c3bdfSopenharmony_ci	{"/dirg/dir_left.1/dir_left.2", FTW_D},
234f08c3bdfSopenharmony_ci	{"/dirg/dir_left.1/dir_left.2/left.3", FTW_F},
235f08c3bdfSopenharmony_ci};
236f08c3bdfSopenharmony_ci
237f08c3bdfSopenharmony_cistruct list mnem[] = {
238f08c3bdfSopenharmony_ci	{"FTW_F", FTW_F},
239f08c3bdfSopenharmony_ci	{"FTW_D", FTW_D},
240f08c3bdfSopenharmony_ci	{"FTW_DNR", FTW_DNR},
241f08c3bdfSopenharmony_ci	{"FTW_NS", FTW_NS},
242f08c3bdfSopenharmony_ci	{"FTW_SL", FTW_SL},
243f08c3bdfSopenharmony_ci#ifndef __linux__
244f08c3bdfSopenharmony_ci/* How do we define __USE_XOPEN_EXTENDED ? Following depends on that */
245f08c3bdfSopenharmony_ci	{"FTW_DP", FTW_DP},
246f08c3bdfSopenharmony_ci	{"FTW_SLN", FTW_SLN},
247f08c3bdfSopenharmony_ci#endif
248f08c3bdfSopenharmony_ci};
249f08c3bdfSopenharmony_ci
250f08c3bdfSopenharmony_ciint npathdats, ngoods, nbads, nmnem;
251f08c3bdfSopenharmony_ci
252f08c3bdfSopenharmony_ci/*--------------------------------------------------------------*/
253f08c3bdfSopenharmony_ciint main(void)
254f08c3bdfSopenharmony_ci{
255f08c3bdfSopenharmony_ci	setup();		/* temp file is now open        */
256f08c3bdfSopenharmony_ci
257f08c3bdfSopenharmony_ci	npathdats = ARRAY_SIZE(pathdat);
258f08c3bdfSopenharmony_ci	ngoods = ARRAY_SIZE(goodlist);
259f08c3bdfSopenharmony_ci	nbads = ARRAY_SIZE(badlist);
260f08c3bdfSopenharmony_ci	nmnem = ARRAY_SIZE(mnem);
261f08c3bdfSopenharmony_ci
262f08c3bdfSopenharmony_ci	setup_path();
263f08c3bdfSopenharmony_ci
264f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 0 --------------------------------*/
265f08c3bdfSopenharmony_ci	blenter();
266f08c3bdfSopenharmony_ci#ifdef DEBUG
267f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
268f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
269f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall recursively descend the\n");
270f08c3bdfSopenharmony_ci	fprintf(temp, "directory hierarchy rooted in path until it has\n");
271f08c3bdfSopenharmony_ci	fprintf(temp,
272f08c3bdfSopenharmony_ci		"traversed the whole tree, calling the function fn for\n");
273f08c3bdfSopenharmony_ci	fprintf(temp, "each object in the directory tree, and return 0.\n\n");
274f08c3bdfSopenharmony_ci#endif
275f08c3bdfSopenharmony_ci	test1A();
276f08c3bdfSopenharmony_ci	blexit();
277f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 0 ---------------------------------*/
278f08c3bdfSopenharmony_ci
279f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 1 --------------------------------*/
280f08c3bdfSopenharmony_ci	blenter();
281f08c3bdfSopenharmony_ci#ifdef DEBUG
282f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
283f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
284f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) when flags contains FTW_PHYS shall\n");
285f08c3bdfSopenharmony_ci	fprintf(temp, "not traverse symbolic links.\n\n");
286f08c3bdfSopenharmony_ci#endif
287f08c3bdfSopenharmony_ci	test2A();
288f08c3bdfSopenharmony_ci	blexit();
289f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 1 ---------------------------------*/
290f08c3bdfSopenharmony_ci
291f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 2 --------------------------------*/
292f08c3bdfSopenharmony_ci	blenter();
293f08c3bdfSopenharmony_ci#ifdef DEBUG
294f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
295f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
296f08c3bdfSopenharmony_ci	fprintf(temp,
297f08c3bdfSopenharmony_ci		"depth, int flags) when flags does not contain FTW_PHYS\n");
298f08c3bdfSopenharmony_ci	fprintf(temp,
299f08c3bdfSopenharmony_ci		"shall follow links instead of reporting them and shall\n");
300f08c3bdfSopenharmony_ci	fprintf(temp, "not report the same file twice.\n\n");
301f08c3bdfSopenharmony_ci#endif
302f08c3bdfSopenharmony_ci	test3A();
303f08c3bdfSopenharmony_ci	blexit();
304f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 2 ---------------------------------*/
305f08c3bdfSopenharmony_ci
306f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 3 --------------------------------*/
307f08c3bdfSopenharmony_ci	blenter();
308f08c3bdfSopenharmony_ci#ifdef DEBUG
309f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
310f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
311f08c3bdfSopenharmony_ci	fprintf(temp,
312f08c3bdfSopenharmony_ci		"depth, int flags) when flags contains FTW_DEPTH shall\n");
313f08c3bdfSopenharmony_ci	fprintf(temp, "report all files in a directory before reporting the\n");
314f08c3bdfSopenharmony_ci	fprintf(temp, "directory.\n\n");
315f08c3bdfSopenharmony_ci#endif
316f08c3bdfSopenharmony_ci	test4A();
317f08c3bdfSopenharmony_ci	blexit();
318f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 3 ---------------------------------*/
319f08c3bdfSopenharmony_ci
320f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 4 --------------------------------*/
321f08c3bdfSopenharmony_ci	blenter();
322f08c3bdfSopenharmony_ci#ifdef DEBUG
323f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
324f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
325f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) when flags does not contain\n");
326f08c3bdfSopenharmony_ci	fprintf(temp, "FTW_DEPTH shall report a directory before reporting\n");
327f08c3bdfSopenharmony_ci	fprintf(temp, "the files in that directory.\n\n");
328f08c3bdfSopenharmony_ci#endif
329f08c3bdfSopenharmony_ci	test5A();
330f08c3bdfSopenharmony_ci	blexit();
331f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 4 ---------------------------------*/
332f08c3bdfSopenharmony_ci
333f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 5 --------------------------------*/
334f08c3bdfSopenharmony_ci	blenter();
335f08c3bdfSopenharmony_ci#ifdef DEBUG
336f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
337f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
338f08c3bdfSopenharmony_ci	fprintf(temp,
339f08c3bdfSopenharmony_ci		"depth, int flags) when flags contains FTW_CHDIR shall\n");
340f08c3bdfSopenharmony_ci	fprintf(temp,
341f08c3bdfSopenharmony_ci		"change the current working directory to each directory\n");
342f08c3bdfSopenharmony_ci	fprintf(temp, "as it reports files in that directory.\n\n");
343f08c3bdfSopenharmony_ci#endif
344f08c3bdfSopenharmony_ci	test6A();
345f08c3bdfSopenharmony_ci	blexit();
346f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 5 ---------------------------------*/
347f08c3bdfSopenharmony_ci
348f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 6 --------------------------------*/
349f08c3bdfSopenharmony_ci	blenter();
350f08c3bdfSopenharmony_ci#ifdef DEBUG
351f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
352f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
353f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass the path-name of the\n");
354f08c3bdfSopenharmony_ci	fprintf(temp, "current object as the first argument of the function\n");
355f08c3bdfSopenharmony_ci	fprintf(temp, "fn.\n\n");
356f08c3bdfSopenharmony_ci#endif
357f08c3bdfSopenharmony_ci	test7A();
358f08c3bdfSopenharmony_ci	blexit();
359f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 6 ---------------------------------*/
360f08c3bdfSopenharmony_ci
361f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 7 --------------------------------*/
362f08c3bdfSopenharmony_ci	blenter();
363f08c3bdfSopenharmony_ci#ifdef DEBUG
364f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
365f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
366f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass a pointer to a stat\n");
367f08c3bdfSopenharmony_ci	fprintf(temp, "structure containing information about the current\n");
368f08c3bdfSopenharmony_ci	fprintf(temp, "object as the second argument to fn.\n\n");
369f08c3bdfSopenharmony_ci#endif
370f08c3bdfSopenharmony_ci	test8A();
371f08c3bdfSopenharmony_ci	blexit();
372f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 7 ---------------------------------*/
373f08c3bdfSopenharmony_ci
374f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 8 --------------------------------*/
375f08c3bdfSopenharmony_ci	blenter();
376f08c3bdfSopenharmony_ci#ifdef DEBUG
377f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
378f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
379f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_F as the third\n");
380f08c3bdfSopenharmony_ci	fprintf(temp,
381f08c3bdfSopenharmony_ci		"argument of the function fn when the object is a file.\n\n");
382f08c3bdfSopenharmony_ci#endif
383f08c3bdfSopenharmony_ci	test9A();
384f08c3bdfSopenharmony_ci	blexit();
385f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 8 ---------------------------------*/
386f08c3bdfSopenharmony_ci
387f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 9 --------------------------------*/
388f08c3bdfSopenharmony_ci	blenter();
389f08c3bdfSopenharmony_ci#ifdef DEBUG
390f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
391f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
392f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_D as the third\n");
393f08c3bdfSopenharmony_ci	fprintf(temp, "argument of the function fn when the object is a\n");
394f08c3bdfSopenharmony_ci	fprintf(temp, "directory.\n\n");
395f08c3bdfSopenharmony_ci#endif
396f08c3bdfSopenharmony_ci	test10A();
397f08c3bdfSopenharmony_ci	blexit();
398f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 9 ---------------------------------*/
399f08c3bdfSopenharmony_ci
400f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 10 --------------------------------*/
401f08c3bdfSopenharmony_ci	blenter();
402f08c3bdfSopenharmony_ci#ifdef DEBUG
403f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
404f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
405f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_DP as the third\n");
406f08c3bdfSopenharmony_ci	fprintf(temp, "argument of the function fn when the object is a\n");
407f08c3bdfSopenharmony_ci	fprintf(temp, "directory and subdirectories have been visited.\n\n");
408f08c3bdfSopenharmony_ci#endif
409f08c3bdfSopenharmony_ci	test11A();
410f08c3bdfSopenharmony_ci	blexit();
411f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 10 ---------------------------------*/
412f08c3bdfSopenharmony_ci
413f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 11 --------------------------------*/
414f08c3bdfSopenharmony_ci	blenter();
415f08c3bdfSopenharmony_ci#ifdef DEBUG
416f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
417f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
418f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_SL as the third\n");
419f08c3bdfSopenharmony_ci	fprintf(temp, "argument of the function fn when the object is a\n");
420f08c3bdfSopenharmony_ci	fprintf(temp, "symbolic link.\n\n");
421f08c3bdfSopenharmony_ci#endif
422f08c3bdfSopenharmony_ci	test12A();
423f08c3bdfSopenharmony_ci	blexit();
424f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 11 ---------------------------------*/
425f08c3bdfSopenharmony_ci
426f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 12 --------------------------------*/
427f08c3bdfSopenharmony_ci	blenter();
428f08c3bdfSopenharmony_ci#ifdef DEBUG
429f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
430f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
431f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_SLN as the third\n");
432f08c3bdfSopenharmony_ci	fprintf(temp, "argument of the function fn when the object is a\n");
433f08c3bdfSopenharmony_ci	fprintf(temp, "symbolic link that does not name an existing file.\n\n");
434f08c3bdfSopenharmony_ci#endif
435f08c3bdfSopenharmony_ci	test13A();
436f08c3bdfSopenharmony_ci	blexit();
437f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 12 ---------------------------------*/
438f08c3bdfSopenharmony_ci
439f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 13 --------------------------------*/
440f08c3bdfSopenharmony_ci	blenter();
441f08c3bdfSopenharmony_ci#ifdef DEBUG
442f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
443f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
444f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_DNR as the third\n");
445f08c3bdfSopenharmony_ci	fprintf(temp, "argument of the function fn when the object is a\n");
446f08c3bdfSopenharmony_ci	fprintf(temp, "directory that cannot be read.\n\n");
447f08c3bdfSopenharmony_ci#endif
448f08c3bdfSopenharmony_ci	test14A();
449f08c3bdfSopenharmony_ci	blexit();
450f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 13 ---------------------------------*/
451f08c3bdfSopenharmony_ci
452f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 14 --------------------------------*/
453f08c3bdfSopenharmony_ci	blenter();
454f08c3bdfSopenharmony_ci#ifdef DEBUG
455f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
456f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
457f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_NS as the third\n");
458f08c3bdfSopenharmony_ci	fprintf(temp,
459f08c3bdfSopenharmony_ci		"argument of the function fn when stat() failed on the\n");
460f08c3bdfSopenharmony_ci	fprintf(temp, "object because of lack of appropriate permission.\n\n");
461f08c3bdfSopenharmony_ci#endif
462f08c3bdfSopenharmony_ci	test15A();
463f08c3bdfSopenharmony_ci	blexit();
464f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 14 ---------------------------------*/
465f08c3bdfSopenharmony_ci
466f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 15 --------------------------------*/
467f08c3bdfSopenharmony_ci	blenter();
468f08c3bdfSopenharmony_ci#ifdef DEBUG
469f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
470f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
471f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass a structure which\n");
472f08c3bdfSopenharmony_ci	fprintf(temp, "contains the offset into the pathname of the object\n");
473f08c3bdfSopenharmony_ci	fprintf(temp, "and the depth relative to the root of the walk\n");
474f08c3bdfSopenharmony_ci	fprintf(temp,
475f08c3bdfSopenharmony_ci		"starting from 0 as the fourth argument of the function\n");
476f08c3bdfSopenharmony_ci	fprintf(temp, "fn.\n\n");
477f08c3bdfSopenharmony_ci#endif
478f08c3bdfSopenharmony_ci	test16A();
479f08c3bdfSopenharmony_ci	blexit();
480f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 15 ---------------------------------*/
481f08c3bdfSopenharmony_ci
482f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 16 --------------------------------*/
483f08c3bdfSopenharmony_ci	blenter();
484f08c3bdfSopenharmony_ci#ifdef DEBUG
485f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
486f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
487f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_SL as the third\n");
488f08c3bdfSopenharmony_ci	fprintf(temp, "argument to the function fn if and only if the\n");
489f08c3bdfSopenharmony_ci	fprintf(temp, "FTW_PHYS flag is included in flags.\n\n");
490f08c3bdfSopenharmony_ci#endif
491f08c3bdfSopenharmony_ci	test17A();
492f08c3bdfSopenharmony_ci	blexit();
493f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 16 ---------------------------------*/
494f08c3bdfSopenharmony_ci
495f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 17 --------------------------------*/
496f08c3bdfSopenharmony_ci	blenter();
497f08c3bdfSopenharmony_ci#ifdef DEBUG
498f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
499f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
500f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall pass FTW_SLN as the third\n");
501f08c3bdfSopenharmony_ci	fprintf(temp, "argument to the function fn if and only if the\n");
502f08c3bdfSopenharmony_ci	fprintf(temp, "FTW_PHYS flag is not included in flags.\n\n");
503f08c3bdfSopenharmony_ci#endif
504f08c3bdfSopenharmony_ci	test18A();
505f08c3bdfSopenharmony_ci	blexit();
506f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 17 ---------------------------------*/
507f08c3bdfSopenharmony_ci
508f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 18 --------------------------------*/
509f08c3bdfSopenharmony_ci	blenter();
510f08c3bdfSopenharmony_ci#ifdef DEBUG
511f08c3bdfSopenharmony_ci	fprintf(temp, "On a call to int nftw(const char *path, int\n");
512f08c3bdfSopenharmony_ci	fprintf(temp, "(*fn)(const char *, const struct stat *, int, struct\n");
513f08c3bdfSopenharmony_ci	fprintf(temp,
514f08c3bdfSopenharmony_ci		"FTW *), int depth, int flags) when the third argument\n");
515f08c3bdfSopenharmony_ci	fprintf(temp, "passed to the function fn is FTW_DNR then the\n");
516f08c3bdfSopenharmony_ci	fprintf(temp,
517f08c3bdfSopenharmony_ci		"descendants of the directory shall not be processed.\n\n");
518f08c3bdfSopenharmony_ci#endif
519f08c3bdfSopenharmony_ci	test19A();
520f08c3bdfSopenharmony_ci	blexit();
521f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 18 ---------------------------------*/
522f08c3bdfSopenharmony_ci
523f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 19 --------------------------------*/
524f08c3bdfSopenharmony_ci	blenter();
525f08c3bdfSopenharmony_ci#ifdef DEBUG
526f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
527f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
528f08c3bdfSopenharmony_ci	fprintf(temp,
529f08c3bdfSopenharmony_ci		"depth, int flags) shall close any file descriptors or\n");
530f08c3bdfSopenharmony_ci	fprintf(temp,
531f08c3bdfSopenharmony_ci		"directory streams used to traverse the directory tree.\n\n");
532f08c3bdfSopenharmony_ci#endif
533f08c3bdfSopenharmony_ci	test20A();
534f08c3bdfSopenharmony_ci	blexit();
535f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 19 ---------------------------------*/
536f08c3bdfSopenharmony_ci
537f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 20 --------------------------------*/
538f08c3bdfSopenharmony_ci	blenter();
539f08c3bdfSopenharmony_ci#ifdef DEBUG
540f08c3bdfSopenharmony_ci	fprintf(temp, "On a call to int nftw(const char *path, int\n");
541f08c3bdfSopenharmony_ci	fprintf(temp, "(*fn)(const char *, const struct stat *, int, struct\n");
542f08c3bdfSopenharmony_ci	fprintf(temp, "FTW *), int depth, int flags) depth shall be the\n");
543f08c3bdfSopenharmony_ci	fprintf(temp,
544f08c3bdfSopenharmony_ci		"maximum number of file descriptors used for the search.\n\n");
545f08c3bdfSopenharmony_ci#endif
546f08c3bdfSopenharmony_ci	test21A();
547f08c3bdfSopenharmony_ci	blexit();
548f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 20 ---------------------------------*/
549f08c3bdfSopenharmony_ci
550f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 21 --------------------------------*/
551f08c3bdfSopenharmony_ci	blenter();
552f08c3bdfSopenharmony_ci#ifdef DEBUG
553f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
554f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
555f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) shall use at most one file\n");
556f08c3bdfSopenharmony_ci	fprintf(temp, "descriptor for each directory level.\n\n");
557f08c3bdfSopenharmony_ci#endif
558f08c3bdfSopenharmony_ci	test22A();
559f08c3bdfSopenharmony_ci	blexit();
560f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 21 ---------------------------------*/
561f08c3bdfSopenharmony_ci
562f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 22 --------------------------------*/
563f08c3bdfSopenharmony_ci	blenter();
564f08c3bdfSopenharmony_ci#ifdef DEBUG
565f08c3bdfSopenharmony_ci	fprintf(temp, "A call to int nftw(const char *path, int (*fn)(const\n");
566f08c3bdfSopenharmony_ci	fprintf(temp, "char *, const struct stat *, int, struct FTW *), int\n");
567f08c3bdfSopenharmony_ci	fprintf(temp, "depth, int flags) when the function fn returns a\n");
568f08c3bdfSopenharmony_ci	fprintf(temp, "non-zero value shall stop and return the value\n");
569f08c3bdfSopenharmony_ci	fprintf(temp, "returned by fn.\n\n");
570f08c3bdfSopenharmony_ci#endif
571f08c3bdfSopenharmony_ci	test23A();
572f08c3bdfSopenharmony_ci	blexit();
573f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 22 ---------------------------------*/
574f08c3bdfSopenharmony_ci
575f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 23 --------------------------------*/
576f08c3bdfSopenharmony_ci	blenter();
577f08c3bdfSopenharmony_ci#ifdef DEBUG
578f08c3bdfSopenharmony_ci	fprintf(temp, "ENAMETOOLONG in errno and return -1 on a call to int\n");
579f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
580f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
581f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when the length of path exceeds PATH_MAX.\n\n");
582f08c3bdfSopenharmony_ci#endif
583f08c3bdfSopenharmony_ci	test24A();
584f08c3bdfSopenharmony_ci	blexit();
585f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 23 ---------------------------------*/
586f08c3bdfSopenharmony_ci
587f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 24 --------------------------------*/
588f08c3bdfSopenharmony_ci	blenter();
589f08c3bdfSopenharmony_ci#ifdef DEBUG
590f08c3bdfSopenharmony_ci	fprintf(temp, "ENAMETOOLONG in errno and return -1 on a call to int\n");
591f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
592f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
593f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when a component of path exceeds NAME_MAX.\n\n");
594f08c3bdfSopenharmony_ci#endif
595f08c3bdfSopenharmony_ci	test25A();
596f08c3bdfSopenharmony_ci	blexit();
597f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 24 ---------------------------------*/
598f08c3bdfSopenharmony_ci
599f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 25 --------------------------------*/
600f08c3bdfSopenharmony_ci	blenter();
601f08c3bdfSopenharmony_ci#ifdef DEBUG
602f08c3bdfSopenharmony_ci	fprintf(temp, "ENOENT in errno and return -1 on a call to int\n");
603f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
604f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
605f08c3bdfSopenharmony_ci	fprintf(temp,
606f08c3bdfSopenharmony_ci		"flags) when path points to a file which does not exist.\n\n");
607f08c3bdfSopenharmony_ci#endif
608f08c3bdfSopenharmony_ci	test26A();
609f08c3bdfSopenharmony_ci	blexit();
610f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 25 ---------------------------------*/
611f08c3bdfSopenharmony_ci
612f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 26 --------------------------------*/
613f08c3bdfSopenharmony_ci	blenter();
614f08c3bdfSopenharmony_ci#ifdef DEBUG
615f08c3bdfSopenharmony_ci	fprintf(temp, "ENOENT in errno and return -1 on a call to int\n");
616f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
617f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
618f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when path points to an empty string.\n\n");
619f08c3bdfSopenharmony_ci#endif
620f08c3bdfSopenharmony_ci	test27A();
621f08c3bdfSopenharmony_ci	blexit();
622f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 26 ---------------------------------*/
623f08c3bdfSopenharmony_ci
624f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 27 --------------------------------*/
625f08c3bdfSopenharmony_ci	blenter();
626f08c3bdfSopenharmony_ci#ifdef DEBUG
627f08c3bdfSopenharmony_ci	fprintf(temp, "ENOTDIR in errno and return -1 on a call to int\n");
628f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
629f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
630f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when path is not a directory.\n\n");
631f08c3bdfSopenharmony_ci#endif
632f08c3bdfSopenharmony_ci	test28A();
633f08c3bdfSopenharmony_ci	blexit();
634f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 27 ---------------------------------*/
635f08c3bdfSopenharmony_ci
636f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 28 --------------------------------*/
637f08c3bdfSopenharmony_ci	blenter();
638f08c3bdfSopenharmony_ci#ifdef DEBUG
639f08c3bdfSopenharmony_ci	fprintf(temp, "EACCES in errno and return -1 on a call to int\n");
640f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
641f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
642f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when search permission is denied for any\n");
643f08c3bdfSopenharmony_ci	fprintf(temp, "component of path.\n\n");
644f08c3bdfSopenharmony_ci#endif
645f08c3bdfSopenharmony_ci	test29A();
646f08c3bdfSopenharmony_ci	blexit();
647f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 28 ---------------------------------*/
648f08c3bdfSopenharmony_ci
649f08c3bdfSopenharmony_ci/*---------------- ENTER BLOCK 29 --------------------------------*/
650f08c3bdfSopenharmony_ci	blenter();
651f08c3bdfSopenharmony_ci#ifdef DEBUG
652f08c3bdfSopenharmony_ci	fprintf(temp, "EACCES in errno and return -1 on a call to int\n");
653f08c3bdfSopenharmony_ci	fprintf(temp, "nftw(const char *path, int (*fn)(const char *, const\n");
654f08c3bdfSopenharmony_ci	fprintf(temp, "struct stat *, int, struct FTW *), int depth, int\n");
655f08c3bdfSopenharmony_ci	fprintf(temp, "flags) when read permission is denied for path.\n\n");
656f08c3bdfSopenharmony_ci#endif
657f08c3bdfSopenharmony_ci	test30A();
658f08c3bdfSopenharmony_ci	blexit();
659f08c3bdfSopenharmony_ci/*--------------- EXIT BLOCK 29 ---------------------------------*/
660f08c3bdfSopenharmony_ci
661f08c3bdfSopenharmony_ci	cleanup_function();
662f08c3bdfSopenharmony_ci
663f08c3bdfSopenharmony_ci	anyfail();		/* THIS CALL DOES NOT RETURN - EXITS!!  */
664f08c3bdfSopenharmony_ci	tst_exit();
665f08c3bdfSopenharmony_ci/*--------------------------------------------------------------*/
666f08c3bdfSopenharmony_ci}
667f08c3bdfSopenharmony_ci
668f08c3bdfSopenharmony_ci/** LTP Port **/
669f08c3bdfSopenharmony_ci/*
670f08c3bdfSopenharmony_ci * setup
671f08c3bdfSopenharmony_ci *
672f08c3bdfSopenharmony_ci * Do set up - here its a dummy function
673f08c3bdfSopenharmony_ci */
674f08c3bdfSopenharmony_civoid setup(void)
675f08c3bdfSopenharmony_ci{
676f08c3bdfSopenharmony_ci	/* Direct debug output to stderr */
677f08c3bdfSopenharmony_ci	temp = stderr;
678f08c3bdfSopenharmony_ci
679f08c3bdfSopenharmony_ci	/* Get the user id "nobody" */
680f08c3bdfSopenharmony_ci	if ((ltpuser = getpwnam("nobody")) == NULL) {
681f08c3bdfSopenharmony_ci		perror("nobody not found in /etc/passwd");
682f08c3bdfSopenharmony_ci		exit(1);
683f08c3bdfSopenharmony_ci	}
684f08c3bdfSopenharmony_ci
685f08c3bdfSopenharmony_ci	/* Switch to "nobody" */
686f08c3bdfSopenharmony_ci	setuid(ltpuser->pw_uid);
687f08c3bdfSopenharmony_ci
688f08c3bdfSopenharmony_ci	tst_tmpdir();
689f08c3bdfSopenharmony_ci}
690f08c3bdfSopenharmony_ci
691f08c3bdfSopenharmony_ci/*
692f08c3bdfSopenharmony_ci * Function: blenter()
693f08c3bdfSopenharmony_ci *
694f08c3bdfSopenharmony_ci * Description: Print message on entering a new block
695f08c3bdfSopenharmony_ci */
696f08c3bdfSopenharmony_civoid blenter(void)
697f08c3bdfSopenharmony_ci{
698f08c3bdfSopenharmony_ci	local_flag = PASSED;
699f08c3bdfSopenharmony_ci	return;
700f08c3bdfSopenharmony_ci}
701f08c3bdfSopenharmony_ci
702f08c3bdfSopenharmony_ci/*
703f08c3bdfSopenharmony_ci * Function: blexit()
704f08c3bdfSopenharmony_ci *
705f08c3bdfSopenharmony_ci * Description: This function will exit a block, a block may be a logical unit
706f08c3bdfSopenharmony_ci *              of a test. It will report the status if the test ie fail or
707f08c3bdfSopenharmony_ci *              pass.
708f08c3bdfSopenharmony_ci */
709f08c3bdfSopenharmony_civoid blexit(void)
710f08c3bdfSopenharmony_ci{
711f08c3bdfSopenharmony_ci	(local_flag == PASSED) ? tst_resm(TPASS, "Test block %d", block_number)
712f08c3bdfSopenharmony_ci	    : tst_resm(TFAIL, "Test block %d", block_number);
713f08c3bdfSopenharmony_ci	block_number++;
714f08c3bdfSopenharmony_ci	return;
715f08c3bdfSopenharmony_ci}
716f08c3bdfSopenharmony_ci
717f08c3bdfSopenharmony_ci/*
718f08c3bdfSopenharmony_ci *
719f08c3bdfSopenharmony_ci * Function: anyfail()
720f08c3bdfSopenharmony_ci *
721f08c3bdfSopenharmony_ci * Description: Exit a test.
722f08c3bdfSopenharmony_ci */
723f08c3bdfSopenharmony_civoid anyfail(void)
724f08c3bdfSopenharmony_ci{
725f08c3bdfSopenharmony_ci	(local_flag == FAILED) ? tst_resm(TFAIL, "Test failed")
726f08c3bdfSopenharmony_ci	    : tst_resm(TPASS, "Test passed");
727f08c3bdfSopenharmony_ci	tst_rmdir();
728f08c3bdfSopenharmony_ci	tst_exit();
729f08c3bdfSopenharmony_ci}
730f08c3bdfSopenharmony_ci
731f08c3bdfSopenharmony_ci/**************/
732