From 1c7d0b339d578511be239c175ef2096e6e8aa6e2 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 21 Aug 2004 01:15:19 +0000 Subject: Added new files --- int2tap.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 127 insertions(+), 5 deletions(-) (limited to 'int2tap.c') diff --git a/int2tap.c b/int2tap.c index 68902a2..b2fba26 100644 --- a/int2tap.c +++ b/int2tap.c @@ -20,6 +20,8 @@ ------------------------------------------------------------------------- + $Name$ + */ static const char id[]="$Id$"; @@ -30,8 +32,11 @@ static const char id[]="$Id$"; #include #include +#include "intel.h" +#include "tap.h" + -/* ---------------------------------------- MACROS +/* ---------------------------------------- GLOBALS */ #undef TRUE #undef FALSE @@ -39,19 +44,136 @@ static const char id[]="$Id$"; #define TRUE 1 #define FALSE 0 - -/* ---------------------------------------- TYPES -*/ +const char *progname; -/* ---------------------------------------- PROTOS +/* ---------------------------------------- PRIVATE UTILS */ +static void Usage(void) +{ + fprintf(stderr,"%s: usage %s [ -b ] [ -s ] [ -a address ] " + "output-file input-file ... \n",progname,progname); +} /* ---------------------------------------- MAIN */ int main(int argc, char *argv[]) { + unsigned char mem[0x10000]; + IntelInfo *info; + char *outname; + unsigned exec_addr; + int bin_only; + int split; + int addr_defined; + int base; + int no; + int f; + int done; + + /* Set program name + */ + if ((progname=strrchr(argv[0],'/'))) + { + progname++; + } + else + { + progname=argv[0]; + } + + /* Set defaults and parse args + */ + addr_defined=FALSE; + bin_only=FALSE; + split=FALSE; + + done=FALSE; + f=1; + + while(fargc-2) + { + Usage(); + } + + addr_defined=TRUE; + + exec_addr=(unsigned)strtoul(argv[++f],NULL,0); + + break; + + default: + Usage(); + break; + } + + f++; + } + } + + if (base>=argc-1) + { + Usage(); + } + + outname=argv[base++]; + + no=argc-base; + + if (!(info=malloc(sizeof *info * no))) + { + fprintf(stderr,"%s: malloc failed\n",progname); + } + + /* Process Intel files + */ + for(f=0;f