home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip532.zip / amiga / z-stat.h < prev   
C/C++ Source or Header  |  1997-05-11  |  2KB  |  82 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. #include <time.h>
  19.  
  20. struct stat {
  21.     unsigned short st_mode;
  22.     time_t st_ctime, st_atime, st_mtime;
  23.     long st_size;
  24.     long st_ino;
  25.     long st_blocks;
  26.     short st_attr, st_dev, st_nlink, st_uid, st_gid, st_rdev;
  27. };
  28.  
  29. #define S_IFDIR  (1<<11)
  30. #define S_IFREG  (1<<10)
  31.  
  32. #if 0
  33.    /* these values here are totally random: */
  34. #  define S_IFLNK  (1<<14)
  35. #  define S_IFSOCK (1<<13)
  36. #  define S_IFCHR  (1<<8)
  37. #  define S_IFIFO  (1<<7)
  38. #  define S_IFMT   (S_IFDIR|S_IFREG|S_IFCHR|S_IFLNK)
  39. #else
  40. #  define S_IFMT   (S_IFDIR|S_IFREG)
  41. #endif
  42.  
  43. #define S_IHIDDEN    (1<<7)
  44. #define S_ISCRIPT    (1<<6)
  45. #define S_IPURE      (1<<5)
  46. #define S_IARCHIVE   (1<<4)
  47. #define S_IREAD      (1<<3)
  48. #define S_IWRITE     (1<<2)
  49. #define S_IEXECUTE   (1<<1)
  50. #define S_IDELETE    (1<<0)
  51.  
  52. int stat(char *name, struct stat *buf);
  53. int fstat(int handle, struct stat *buf);      /* returns dummy values */
  54.  
  55.  
  56. #include <libraries/dos.h>
  57.  
  58. typedef struct dirent {
  59.     struct dirent       *d_cleanuplink,
  60.                        **d_cleanupparent;
  61.     BPTR                 d_parentlock;
  62.     struct FileInfoBlock d_fib;
  63. } DIR;
  64. #define                  d_name  d_fib.fib_FileName
  65.  
  66. extern unsigned short disk_not_mounted;         /* flag set by opendir() */
  67.  
  68. DIR *opendir(char *);
  69. void closedir(DIR *);
  70. void close_leftover_open_dirs(void);    /* call this if aborted in mid-run */
  71. struct dirent *readdir(DIR *);
  72.  
  73. int rmdir(char *);
  74.  
  75. #  ifdef AZTEC_C
  76. void tzset(void);
  77. int umask(void);
  78. int chmod(char *filename, int bits);
  79. #  endif
  80.  
  81. #endif /* __Z_STAT_H */
  82.