/* ** bd v1.0 ** ** Binary diff ** ** Copyright (C) 20.11.96 by Andreas Ley ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** 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 General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** This program has been tested on a HP9000/715 with HP-UX A.09.07 ** In this environment, neither lint -u nor gcc -Wall -fsyntax-only produce ** any messages. If you encounter any errors or need to make any changes to ** port it to another platform, please contact me. ** ** Version history ** ** Version 1.0 - 20.11.96 ** Initial version */ static char copyright[] = "@(#)Copyright (C) 1996 by Andreas Ley (ley@rz.uni-karlsruhe.de)"; static char sccsid[] = "@(#)bd v1.0 - Binary diff"; #include #include #include #include #ifndef FALSE #define FALSE (0) /* This is the naked Truth */ #define TRUE (1) /* and this is the Light */ #endif char *image; int debug=0; static void bd(src) FILE *src; { char line[8*1024],*ptr; if (debug) (void)fprintf(stderr,"bd(0x%08lx)\n",src); while (fgets(line,sizeof(line),src)) { ptr=strchr(line,'\0'); if (*(ptr-1)=='\n') ptr--; if (*(ptr-1)=='\r') ptr--; while (ptr>line && *(ptr-1)==' ') ptr--; *ptr='\0'; } } static void usage() { (void)fprintf(stderr,"Usage: %s [-h] [-v] [filename...]\n",image); exit(1); } int main(argc,argv) int argc; char *argv[]; { int c; extern char *optarg; extern int optind; FILE *src; if ((image=strrchr(argv[0],'/'))) image++; else image=argv[0]; while ((c=getopt(argc,argv,"Dvh?"))!=EOF) switch ((char)c) { case 'D': debug++; break; case 'v': (void)fprintf(stderr,"%s\n",sccsid+4); (void)fprintf(stderr,"%s\n",copyright+4); exit(0); case 'h': (void)fprintf(stderr,"%s\n",sccsid+4); (void)fprintf(stderr,"%s\n",copyright+4); case '?': usage(); } if (optind