home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / packery / unrar / sources / amiga-gcc / amyunrar.h next >
C/C++ Source or Header  |  1977-12-31  |  3KB  |  125 lines

  1. /******    *****   ******
  2.  **   **  **   **  **   **      unRAR utility version 1.01
  3.  ******   *******  ******       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4.  **   **  **   **  **   **         FREE portable version
  5.  **   **  **   **  **   **         ~~~~~~~~~~~~~~~~~~~~~
  6.  
  7.      Definitions header
  8.  
  9.    UNCOMMENT ONE OF THE INITIAL LINES TO DEFINE YOUR OS TYPE.
  10. */
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <ctype.h>
  16.  
  17. /*
  18.     In following generic OS definitions you can define the optional
  19.     macro SETFILETIME in order to allow UNRAR properly handle the time
  20.     format of your operating media.
  21.  
  22.     The first argument of SETFILETIME is FILE *DestFile, and the
  23.     second one - pointer to the DOS time structure.
  24.  
  25.     You can disable SETFILETIME by single ';' after the macro name:
  26.  
  27.     #define SETFILETIME(FPtr,DosTimePtr)  ;
  28. */
  29.  
  30.  
  31. #ifdef AMIGA
  32.  
  33. typedef unsigned char   UBYTE;
  34. typedef unsigned short  UWORD;
  35. typedef unsigned long   UDWORD;
  36. typedef long            SDWORD;
  37. typedef UBYTE *         HPBYTE;
  38.  
  39. #define MEMALLOC(Size)                malloc(Size)
  40. #define MEMFREE(Ptr)                  free(Ptr)
  41. #define MAKEDIR(Name)                 mkdir(Name)
  42. #define SETFILETIME(FPtr,DosTimePtr)  ;
  43. #define PATHDIV                       '/'
  44. #define FOPENREADMODE                 "rb"
  45. #define FOPENWRITEMODE                "wb"
  46. #endif
  47.  
  48. #define  UNP_VER       15       /* current version of unpacking method */
  49.  
  50. /* DOS specific file atributes flags */
  51. #define DOSFA_RDONLY   0x01
  52. #define DOSFA_HIDDEN   0x02
  53. #define DOSFA_SYSTEM   0x04
  54. #define DOSFA_LABEL    0x08
  55. #define DOSFA_DIREC    0x10
  56. #define DOSFA_ARCH     0x20
  57.  
  58. /* Exit codes */
  59. enum { SUCCESS=0,WARNING=5,FATAL_ERROR=10,CRC_ERROR=10,LOCK_ERROR=5,WRITE_ERROR=10,
  60.        OPEN_ERROR=10,USER_ERROR,MEMORY_ERROR=103,USER_BREAK=255 };
  61.  
  62. /* Status for shutdown */
  63. enum { SD_MEMORY=1,SD_FILES=2 };
  64.  
  65. /* Status for path comparison */
  66. enum { COMPARE_PATH,NOT_COMPARE_PATH };
  67.  
  68. /* Archive header flags */
  69. #define  MHD_MULT_VOL       1
  70. #define  MHD_COMMENT        2
  71. #define  MHD_LOCK           4
  72. #define  MHD_SOLID          8
  73.  
  74. /* File header flags */
  75. #define  LHD_SPLIT_BEFORE   1
  76. #define  LHD_SPLIT_AFTER    2
  77. #define  LHD_PASSWORD       4
  78. #define  LHD_COMMENT        8
  79. #define  SKIP_IF_UNKNOWN    0x4000
  80. #define  LONG_BLOCK         0x8000
  81.  
  82. /* Archive internal block types */
  83. enum { ALL_HEAD=0,MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,
  84.        COMM_HEAD=0x75 };
  85.  
  86. /* HostOS code */
  87. enum { MS_DOS=0 };
  88.  
  89. /* Error codes */
  90. enum { EEMPTY = -1,EWRITE = 1,EREAD,EOPEN,ECLOSE,ESEEK,EMEMORY,EARCH };
  91.  
  92. /* Headers definitions */
  93.  
  94. struct MarkHeader
  95. {
  96.   UBYTE Mark[5];
  97.   UWORD HeadSize;
  98. };
  99.  
  100. struct ArchiveHeader
  101. {
  102.   UWORD  HeadCRC;
  103.   UBYTE  HeadType;
  104.   UWORD  Flags;
  105.   UWORD  HeadSize;
  106.   UBYTE  Reserved[6];
  107. };
  108.  
  109. struct FileHeader
  110. {
  111.   UWORD  HeadCRC;
  112.   UBYTE  HeadType;
  113.   UWORD  Flags;
  114.   UWORD  HeadSize;
  115.   UDWORD PackSize;
  116.   UDWORD UnpSize;
  117.   UBYTE  HostOS;
  118.   UDWORD FileCRC;
  119.   UDWORD FileTime;
  120.   UBYTE  UnpVer;
  121.   UBYTE  Method;
  122.   UWORD  NameSize;
  123.   UDWORD FileAttr;
  124. };
  125.