From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17778 invoked from network); 12 Aug 2002 15:13:05 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 12 Aug 2002 15:13:05 -0000 Received: (qmail 5102 invoked by alias); 12 Aug 2002 15:12:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17536 Received: (qmail 5088 invoked from network); 12 Aug 2002 15:12:57 -0000 From: "Bart Schaefer" Message-Id: <1020812151223.ZM29332@candle.brasslantern.com> Date: Mon, 12 Aug 2002 15:12:23 +0000 In-Reply-To: <87n0rsxsqr.fsf@julie.debian-fr.org> Comments: In reply to Bruno Bonfils "Re: read timeout argument || completion of a function" (Aug 12, 12:43pm) References: <87znvt15hr.fsf@julie.debian-fr.org> <1020812054520.ZM28574@candle.brasslantern.com> <87n0rsxsqr.fsf@julie.debian-fr.org> <11500.1029152497@csr.com> In-Reply-To: <11500.1029152497@csr.com> Comments: In reply to Peter Stephenson "Re: read timeout argument || completion of a function" (Aug 12, 12:41pm) X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: read timeout argument || completion of a function MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 12, 12:43pm, Bruno Bonfils wrote: } } "Bart Schaefer" writes: } } > There are certain aspects of the arms race in which ksh is currently } > ahead. I suppose when it gets a builtin to launch satellites we'll } > have to start working on moon landers. } } I'm don't sure to understanding you at all. (maybe my sentence is } meaningless ?) I'm making a silly joke that compares features in ksh and zsh to the 1950's space race between the USSR and the USA. On Aug 12, 12:41pm, Peter Stephenson wrote: } } Two issues: } } (1) Getting keyboard polling to work on both UNIX and Cygwin was a } nightmare, so the code is quite complicated. } } (2) We took -t for this (test) and we really need to make -t with a } number work for timeouts for compatibility with everyone else. You } don't normally give a numeric parameter to read (though in fact it works), } so this ought to be possible. However, adding optional numeric } arguments will have to wait for the current horrific handling of option } arguments (dating from year zero and looking like it) to be tidied up. Peter already knows this, but to elaborate: Optional arguments of any sort are a bit messy in the zsh command flag parsing scheme, mainly because it doesn't keep track of the order in which the flags appear. E.g. given "read -t 3 -k 5" the parser rewrites it into the equivalent of "read -kt 3 5" before calling the builtin. So you can trick it into handling one flag with an optional argument, but not two or more such flags at once. } (It's not just horrific internally in some cases: I've a vague memory } there are places which only accept `-X' and other places which only } accept `-X '. It's no surprise that many modules handle option } arguments using their own code.) The vague memory is of the `read' builtin itself, -uN and -k N. BTW, there's this mystifying bit of code in bin_read(): if ((ops['k'] || ops['b']) && *args && idigit(**args)) { What the heck is ops['b'] ? As far as I can tell there's no way for bin_read() to ever get called with a 'b' flag, and the flag is never mentioned anywhere else. This 'b' code appears in my personal CVS repository on 1997/06/27 as part of 3.0.3, but I can't find any corresponding change to hashtable.c (where the `struct builtin' for all builtins were defined at that time). -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net