home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c019 / 1.ddi / ARCVIEW / ARCHDR.H next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  7.2 KB  |  164 lines

  1. #ifndef fallthrough        /* "fallthrough" is in opus.h */
  2. typedef unsigned    char    byte;
  3. typedef unsigned    int     word;
  4. #endif
  5.  
  6.  
  7. /****** General purpose Symbolic constants:  *********/
  8. #define TRUE    1        /* general purpose true truth value */
  9. #define FALSE    0        /* general purpose false truth value */
  10. #define ERROR    -1        /* General "on error" return value */
  11. #define OK    0        /* General "no error" return value */
  12. #define EOS    '\0'        /* standard end of string */
  13.  
  14. #define MAX_PATH    78        /* max. length of full pathname        */
  15. #define MAX_DIR     66        /* max. length of full directory name    */
  16.  
  17.  
  18. /*----------------------------------------------------------------------*/
  19. /*         Information for file date conversion            */
  20. /*----------------------------------------------------------------------*/
  21. #define MONTH_SHIFT     5
  22. #define MONTH_MASK      0x0F
  23. #define DAY_MASK    0x1F
  24. #define YEAR_SHIFT      9
  25. #define DOS_EPOCH       80
  26. #define HOUR_SHIFT      11
  27. #define HOUR_MASK       0x1F
  28. #define MINUTE_SHIFT    5
  29. #define MINUTE_MASK     0x3F
  30.  
  31.  
  32. /*----------------------------------------------------------------------*/
  33. /*              archive list junk                */
  34. /*----------------------------------------------------------------------*/
  35. #define ARCMARK 26    /* special archive marker */
  36. #define ARCVER 10    /* highest compression code used */
  37.  
  38. #pragma pack(1)        /* req'd by MSC to keep struct byte aligned */ 
  39. struct heads        /* archive entry header format */
  40. {   
  41.     char mbrname[13];    /* file name */
  42.     long mbrsize;    /* size of file in archive, bytes */
  43.     unsigned mbrdate;    /* creation date */
  44.     unsigned mbrtime;    /* creation time */
  45.     int mbrcrc;        /* cyclic redundancy check */
  46.     long mbrlen;    /* true file size, bytes */
  47. };
  48. #pragma pack()        /* we now return to our regular programming */
  49.  
  50.  
  51. /*--------------------------------------------------------------------------*/
  52. /* Garbage for ZOO listing                                                  */
  53. /*--------------------------------------------------------------------------*/
  54.  
  55. #define MAJOR_VER 1        /* needed to manipulate archive */
  56. #define MINOR_VER 4
  57.  
  58. #define MAJOR_EXT_VER 1    /* needed to extract file */
  59. #define MINOR_EXT_VER 0
  60.  
  61. #define CTRL_Z 26
  62. #define ZOO_TAG ((unsigned long) 0xFDC4A7DC) /* A random choice */
  63. #define TEXT "ZOO 1.50 Archive.\032"   /* Header text for archive. */
  64. #define SIZ_TEXT  20                   /* Size of header text */
  65.  
  66. #define PATHSIZE 256                   /* Max length of pathname */
  67. #define FNAMESIZE 13                   /* Size of DOS filename */
  68. #define LFNAMESIZE 256                 /* Size of long filename */
  69. #define ROOTSIZE 8                     /* Size of fname without extension */
  70. #define EXTLEN 3                       /* Size of extension */
  71. #define FILE_LEADER  "@)#("            /* Allowing location of file data */
  72. #define SIZ_FLDR  5                    /* 4 chars plus null */
  73. #define MAX_PACK 1                     /* max packing method we can handle */
  74. #define BACKUP_EXT ".bak"              /* extension of backup file */
  75.  
  76. #ifdef OOZ
  77. #define FIRST_ARG 2
  78. #endif
  79.  
  80. #ifdef ZOO
  81. #define FIRST_ARG 3        /* argument position of filename list */
  82. #endif
  83.  
  84. /* WARNING:  Static initialization in zooadd.c or zooext.c depends on the 
  85.    order of fields in struct zoo_header */
  86. struct zoo_header {
  87.    char text[SIZ_TEXT];       /* archive header text */
  88.    unsigned long zoo_tag;     /* identifies archives           */
  89.    long zoo_start;            /* where the archive's data starts        */
  90.    long zoo_minus;      /* for consistency checking of zoo_start  */
  91.    char major_ver;
  92.    char minor_ver;            /* minimum version to extract all files   */
  93. };
  94.  
  95. /* Note:  Microsoft C aligns data at word boundaries.  So, to keep things
  96.    compact, always try to pair up character fields. */
  97. struct direntry {
  98.    unsigned long zoo_tag;     /* tag -- redundancy check */
  99.    char type;                 /* type of directory entry.  always 1 for now */
  100.    char packing_method;       /* 0 = no packing, 1 = normal LZW */
  101.    long next;                 /* pos'n of next directory entry */
  102.    long offset;               /* position of this file */
  103.    unsigned int date;         /* DOS format date */
  104.    unsigned int time;         /* DOS format time */
  105.    unsigned int file_crc;     /* CRC of this file */
  106.    long org_size;
  107.    long size_now;
  108.    char major_ver;
  109.    char minor_ver;            /* minimum version needed to extract */
  110.    char deleted;              /* will be 1 if deleted, 0 if not */
  111.    char struc;                /* file structure if any */
  112.    long comment;              /* points to comment;  zero if none */
  113.    unsigned int cmt_size; /* length of comment, 0 if none */
  114.    char fname[FNAMESIZE]; /* filename */
  115.  
  116.    int var_dir_len;           /* length of variable part of dir entry */
  117.    char tz;                   /* timezone where file was archived */
  118.    unsigned int dir_crc;      /* CRC of directory entry */
  119.  
  120.    /* fields for variable part of directory entry follow */
  121.    char namlen;               /* length of long filename */
  122.    char dirlen;               /* length of directory name */
  123.    char lfname[LFNAMESIZE];   /* long filename */
  124.    char dirname[PATHSIZE];    /* directory name */
  125.    int system_id;             /* Filesystem ID */
  126. };
  127.  
  128. /* Values for direntry.system_id */
  129. #define SYSID_NIX       0     /* UNIX and similar filesystems */
  130. #define SYSID_MS        1     /* MS-DOS filesystem */
  131. #define SYSID_PORTABLE  2     /* Portable syntax */
  132.  
  133. /*-End of Zoo stuff---------------------------------------------------------*/
  134. /*-Start of DWC stuff-------------------------------------------------------*/
  135. #pragma pack(1)        /* req'd by MSC to keep struct byte aligned    */ 
  136.  
  137. /* ENTRY - information that is stored for each file in the DWC archive.      */
  138.  
  139. struct dwc_entry {
  140.    char     name[13];      /* ... File name, Note: path is not saved here    */
  141.    long     size;          /* ... Size of file before compression in bytes   */
  142.    long     time;          /* ... Time stamp on file before added to archive */
  143.    long     new_size;      /* ... Size of compressed file                    */
  144.    long     pos;           /* ... Position of file in archive file           */
  145.    char     method;        /* ... Method of compression used on file         */
  146.    char     sz_c;          /* ... Size of comment added to file              */
  147.    char     sz_d;          /* ... Size of directory name recorded on add     */
  148.    unsigned crc;           /* ... CRC value computed for this file           */
  149. };
  150.  
  151. /* ARCHIVE - information that is stored at the end of every achive.          */
  152.  
  153. struct dwc_arc {
  154.    unsigned size;          /* ... Size of archive structure, future expansion*/
  155.    char     ent_sz;        /* ... Size of directory entry, future expansion  */
  156.    char     header[13];    /* ... Name of Header file to print on listings   */
  157.    long     time;          /* ... Time stamp of last modification to archive */
  158.    long     entries;       /* ... Number of entries in archive               */
  159.    char     id[3];         /* ... the string "DWC" to identify archive       */
  160. };
  161. #pragma pack()
  162. /*-End of DWC stuff---------------------------------------------------------*/
  163.  
  164.