comparison lwasm/main.c @ 182:833d392fec82

Arranged for lwasm and lwlink to remove the output file in case they fail
author lost
date Fri, 06 Mar 2009 01:35:40 +0000
parents 427e268e876b
children bae1e3ecdce1
comparison
equal deleted inserted replaced
181:14878196ed5b 182:833d392fec82
28 28
29 #include <argp.h> 29 #include <argp.h>
30 #include <errno.h> 30 #include <errno.h>
31 #include <stdio.h> 31 #include <stdio.h>
32 #include <stdlib.h> 32 #include <stdlib.h>
33 #include <unistd.h>
33 34
34 #include "lwasm.h" 35 #include "lwasm.h"
35 36
36 // external declarations 37 // external declarations
37 extern void lwasm_pass1(asmstate_t *as); 38 extern void lwasm_pass1(asmstate_t *as);
174 { 175 {
175 fprintf(stderr, "No input files specified.\n"); 176 fprintf(stderr, "No input files specified.\n");
176 exit(1); 177 exit(1);
177 } 178 }
178 179
180 // lose the output file if it already exists...
181 unlink(asmstate.outfile);
182
179 /* pass 1 - collect the symbols and assign addresses where possible */ 183 /* pass 1 - collect the symbols and assign addresses where possible */
180 /* pass 1 also resolves included files, etc. */ 184 /* pass 1 also resolves included files, etc. */
181 /* that means files are read exactly once unless included multiple times */ 185 /* that means files are read exactly once unless included multiple times */
182 lwasm_pass1(&asmstate); 186 lwasm_pass1(&asmstate);
183 187