home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / OS2LHX.LZH / LHX.H < prev    next >
C/C++ Source or Header  |  1989-04-15  |  3KB  |  82 lines

  1. /* LHX.H -- Definitions for LHX
  2.  *
  3.  * version 1.0 by Mark Armbrust, 15 April 1985   (IRS? Just say NO!)
  4.  *
  5.  * The code in this module is public domain -- do whatever you want with it */
  6.  
  7. #define BUFF_LEN    8192    /* buffer size for uncompressed file manipulation */
  8.  
  9. #define EXTRACT    1            /* 'mode' values */
  10. #define LIST    2
  11. #define SCAN    4
  12. #define TEST    8
  13. #define MODES    (EXTRACT | LIST | SCAN | TEST)
  14. #define AT        0x10
  15.  
  16. #ifdef DEBUG
  17. #define PRIVATE
  18. #else
  19. #define PRIVATE static
  20. #endif
  21.  
  22. #ifdef MAIN
  23. #define PUBLIC
  24. #else
  25. #define PUBLIC extern
  26. #endif
  27.  
  28.  
  29. /* special data types */
  30.  
  31. struct lzhdir {
  32.     unsigned char    header_len;        /* length of header excluding this byte
  33.                                          and checksum byte MUST BE <= 98 */
  34.     unsigned char    header_sum;        /* binary sum of header bytes */
  35.     char            method[5];        /* compression method:    */
  36.                                     /*     "-lh0-" => no compression */
  37.                                     /*     "-lh1-" => lzhuf compression */
  38.     unsigned long    data_size;        /* size of compressed data following
  39.                                         directory entry */
  40.     unsigned long    file_size;        /* external file size */
  41.     unsigned int      file_time;        /* external file time; DOS format */
  42.     unsigned int      file_date;        /* external file date; DOS format */
  43.     unsigned int      file_attr;        /* external file attributes; DOS format */
  44.     unsigned char    name_len;        /* length of file name */
  45.     char            filename[74];    /* variable length file name ( <= 74 chars) */
  46.     unsigned int      file_CRC;        /* external file CRC-16 (same as zoo)
  47.                                         immediately following file name. */
  48.     };
  49.  
  50. struct fname {
  51.     char         *    name;
  52.     struct fname *    next;
  53.     };
  54.  
  55.  
  56. /* public functions */
  57.  
  58. PUBLIC void        addbfcrc    (char *, int  );
  59. PUBLIC void        Extract        (FILE * arcfile, struct fname * filenames);
  60. PUBLIC void        List        (FILE * arcfile, struct fname * filenames);
  61. PUBLIC void        Scan        (FILE * arcfile);
  62. PUBLIC int        Process        (FILE * arcfile, struct fname * filenames);
  63. PUBLIC void        main        (int, char * []);
  64. PUBLIC int      Decode        (void);
  65. PUBLIC int        MatchAny    (char *, struct fname *);
  66.  
  67. /* public variables */
  68.  
  69. PUBLIC unsigned int      crccode;
  70. PUBLIC int              mode;                /* program [default] operating mode */
  71. PUBLIC char                name[100];            /* name of archive being manipulated */
  72. PUBLIC char                buffer[BUFF_LEN];    /* buffer for uncompressed file manipulation */
  73. PUBLIC FILE            *    infile;
  74. PUBLIC FILE            *    outfile;
  75. PUBLIC unsigned long    textsize;
  76. PUBLIC long                header_start;
  77. PUBLIC long                file_start;
  78. PUBLIC long                file_size;
  79. PUBLIC int              file_type;
  80. PUBLIC char                file_name[20];
  81.  
  82.