Endast i latest: build
diff -ru latest-orig/Makefile latest/Makefile
--- latest-orig/Makefile	2006-12-29 21:04:01.000000000 +0100
+++ latest/Makefile	2007-01-05 02:56:42.000000000 +0100
@@ -1,6 +1,7 @@
 # full optimizations
-CXXFLAGS = -O3 -D__HAVE_CONFIG__ -I$(CURDIR)/include
-OBJS = $(subst .c,.o,$(subst .cpp,.o,$(shell cd src;find . -name "*.[c]*")))
+CXXFLAGS = -g -D__HAVE_CONFIG__ -I$(CURDIR)/include
+OBJS = loaders_db.o convenience.o guioutput_logfile.o imei_db.o main.o sha1.o ucl_alloc.o ucl_n2_99.o
+
 
 #############################
 ############################# EDIT THAT ...
@@ -105,7 +106,8 @@
 CFLAGS = $(CXXFLAGS)
 
 all:	showvars createlinks $(BUILDOBJS)
-
+	echo "OBJS: $(OBJS)"
+	echo "COMPORTS: $(COMPORTS)"
 	$(CXX) $(CXXFLAGS) $(BUILDOBJS) $(LDFLAGS) -o $(BUILDDIR)/$(TARGET)
 
 createlinks: ;mkdir -p $(BUILDDIR); cd $(BUILDDIR); ln -f -s ../../src/* .;cd $(CURDIR);
diff -ru latest-orig/src/comport_linux.cpp latest/src/comport_linux.cpp
--- latest-orig/src/comport_linux.cpp	2006-12-31 01:51:47.000000000 +0100
+++ latest/src/comport_linux.cpp	2007-01-05 02:12:14.000000000 +0100
@@ -56,11 +56,13 @@
 
 	// create new settings
 	newtio.c_cflag = speed | 
+#ifdef CDTR_IFLOW
 					CDTR_IFLOW | CCTS_OFLOW | 
       			 	CRTS_IFLOW | CDSR_OFLOW | 
+      			 	CCAR_OFLOW |
+#endif
       			 	DATABITS | STOPBITS | PARITYON | PARITY | 
       			 	CLOCAL | CREAD | CRTSCTS | 
-      			 	CCAR_OFLOW |
       			 	0 ;
 	newtio.c_iflag = IGNPAR;
 	newtio.c_oflag = 0;
Endast i latest/src: .comport_linux_dcu60.cpp.swp
diff -ru latest-orig/src/loaders_db.cpp latest/src/loaders_db.cpp
--- latest-orig/src/loaders_db.cpp	2006-12-17 19:45:26.000000000 +0100
+++ latest/src/loaders_db.cpp	2007-01-05 02:59:05.000000000 +0100
@@ -186,14 +186,15 @@
 	file = mallocfile( name, &length );
 	if ( file==NULL)
 	{
-		//output->printf("Cannot open %s\n", name );
+		output->printf("Cannot open %s\n", name );
 		return;
 	}
 	
 	if ( file[0]!=0xba || file[1]!=0xbe )
 	{
-		//output->printf("Not SE file format\n");
-		goto exit;
+		output->printf("Not SE file format\n");
+		free(file);
+		return;
 	}
 	
 	// determine DB, CID, color
@@ -212,8 +213,9 @@
 	}
 	else
 	{
-		//output->printf("Error: unknown db-bits (%08x)\n", DBbits );
-		goto exit;
+		output->printf("Error: unknown db-bits (%08x)\n", DBbits );
+		free(file);
+		return;
 	}
 
 	// FFFFFFEF = blue
@@ -262,16 +264,19 @@
 		}
 		else
 		{
-			//output->printf("Unknown color %x\n", *color);
-			//goto exit;
+			output->printf("Unknown color %x\n", *color);
+			free(file);
+			return;
 		}
 	
 		unsigned long certlength=0;
 		unsigned char*cert = mallocfile( certname, &certlength );
 		if (cert==NULL)
 		{
-			//output->printf("Cannot open %s\n", certname);
-			//goto exit;
+			output->printf("Cannot open %s\n", certname);
+			free(cert);
+			free(file);
+			return;
 		}
 		else
 		{
@@ -387,7 +392,7 @@
     int n = scandir(dirname, &namelist, 0, alphasort);
     if (n < 0)
 	{
-		output->printf("Error scanning directory %s\n");
+		output->printf("Error scanning directory %s\n", dirname);
 		return;
 	}
 
diff -ru latest-orig/src/main.cpp latest/src/main.cpp
--- latest-orig/src/main.cpp	2006-12-31 03:15:02.000000000 +0100
+++ latest/src/main.cpp	2007-01-05 02:41:11.000000000 +0100
@@ -45,6 +45,7 @@
 #endif
 #include <ctype.h>
 #include <sys/types.h>
+#include <time.h>
 
 #if defined(__MINGW32__)
 // WINDOWS: non-cygwin build under cygwin: use kbhit() and getchar()
@@ -2266,7 +2267,8 @@
 	else
 	{
 		output->printf("Error: unknown db-bits (%08x)\n", DBbits );
-		goto exit;
+		free(file);
+		return NULL;
 	}
 
 	// FFFFFFEF = blue
@@ -2315,7 +2317,8 @@
 		else
 		{
 			output->printf("Unknown color %08x\n", COLOR);
-			goto exit;
+			free(file);
+			return NULL;
 		}
 	
 		// have to insert the cert
@@ -2324,7 +2327,9 @@
 		if (cert==NULL)
 		{
 			output->printf("Cannot open %s\n", certname);
-			goto exit;
+			free(file);
+			free(cert);
+			return NULL;
 		}
 		output->printf("Inserting certificate %s\n", certname);
 		memcpy( &file[0x3c], &cert[4], 0x1e8 );
@@ -2358,15 +2363,12 @@
 	}
 	else
 	{
-		goto exit;
+		free(file);
+		return NULL;
 	}
 	
 	// all is okay
 	return file;
-
-exit:
-	free( file );
-	return NULL;
 }
 
 unsigned char* flashloader_verifyflashfile( GUIoutput*output, char*name )
@@ -2404,7 +2406,9 @@
 	else
 	{
 		output->printf("Error: unknown db-bits (%08x)\n", DBbits );
-		goto flash_invalid;
+		//goto flash_invalid;
+		free(file);
+		return NULL;
 	}
 
 	// FFFFFFEF = blue
@@ -2416,17 +2420,23 @@
 	if ( DB != PHONE_bbid_number )
 	{
 		output->printf( "ERROR: the phone is db%i, the flash is db%i\n", PHONE_bbid_number, DB );
-		goto flash_invalid;
+		//goto flash_invalid;
+		free(file);
+		return NULL;
 	}
 	if ( COLOR != PHONE_erom_color )
 	{
 		output->printf( "ERROR: the EROM is color %i, the flash is color %i\n", PHONE_erom_color, COLOR );
-		goto flash_invalid;
+		//goto flash_invalid;
+		free(file);
+		return NULL;
 	}
 	if ( CID != PHONE_erom_cid )
 	{
 		output->printf( "ERROR: the EROM is CID%i, the flash is CID%i\n", PHONE_erom_cid, CID );
-		goto flash_invalid;
+		//goto flash_invalid;
+		free(file);
+		return NULL;
 	}
 	
 	//output->printf("DB%i CID%i COLOR%i match\n", DB, CID, COLOR );
@@ -2471,7 +2481,9 @@
 		else
 		{
 			output->printf("Unknown color %08x\n", COLOR);
-			goto flash_invalid;
+			//goto flash_invalid;
+			free(file);
+			return NULL;
 		}
 	
 		// have to insert the cert
@@ -2480,7 +2492,9 @@
 		if (cert==NULL)
 		{
 			output->printf("Cannot open %s\n", certname);
-			goto flash_invalid;
+			//goto flash_invalid;
+			free(file);
+			return NULL;
 		}
 		//output->printf("Inserting certificate %s\n", certname);
 		memcpy( &file[0x3c], &cert[4], 0x1e8 );
@@ -2518,7 +2532,9 @@
 		if ( (sha_copy.Message_Digest[4]&0xff) != prologue[i] )
 		{
 			output->printf("Flashblock %i is invalid (SHA1=%02x != prologue=%02x)\n", i, sha_copy.Message_Digest[4]&0xff, prologue[i]);
-			goto flash_invalid;
+			//goto flash_invalid;
+			free(file);
+			return NULL;
 		}
 		
 		// next block: skip address, size, data
@@ -2534,9 +2550,6 @@
 	// all is okay
 	return file;
 
-flash_invalid:
-	free( file );
-	return file;
 //	return flashloader_fixflashfile( output, name, 4 );
 
 exit:
@@ -2598,7 +2611,9 @@
 	if (res1!=0x06 || res2!=0)
 	{
 		output->printf("Failed sending header. Returnvalue 0x%x\n", res2);
-		goto exit;
+		//goto exit;
+		free(flashfile);
+		return;
 	}
 	
 	// actual blockptr
@@ -2644,14 +2659,15 @@
 		if (res1!=0x06 || res2!=0)
 		{
 			output->printf("Failed sending flashblock %ld. Returnvalue 0x%x\n", i+1, res2);
-			goto exit;
+			//goto exit;
+			break;
 		}		
 
 		// next block: skip address, size, data
 		blockptr = &blockptr[ blocksize + 8];
 	}
 	
-exit:
+//exit:
 	output->printf("Finishing flash\n");
 	res1=sendbinarycommand( output, phone, 0x11, NULL, 0 );
 	if (res1!=0x06)
@@ -2750,7 +2766,9 @@
 	if (res1!=0x06 || res2!=0)
 	{
 		output->printf("Failed sending header. Returnvalue 0x%x\n", res2);
-		goto exit;
+		//goto exit;
+		free( flashfile );
+		return;
 	}
 	
 	// actual blockptr
@@ -2870,13 +2888,14 @@
 		{
 			output->printf("Failed sending flashblock %ld. Returnvalue 0x%x\n", i+1, res2);
 			//goto exit;
+			break;
 		}		
 
 		// next block: skip address, size, data
 		blockptr = &blockptr[ getlong( &blockptr[4] ) + 8];
 	}
 	
-exit:
+//exit:
 	double savedbycompression = 100.0 * (flashblocks_sum-flashblockscompressed_sum) / double(flashblocks_sum);
 	output->printf("Flashdata %08lx Compressed %08lx Saving %lf percent\n", flashblocks_sum, flashblockscompressed_sum, savedbycompression);
 
@@ -3036,7 +3055,8 @@
 	loadersdb_makename( fname2, LOADER_CERT, "r2e");
 	if (!sendloader(output, phone, fname2))
 	{
-		goto exit;
+		output->printf("Failed\n");
+		return;
 	}
 	
 	output->printf("***** Injection ELF-loader\n");
@@ -3124,7 +3144,7 @@
 	output->printf("***** Wait for loader hello\n");
 	loader_gethello(output, phone);
 
-exit:
+//exit:
 	// shutdown
 	output->printf("***** Shutdown (cmd 14)\n");
 	if (sendbinarycommand( output, phone, 0x14, NULL, 0 )!=0x06)
@@ -3147,6 +3167,7 @@
 	loadersdb_makename( fname1, LOADER_PRODUCTION_ID, "r2f");
 	if (!sendloader(output, phone, fname1))
 	{
+		output->printf("Failed\n");
 		return;
 	}
 
@@ -3155,7 +3176,8 @@
 	loadersdb_makename( fname2, LOADER_CERT, "r2e");
 	if (!sendloader(output, phone, fname2))
 	{
-		goto exit;
+		output->printf("Failed\n");
+		return;
 	}
 	
 	output->printf("***** Injection breakin small\n");
@@ -3200,7 +3222,6 @@
 
 	fclose(f);
 
-exit:
 	// shutdown
 	output->printf("***** Shutdown (cmd 14)\n");
 	if (sendbinarycommand( output, phone, 0x14, NULL, 0 )!=0x06)
@@ -3220,6 +3241,7 @@
 	loadersdb_makename( fname1, LOADER_PRODUCTION_ID, "r2f");
 	if (!sendloader(output, phone, fname1))
 	{
+		output->printf("Failed\n");
 		return;
 	}
 
@@ -3227,7 +3249,8 @@
 	loadersdb_makename( fname1, LOADER_CERT, "r2e");
 	if (!sendloader(output, phone, fname1))
 	{
-		goto shutdown;
+		output->printf("Failed\n");
+		//goto shutdown;
 		return;
 	}
 	
@@ -3237,7 +3260,7 @@
 	if (breakinsmall==0)
 	{
 		output->printf("Cannot open %s\n", fname1);
-		goto shutdown;
+		//goto shutdown;
 		return;
 	}
 	sendbinarycommand( output, phone, 0x3e, breakinsmall, length ); 
@@ -3247,7 +3270,8 @@
 	loadersdb_makename( fname1, LOADER_HACK, "cs_v23");
 	if (!sendloader(output, phone, fname1))
 	{
-		goto shutdown;
+		output->printf("Failed\n");
+		//goto shutdown;
 		return;
 	}
 
@@ -3256,7 +3280,8 @@
 	if (res1!=0x06)
 	{
 		output->printf("Failed\n");
-		goto shutdown;
+		//goto shutdown;
+		return;
 	}
 	waitforbinaryanswer( output, phone );
 	PHONE_loaderFSstarted=true;
@@ -3264,7 +3289,7 @@
 	output->printf("***** Uploading directory to phone\n");
 	csloader_uploaddirectory(output, phone, "./files_to_phone", "" );
 
-shutdown:
+//shutdown:
 	output->printf("***** Shutdown (cmd 01-08)\n");
 	res1=sendbinarycommand_csloader( output, phone, 0x01, 0x08, NULL, 0 );
 	if (res1!=0x06)
@@ -3282,6 +3307,7 @@
 	loadersdb_makename( fname1, LOADER_CERT, "r3l");
 	if (!sendloader(output, phone, fname1))
 	{
+		output->printf("Failed\n");
 		return;
 	}
 
@@ -3292,7 +3318,7 @@
 	if (breakinsmall==0)
 	{
 		output->printf("Cannot open %s\n", fname1);
-		goto shutdown;
+		//goto shutdown;
 		return;
 	}
 	sendbinarycommand( output, phone, 0x3e, breakinsmall, length ); 
@@ -3302,7 +3328,8 @@
 	loadersdb_makename( fname1, LOADER_HACK, "cs_v23");
 	if (!sendloader(output, phone, fname1))
 	{
-		goto shutdown;
+		output->printf("Failed\n");
+		//goto shutdown;
 		return;
 	}
 
@@ -3311,7 +3338,8 @@
 	if (res1!=0x06)
 	{
 		output->printf("Failed\n");
-		goto shutdown;
+		//goto shutdown;
+		return;
 	}
 	waitforbinaryanswer( output, phone );
 	PHONE_loaderFSstarted=true;
@@ -3319,7 +3347,7 @@
 	output->printf("***** Uploading directory to phone\n");
 	csloader_uploaddirectory(output, phone, "./files_to_phone", "" );
 
-shutdown:
+//shutdown:
 	output->printf("***** Shutdown (cmd 01-08)\n");
 	res1=sendbinarycommand_csloader( output, phone, 0x01, 0x08, NULL, 0 );
 	if (res1!=0x06)
diff -ru latest-orig/src/ucl_alloc.c latest/src/ucl_alloc.c
--- latest-orig/src/ucl_alloc.c	2006-12-29 20:59:24.000000000 +0100
+++ latest/src/ucl_alloc.c	2007-01-05 02:42:53.000000000 +0100
@@ -26,6 +26,7 @@
  */
 
 #include <ctype.h>
+#include <stdlib.h>
 #include "ucl_conf.h"
 
 
@@ -49,7 +50,7 @@
 ucl_malloc_internal(ucl_uint size)
 {
     ucl_voidp p = 0;
-    if (size < ~(size_t)0)
+    if (size < ~(ucl_uint)0)
         p = (ucl_voidp) malloc((size_t) size);
     return p;
 }
diff -ru latest-orig/src/ucl_n2_99.c latest/src/ucl_n2_99.c
--- latest-orig/src/ucl_n2_99.c	2006-12-29 20:59:47.000000000 +0100
+++ latest/src/ucl_n2_99.c	2007-01-05 02:57:57.000000000 +0100
@@ -26,6 +26,7 @@
  */
 
 #include <ctype.h>
+#include <string.h>
 
 #include "ucl_conf.h"
 #include "ucl/ucl.h"
