From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23013 invoked from network); 12 Jan 2005 16:00:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Jan 2005 16:00:08 -0000 Received: (qmail 60995 invoked from network); 12 Jan 2005 16:00:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jan 2005 16:00:02 -0000 Received: (qmail 21945 invoked by alias); 12 Jan 2005 15:59:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20698 Received: (qmail 21932 invoked from network); 12 Jan 2005 15:59:47 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Jan 2005 15:59:47 -0000 Received: (qmail 60431 invoked from network); 12 Jan 2005 15:58:48 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 12 Jan 2005 15:58:44 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Wed, 12 Jan 2005 15:57:24 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 12 Jan 2005 16:00:58 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j0CFwgKw026994 for ; Wed, 12 Jan 2005 15:58:43 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j0CFwgeq026991 for ; Wed, 12 Jan 2005 15:58:42 GMT Message-Id: <200501121558.j0CFwgeq026991@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk Subject: Re: POSIX conformance in coreutils In-reply-to: References: <200501121027.j0CAR12W018808@news01.csr.com> Date: Wed, 12 Jan 2005 15:58:41 +0000 From: Peter Stephenson X-OriginalArrivalTime: 12 Jan 2005 16:00:58.0396 (UTC) FILETIME=[E7C2C5C0:01C4F8BF] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 Vin Shelton wrote: > I checked and I do not have POSIXLY_CORRECT set. Here's what the > 'Standards conformance' section of the coreutils info says: It doesn't look like we can expect much sense, then. Here is a more heavyweight change. Index: Test/ztst.zsh =================================================================== RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v retrieving revision 1.20 diff -u -r1.20 ztst.zsh --- Test/ztst.zsh 12 Jan 2005 10:32:20 -0000 1.20 +++ Test/ztst.zsh 12 Jan 2005 15:56:50 -0000 @@ -28,9 +28,6 @@ [[ -n $LC_COLLATE ]] && LC_COLLATE=C [[ -n $LANG ]] && LANG=C -# POSIXLY_CORRECT can cause spurious error messages with "tail -". -unset POSIXLY_CORRECT - # Set the module load path to correspond to this build of zsh. # This Modules directory should have been created by "make check". [[ -d Modules/zsh ]] && module_path=( $PWD/Modules ) @@ -60,6 +57,33 @@ integer ZTST_testfailed +# This is POSIX nonsense. Because of the vague feeling someone, somewhere +# may one day need to examine the arguments of "tail" using a standard +# option parser, every Unix user in the world is expected to switch +# to using "tail -n NUM" instead of "tail -NUM". Older versions of +# tail don't support this. +tail() { + emulate -L zsh + + if [[ -z $TAIL_SUPPORTS_MINUS_N ]]; then + local test + test=$(echo "foo\nbar" | command tail -n 1 2>/dev/null) + if [[ $test = bar ]]; then + TAIL_SUPPORTS_MINUS_N=1 + else + TAIL_SUPPORTS_MINUS_N=0 + fi + fi + + integer argi=${argv[(i)-<->]} + + if [[ $argi -le $# && $TAIL_SUPPORTS_MINUS_N = 1 ]]; then + argv[$argi]=(-n ${argv[$argi][2,-1]}) + fi + + command tail "$argv[@]" +} + # The source directory is not necessarily the current directory, # but if $0 doesn't contain a `/' assume it is. if [[ $0 = */* ]]; then -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************