/security/dbm/src/dirent.h

http://github.com/zpao/v8monkey · C Header · 97 lines · 65 code · 13 blank · 19 comment · 5 complexity · e30bd1a8f55453b0690befcc5d4d1e34 MD5 · raw file

  1. #ifndef __DIRENT_H__
  2. #define __DIRENT_H__
  3. /*
  4. * @(#)msd_dir.h 1.4 87/11/06 Public Domain.
  5. *
  6. * A public domain implementation of BSD directory routines for
  7. * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
  8. * August 1897
  9. *
  10. * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks
  11. * and returns 2 more pieces of information - file size & attribute.
  12. * Plus a little reshuffling of some #define's positions December 1987
  13. *
  14. * Some modifications by Martin Junius 02-14-89
  15. *
  16. * AK900712
  17. * AK910410 abs_path - make absolute path
  18. *
  19. */
  20. #ifdef __EMX__
  21. #include <sys/param.h>
  22. #else
  23. #if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC)
  24. #include <stdio.h>
  25. #ifdef MAXPATHLEN
  26. #undef MAXPATHLEN
  27. #endif
  28. #define MAXPATHLEN (FILENAME_MAX*4)
  29. #define MAXNAMLEN FILENAME_MAX
  30. #else
  31. #include <param.h>
  32. #endif
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /* attribute stuff */
  38. #ifndef A_RONLY
  39. # define A_RONLY 0x01
  40. # define A_HIDDEN 0x02
  41. # define A_SYSTEM 0x04
  42. # define A_LABEL 0x08
  43. # define A_DIR 0x10
  44. # define A_ARCHIVE 0x20
  45. #endif
  46. struct dirent {
  47. #if defined(OS2) || defined(WIN32) /* use the layout of EMX to avoid trouble */
  48. int d_ino; /* Dummy */
  49. int d_reclen; /* Dummy, same as d_namlen */
  50. int d_namlen; /* length of name */
  51. char d_name[MAXNAMLEN + 1];
  52. unsigned long d_size;
  53. unsigned short d_attribute; /* attributes (see above) */
  54. unsigned short d_time; /* modification time */
  55. unsigned short d_date; /* modification date */
  56. #else
  57. char d_name[MAXNAMLEN + 1]; /* garentee null termination */
  58. char d_attribute; /* .. extension .. */
  59. unsigned long d_size; /* .. extension .. */
  60. #endif
  61. };
  62. typedef struct _dirdescr DIR;
  63. /* the structs do not have to be defined here */
  64. extern DIR *opendir(const char *);
  65. extern DIR *openxdir(const char *, unsigned);
  66. extern struct dirent *readdir(DIR *);
  67. extern void seekdir(DIR *, long);
  68. extern long telldir(DIR *);
  69. extern void closedir(DIR *);
  70. #define rewinddir(dirp) seekdir(dirp, 0L)
  71. extern char * abs_path(const char *name, char *buffer, int len);
  72. #ifndef S_IFMT
  73. #define S_IFMT ( S_IFDIR | S_IFREG )
  74. #endif
  75. #ifndef S_ISDIR
  76. #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR)
  77. #endif
  78. #ifndef S_ISREG
  79. #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG)
  80. #endif
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif