From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6651 invoked from network); 22 Jul 2003 15:50:41 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 22 Jul 2003 15:50:41 -0000 Received: (qmail 225 invoked by alias); 22 Jul 2003 15:50:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18885 Received: (qmail 214 invoked from network); 22 Jul 2003 15:50:30 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 22 Jul 2003 15:50:30 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 22 Jul 2003 15:50:30 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-12.tower-36.messagelabs.com!1058889324!24920 X-StarScan-Version: 5.0.7; banners=.,-,- Received: (qmail 2308 invoked from network); 22 Jul 2003 15:55:24 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-12.tower-36.messagelabs.com with SMTP; 22 Jul 2003 15:55:24 -0000 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id h6MFoS3l032290 for ; Tue, 22 Jul 2003 16:50:28 +0100 Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h6MFplI01364 for ; Tue, 22 Jul 2003 17:51:48 +0200 To: zsh-workers@sunsite.dk (Zsh hackers list) X-VirusChecked: Checked In-reply-to: <22303.1058880773@csr.com> From: Oliver Kiddle References: <22303.1058880773@csr.com> Subject: Re: PATCH: access to names of errors Date: Tue, 22 Jul 2003 17:51:47 +0200 Message-ID: <1362.1058889107@gmcs3.local> Peter wrote: > This patches the parameter module to add $sys_errnos, which turns $ERRNO > into the name of the error --- not the error text you would get with > strerror(), the standard name. This is more useful for programming, > since if you know you can test for > > [[ $sys_errnos[$ERRNO] = EINTR ]] > > and so on. It's also more difficult, but I simply copied the code for > signal names. > > I'd appreciate comments on > - where this should appear; I'm planning on an interface to the system > read function and it could go there instead. This might be > better since the parameter module usually provides shell rather > than system information and the new array bloats it somewhat. > The new module could be a generic zsystem module. I'd say it shouldn't be in the parameter module because as you say, that interfaces to shell rather than system information. I'd just call the module `system'. The `z' seems a bit redundant especially as it is effectively zsh/system with the namespace. > - what it should be called; the current name at least paves the way > for a move into a different namespace such as $sys.errnos, should > anybody ever have the time to rewrite the parameter code completely I'd have thought just $errnos would be fine. Especially if it can be in a system namespace in the long term. > - what else we should provide; strerror() would be fairly easy, but > an array would probably have to be generated specially during > configuration, because the internal system array seems to be > non-standard. We can check for _sys_errlist and _sys_nerr first, > perhaps. By during configuration, do you mean by autoconf? When the module is loaded would be better. If it's in an out of the way module that isn't loaded by default, I don't think it matters. That long over due parameter code rewrite will have to allow individual array elements to be generated on demand. Oliver ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________