BSD 4_4_Lite1 release
[unix-history] / usr / src / lib / libc / gen / fts.3
index be99f22..dde076d 100644 (file)
@@ -1,11 +1,37 @@
-.\" Copyright (c) 1989, 1991 The Regents of the University of California.
-.\" All rights reserved.
+.\" Copyright (c) 1989, 1991, 1993, 1994
+.\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\"
-.\" %sccs.include.redist.man%
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"     @(#)fts.3      5.18 (Berkeley) %G%
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.Dd 
+.\"     @(#)fts.3      8.5 (Berkeley) 4/16/94
+.\"
+.Dd April 16, 1994
 .Dt FTS 3
 .Os
 .Sh NAME
 .Dt FTS 3
 .Os
 .Sh NAME
@@ -20,7 +46,7 @@
 .Ft FTSENT *
 .Fn fts_read "FTS *ftsp"
 .Ft FTSENT *
 .Ft FTSENT *
 .Fn fts_read "FTS *ftsp"
 .Ft FTSENT *
-.Fn fts_children "FTS *ftsp"
+.Fn fts_children "FTS *ftsp" "int options"
 .Ft int
 .Fn fts_set "FTS ftsp" "FTSENT *f" "int options"
 .Ft int
 .Ft int
 .Fn fts_set "FTS ftsp" "FTSENT *f" "int options"
 .Ft int
@@ -83,7 +109,7 @@ typedef struct _ftsent {
        char *fts_name;                 /* file name */
        short fts_namelen;              /* strlen(fts_name) */
        short fts_level;                /* depth (\-1 to N) */
        char *fts_name;                 /* file name */
        short fts_namelen;              /* strlen(fts_name) */
        short fts_level;                /* depth (\-1 to N) */
-       int fts_error;                  /* file errno */
+       int fts_errno;                  /* file errno */
        long fts_number;                /* local numeric value */
        void *fts_pointer;              /* local address value */
        struct ftsent *fts_parent;      /* parent directory */
        long fts_number;                /* local numeric value */
        void *fts_pointer;              /* local address value */
        struct ftsent *fts_parent;      /* parent directory */
@@ -230,12 +256,6 @@ not modified by the
 .Nm fts
 functions.
 It is initialized to 0.
 .Nm fts
 functions.
 It is initialized to 0.
-The
-.Fa fts_number
-and
-.Fa fts_pointer
-fields occupy the same physical location; using both may cause undefined
-results.
 .It Fa fts_pointer
 This field is provided for the use of the application program and is
 not modified by the
 .It Fa fts_pointer
 This field is provided for the use of the application program and is
 not modified by the
@@ -243,12 +263,6 @@ not modified by the
 functions.
 It is initialized to
 .Dv NULL .
 functions.
 It is initialized to
 .Dv NULL .
-The
-.Fa fts_number
-and
-.Fa fts_pointer
-fields occupy the same physical location; using both may cause undefined
-results.
 .It Fa fts_parent
 A pointer to the
 .Fa FTSENT
 .It Fa fts_parent
 A pointer to the
 .Fa FTSENT
@@ -338,6 +352,11 @@ The options are selected by
 .Em or Ns 'ing
 the following values:
 .Bl -tag -width "FTS_PHYSICAL"
 .Em or Ns 'ing
 the following values:
 .Bl -tag -width "FTS_PHYSICAL"
+.It Dv FTS_COMFOLLOW
+This option causes any symbolic link specified as a root path to be
+followed immediately whether or not
+.Dv FTS_LOGICAL
+is also specified.
 .It Dv FTS_LOGICAL
 This option causes the
 .Nm fts
 .It Dv FTS_LOGICAL
 This option causes the
 .Nm fts
@@ -455,7 +474,7 @@ If the
 field is set to
 .Dv FTS_NS
 or
 field is set to
 .Dv FTS_NS
 or
-.DV FTS_NSOK ,
+.Dv FTS_NSOK ,
 the
 .Fa fts_statp
 field may not either.
 the
 .Fa fts_statp
 field may not either.
@@ -463,9 +482,10 @@ If the
 .Fn compar
 argument is
 .Dv NULL ,
 .Fn compar
 argument is
 .Dv NULL ,
-the directory traversal order is unspecified except
-for the root paths which are traversed in the order listed in
-.Fa path_argv .
+the directory traversal order is in the order listed in
+.Fa path_argv
+for the root paths, and in the order listed in the directory for
+everything else.
 .Sh FTS_READ
 The
 .Fn fts_read
 .Sh FTS_READ
 The
 .Fn fts_read
@@ -574,6 +594,19 @@ may be overwritten after a call to
 or
 .Fn fts_read
 on the same file hierarchy stream.
 or
 .Fn fts_read
 on the same file hierarchy stream.
+.Pp
+.Em Option
+may be set to the following value:
+.Bl -tag -width FTS_NAMEONLY
+.It Dv FTS_NAMEONLY
+Only the names of the files are needed.
+The contents of all the fields in the returned linked list of structures
+are undefined with the exception of the
+.Fa fts_name
+and
+.Fa fts_namelen
+fields.
+.El
 .Sh FTS_SET
 The function
 .Fn fts_set
 .Sh FTS_SET
 The function
 .Fn fts_set
@@ -660,16 +693,18 @@ returns 0 on success, and \-1 if an error occurs.
 .Sh ERRORS
 The function
 .Fn fts_open
 .Sh ERRORS
 The function
 .Fn fts_open
-may fail and set errno for any of the errors specified for the library
-functions
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
 .Xr open 2
 and
 .Xr malloc 3 .
 .Pp
 The function
 .Fn fts_close
 .Xr open 2
 and
 .Xr malloc 3 .
 .Pp
 The function
 .Fn fts_close
-may fail and set errno for any of the errors specified for the library
-functions
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
 .Xr chdir 2
 and
 .Xr close 2 .
 .Xr chdir 2
 and
 .Xr close 2 .
@@ -678,14 +713,28 @@ The functions
 .Fn fts_read
 and
 .Fn fts_children
 .Fn fts_read
 and
 .Fn fts_children
-may fail and set errno for any of the errors specified for the library
-functions
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
 .Xr chdir 2 ,
 .Xr malloc 3 ,
 .Xr opendir 3 ,
 .Xr readdir 3
 and
 .Xr stat 2 .
 .Xr chdir 2 ,
 .Xr malloc 3 ,
 .Xr opendir 3 ,
 .Xr readdir 3
 and
 .Xr stat 2 .
+.Pp
+In addition,
+.Fn fts_children ,
+.Fn fts_open
+and
+.Fn fts_set
+may fail and set
+.Va errno
+as follows:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The options were invalid.
+.El
 .Sh SEE ALSO
 .Xr find 1 ,
 .Xr chdir 2 ,
 .Sh SEE ALSO
 .Xr find 1 ,
 .Xr chdir 2 ,
@@ -694,6 +743,6 @@ and
 .Sh STANDARDS
 The
 .Nm fts
 .Sh STANDARDS
 The
 .Nm fts
-utility is expected to be a superset of the
+utility is expected to be included in a future
 .St -p1003.1-88
 .St -p1003.1-88
-specification.
+revision.