home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip531.zip / amiga / z-stat.h < prev   
C/C++ Source or Header  |  1995-10-21  |  3KB  |  86 lines

  1. #ifndef __Z_STAT_H
  2. #define __Z_STAT_H
  3. #define __STAT_H
  4.  
  5. /* Since older versions of the Lattice C compiler for Amiga, and all current */
  6. /* versions of the Manx Aztec C compiler for Amiga, either provide no stat() */
  7. /* function or provide one inadequate for unzip (Aztec's has no st_mode      */
  8. /* field), we provide our own stat() function in stat.c by Paul Wells, and   */
  9. /* this fake stat.h file by Paul Kienitz.  Paul Wells originally used the    */
  10. /* Lattice stat.h but that does not work for Aztec and is not distributable  */
  11. /* with this package, so I made a separate one.  This has to be pulled into  */
  12. /* unzip.h when compiling an Amiga version, as "amiga/z-stat.h".             */
  13.  
  14. /* We also provide here a "struct dirent" for use with opendir() & readdir() */
  15. /* functions included in amiga/stat.c.  If you use amiga/stat.c, this must   */
  16. /* be included wherever you use either readdir() or stat().                  */
  17.  
  18. /* This include file should ONLY be loaded if AZTEC_C is defined, and
  19.  * you are using the substitute version of stat() from amiga/stat.c.
  20.  * Bit definitions are based on those in headers for SAS/C v6.0
  21.  */
  22.  
  23. #include <time.h>
  24.  
  25. struct stat {
  26.     unsigned short st_mode;
  27.     time_t st_ctime, st_atime, st_mtime;
  28.     long st_size;
  29.     long st_ino;
  30.     long st_blocks;
  31.     short st_attr, st_dev, st_nlink, st_uid, st_gid, st_rdev;
  32. };
  33.  
  34. #define S_IFDIR  (1<<11)
  35. #define S_IFREG  (1<<10)
  36.  
  37. #if 0
  38.    /* these values here are totally random: */
  39. #  define S_IFLNK  (1<<14)
  40. #  define S_IFSOCK (1<<13)
  41. #  define S_IFCHR  (1<<8)
  42. #  define S_IFIFO  (1<<7)
  43. #  define S_IFMT   (S_IFDIR|S_IFREG|S_IFCHR|S_IFLNK)
  44. #else
  45. #  define S_IFMT   (S_IFDIR|S_IFREG)
  46. #endif
  47.  
  48. #define S_IHIDDEN    (1<<7)
  49. #define S_ISCRIPT    (1<<6)
  50. #define S_IPURE      (1<<5)
  51. #define S_IARCHIVE   (1<<4)
  52. #define S_IREAD      (1<<3)
  53. #define S_IWRITE     (1<<2)
  54. #define S_IEXECUTE   (1<<1)
  55. #define S_IDELETE    (1<<0)
  56.  
  57. int stat(char *name, struct stat *buf);
  58.  
  59.  
  60. #include <libraries/dos.h>
  61.  
  62. typedef struct dirent {
  63.     struct dirent       *d_cleanuplink,
  64.                        **d_cleanupparent;
  65.     BPTR                 d_parentlock;
  66.     struct FileInfoBlock d_fib;
  67. } DIR;
  68. #define                  d_name  d_fib.fib_FileName
  69.  
  70. extern unsigned short disk_not_mounted;         /* flag set by opendir() */
  71.  
  72. DIR *opendir(char *);
  73. void closedir(DIR *);
  74. void close_leftover_open_dirs(void);    /* call this if aborted in mid-run */
  75. struct dirent *readdir(DIR *);
  76.  
  77. int rmdir(char *);
  78.  
  79. #  ifdef AZTEC_C
  80. void tzset(void);
  81. int umask(void);
  82. int chmod(char *filename, int bits);
  83. #  endif
  84.  
  85. #endif /* __Z_STAT_H */
  86.