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

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Wed, 25 Jun 2008 01:04:20 +0400
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

-- 
http://ache.pp.ru/
Received on Tue Jun 24 2008 - 19:04:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:32 UTC