Convert remaining code to use prototypes.

This commit is contained in:
Arvid Norlander 2022-09-29 22:13:16 +02:00
parent 926f4a694d
commit a5e3a5e59c
No known key found for this signature in database
GPG Key ID: E824A8E5D8D29AA0
69 changed files with 387 additions and 290 deletions

View File

@ -12,7 +12,7 @@
#define LOCALOPT "RilqVH"
static void usage();
static void usage(void);
static char options[128];
static char *dir_stack;

View File

@ -16,13 +16,13 @@ static int savebits;
static int rep_char;
static int rep_count;
void doheader();
void dofork();
void outbyte();
void finish();
void outbyte1();
void out6bit();
void outchar();
static void doheader();
static void dofork(char *fork, int size);
static void outbyte(int b);
static void finish(void);
static void outbyte1(int b);
static void out6bit(int c);
static void outchar(int c);
void
dofile (void)
@ -42,7 +42,7 @@ dofile (void)
(void)putchar('\n');
}
void
static void
doheader (void)
{
uint32_t crc;
@ -95,7 +95,7 @@ int i;
outbyte((int)(crc & 0xff));
}
void
static void
outbyte (int b)
{
b &= 0xff;
@ -128,7 +128,7 @@ outbyte (int b)
}
}
void
static void
finish (void)
{
if(rep_count > 0) {
@ -153,7 +153,7 @@ finish (void)
}
}
void
static void
outbyte1 (int b)
{
switch(state) {
@ -177,13 +177,13 @@ outbyte1 (int b)
}
}
void
static void
out6bit (int c)
{
outchar(codes[c & 0x3f]);
}
void
static void
outchar (int c)
{
(void)putchar(c);

View File

@ -20,7 +20,7 @@
extern char info[];
static void usage();
static void usage(void);
static char options[128];
static int multi_file = 0;

View File

@ -17,7 +17,7 @@
#define LOCALOPT "ilqxyzoTVH"
static void usage();
static void usage(void);
static char options[128];
static char *dir_stack;

View File

@ -10,9 +10,9 @@
#include "protocol.h"
#include "tty.h"
static void receive_part();
static int receive_sync();
static int receive_rec();
static void receive_part(char *info, int size, int more);
static int receive_sync(void);
static int receive_rec(char *buf, int bufsize, int recno);
char info[INFOBYTES];

View File

@ -1 +1 @@
void xm_from();
void xm_from(void);

View File

@ -7,9 +7,9 @@
#include "protocol.h"
#include "tty.h"
static void send_part();
static int send_sync();
static void send_rec();
static void send_part(char *info, int size, int more);
static int send_sync(void);
static void send_rec(char *buf, int bufsize, int recno);
void
xm_to (void)

View File

@ -1 +1 @@
void xm_to();
void xm_to(void);

View File

@ -35,7 +35,7 @@
#include <stdlib.h>
#include <string.h>
static void initcrctab();
static void initcrctab(char *name, int poly, int init, int swapped, int bits);
int
main (void)

View File

@ -1,3 +1,5 @@
#include "rdfile.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -7,7 +9,6 @@
#endif /* TYPES_H */
#include <sys/stat.h>
#include "machdr.h"
#include "rdfile.h"
#include "rdfileopt.h"
#ifndef DIRENT_H
#include <sys/dir.h>
@ -46,11 +47,11 @@
#define RSRC_FORMAT 2
#define UNIX_FORMAT 3
static void check_files();
static void read_file();
static void enter_dir();
static void exit_dir();
static int get_stdin_file();
static void check_files(int initial);
static void read_file(void);
static void enter_dir(void);
static void exit_dir(void);
static int get_stdin_file(void);
char file_info[INFOBYTES];
char *data_fork, *rsrc_fork;
@ -81,12 +82,12 @@ static char f_name[] = ".foldername";
#include "aufs.h"
static char infodir[] = ".finderinfo";
static char rsrcdir[] = ".resource";
static void read_aufs_info();
static void read_aufs_info(FILE *fd);
#endif /* AUFS */
#ifdef APPLEDOUBLE
#include "appledouble.h"
static char infodir[] = ".AppleDouble";
static void read_appledouble_info();
static void read_appledouble_info(FILE *fd);
#endif /* APPLEDOUBLE */
#endif /* APPLESHARE */
static char filename[255];

View File

@ -1,3 +1,5 @@
#include "machdr.h"
#define ISATEND 0
#define ISFILE 1
#define ISDIR 2

View File

@ -1,5 +1,5 @@
extern int rdfileopt();
extern void give_rdfileopt();
extern void set_norecurse();
extern char *get_rdfileopt();
extern int rdfileopt(int c);
extern void give_rdfileopt(void);
extern void set_norecurse(void);
extern char *get_rdfileopt(void);

View File

@ -4,6 +4,7 @@
#include <sys/types.h>
#endif /* TYPES_H */
#include <sys/stat.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -44,17 +45,17 @@ char *sprintf();
#endif /* UNDEF */
#ifdef AUFS
static void check_aufs();
static void aufs_namings();
static void wr_aufs_info();
static void check_aufs(void);
static void aufs_namings(void);
static void wr_aufs_info(FILE* fp);
#endif /* AUFS */
#ifdef APPLEDOUBLE
static void check_appledouble();
static void appledouble_namings();
static void wr_appledouble_info();
static void check_appledouble(void);
static void appledouble_namings(void);
static void wr_appledouble_info(FILE* fp);
#endif /* APPLEDOUBLE */
#ifdef APPLESHARE
static void mk_share_name();
static void mk_share_name(void);
#endif /* APPLESHARE */
#ifndef BSD
@ -531,7 +532,7 @@ int i;
#ifdef APPLESHARE
#ifdef AUFS
static void check_aufs()
static void check_aufs(void)
{
/* check for .resource/ and .finderinfo/ */
struct stat stbuf;
@ -557,7 +558,7 @@ static void check_aufs()
}
}
static void aufs_namings()
static void aufs_namings(void)
{
mk_share_name();
(void)sprintf(f_info_aufs, "%s/%s", infodir, share_name);
@ -565,8 +566,7 @@ static void aufs_namings()
(void)sprintf(f_data, "%s", share_name);
}
static void wr_aufs_info(fp)
FILE *fp;
static void wr_aufs_info(FILE* fp)
{
FileInfo theinfo;
int n;
@ -601,7 +601,7 @@ FILE *fp;
#endif /* AUFS */
#ifdef APPLEDOUBLE
static void check_appledouble()
static void check_appledouble(void)
{
/* check for .AppleDouble/ */
struct stat stbuf;
@ -620,15 +620,14 @@ static void check_appledouble()
}
}
static void appledouble_namings()
static void appledouble_namings(void)
{
mk_share_name();
(void)snprintf(f_info_appledouble, sizeof(f_info_appledouble), "%s/%s", infodir, share_name);
(void)snprintf(f_data, sizeof(f_data), "%s", share_name);
}
static void wr_appledouble_info(fp)
FILE *fp;
static void wr_appledouble_info(FILE* fp)
{
FileInfo theinfo;
int n;
@ -673,7 +672,7 @@ FILE *fp;
}
#endif /* APPLEDOUBLE */
static void mk_share_name()
static void mk_share_name(void)
{
int ch;
char *mp, *up;
@ -693,8 +692,7 @@ static void mk_share_name()
}
#endif /* APPLESHARE */
int wrfileopt(c)
char c;
int wrfileopt(char c)
{
switch(c) {
case 'b':
@ -767,7 +765,7 @@ char c;
return 1;
}
void give_wrfileopt()
void give_wrfileopt(void)
{
(void)fprintf(stderr, "File output options:\n");
(void)fprintf(stderr, "-b:\tMacBinary (default)\n");
@ -810,7 +808,7 @@ void set_s_wrfileopt(int restricted)
mode_s_restricted = restricted;
}
char *get_wrfileopt()
char *get_wrfileopt(void)
{
static char options[20];

View File

@ -8,7 +8,7 @@ extern void start_rsrc(void);
extern void start_data(void);
extern void end_file(void);
#ifdef SCAN
extern void do_idf();
extern void do_idf(char *name, int kind);
#endif /* SCAN */
extern void do_mkdir(char *name, char *header);
extern void enddir(void);

View File

@ -1,6 +1,6 @@
extern int wrfileopt();
extern void give_wrfileopt();
extern void set_wrfileopt();
extern void set_s_wrfileopt();
extern char *get_wrfileopt();
extern int wrfileopt(char c);
extern void give_wrfileopt(void);
extern void set_wrfileopt(int restricted);
extern void set_s_wrfileopt(int restricted);
extern char *get_wrfileopt(void);

View File

@ -1,6 +1,6 @@
extern char *data_fork, *rsrc_fork;
extern int data_size, rsrc_size;
extern void put_byte();
extern void set_put();
extern void end_put();
extern void put_byte(int c);
extern void set_put(int data);
extern void end_put(void);

View File

@ -6,6 +6,7 @@
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/transname.h"
#include "buffer.h"
#include "printhdr.h"

View File

@ -2,15 +2,12 @@
#include <stdint.h>
#include <string.h>
#ifdef BSD
extern char *rindex();
#include <strings.h>
#define search_last rindex
#else /* BSD */
extern char *strrchr();
#define search_last strrchr
#endif /* BSD */
extern void transname();
extern char info[];
extern char trname[];
@ -36,5 +33,5 @@ extern int was_macbin;
extern FILE *ifp;
extern void do_error();
extern void do_error(char *string);

View File

@ -4,6 +4,7 @@
#include "crc.h"
#include "readline.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "../util/util.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
@ -12,13 +13,13 @@
#include <stdlib.h>
static void do_o_forks();
static int32_t make_file();
static void comp_c_crc();
static void comp_e_crc();
static int comp_to_bin();
static int hex_to_bin();
static int hexit();
static void do_o_forks(void);
static int32_t make_file(int compressed);
static void comp_c_crc(int c);
static void comp_e_crc(int c);
static int comp_to_bin(void);
static int hex_to_bin(void);
static int hexit(int c);
static int compressed;

View File

@ -9,6 +9,7 @@
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/transname.h"
#include "printhdr.h"
static void get_header(void);

View File

@ -5,6 +5,7 @@
#include "readline.h"
#include "../util/masks.h"
#include "../util/util.h"
#include "../util/transname.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "buffer.h"
@ -12,9 +13,9 @@
#include <stdlib.h>
static void do_mu_fork();
static int mu_comp_to_bin();
static int mu_convert();
static void do_mu_fork(void);
static int mu_comp_to_bin(void);
static int mu_convert(char *ibuf, char *obuf);
/* mu format -- process .mu files */
void

View File

@ -1,5 +1,6 @@
#include "printhdr.h"
#include "globals.h"
#include "../util/transname.h"
/* print out header information in human-readable format */
void print_header0(int skip)

View File

@ -1,4 +1,4 @@
extern void print_header0();
extern void print_header1();
extern void print_header2();
extern void print_header0(int skip);
extern void print_header1(int skip1, int skip2);
extern void print_header2(int skip);

View File

@ -1,3 +1,3 @@
extern char line[];
int readline();
int readline(void);

View File

@ -1,6 +1,7 @@
#include "macunpack.h"
#include "bin.h"
#ifdef BIN
#include <stdlib.h>
#include <string.h>
#include "globals.h"
#include "../fileio/machdr.h"

View File

@ -4,7 +4,7 @@ extern unsigned int bit_be_bitbuf;
extern char *bit_be_filestart;
extern int bit_be_inbytes;
extern void bit_be_fillbuf();
extern unsigned int bit_be_getbits();
extern void bit_be_init_getbits();
extern void bit_be_fillbuf(int n);
extern unsigned int bit_be_getbits(int n);
extern void bit_be_init_getbits(void);

View File

@ -5,15 +5,19 @@
#endif /* CPT */
#endif /* DD */
#ifdef CPT
#define CPT_INTERNAL
#include "cpt.h"
#include <stdlib.h>
#include "globals.h"
#include "cpt.h"
#include "crc.h"
#include "../util/util.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../fileio/kind.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "huffman.h"
#define ESC1 0x81
@ -22,7 +26,6 @@
#define ESC1SEEN 1
#define ESC2SEEN 2
static void cpt_uncompact();
static unsigned char *cpt_data;
static uint32_t cpt_datamax;
static uint32_t cpt_datasize;
@ -42,17 +45,17 @@ static int cpt_blocksize;
static node cpt_Hufftree[512 + SLACK], cpt_LZlength[128 + SLACK],
cpt_LZoffs[256 + SLACK];
static int readcpthdr();
static int cpt_filehdr();
static void cpt_folder();
static void cpt_uncompact();
static void cpt_wrfile();
static void cpt_outch();
static void cpt_rle();
static void cpt_rle_lzh();
static void cpt_readHuff();
static int cpt_get6bits();
static int cpt_getbit();
static int readcpthdr(struct cptHdr *s);
static int cpt_filehdr(struct cpt_fileHdr *f, char *hdr);
static void cpt_folder(char *name, struct cpt_fileHdr fileh, char *cptptr);
static void cpt_uncompact(struct cpt_fileHdr filehdr);
static void cpt_wrfile(uint32_t ibytes, uint32_t obytes, int type);
static void cpt_outch(int ch);
static void cpt_rle(void);
static void cpt_rle_lzh(void);
static void cpt_readHuff(int size, struct node *Hufftree);
static int cpt_get6bits(void);
static int cpt_getbit(void);
void
cpt (void)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef CPT
#ifdef CPT_INTERNAL
#include <stdint.h>
#define C_SIGNATURE 0
@ -93,9 +97,13 @@ typedef struct cpt_fileHdr { /* 78 bytes */
#define CIRCSIZE 8192
#endif
void
cpt_wrfile1 (unsigned char *in_char,
uint32_t ibytes,
uint32_t obytes,
int type,
uint32_t blocksize);
void cpt (void);
#endif

View File

@ -13,34 +13,35 @@
#include "../fileio/fileglob.h"
#include "../util/masks.h"
#include "../util/util.h"
#include "../util/transname.h"
static void dd_name();
static int dd_filehdr();
static void dd_cfilehdr();
static int dd_valid();
static int dd_valid1();
static char *dd_methname();
static uint32_t dd_checksum();
static void dd_chksum();
static uint32_t dd_checkor();
static void dd_do_delta();
static void dd_delta();
static void dd_delta3();
static void dd_copy();
static void dd_copyfile();
static void dd_expand();
static void dd_expandfile();
static void dd_nocomp();
static void dd_lzc();
static void dd_name(unsigned char *bin_hdr);
static int dd_filehdr(struct dd_fileHdr *f, struct dd_fileCHdr *cf, int skip);
static void dd_cfilehdr(struct dd_fileCHdr *f);
static int dd_valid(int dmethod, int rmethod);
static int dd_valid1(int method);
static char *dd_methname(int n);
static uint32_t dd_checksum(uint32_t init, char *buffer, uint32_t length);
static void dd_chksum(struct dd_fileHdr hdr, unsigned char *data);
static uint32_t dd_checkor(uint32_t init, char *buffer, uint32_t length);
static void dd_do_delta(char *out_ptr, uint32_t nbytes, int kind);
static void dd_delta(char *out_ptr, uint32_t nbytes);
static void dd_delta3(char *out_ptr, uint32_t nbytes);
static void dd_copy(struct dd_fileHdr hdr, unsigned char *data);
static void dd_copyfile(uint32_t obytes, unsigned char *data);
static void dd_expand(struct dd_fileCHdr hdr, unsigned char *data);
static void dd_expandfile(uint32_t obytes, uint32_t ibytes, int method, int kind, unsigned char *data, uint32_t chksum);
static void dd_nocomp(uint32_t obytes, unsigned char *data);
static void dd_lzc(uint32_t ibytes, uint32_t obytes, unsigned char *data, int mb, uint32_t chksum, uint32_t ckinit);
#ifdef UNTESTED
static void dd_rle();
static void dd_rle(uint32_t ibytes, unsigned char *data);
#ifdef NOTIMPLEMENTED
static void dd_huffman();
static void dd_huffman(uint32_t ibytes, unsigned char *data);
#endif /* NOTIMPLEMENTED */
static void dd_lzss();
static int dd_getbits();
static void dd_lzss(unsigned char *data, uint32_t chksum);
static int dd_getbits(int n);
#endif /* UNTESTED */
static void dd_cpt_compat();
static void dd_cpt_compat(uint32_t ibytes, uint32_t obytes, unsigned char *data, int sub_method, uint32_t chksum);
typedef struct methodinfo {
char *name;

View File

@ -1,4 +1,7 @@
#include "de_compress.h"
#include <stdlib.h>
#include "macunpack.h"
#ifdef SIT
#define DECOMPRESS
@ -32,7 +35,7 @@ static unsigned short codetab [HSIZE];
static int32_t free_ent = 0; /* first unused entry */
static int32_t getcode();
static int32_t getcode(void);
static int clear_flg = 0;
@ -121,8 +124,8 @@ static unsigned char rmask[9] =
static int get_core_bytes;
static char *core_ptr;
static int file_bytes();
static int core_bytes();
static int file_bytes(char *buf, int length);
static int core_bytes(char *buf, int length);
static int32_t
getcode (void)

View File

@ -23,15 +23,15 @@
#include "huffman.h"
#include "../util/util.h"
int (*get_bit)();
int (*get_bit)(void);
int bytesread;
/* 515 because StuffIt Classic needs more than the needed 511 */
struct node nodelist[515];
static int getbit_be();
static int getbit_le();
static int getdecodebyte();
static int getbit_be(void);
static int getbit_le(void);
static int getdecodebyte(void);
static node *nodeptr, *read_sub_tree();
static node *nodeptr, *read_sub_tree(void);
static int bit;
@ -72,7 +72,7 @@ read_tree (void)
/* This routine recursively reads the Huffman encoding table and builds
a decoding tree. */
static node *read_sub_tree()
static node *read_sub_tree(void)
{
node *np;

View File

@ -1,6 +1,6 @@
#include <stdint.h>
void set_huffman(int endian);
void read_tree();
void read_tree(void);
void de_huffman(uint32_t obytes);
void de_huffman_end(unsigned int term);

View File

@ -79,13 +79,13 @@ static short HuffLength[] = {
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8};
unsigned char (*lzah_getbyte)();
unsigned char (*lzah_getbyte)(void);
static void lzah_inithuf();
static void lzah_reorder();
static void lzah_inithuf(void);
static void lzah_reorder(void);
static void lzah_move(int *p, int *q, int n);
static void lzah_getbit();
static void lzah_outchar();
static void lzah_getbit(void);
static void lzah_outchar(int ch);
static char lzah_buf[4096];
static int lzah_bufptr;

View File

@ -4,7 +4,7 @@
#include <stdint.h>
extern void de_lzah(uint32_t obytes);
extern unsigned char (*lzah_getbyte)();
extern unsigned char (*lzah_getbyte)(void);
extern void de_lzh(int32_t ibytes, int32_t obytes, char **data, int bits);
#endif

View File

@ -19,9 +19,9 @@
static int decoded;
static int bitsused;
static unsigned int blocksize;
static unsigned int decode_c();
static unsigned int decode_p();
static void make_table();
static unsigned int decode_c(void);
static unsigned int decode_p(void);
static void make_table(int nchar, unsigned char bitlen[], int tablebits, unsigned int table[]);
/* lzh compression */
void de_lzh(int32_t ibytes, int32_t obytes, char **data, int bits)

View File

@ -1,11 +1,14 @@
#include "macunpack.h"
#ifdef DIA
#define DIA_INTERNAL
#include "dia.h"
#include <stdlib.h>
#include <string.h>
#include "globals.h"
#include "dia.h"
#include "../util/curtime.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../fileio/kind.h"
@ -26,14 +29,14 @@ static int dia_LZtab[BCHUNKSIZE];
static unsigned char *dia_bit_base;
static int dia_imask;
static void dia_folder();
static void dia_file();
static void dia_getlength();
static void dia_skipfork();
static void dia_getfork();
static void dia_getblock();
static int dia_decode();
static int dia_prevbit();
static void dia_folder(unsigned char *name);
static void dia_file(int indicator, unsigned char *name);
static void dia_getlength(int nblocks);
static void dia_skipfork(int nblocks);
static void dia_getfork(int nblocks);
static void dia_getblock(unsigned char **archive_ptr, unsigned char **block_ptr);
static int dia_decode(unsigned char *ibuff, unsigned char *obuff, int in_length);
static int dia_prevbit(void);
void
dia (unsigned char *bin_hdr)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef DIA
#ifdef DIA_INTERNAL
#define IS_FOLDER 0x80
#define F_INFO 0x40
#define VOLUME 0x30
@ -20,3 +24,8 @@
#define NOCOMP 1
#define COMP 2
#endif
void dia (unsigned char *bin_hdr);
#endif

View File

@ -1,9 +1,12 @@
#include "dir.h"
#include <stdlib.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/masks.h"
#include "../util/transname.h"
static char *dir_stack;
static int dir_ptr = -64;

1
macunpack/dir.h Normal file
View File

@ -0,0 +1 @@
void dir (char *hdr);

View File

@ -1,8 +1,6 @@
#include <stdio.h>
extern void exit();
extern void transname();
extern void do_error();
void do_error (char *string);
extern char info[];
extern char text[];

View File

@ -6,10 +6,10 @@ typedef struct node {
struct node *one, *zero;
} node;
extern int (*get_bit)();
extern void clrhuff();
extern int (*get_bit)(void);
extern void clrhuff(void);
int gethuffbyte(node *l_nodelist);
int getihuffbyte();
int getihuffbyte(void);
extern struct node nodelist[];
extern int bytesread;

View File

@ -1,17 +1,20 @@
#include "macunpack.h"
#ifdef JDW
#define JDW_INTERNAL
#include "jdw.h"
#include "globals.h"
#include "huffman.h"
#include "de_huffman.h"
#include "../fileio/wrfile.h"
#include "../fileio/machdr.h"
#include "../util/util.h"
#include "../util/transname.h"
#include "../util/masks.h"
static void jdw_wrfile();
static void jdw_wrfork();
static void jdw_block();
static void jdw_wrfile(uint32_t rsrcLength, uint32_t dataLength);
static void jdw_wrfork(uint32_t length);
static void jdw_block(int olength);
void
jdw (uint32_t ibytes)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef JDW
#ifdef JDW_INTERNAL
#include <stdint.h>
#define J_MAGIC 0
@ -23,3 +27,6 @@ typedef struct jdw_fileHdr {
char fname[32]; /* actually flength */
} jdw_fileHdr;
#endif
void jdw (uint32_t ibytes);
#endif

View File

@ -1,18 +1,22 @@
#include "macunpack.h"
#ifdef LZC
#include <string.h>
#include "globals.h"
#define LZC_INTERNAL
#include "lzc.h"
#include <string.h>
#include <stdlib.h>
#include "globals.h"
#include "../util/util.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "de_compress.h"
#include "mcb.h"
static void lzc_zivm();
static void lzc_wrfile();
static void lzc_zivu();
static void lzc_zivm(char *ohdr);
static void lzc_wrfile(uint32_t obytes, uint32_t ibytes);
static void lzc_zivu(char *ohdr);
void
lzc (char *ohdr)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef LZC
#ifdef LZC_INTERNAL
#include <stdint.h>
#define HEADERBYTES 48
@ -28,3 +32,6 @@ typedef struct lzc_fileHdr {
uint32_t flag1;
uint32_t flag2;
} lzc_fileHdr;
#endif
void lzc (char *ohdr);
#endif

View File

@ -1,4 +1,7 @@
#include "macunpack.h"
#define LZH_INTERNAL
#include <stdlib.h>
#include <string.h>
#include "globals.h"
@ -7,8 +10,10 @@
#include "../fileio/wrfile.h"
#include "../fileio/machdr.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "../util/util.h"
#include "bits_be.h"
#include "de_lzah.h"
#define LZ5LOOKAHEAD 18 /* look ahead buffer size for LArc */
#define LZ5BUFFSIZE 8192
@ -18,10 +23,6 @@
#define LZSMASK 4095
#define LZBUFFSIZE 8192 /* Max of above buffsizes */
extern void de_lzah();
extern unsigned char (*lzah_getbyte)();
extern void de_lzh();
typedef struct methodinfo {
char *name;
int number;
@ -51,26 +52,26 @@ static char *lzh_current;
static char *tmp_out_ptr;
static char lzh_lzbuf[LZBUFFSIZE];
static int lzh_filehdr();
static int lzh_checkm();
static char *lzh_methname();
static void lzh_wrfile();
static void lzh_skip();
static void lzh_nocomp();
static int lzh_filehdr(struct lzh_fileHdr *f);
static int lzh_checkm(struct lzh_fileHdr *f);
static char *lzh_methname(int n);
static void lzh_wrfile(struct lzh_fileHdr *filehdr, int method);
static void lzh_skip(struct lzh_fileHdr *filehdr);
static void lzh_nocomp(uint32_t obytes);
#ifdef UNTESTED
static void lzh_lzss1();
static void lzh_lzss2();
static void lzh_lzss1(uint32_t obytes);
static void lzh_lzss2(uint32_t obytes);
#endif /* UNTESTED */
static void lzh_lzah();
static unsigned char lzh_getbyte();
static void lzh_lzah(uint32_t obytes);
static unsigned char lzh_getbyte(void);
#ifdef UNDEF
static void lzh_lh2();
static void lzh_lh3();
static void lzh_lh2(uint32_t obytes);
static void lzh_lh3(uint32_t obytes);
#endif /* UNDEF */
#ifdef UNTESTED
static void lzh_lzh12();
static void lzh_lzh12(uint32_t obytes);
#endif /* UNTESTED */
static void lzh_lzh13();
static void lzh_lzh13(uint32_t obytes);
void
lzh (int kind)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef LZH
#ifdef LZH_INTERNAL
#include <stdint.h>
#define FILEHDRSIZE 22
@ -59,3 +63,9 @@ typedef struct lzh_fileHdr { /* 58 bytes */
#define lz4 6
#define lz5 7
#define lzs 8
#endif
void lzh (int kind);
#endif

View File

@ -1,49 +1,38 @@
#include "macunpack.h"
#include "macbinary.h"
#include <stdlib.h>
#include <string.h>
#include "globals.h"
#include "../fileio/kind.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../fileio/kind.h"
#include "zmahdr.h"
#include "../util/util.h"
#include "stf.h"
#include "mcb.h"
#include "bin.h"
#include "dd.h"
#include "dir.h"
#include "globals.h"
#include "mcb.h"
#include "sit.h"
#include "stf.h"
#include "zmahdr.h"
#include "jdw.h"
#include "lzc.h"
#include "pit.h"
#include "dia.h"
#include "cpt.h"
#include "zma.h"
#include "lzh.h"
extern void dir(char *hdr);
#ifdef JDW
extern void jdw();
#endif /* JDW */
#ifdef LZC
extern void lzc();
#endif /* LZC */
#ifdef ASQ
extern void asq();
#endif /* ASQ */
#ifdef ARC
extern void arc();
#endif /* ARC */
#ifdef PIT
extern void pit();
#endif /* PIT */
#ifdef DIA
extern void dia();
#endif /* DIA */
#ifdef CPT
extern void cpt();
#endif /* CPT */
#ifdef ZMA
extern void zma();
#endif /* ZMA */
#ifdef LZH
extern void lzh();
#endif /* LZH */
static void skip_file();
static void skip_file(int skip);
#ifdef SCAN
static void get_idf();
static void get_idf(int kind);
#endif /* SCAN */
#define Z (ZMAHDRS2 + 1)

1
macunpack/macbinary.h Normal file
View File

@ -0,0 +1 @@
void macbinary (void);

View File

@ -1,4 +1,7 @@
#include "macunpack.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "globals.h"
#include "../util/patchlevel.h"
@ -6,25 +9,15 @@
#include "../fileio/wrfileopt.h"
#include "../fileio/kind.h"
#include "../util/util.h"
#include "stf.h"
#include "pit.h"
#include "sit.h"
#include "cpt.h"
#include "macbinary.h"
#define LOCALOPT "ilvqVH"
extern char *strcat();
#ifdef STF
extern void stf();
#endif /* STF */
#ifdef PIT
extern void pit();
#endif /* PIT */
#ifdef SIT
extern void sit();
#endif /* SIT */
#ifdef CPT
extern void cpt();
#endif /* CPT */
void macbinary();
static void usage();
static void usage(void);
static char options[128];

View File

@ -1,12 +1,17 @@
#include "mcb.h"
#include <stdlib.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/masks.h"
#include "../util/util.h"
#include "../util/transname.h"
static int mcb_read;
static void mcb_wrfile();
static void mcb_wrfile(uint32_t ibytes);
void mcb(char *hdr, uint32_t rsrcLength, uint32_t dataLength, int toread)
{

View File

@ -1 +1,3 @@
#include <stdint.h>
extern void mcb(char *hdr, uint32_t rsrcLength, uint32_t dataLength, int toread);

View File

@ -1,22 +1,26 @@
#include "macunpack.h"
#ifdef PIT
#define PIT_INTERNAL
#include "pit.h"
#include <stdlib.h>
#include <string.h>
#include "../fileio/wrfile.h"
#include "../fileio/fileglob.h"
#include "../fileio/kind.h"
#include "globals.h"
#include "pit.h"
#include "../fileio/machdr.h"
#include "crc.h"
#include "../fileio/wrfile.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "../util/util.h"
#include "huffman.h"
#include "crc.h"
#include "de_huffman.h"
#include "globals.h"
#include "huffman.h"
static int pit_filehdr();
static void pit_wrfile();
static void pit_nocomp();
static void pit_huffman();
static int pit_filehdr(struct pit_header *f, int compr);
static void pit_wrfile(uint32_t bytes, int type);
static void pit_nocomp(uint32_t ibytes);
static void pit_huffman(uint32_t obytes);
void
pit (void)

View File

@ -1,3 +1,9 @@
#include "macunpack.h"
#ifdef PIT
#ifdef PIT_INTERNAL
#include <stdint.h>
#define H_NAMELEN 63
#define H_NLENOFF 0
@ -30,3 +36,8 @@ struct pit_header { /* Packit file header (92 bytes) */
#define nocomp 0
#define huffman 1
#endif
void pit (void);
#endif

View File

@ -4,6 +4,7 @@
#ifdef SIT
#include <string.h>
#include <stdlib.h>
#include "globals.h"
#include "crc.h"
#include "../util/util.h"
@ -11,6 +12,7 @@
#include "../fileio/wrfile.h"
#include "../fileio/kind.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "huffman.h"
#include "de_compress.h"
#include "de_huffman.h"
@ -33,26 +35,26 @@ static struct methodinfo methods[] = {
};
static int sit_nodeptr;
static int readsithdr();
static int sit_filehdr();
static int sit_valid();
static int sit_checkm();
static char *sit_methname();
static void sit_folder();
static void sit_unstuff();
static void sit_wrfile();
static void sit_skip();
static void sit_nocomp();
static void sit_rle();
static void sit_lzc();
static void sit_huffman();
static void sit_lzah();
static unsigned char sit_getbyte();
static void sit_fixhuf();
static void sit_dosplit();
static void sit_mw();
static void sit_mw_out();
static int sit_mw_in();
static int readsithdr(sitHdr *s);
static int sit_filehdr(struct sit_fileHdr *f, int skip);
static int sit_valid(struct sit_fileHdr f);
static int sit_checkm(int f);
static char *sit_methname(int n);
static void sit_folder(char *name);
static void sit_unstuff(struct sit_fileHdr filehdr);
static void sit_wrfile(uint32_t ibytes, uint32_t obytes, int type);
static void sit_skip(uint32_t ibytes);
static void sit_nocomp(uint32_t ibytes);
static void sit_rle(uint32_t ibytes);
static void sit_lzc(uint32_t ibytes);
static void sit_huffman(uint32_t obytes);
static void sit_lzah(uint32_t obytes);
static unsigned char sit_getbyte(void);
static void sit_fixhuf(uint32_t ibytes);
static void sit_dosplit(int ptr, int sum, int low, int upp);
static void sit_mw(uint32_t ibytes);
static void sit_mw_out(int ptr);
static int sit_mw_in(int bits, uint32_t *ibytes);
static short code6[258] = {
1024, 512, 256, 256, 256, 256, 128, 128,

View File

@ -1,16 +1,16 @@
#include "macunpack.h"
#ifdef STF
#include <string.h>
#include <stdlib.h>
#include "stf.h"
#include "globals.h"
#include "huffman.h"
#include "../util/curtime.h"
#include "../fileio/wrfile.h"
#include "../fileio/machdr.h"
#include "../util/transname.h"
#include "../util/util.h"
extern void de_huffman();
extern void set_huffman();
#include "de_huffman.h"
typedef struct{
int num;
@ -20,9 +20,9 @@ typedef struct{
static table_struct table[511];
static char length[256];
static void stf_wrfile();
static void stf_wrfork();
static void stf_construct();
static void stf_wrfile(uint32_t rsrcLength, uint32_t dataLength, uint32_t ibytes);
static void stf_wrfork(uint32_t *num, uint32_t towrite, int offs);
static void stf_construct(int n);
void
stf (uint32_t ibytes)

View File

@ -1,17 +1,20 @@
#include "macunpack.h"
#ifdef ZMA
#define ZMA_INTERNAL
#include "zma.h"
#include <stdlib.h>
#include <string.h>
#include "globals.h"
#include "zma.h"
#include "crc.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../fileio/kind.h"
#include "../util/masks.h"
#include "../util/transname.h"
#include "../util/util.h"
extern void de_lzh();
#include "de_lzah.h"
/* We do allow for possible backpointing, so we allocate the archive in core */
static char *zma_archive;
@ -20,12 +23,12 @@ static char *zma_filestart;
static uint32_t zma_length;
static int32_t zma_archlength;
static int zma_filehdr();
static void zma_folder();
static void zma_mooz();
static void zma_wrfile();
static void zma_nocomp();
static void zma_lzh();
static int zma_filehdr(struct zma_fileHdr *f, int skip);
static void zma_folder(struct zma_fileHdr fhdr);
static void zma_mooz(struct zma_fileHdr filehdr);
static void zma_wrfile(uint32_t ibytes, uint32_t obytes, int type);
static void zma_nocomp(uint32_t ibytes);
static void zma_lzh(uint32_t ibytes);
void
zma (char *start, uint32_t length)

View File

@ -1,3 +1,7 @@
#include "macunpack.h"
#ifdef ZMA
#ifdef ZMA_INTERNAL
#include "zmahdr.h"
#include <stdint.h>
@ -53,3 +57,8 @@ typedef struct zma_fileHdr { /* 78 bytes */
#define z_dir 3 /* directory */
#define z_plug 4 /* for plug in, not supported */
#endif
void zma (char *start, uint32_t length);
#endif

View File

@ -1,8 +1,11 @@
#include "dir.h"
#include <stdlib.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/transname.h"
#include "../util/masks.h"
static char *dir_stack;

1
mixed/dir.h Normal file
View File

@ -0,0 +1 @@
void dir(char *hdr);

View File

@ -1,8 +1,5 @@
#include <stdio.h>
extern void exit();
extern void transname();
extern char info[];
extern char text[];

View File

@ -1,15 +1,19 @@
#include "macbinary.h"
#include "globals.h"
#include <stdlib.h>
#include "../fileio/machdr.h"
#include "../fileio/kind.h"
#include "../util/util.h"
#include "dir.h"
#include "mcb.h"
extern void dir();
extern void mcb();
extern void do_indent();
static void skip_file();
static void skip_file(int skip);
#ifdef SCAN
static void get_idf();
static void get_idf(int kind);
#endif /* SCAN */
void

1
mixed/macbinary.h Normal file
View File

@ -0,0 +1 @@
void macbinary (void);

View File

@ -1,16 +1,17 @@
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "globals.h"
#include "../util/patchlevel.h"
#include "../fileio/wrfile.h"
#include "../fileio/wrfileopt.h"
#include "../util/util.h"
#include "macbinary.h"
#define LOCALOPT "ilqVH"
void macbinary();
static void usage();
static void usage(void);
static char options[128];

View File

@ -9,11 +9,9 @@
#include "../util/transname.h"
#include "../util/util.h"
extern void do_indent();
#define LOCALOPT "ilqVH"
static void usage();
static void usage(void);
static char options[128];
static char *dir_stack;

View File

@ -1,12 +1,17 @@
#include "mcb.h"
#include <stdlib.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/masks.h"
#include "../util/util.h"
#include "../util/transname.h"
static int mcb_read;
static void mcb_wrfile();
static void mcb_wrfile(uint32_t ibytes);
void
mcb (char *hdr, uint32_t rsrcLength, uint32_t dataLength, int toread)

3
mixed/mcb.h Normal file
View File

@ -0,0 +1,3 @@
#include <stdint.h>
void mcb (char *hdr, uint32_t rsrcLength, uint32_t dataLength, int toread);

View File

@ -4,7 +4,6 @@
#ifdef BSD
#include <sys/time.h>
extern time_t time();
#else /* BSD */
#include <time.h>
#endif /* BSD */

View File

@ -1,4 +1,5 @@
#include <stdint.h>
#include <stdio.h>
typedef struct real_time {
int year;