From 34470507ed5ed8ed1faf48d8c3f3f9953f91e2cb Mon Sep 17 00:00:00 2001 From: wes Date: Mon, 29 Nov 1999 06:12:22 +0000 Subject: Provide a man page for Alfreds lovely readdir_r function. Also fixed a minor indentation nit and added a few {}s to make readdir_r easier on old eyes. --- lib/libc/gen/directory.3 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/libc/gen/directory.3') diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3 index 23cd2f9..6334d38 100644 --- a/lib/libc/gen/directory.3 +++ b/lib/libc/gen/directory.3 @@ -38,6 +38,7 @@ .Sh NAME .Nm opendir , .Nm readdir , +.Nm readdir_r , .Nm telldir , .Nm seekdir , .Nm rewinddir , @@ -51,6 +52,8 @@ .Fn opendir "const char *filename" .Ft struct dirent * .Fn readdir "DIR *dirp" +.Ft int +.Fn readdir_r "DIR *dirp" "struct dirent *entry" "struct dirent **result" .Ft long .Fn telldir "const DIR *dirp" .Ft void @@ -90,6 +93,22 @@ upon reaching the end of the directory or detecting an invalid .Fn seekdir operation. .Pp +.Fn readdir_r +provides the same functionality as +.Fn readdir , +but the caller must provide a directory +.Fa entry +buffer to store the results in. If the read succeeds, +.Fa result +is pointed at the +.Fa entry ; +upon reaching the end of the directory +.Fa result +is set to +.Dv NULL . +.Fn readdir_r +returns 0 on success or an error number to indicate failure. +.Pp The .Fn telldir function -- cgit v1.1