z-stat.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. #ifndef __amiga_z_stat_h
  9. #define __amiga_z_stat_h
  10. /* Since older versions of the Lattice C compiler for Amiga, and all current */
  11. /* versions of the Manx Aztec C compiler for Amiga, either provide no stat() */
  12. /* function or provide one inadequate for unzip (Aztec's has no st_mode */
  13. /* field), we provide our own stat() function in stat.c by Paul Wells, and */
  14. /* this fake stat.h file by Paul Kienitz. Paul Wells originally used the */
  15. /* Lattice stat.h but that does not work for Aztec and is not distributable */
  16. /* with this package, so I made a separate one. This has to be pulled into */
  17. /* unzip.h when compiling an Amiga version, as "amiga/z-stat.h". */
  18. /* We also provide here a "struct dirent" for use with opendir() & readdir() */
  19. /* functions included in amiga/stat.c. If you use amiga/stat.c, this must */
  20. /* be included wherever you use either readdir() or stat(). */
  21. #ifdef AZTEC_C
  22. # define __STAT_H
  23. #else /* __SASC */
  24. /* do not include the following header, replacement definitions are here */
  25. # define _STAT_H /* do not include SAS/C <stat.h> */
  26. # define _DIRENT_H /* do not include SAS/C <dirent.h> */
  27. # define _SYS_DIR_H /* do not include SAS/C <sys/dir.h> */
  28. # define _COMMIFMT_H /* do not include SAS/C <sys/commifmt.h> */
  29. # include <dos.h>
  30. #endif
  31. #include <libraries/dos.h>
  32. #include <time.h>
  33. struct stat {
  34. unsigned short st_mode;
  35. time_t st_ctime, st_atime, st_mtime;
  36. long st_size;
  37. long st_ino;
  38. long st_blocks;
  39. short st_attr, st_dev, st_nlink, st_uid, st_gid, st_rdev;
  40. };
  41. #define S_IFDIR (1<<11)
  42. #define S_IFREG (1<<10)
  43. #if 0
  44. /* these values here are totally random: */
  45. # define S_IFLNK (1<<14)
  46. # define S_IFSOCK (1<<13)
  47. # define S_IFCHR (1<<8)
  48. # define S_IFIFO (1<<7)
  49. # define S_IFMT (S_IFDIR|S_IFREG|S_IFCHR|S_IFLNK)
  50. #else
  51. # define S_IFMT (S_IFDIR|S_IFREG)
  52. #endif
  53. #define S_IHIDDEN (1<<7)
  54. #define S_ISCRIPT (1<<6)
  55. #define S_IPURE (1<<5)
  56. #define S_IARCHIVE (1<<4)
  57. #define S_IREAD (1<<3)
  58. #define S_IWRITE (1<<2)
  59. #define S_IEXECUTE (1<<1)
  60. #define S_IDELETE (1<<0)
  61. int stat(const char *name, struct stat *buf);
  62. int fstat(int handle, struct stat *buf); /* returns dummy values */
  63. typedef struct dirent {
  64. struct dirent *d_cleanuplink,
  65. **d_cleanupparent;
  66. BPTR d_parentlock;
  67. struct FileInfoBlock d_fib;
  68. } DIR;
  69. #define d_name d_fib.fib_FileName
  70. extern unsigned short disk_not_mounted; /* flag set by opendir() */
  71. DIR *opendir(const char *);
  72. void closedir(DIR *);
  73. void close_leftover_open_dirs(void); /* call this if aborted in mid-run */
  74. struct dirent *readdir(DIR *);
  75. int umask(void);
  76. #ifdef AZTEC_C
  77. int rmdir(const char *);
  78. int chmod(const char *filename, int bits);
  79. #endif
  80. #endif /* __amiga_z_stat_h */