CFT: BSD-licensed grep [Fwd: cvs commit: ports/textproc/bsdgrep Makefile distinfo]

Andrey Chernov ache at
Tue Jun 24 21:04:24 UTC 2008

On Tue, Jun 24, 2008 at 10:32:17PM +0200, Gabor Kovesdan wrote:

>                 ch = fgetwc(f);

You must clear errno before and handle EILSEQ possible coming after 
fgetwc() somehow. Perhaps by return ret = 1 (binary), I am not sure.
fgetwc() returns WEOF in that case which is not true end of file.

>         if ((s = mbstowcs(NULL, f->base, 0)) == -1)
>                 return (0);

The same here. Check EILSEQ and return 1


More information about the freebsd-hackers mailing list