From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29519 invoked from network); 15 Dec 2005 10:46:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Dec 2005 10:46:14 -0000 Received: (qmail 44405 invoked from network); 15 Dec 2005 10:46:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Dec 2005 10:46:08 -0000 Received: (qmail 25022 invoked by alias); 15 Dec 2005 10:46:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22082 Received: (qmail 25011 invoked from network); 15 Dec 2005 10:46:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Dec 2005 10:46:00 -0000 Received: (qmail 43668 invoked from network); 15 Dec 2005 10:46:00 -0000 Received: from cluster-c.mailcontrol.com (HELO rly27c.srv.mailcontrol.com) (168.143.177.190) by a.mx.sunsite.dk with SMTP; 15 Dec 2005 10:45:59 -0000 Received: from exchange03.csr.com (uuk202166.uk.customer.alter.net [62.189.241.194] (may be forged)) by rly27c.srv.mailcontrol.com (MailControl) with ESMTP id jBFAhYXw014326 for ; Thu, 15 Dec 2005 10:45:45 GMT Received: from news01 ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 15 Dec 2005 10:45:26 +0000 Date: Thu, 15 Dec 2005 10:45:24 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: Globbing feature suggestion Message-Id: <20051215104524.2429e0d1.pws@csr.com> In-Reply-To: <1051215043452.ZM3906@candle.brasslantern.com> References: <87irtt4uno.fsf@shazam.localnet> <1051213041649.ZM21953@candle.brasslantern.com> <871x0ge5ge.fsf@shazam.localnet> <1051215043452.ZM3906@candle.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 0.9.12 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 Dec 2005 10:45:26.0259 (UTC) FILETIME=[A889AC30:01C60164] X-Scanned-By: MailControl A-05-40-01 (www.mailcontrol.com) on 10.67.0.137 Bart Schaefer wrote: > Urk. Sorry about that; I don't actually *have* any files with unknown > uid/gid on my system, but I had assumed "stat" would return the numeric > ID in the absence of a name, the way "ls -l" does. > > In fact I think it's pretty darn useless to return '???' for all unknown > IDs, as if they were equivalent. Would anyone seriously object if that > were changed? I don't see why not. I think it was that way because you can get both (with stat -rs). Index: Src/Modules/stat.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/stat.c,v retrieving revision 1.9 diff -u -r1.9 stat.c --- Src/Modules/stat.c 2 Nov 2005 19:29:53 -0000 1.9 +++ Src/Modules/stat.c 15 Dec 2005 10:42:17 -0000 @@ -140,10 +140,16 @@ #ifdef HAVE_GETPWUID struct passwd *pwd; pwd = getpwuid(uid); - strcat(outbuf, pwd ? pwd->pw_name : "???"); -#else /* !HAVE_GETPWUID */ - strcat(outbuf, "???"); + if (pwd) + strcat(outbuf, pwd->pw_name); + else #endif /* !HAVE_GETPWUID */ + { + char *optr; + for (optr = outbuf; *optr; optr++) + ; + sprintf(optr, "%lu", (unsigned long)uid); + } if (flags & STF_RAW) strcat(outbuf, ")"); } @@ -163,10 +169,16 @@ #ifdef HAVE_GETGRGID struct group *gr; gr = getgrgid(gid); - strcat(outbuf, gr ? gr->gr_name : "???"); -#else /* !HAVE_GETGRGID */ - strcat(outbuf, "???"); + if (gr) + strcat(outbuf, gr->gr_name); + else #endif /* !HAVE_GETGRGID */ + { + char *optr; + for (optr = outbuf; *optr; optr++) + ; + sprintf(optr, "%lu", (unsigned long)gid); + } if (flags & STF_RAW) strcat(outbuf, ")"); } -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com