lt__dirent.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* lt__dirent.h -- internal directory entry scanning interface
  2. Copyright (C) 2001, 2004, 2006, 2011-2015 Free Software Foundation,
  3. Inc.
  4. Written by Bob Friesenhahn, 2001
  5. NOTE: The canonical source of this file is maintained with the
  6. GNU Libtool package. Report bugs to bug-libtool@gnu.org.
  7. GNU Libltdl is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2 of the License, or (at your option) any later version.
  11. As a special exception to the GNU Lesser General Public License,
  12. if you distribute this file as part of a program or library that
  13. is built using GNU Libtool, you may include this file under the
  14. same distribution terms that you use for the rest of that program.
  15. GNU Libltdl is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU Lesser General Public License for more details.
  19. You should have received a copy of the GNU Lesser General Public
  20. License along with GNU Libltdl; see the file COPYING.LIB. If not, a
  21. copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
  22. or obtained by writing to the Free Software Foundation, Inc.,
  23. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #if !defined LT__DIRENT_H
  26. #define LT__DIRENT_H 1
  27. #if defined LT_CONFIG_H
  28. # include LT_CONFIG_H
  29. #else
  30. # include <config.h>
  31. #endif
  32. #include "lt_system.h"
  33. #ifdef HAVE_DIRENT_H
  34. /* We have a fully operational dirent subsystem. */
  35. # include <dirent.h>
  36. # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
  37. #elif defined __WINDOWS__
  38. /* Use some wrapper code to emulate dirent on windows.. */
  39. # define WINDOWS_DIRENT_EMULATION 1
  40. # include <windows.h>
  41. # define D_NAMLEN(dirent) (strlen((dirent)->d_name))
  42. # define dirent lt__dirent
  43. # define DIR lt__DIR
  44. # define opendir lt__opendir
  45. # define readdir lt__readdir
  46. # define closedir lt__closedir
  47. LT_BEGIN_C_DECLS
  48. struct dirent
  49. {
  50. char d_name[LT_FILENAME_MAX];
  51. int d_namlen;
  52. };
  53. typedef struct
  54. {
  55. HANDLE hSearch;
  56. WIN32_FIND_DATA Win32FindData;
  57. BOOL firsttime;
  58. struct dirent file_info;
  59. } DIR;
  60. LT_SCOPE DIR * opendir (const char *path);
  61. LT_SCOPE struct dirent *readdir (DIR *entry);
  62. LT_SCOPE void closedir (DIR *entry);
  63. LT_END_C_DECLS
  64. #else /* !defined __WINDOWS__*/
  65. ERROR - cannot find dirent
  66. #endif /*!defined __WINDOWS__*/
  67. #endif /*!defined LT__DIRENT_H*/