*** hbf.h.orig	Tue Dec 30 10:26:18 1997
--- hbf.h	Sun Jan 19 18:27:27 1997
***************
*** 6,11 ****
--- 6,19 ----
  #ifndef _HBF_
  #define _HBF_
  
+ /*
+  * $Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $
+  */
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
  #ifndef __STDC__
  #	ifndef const
  #		define const
***************
*** 60,66 ****
  extern	void	hbfForEach(
  #ifdef __STDC__
  			HBF	*hbf,
! 			void	(*func)(HBF *sameHbf, HBF_CHAR code)
  #endif
  		);
  
--- 68,76 ----
  extern	void	hbfForEach(
  #ifdef __STDC__
  			HBF	*hbf,
! 			void	(*func)(HBF *sameHbf, HBF_CHAR code,
! 					void *callback_data),
! 			void	*callback_data
  #endif
  		);
  
***************
*** 161,165 ****
--- 171,179 ----
  		HBF_BytePtr ptrBitmapBuffer
  #endif
  );
+ 
+ #ifdef __cplusplus
+ }
+ #endif
  
  #endif /* ! _HBF_ */
*** hbf.c.orig	Tue Dec 30 10:26:21 1997
--- hbf.c	Wed Nov  5 00:36:18 1997
***************
*** 1,3 ****
--- 1,10 ----
+ #ifndef lint
+ #ifdef __GNUC__
+ static char rcsid[] __attribute__ ((unused)) = "$Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $";
+ #else
+ static char rcsid[] = "$Id: HBF.PATCH,v 1.1 1998/07/24 16:12:11 mleisher Exp $";
+ #endif
+ #endif
  /*
   * Copyright 1993,1994,1995 by Ross Paterson
   *
***************
*** 591,605 ****
  	BM_FILE	**fp;
  reg	BM_FILE	*file;
  	FILE	*f;
  #ifdef IN_MEMORY
  #ifdef unix
  	bool	from_pipe;
  #endif
  #endif
  
! 	for (fp = &(hbf->bm_file); *fp != NULL; fp = &((*fp)->bmf_next))
! 		if (strcmp((*fp)->bmf_name, filename) == 0)
! 			return *fp;
  
  	file = NEW(BM_FILE);
  	if (file == NULL) {
--- 598,616 ----
  	BM_FILE	**fp;
  reg	BM_FILE	*file;
  	FILE	*f;
+ 	char *bmfname;
  #ifdef IN_MEMORY
  #ifdef unix
  	bool	from_pipe;
  #endif
  #endif
  
! 	for (fp = &(hbf->bm_file); *fp != NULL; fp = &((*fp)->bmf_next)) {
!             bmfname = strrchr((*fp)->bmf_name, '/');
!             bmfname = (bmfname) ? bmfname + 1 : (*fp)->bmf_name;
!             if (strcmp(bmfname, filename) == 0)
!               return *fp;
!         }
  
  	file = NEW(BM_FILE);
  	if (file == NULL) {
***************
*** 615,631 ****
  #ifdef IN_MEMORY
  #ifdef unix
  	from_pipe = FALSE;
  	if (f == NULL) {
  		char	tmp[400];
  
  		sprintf(tmp, "%s.gz", file->bmf_name);
  		if ((f = fopen(tmp, "r")) != NULL) {
  			fclose(f);
! 			sprintf(tmp, "gzcat %s.gz", file->bmf_name);
  			if ((f = popen(tmp, "r")) != NULL)
  				from_pipe = TRUE;
  		}
  	}
  #endif /* unix */
  #endif /* IN_MEMORY */
  	if (f == NULL) {
--- 626,644 ----
  #ifdef IN_MEMORY
  #ifdef unix
  	from_pipe = FALSE;
+ #ifdef GUNZIP_CMD
  	if (f == NULL) {
  		char	tmp[400];
  
  		sprintf(tmp, "%s.gz", file->bmf_name);
  		if ((f = fopen(tmp, "r")) != NULL) {
  			fclose(f);
! 			sprintf(tmp, "%s %s.gz", GUNZIP_CMD, file->bmf_name);
  			if ((f = popen(tmp, "r")) != NULL)
  				from_pipe = TRUE;
  		}
  	}
+ #endif /* GUNZIP_CMD */
  #endif /* unix */
  #endif /* IN_MEMORY */
  	if (f == NULL) {
***************
*** 674,680 ****
  	cp = contents = (byte *)malloc((unsigned)GRAIN_SIZE);
  	if (contents == NULL) {
  		eprintf("not enough space for bitmap file");
! 		return NULL;
  	}
  	while ((c = getc(f)) != EOF) {
  		if (size%GRAIN_SIZE == 0) {
--- 687,693 ----
  	cp = contents = (byte *)malloc((unsigned)GRAIN_SIZE);
  	if (contents == NULL) {
  		eprintf("not enough space for bitmap file");
! 		return FALSE;
  	}
  	while ((c = getc(f)) != EOF) {
  		if (size%GRAIN_SIZE == 0) {
***************
*** 682,688 ****
  					(unsigned)(size + GRAIN_SIZE));
  			if (contents == NULL) {
  				eprintf("not enough space for bitmap file");
! 				return NULL;
  			}
  			cp = contents + size;
  		}
--- 695,701 ----
  					(unsigned)(size + GRAIN_SIZE));
  			if (contents == NULL) {
  				eprintf("not enough space for bitmap file");
! 				return FALSE;
  			}
  			cp = contents + size;
  		}
***************
*** 1397,1405 ****
   * Call function on each valid code in ascending order.
   */
  void
! hbfForEach(hbfFile, func)
  reg	HBF	*hbfFile;
! reg	void	(*func)_((HBF *sameHbfFile, HBF_CHAR code));
  {
  	HBF_STRUCT	*hbf;
  	CODE_RANGE	*cp;
--- 1410,1420 ----
   * Call function on each valid code in ascending order.
   */
  void
! hbfForEach(hbfFile, func, callback_data)
  reg	HBF	*hbfFile;
! reg	void	(*func)_((HBF *sameHbfFile, HBF_CHAR code,
! 			  void *callback_data));
! 	void	*callback_data;
  {
  	HBF_STRUCT	*hbf;
  	CODE_RANGE	*cp;
***************
*** 1423,1429 ****
  					finish = SecondByte(cp->code_finish);
  				while (byte2 <= finish) {
  					(*func)(hbfFile,
! 						MakeCode(byte1, byte2));
  					byte2++;
  				}
  			}
--- 1438,1445 ----
  					finish = SecondByte(cp->code_finish);
  				while (byte2 <= finish) {
  					(*func)(hbfFile,
! 						MakeCode(byte1, byte2),
! 						callback_data);
  					byte2++;
  				}
  			}
