Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Wayne Davison
Mon, 27 Nov 1989 10:05
Better binary-file checking for gnu diff
Author: Wayne Davison
Date: Mon, 27 Nov 1989 10:05
Date: Mon, 27 Nov 1989 10:05
39 lines
1711 bytes
1711 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads