davison@drivax.UUCP (Wayne Davison) (11/27/89)
Here's a simple little change that I've been applying to each new release of gnu diff that comes out. It extends the check for a binary file to include a file with 0's in it. I've had binaries in the past that didn't have any bytes with the 0200 bit set (in the quantity checked by gnu diff), but had plenty of 0's. Any reason NOT to do this? This diff generated from version 1.12: *** io.c.orig Sun Sep 17 23:58:49 1989 --- io.c Sat Nov 25 14:26:18 1989 *************** *** 32,36 **** /* Check for binary files and compare them for exact identity. */ ! /* Return 1 if BUF contains a character with the 0200 bit set. SIZE is the number of characters in BUF. */ --- 32,36 ---- /* Check for binary files and compare them for exact identity. */ ! /* Return 1 if BUF contains a 0 or a character with the 0200 bit set. SIZE is the number of characters in BUF. */ *************** *** 41,45 **** { while (--size >= 0) ! if (*buf++ & 0200) return 1; return 0; --- 41,45 ---- { while (--size >= 0) ! if (!*buf || *buf++ & 0200) return 1; return 0; -- Wayne Davison \ /| / /| \/ /| /(_) davison@drivax.UUCP (_)/ |/ /\| / / |/ \ ...!amdahl!drivax!davison