Date: Wed, 25 Jun 2008 01:04:20 +0400 From: Andrey Chernov <ache@nagual.pp.ru> To: Gabor Kovesdan <gabor@FreeBSD.org> Cc: hackers@FreeBSD.org, current@FreeBSD.org Subject: Re: CFT: BSD-licensed grep [Fwd: cvs commit: ports/textproc/bsdgrep Makefile distinfo] Message-ID: <20080624210420.GA43007@nagual.pp.ru> In-Reply-To: <486159D1.3060704@FreeBSD.org> References: <20080618055851.GA85018@nagual.pp.ru> <86zlpjduew.fsf@ds4.des.no> <20080618083739.GA87100@nagual.pp.ru> <867icndqv5.fsf@ds4.des.no> <4858DBF6.5070001@bluemedia.pl> <86skvbc9gn.fsf@ds4.des.no> <20080618114917.GB89383@nagual.pp.ru> <485E4C69.1080805@FreeBSD.org> <20080622135343.GA72068@nagual.pp.ru> <486159D1.3060704@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080624210420.GA43007>