


     ftw(XOPEN.os/genutsRelease	4.4.1 (UniSoft Ltdftw(XOPEN.os/genuts)



     NAME
	  XOPEN.os/genuts/ftw -	walk a file tree testset

     DESCRIPTION
	  Ftw tests the	ftw() subroutine interface for conformance to
	  the XSI System Interfaces Page:ftw()

     TESTS
     Compliance
	  1    ftw() recursively descends the directory	hierarchy
	       rooted in path until it has traversed the whole tree,
	       calling the function fn for each	object in the
	       directory tree, and returns zero.

	  2    ftw() visits a directory	before visiting	its
	       descendants.

	  3    ftw() passes
	       a. the path-name	of the current object, which is	a NULL
	       terminated string including the root name specified by
	       path, as	the first argument of the function fn;
	       b. a pointer to a stat structure, containing
	       information about the current object, as	the second
	       argument	of the function	fn;
	       c. an integer as	the third argument of the function,
	       which should be defined as :
		    i. FTW_F if	the object is a	file;
		    ii.	FTW_D if the object is a directory;
		    iii. FTW_DNR if the	object is a directory that
		    cannot be read;
		    iv.	FTW_NS if a stat() could not be	carried	out on
		    the	object.

	  4    If the integer passed to	the function fn	is FTW_DNR
	       then the	descendants of the directory will not be
	       processed.

	  5    ftw() closes any	file descriptors or directory streams
	       used to traverse	the directory tree.

	  6    ndirs is	the maximum number of file descriptors or
	       directory streams used by ftw().

	  7    If ndirs	is negative or zero, then ftw()	either
	       executes	as if it were 1	or returns -1 and sets errno
	       to EINVAL.

	  8    If the function fn returns a non-zero value then	ftw()
	       stops and returns the return value of fn.

     Deviance
	  9    If _POSIX_PATH_MAX <= {PATH_MAX}	<= PCTS_PATH_MAX, then



     Page 1					    (printed 2/21/103)






     ftw(XOPEN.os/genutsRelease	4.4.1 (UniSoft Ltdftw(XOPEN.os/genuts)



	       ftw() returns -1	and sets errno to ENAMETOOLONG if the
	       length of path exceeds PATH_MAX;
				      otherwise
	       a call to ftw() when the	length of the path argument
	       equals PCTS_PATH_MAX does not give an ENAMETOOLONG
	       error.

	  10   For the XNFS specification:
		   Not in use.
	       For the XSH specification:
		   If POSIX_NO_TRUNC is	in effect:
		       If _POSIX_NAME_MAX <= {NAME_MAX}	<=
		       PCTS_NAME_MAX, then ftw() returns -1 and	sets
		       errno to	ENAMETOOLONG if	a component of path
		       exceeds NAME_MAX;
					  otherwise
		       a call to ftw() when the	length of a component
		       of path equals PCTS_NAME_MAX does not give an
		       ENAMETOOLONG error.

	  11   ftw() returns -1	and sets errno to ENOENT if path
	       points to a file	which does not exist.

	  12   ftw() returns -1	and sets errno to ENOENT if path is an
	       empty string.

	  13   ftw() returns -1	and sets errno to ENOTDIR if a
	       component of path is not	a directory.

	  14   For the XNFS specification:
		   If {_POSIX_NO_TRUNC}	is defined on the client and
		   {NAME_MAX} on the client is less than or equal to
		   PCTS_NAME_MAX:
		       When the	length of a pathname component of path
		       is longer than {NAME_MAX} on the	client,	then a
		       call to ftw(path, args ...)  returns a value of
		       -1 and sets errno to ENAMETOOLONG.
	       For the XSH specification:
		   Not in use.

	  15   For the XNFS specification:
		   If {_POSIX_NO_TRUNC}	is defined on the server and
		   {NAME_MAX} on the server is less than or equal to
		   PCTS_NAME_MAX and {NAME_MAX}	on the server is less
		   than	NFS_MAXNAMLEN and {NAME_MAX} on	the server is
		   less	than {NAME_MAX}	on the client:
		       When the	length of a pathname component of path
		       is longer than {NAME_MAX} on the	server,	then a
		       call to ftw(path, args ...)  returns a value of
		       -1 and sets errno to ENAMETOOLONG.
	       For the XSH specification:
		   Not in use.



     Page 2					    (printed 2/21/103)






     ftw(XOPEN.os/genutsRelease	4.4.1 (UniSoft Ltdftw(XOPEN.os/genuts)



	  16   For the XNFS specification:
		   If {_POSIX_NO_TRUNC}	is defined on the client and
		   {NAME_MAX} on the client is greater than or equal
		   to NFS_MAXNAMLEN and	{_POSIX_NO_TRUNC} is defined
		   on the server and {NAME_MAX}	on the server is
		   greater than	or equal to NFS_MAXNAMLEN:
		       When the	length of a pathname component of path
		       is equal	to NFS_MAXNAMLEN, then a call to
		       ftw(path, args ...)  does not give an
		       ENAMETOOLONG error.
	       For the XSH specification:
		   Not in use.

	  17   For the XNFS specification:
		   If {_POSIX_NO_TRUNC}	is defined on the client and
		   {NAME_MAX} on the client is greater than or equal
		   to NFS_MAXNAMLEN and	{_POSIX_NO_TRUNC} is not
		   defined on the server:
		       When the	length of a pathname component of path
		       is equal	to NFS_MAXNAMLEN, then a call to
		       ftw(path, args ...)  does not give an
		       ENAMETOOLONG error.
	       For the XSH specification:
		   Not in use.

     OUTPUTS
     Tests:
	  1    Pass/Fail indication - failure information includes
	       detected	and expected return value and point of failure
	       in directory tree.

	  2    Pass/Fail indication only.

	  3    Pass/Fail indication - failure information includes
	       detected	and expected argument value.

	  4-5  Pass/Fail indication only.

	  6-7  Pass/Fail indication - failure information includes
	       detected	and expected number of file descriptors	used
	       by ftw().

	  8    Pass/Fail indication - failure information includes
	       detected	and expected return value.

	  9    Pass/Fail indication - failure information includes
	       detected	and expected errno and return value.

	  10   Pass/Fail/Unsupported indication	- failure information
	       includes	expected and detected error number and return
	       value.




     Page 3					    (printed 2/21/103)






     ftw(XOPEN.os/genutsRelease	4.4.1 (UniSoft Ltdftw(XOPEN.os/genuts)



	  11-13
	       Pass/Fail indication - failure information includes
	       detected	and expected errno and return value.

	  14-17
	       Pass/Fail/Unsupported indication	- failure information
	       includes	expected and detected error number and return
	       value.

     RELEASE
	  4.4.1	(06/09/97)












































     Page 4					    (printed 2/21/103)



