os2zip.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * @(#) dir.h 1.4 87/11/06 Public Domain.
  3. *
  4. * A public domain implementation of BSD directory routines for
  5. * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield),
  6. * August 1987
  7. *
  8. * Ported to OS/2 by Kai Uwe Rommel
  9. * Addition of other OS/2 file system specific code
  10. * Placed into the public domain
  11. */
  12. #define MAXNAMLEN 256
  13. #define MAXPATHLEN 256
  14. #define _A_RONLY 0x01
  15. #define _A_HIDDEN 0x02
  16. #define _A_SYSTEM 0x04
  17. #define _A_VOLID 0x08
  18. #define _A_DIR 0x10
  19. #define _A_ARCHIVE 0x20
  20. struct dirent
  21. {
  22. ino_t d_ino; /* a bit of a farce */
  23. int d_reclen; /* more farce */
  24. int d_namlen; /* length of d_name */
  25. char d_name[MAXNAMLEN + 1]; /* null terminated */
  26. /* nonstandard fields */
  27. long d_size; /* size in bytes */
  28. unsigned d_mode; /* DOS or OS/2 file attributes */
  29. unsigned d_time;
  30. unsigned d_date;
  31. };
  32. /* The fields d_size and d_mode are extensions by me (Kai Uwe Rommel).
  33. * The find_first and find_next calls deliver this data without any extra cost.
  34. * If this data is needed, these fields save a lot of extra calls to stat()
  35. * (each stat() again performs a find_first call !).
  36. */
  37. struct _dircontents
  38. {
  39. char *_d_entry;
  40. long _d_size;
  41. unsigned _d_mode, _d_time, _d_date;
  42. struct _dircontents *_d_next;
  43. };
  44. typedef struct _dirdesc
  45. {
  46. int dd_id; /* uniquely identify each open directory */
  47. long dd_loc; /* where we are in directory entry is this */
  48. struct _dircontents *dd_contents; /* pointer to contents of dir */
  49. struct _dircontents *dd_cp; /* pointer to current position */
  50. }
  51. DIR;
  52. extern DIR *opendir(const char *);
  53. extern struct dirent *readdir(DIR *);
  54. extern void seekdir(DIR *, long);
  55. extern long telldir(DIR *);
  56. extern void closedir(DIR *);
  57. #define rewinddir(dirp) seekdir(dirp, 0L)
  58. int GetFileMode(char *name);
  59. ulg GetFileTime(char *name);
  60. void SetFileTime(char *path, ulg stamp);
  61. char *getVolumeLabel(int drive, unsigned long *time, unsigned long *mode,
  62. time_t *utim);
  63. int IsFileNameValid(char *name);
  64. int IsFileSystemFAT(char *dir);
  65. void ChangeNameForFAT(char *name);
  66. char *GetLongNameEA(const char *name);
  67. char *GetLongPathEA(const char *name);
  68. void GetEAs(char *name, char **bufptr, size_t *size,
  69. char **cbufptr, size_t *csize);
  70. char *StringLower(char *);