Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: [netbsd-2] src/usr.bin/grep



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@localhost
                                "A potential Snark may lurk in every tree."



Home | Main Index | Thread Index | Old Index