Deleted Added
full compact
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/gen/directory.3 50476 1999-08-28 00:22:10Z peter $
33.\" $FreeBSD: head/lib/libc/gen/directory.3 53872 1999-11-29 06:12:22Z wes $
34.\"
35.Dd June 4, 1993
36.Dt DIRECTORY 3
37.Os BSD 4.2
38.Sh NAME
39.Nm opendir ,
40.Nm readdir ,
41.Nm readdir_r ,
42.Nm telldir ,
43.Nm seekdir ,
44.Nm rewinddir ,
45.Nm closedir ,
46.Nm dirfd
47.Nd directory operations
48.Sh SYNOPSIS
49.Fd #include <sys/types.h>
50.Fd #include <dirent.h>
51.Ft DIR *
52.Fn opendir "const char *filename"
53.Ft struct dirent *
54.Fn readdir "DIR *dirp"
55.Ft int
56.Fn readdir_r "DIR *dirp" "struct dirent *entry" "struct dirent **result"
57.Ft long
58.Fn telldir "const DIR *dirp"
59.Ft void
60.Fn seekdir "DIR *dirp" "long loc"
61.Ft void
62.Fn rewinddir "DIR *dirp"
63.Ft int
64.Fn closedir "DIR *dirp"

--- 23 unchanged lines hidden (view full) ---

88.Fn readdir
89function
90returns a pointer to the next directory entry. It returns
91.Dv NULL
92upon reaching the end of the directory or detecting an invalid
93.Fn seekdir
94operation.
95.Pp
96.Fn readdir_r
97provides the same functionality as
98.Fn readdir ,
99but the caller must provide a directory
100.Fa entry
101buffer to store the results in. If the read succeeds,
102.Fa result
103is pointed at the
104.Fa entry ;
105upon reaching the end of the directory
106.Fa result
107is set to
108.Dv NULL .
109.Fn readdir_r
110returns 0 on success or an error number to indicate failure.
111.Pp
112The
113.Fn telldir
114function
115returns the current location associated with the named
116.Em directory stream .
117Values returned by
118.Fn telldir
119are good only for the lifetime of the

--- 79 unchanged lines hidden ---