[comp.sources.bugs] Fix to binary file patch/dump utility

alex@aiva.ed.ac.uk (Alex Zbyslaw) (04/08/88)

Description:
	Fails to display a '%' character on the ascii side of the screen
	because it is using sprintf to try to print it.

Reapeat-by:
	Make a copy of the program (called from here on bpatch) and
	bpatch this copy.  Search for the string "FILE:" and then change
	it to "File:".  Save the change and then use the new bpatch to edit
	something.  Notice that at the top it says "IlLe:", or something
	else basically wrong.

Fix:	Apply this patch.  Ok it's a hack, but it works.


[ Alex Zbyslaw						  alex@uk.ac.ed.eusip ]
[ Centre for Speech Technology		             alex%ed.eusip@nss.cs.ucl ]
[ Edinburgh University			  { major node }!mcvax!ukc!eusip!alex ]

-----------------------------------CUT HERE------------------------------------

*** bpatch.c.orig	Fri Apr  8 11:06:33 1988
--- bpatch.c	Fri Apr  8 11:09:05 1988
***************
*** 1242,1247
  		for (j = 0; j < 16 && i*16+j < bytes; ++j)
  		{
  			if (temp[j] < ' ') outch ('.');
  			else
  			{
  				sprintf (outbuf, "%c", temp[j]);

--- 1242,1248 -----
  		for (j = 0; j < 16 && i*16+j < bytes; ++j)
  		{
  			if (temp[j] < ' ') outch ('.');
+ 			else if (temp[j] == '%') outch ('%');
  			else
  			{
  				sprintf (outbuf, "%c", temp[j]);