Subject: Re: CVS commit: [netbsd-2] src/usr.bin/grep
To: Jeff Rizzo <riz@NetBSD.org>
From: Michael van Elst <mlelstv@serpens.de>
List: source-changes
Date: 07/16/2005 09:48:44
On Sat, Jul 16, 2005 at 09:17:01AM +0200, Jukka Salmi wrote:
> The build fails as follows:
I have requested only one change to binary.c, which is:
- for (i = 0; i < BUFFER_SIZE && i < f->len - 1; i++)
+ for (i = 0; i < BUFFER_SIZE && i < f->len; i++)
There are two more changes to binary.c which I did not request.
- if ((m = gzread(f, buf, BUFFER_SIZE)) == 0)
+ if ((m = gzread(f, buf, BUFFER_SIZE)) <= 0)
This catches errors in gzread but which is not a correct thing
to do. It does not (can not!) report the error and fails to gzrewind()
the filehandle.
- if (!isprint(buf[i]) && !isspace(buf[i]) &&
- buf[i] != line_endchar)
+ if (!okchar(buf[i]))
This (together with the new okchar() function which is missing)
factors out the 'is a binary' test and fixes the wrong call to
isprint() with a possibly signed character at the same time.
Greetings,
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."