/****************************************************************************** * * project name: TI-68k Developer Utilities * file name: ttstrip.c * initial date: 13/08/2000 * author: thomas.nussbaumer@gmx.net * description: strips PC header and trailing checksum from an TI executable * ******************************************************************************/ /* This file is part of TI-68k Developer Utilities. This file is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. As a special exception, UNMODIFIED copies of ttstrip may also be redistributed or sold without source code, for any purpose. (The Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the program.) This exception notice must be removed on modified copies of this file. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __TTSTRIP__ #define __TTSTRIP__ // if EMBEDDED_USE is defined, than we use this sourcefile from within another // sourcefile #ifndef EMBEDDED_USE #include #include #include #include "ttversion.h" #include "revtools.h" #include "tt.h" #ifdef FILE_REVISION #undef FILE_REVISION #endif #define FILE_REVISION "1.8" //============================================================================= // outputs usage information of this tool //============================================================================= void PrintUsage() { #ifndef EMBEDDED_USE PRINT_ID("TTStrip"); #endif fprintf(USAGE_OUT, "Usage: ttstrip [-quiet] \n\n" \ " -quiet ... don't output standard messages\n\n" \ " extracts the raw binary content of a TI file by stripping\n" \ " the header and trailing checksum which are only necessary\n" \ " for the link software to send the data to the calc.\n" \ " NOTE: after stripping these informations it is no longer\n" \ " possible to distinguish between a TI89 and a TI92p file.\n" \ " So be careful!\n\n"); } //============================================================================= // its a main ... //============================================================================= int main(int argc,char *argv[]) { #else int TTStrip(int argc,char *argv[]) { #endif char* infile = NULL; char* outfile = NULL; FILE* ifp; FILE* ofp; char sig[9]; int length; int striplen; int n; int quiet = 0; // check for too less arguments if (argc < 3) { #ifndef EMBEDDED_USE PrintUsage(); #endif return 1; } // parse arguments for (n=1; n