home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
479a.lha
/
Unzip
/
zip_proto.i
< prev
Wrap
Text File
|
1991-02-10
|
3KB
|
105 lines
#include <proto/exec.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define ASTERISK '*' /* The '*' metacharacter */
#define QUESTION '?' /* The '?' metacharacter */
#define BACK_SLASH '\\' /* The '\' metacharacter */
#define LEFT_BRACKET '[' /* The '[' metacharacter */
#define RIGHT_BRACKET ']' /* The ']' metacharacter */
#define IS_OCTAL(ch) (ch >= '0' && ch <= '7')
typedef short int INT; /* v2.0b */
typedef short int BOOLEAN; /* v2.0b */
#define TRUE 1
#define FALSE 0
#define EOS '\000'
#define OUTBUFSIZ 0x2000 /* unImplode needs power of 2, >= 0x2000 */
#define LITVALS 256
#define DISTVALS 64
#define LENVALS 64
#define MAXSF LITVALS
typedef struct sf_entry {
byte Value;
byte BitLength;
} sf_entry;
typedef struct sf_tree { /* a shannon-fano "tree" (table) */
sf_entry entry[MAXSF];
int entries;
int MaxLength;
} sf_tree;
typedef sf_tree *sf_treep;
typedef struct sf_node { /* node in a true shannon-fano tree */
UWORD left; /* 0 means leaf node */
UWORD right; /* or value if leaf node */
} sf_node;
typedef short int BOOLEAN;
typedef unsigned char byte;
#define UPDCRC32(res,oct) res=crc_32_tab[(byte)res^(byte)oct] ^ ((res>>8) & 0x00FFFFFFL)
/* Prototypes for functions defined in ascebc.c */
/* Prototypes for functions defined in crc32.c */
void UpdateCRC(unsigned char *s,
int len);
/* Prototypes for functions defined in mapname.c */
int mapped_name(void);
/* Prototypes for functions defined in match.c */
int match(char *string,
char *pattern);
BOOLEAN do_list(char *string,
char *pattern);
void list_parse(char **patp,
char *lowp,
char *highp);
char nextch(char **patp);
/* Prototypes for functions defined in unzip.c */
void set_file_time(void);
int create_output_file(void);
int open_input_file(void);
int __regargs readbuf(int fd,
char *buf,
unsigned int size);
int ReadByte(UWORD *x);
int __regargs FillBitBuffer(int bits);
int dos2unix(unsigned char *buf,
int len);
void WriteBuffer(int fd,
unsigned char *buf,
int len);
void FlushOutput(void);
void LoadFollowers(void);
void unReduce(void);
void partial_clear(void);
void unShrink(void);
void SortLengths(sf_tree *tree);
void ReadLengths(sf_tree *tree);
void GenerateTrees(sf_tree *tree,
sf_node *nodes);
void LoadTree(sf_tree *tree,
int treesize,
sf_node *nodes);
void LoadTrees(void);
void ReadTree(sf_node *nodes,
int *dest);
void unImplode(void);
void dir_member(void);
void skip_member(void);
void extract_member(void);
void get_string(int len,
char *s);
void process_local_file_header(char **fnamev);
void process_central_file_header(void);
void process_end_central_dir(void);
void process_headers(void);
void skip_to_signature(void);
void process_zipfile(void);
void usage(void);
void main(int argc,
char **argv);