__getdirentries.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright (C) 1993 Free Software Foundation, Inc.
  4. * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. *
  6. * This file is part of GNU Mes.
  7. *
  8. * GNU Mes is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * GNU Mes is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. // Taken from GNU C Library 1.06.4
  22. #include <mes/lib.h>
  23. #include <dirent.h>
  24. #include <stdio.h>
  25. #include <unistd.h>
  26. int
  27. __getdirentries (int filedes, char *buffer, size_t nbytes, off_t * basep)
  28. {
  29. if (basep)
  30. *basep = lseek (filedes, (off_t) 0, SEEK_CUR);
  31. return read (filedes, buffer, nbytes);
  32. }