Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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