1 /* readdir() Author: Kees J. Bot
5 #define readdir _readdir
6 #define getdents _getdents
15 struct dirent
*readdir(DIR *dp
)
16 /* Return the next entry in a directory. */
19 int count
, pos
, reclen
;
21 if (dp
== nil
) { errno
= EBADF
; return nil
; }
25 if (count
== 0 || pos
>= count
)
27 count
= getdents(dp
->_fd
, (struct dirent
*)dp
->_buf
,
29 if (count
<= 0) return nil
;
33 entp
= (struct dirent
*)&((char *)dp
->_buf
)[pos
];
34 reclen
= entp
->d_reclen
;
41 * $PchId: _readdir.c,v 1.6 2005/01/27 21:46:42 philip Exp $