rewinddir.c 300 B

123456789101112131415
  1. #include <errno.h>
  2. #include <unistd.h>
  3. #include "dirstream.h"
  4. /* rewinddir() just does an lseek(fd,0,0) - see close for comments */
  5. void rewinddir(DIR * dir)
  6. {
  7. if (!dir) {
  8. __set_errno(EBADF);
  9. return;
  10. }
  11. lseek(dir->dd_fd, 0, SEEK_SET);
  12. dir->dd_nextoff = dir->dd_nextloc = dir->dd_size = 0;
  13. }