[comp.sources.bugs] Un-official patches to filescan

jfh@rpp386.Dallas.TX.US (John F. Haugh II) (09/17/89)

These are some patches I had to make to get filescan to run
under SCO Xenix.

Good luck, and enjoy!
--
*** orig/in_cksum.c
--- in_cksum.c
**************
*** 5,11
   */
  
  in_cksum(addr, len)
! 	u_short	*addr;
  	int	len;
  {
  	register int nleft = len;
--- 5,11 -----
   */
  
  in_cksum(addr, len)
! 	unsigned short *addr;
  	int	len;
  {
  	register int nleft = len;
**************
*** 9,16
  	int	len;
  {
  	register int nleft = len;
! 	register u_short *w = addr;
! 	register u_short answer;
  	register int sum = 0;
  
  	/*
--- 9,16 -----
  	int	len;
  {
  	register int nleft = len;
! 	register unsigned short *w = addr;
! 	register unsigned short answer;
  	register int sum = 0;
  
  	/*
**************
*** 26,32
  
  	/* mop up an odd byte, if necessary */
  	if( nleft == 1 )
! 		sum += *(u_char *)w;
  
  	/*
  	 * add back carry outs from top 16 bits to low 16 bits
--- 26,32 -----
  
  	/* mop up an odd byte, if necessary */
  	if( nleft == 1 )
! 		sum += *(unsigned char *)w;
  
  	/*
  	 * add back carry outs from top 16 bits to low 16 bits
*** orig/Makefile
--- Makefile
**************
*** 12,19
  MANDIR=/usr/man/man8
  
  #define DBM if you dont have NDBM.
! DBM= -DNDBM
! #DBM= -DDBM
  
  CFLAGS= -O $(DBM)
  LDFLAGS= -s
--- 12,21 -----
  MANDIR=/usr/man/man8
  
  #define DBM if you dont have NDBM.
! #DBM= -DNDBM
! DBM= -DDBM
! #OS= -DBSD
! OS= -DSYSV
  
  CFLAGS= -O $(DBM) $(OS)
  LDFLAGS= -s
**************
*** 15,21
  DBM= -DNDBM
  #DBM= -DDBM
  
! CFLAGS= -O $(DBM)
  LDFLAGS= -s
  
  LIBS= -ldbm
--- 17,23 -----
  #OS= -DBSD
  OS= -DSYSV
  
! CFLAGS= -O $(DBM) $(OS)
  LDFLAGS= -s
  
  LIBS= -ldbm
*** orig/filescan.c
--- filescan.c
**************
*** 1,6
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/file.h>
  #ifdef	DBM
  #include <dbm.h>
  #endif
--- 1,7 -----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/file.h>
+ #include <fcntl.h>
  #ifdef	DBM
  #include <dbm.h>
  #endif
**************
*** 26,32
  */
  
  #ifndef	lint
! static	char	*rcsid[] = "$Header: filescan.c,v 1.1 89/09/13 14:26:27 mjr Rel $";
  #endif
  
  
--- 27,33 -----
  */
  
  #ifndef	lint
! static	char	*rcsid = "$Header: filescan.c,v 1.1 89/09/13 14:26:27 mjr Rel $";
  #endif
  
  #ifdef	SYSV
**************
*** 29,34
  static	char	*rcsid[] = "$Header: filescan.c,v 1.1 89/09/13 14:26:27 mjr Rel $";
  #endif
  
  
  extern	datum	fetch();
  extern	char	*rindex();
--- 30,39 -----
  static	char	*rcsid = "$Header: filescan.c,v 1.1 89/09/13 14:26:27 mjr Rel $";
  #endif
  
+ #ifdef	SYSV
+ #define	bcopy(a,b,s)	memcpy(b,a,s)
+ #define	rindex	strrchr
+ #endif
  
  extern	datum	fetch();
  extern	char	*rindex();
**************
*** 182,188
  	}
  
  	/* exit with different values depending on request */
! #ifdef	DBM
  	(void)dbmclose();
  #endif
  #ifdef	NDBM
--- 187,193 -----
  	}
  
  	/* exit with different values depending on request */
! #if defined(DBM) && defined(BSD)
  	(void)dbmclose();
  #endif
  #ifdef	NDBM
**************
*** 354,360
  		warn("cannot read for sum",fil);
  	} else {
  		while((cnt = read(fd,buf,BUFSIZ)) > 0)
! 			sum += in_cksum((u_short *)buf,cnt);
  		(void)close(fd);
  	}
  	return(sum);
--- 359,365 -----
  		warn("cannot read for sum",fil);
  	} else {
  		while((cnt = read(fd,buf,BUFSIZ)) > 0)
! 			sum += in_cksum((unsigned short *)buf,cnt);
  		(void)close(fd);
  	}
  	return(sum);
-- 
John F. Haugh II                        +-Quote of the month club: ------------
VoiceNet: (512) 832-8832   Data: -8835  |  It's not that important,
InterNet: jfh@rpp386.cactus.org         |      it's only USENET.
UUCPNet:  {texbell|bigtex}!rpp386!jfh   +--------------     -- Rich $alz   ----