changeset 307:87c4e65074f0

Actually allow script file to be specified and fix segfault on parsing script file
author lost
date Fri, 23 Jan 2009 04:53:01 +0000
parents be1abc4ac114
children ecc092adc0be
files src/main.c src/script.c
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Fri Jan 23 04:03:37 2009 +0000
+++ b/src/main.c	Fri Jan 23 04:53:01 2009 +0000
@@ -106,7 +106,7 @@
 				"Generate DECB .bin format output, equivalent of --format=decb"},
 	{ "raw",		'r',	0,		0,
 				"Generate raw binary format output, equivalent of --format=raw"},
-	{ "script",		's',	0,		0,
+	{ "script",		's',	"FILE",		0,
 				"Specify the linking script (overrides the build in defaults)"},
 	{ 0 }
 };
--- a/src/script.c	Fri Jan 23 04:03:37 2009 +0000
+++ b/src/script.c	Fri Jan 23 04:53:01 2009 +0000
@@ -60,7 +60,7 @@
 
 void setup_script()
 {
-	char *script;
+	char *script, *oscript;
 	long size;
 
 	// read the file if needed
@@ -115,6 +115,7 @@
 		size = strlen(script);
 	}
 
+	oscript = script;
 	// now parse the script file
 	while (*script)
 	{
@@ -252,5 +253,5 @@
 	}
 	
 	if (scriptfile)
-		lw_free(script);
+		lw_free(oscript);
 }