-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathisDcc.c
More file actions
67 lines (47 loc) · 1.37 KB
/
Copy pathisDcc.c
File metadata and controls
67 lines (47 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
isDcc
(c) 1998 Andrew de Quincey
adq@tardis.ed.ac.uk
See README.TXT for copying/distribution/modification details.
*/
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include "common.h"
#include "util.h"
#include "ishield.h"
#include "header.h"
#include "decode.h"
#include "output.h"
#include "optimise.h"
char version[] = "1.22";
int main(int argc, char* argv[])
{
int fd;
int i,j;
int tmp;
ISData isData;
fprintf(stderr, "isDcc v%s, (c) 1998 Andrew de Quincey\n\n", version);
// --------------------------------------------------------------------------
// check params
if (argc != 2)
error("Syntax: isDcc <scriptfile>\n");
// --------------------------------------------------------------------------
// open file
if ((fd = open(argv[1], O_RDONLY | O_BINARY)) == -1)
error("Cannot open file %s for reading\n", argv[1]);
// --------------------------------------------------------------------------
// initialise the opTable stuff
initDecode();
// --------------------------------------------------------------------------
// parse the header
parseHeader(fd, &isData);
// decode the code
decode(fd, &isData);
// do any extra conversion on the code
optimise(&isData);
// output it
output(fd, &isData, 1);
close(fd);
}