Date: Wed, 9 Sep 2009 17:26:16 +0400 From: Andrey Chernov <ache@nagual.pp.ru> To: Roman Divacky <rdivacky@FreeBSD.org> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196981 - head/usr.bin/unzip Message-ID: <20090909132616.GA35808@nagual.pp.ru> In-Reply-To: <200909081555.n88FtDwe052523@svn.freebsd.org> References: <200909081555.n88FtDwe052523@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 08, 2009 at 03:55:13PM +0000, Roman Divacky wrote: > + * Detect whether this is a text file. The correct way to > + * do this is to check the least significant bit of the > + * "internal file attributes" field of the corresponding > + * file header in the central directory, but libarchive > + * does not read the central directory, so we have to > + * guess by looking for non-ASCII characters in the > + * buffer. Hopefully we won't guess wrong. If we do > + * guess wrong, we print a warning message later. > + */ > + if (a_opt && n == 0) { > + for (p = buffer; p < end; ++p) { > + if (!isascii((unsigned char)*p)) { > + text = 0; > + break; > + } > + } > + } > + If I understand the purpose of this code right, better use isalnum()+ispunct()+ispace() combination to count non-ASCII people too. Also setlocale() call must be added to the main() for that. -- http://ache.pp.ru/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090909132616.GA35808>