10 /* usage(): print das's usage information */
11 static void usage(void)
14 "usage: das [ options ] < -o file > < file.asm >\n"
17 "-1 performs only first pass\n"
19 "-D do not remove first pass temp file\n"
20 "-o < file > output (object) file\n"
24 int main(int argc
, char *argv
[])
27 FILE *asmfp
, *interfp
, *binfp
;
28 char pass1file
[] = ".pass1.XXXXXX";
29 int err
, ret
, del_p1file
, p1_only
, debug
;
34 output
= input
= NULL
;
36 while ((ret
= getopt(argc
, argv
, "1dDho:")) != -1) {
60 fatal("no input file given");
65 fatal("no output file given");
73 asmfp
= file_open(input
, "r");
76 interfp
= file_open(output
, "w");
78 interfp
= file_open_tmp(pass1file
);
80 ret
= das_pass1(asmfp
, interfp
, debug
);
96 binfp
= file_open(output
, "w");
98 /* XXX: Why do I need freopen() to rewind() ? */
99 interfp
= freopen(pass1file
, "r", interfp
);
102 ret
= das_pass2(interfp
, binfp
, debug
);
112 /* we remove the binary file on error because
113 * it's probably botched */