diff 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
line wrap: on
line diff
--- a/lwasm/main.c	Thu Mar 05 02:23:47 2009 +0000
+++ b/lwasm/main.c	Fri Mar 06 01:35:40 2009 +0000
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "lwasm.h"
 
@@ -176,6 +177,9 @@
 		exit(1);
 	}	
 
+	// lose the output file if it already exists...
+	unlink(asmstate.outfile);
+
 	/* pass 1 - collect the symbols and assign addresses where possible */
 	/* pass 1 also resolves included files, etc. */
 	/* that means files are read exactly once unless included multiple times */