From owner-svn-src-all@FreeBSD.ORG Wed Sep 9 13:26:19 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31F19106566C; Wed, 9 Sep 2009 13:26:19 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 9945C8FC08; Wed, 9 Sep 2009 13:26:18 +0000 (UTC) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.3/8.14.3) with ESMTP id n89DQGIZ035867; Wed, 9 Sep 2009 17:26:17 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1252502777; bh=eRDuSaV2e+ZBpvJCqs/q83VhZqI/2vulKS84wJiWzxc=; l=963; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=S75dtThzO0JPJ9VTrSK3MDfPdw2YOFhOj8RRl+pJ9Zmuz1wTPTqsxQAvb5PQ0zjPt gmvJE38fNLJUJFcb98KlsIxosUT6AJcMz6eXg8z7Q03/8SyD89yzxSggjouXlZ2Y5B r+UKOrj89j8lYmFgxvkKCvP6X+bUUXsptFYhK15E= Received: (from ache@localhost) by nagual.pp.ru (8.14.3/8.14.3/Submit) id n89DQGST035866; Wed, 9 Sep 2009 17:26:16 +0400 (MSD) (envelope-from ache) Date: Wed, 9 Sep 2009 17:26:16 +0400 From: Andrey Chernov To: Roman Divacky Message-ID: <20090909132616.GA35808@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Roman Divacky , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <200909081555.n88FtDwe052523@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200909081555.n88FtDwe052523@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196981 - head/usr.bin/unzip X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2009 13:26:19 -0000 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/