Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: read timeout argument || completion of a function
- X-seq: zsh-workers 17533
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: read timeout argument || completion of a function
- Date: Mon, 12 Aug 2002 12:41:37 +0100
- In-reply-to: "Oliver Kiddle"'s message of "Mon, 12 Aug 2002 12:13:47 BST." <20020812111347.GA5620@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Oliver Kiddle wrote:
> On Mon, Aug 12, 2002 at 12:43:08PM +0200, Bruno Bonfils wrote:
> > > On Aug 11, 10:54pm, Bruno Bonfils wrote:
> > > } i'm very surprised to observe there isn't timeout argument for
> > > } read builtin function.
>
> > So, do you think it's difficult to add this argument to read builtin
> > function ?
>
> That is probably for Peter to say.
Two issues:
(1) Getting keyboard polling to work on both UNIX and Cygwin was a
nightmare, so the code is quite complicated. This makes adding timeouts
in the case where the input is a tty more difficult, though still
entirely feasible. (Even on Solaris I have problems with both select()
and poll() that they won't tell you about lookahead when the tty goes
from canonical to raw mode, so it will have to be done via termio
timeouts in this case, while for non-tty input you are stuck with
select/poll, which probably means bringing in the core of zsh/zselect
and leaving only the builtin itself in the module. In addition, I am
more and more missing a direct interface to system read.)
(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.
(It's not just horrific internally in some cases: I've a vague memory
there are places which only accept `-X<arg>' and other places which only
accept `-X <arg>'. It's no surprise that many modules handle option
arguments using their own code.)
I have been waiting hopefully for other people to attempt these tasks,
but I will obviously be waiting till doomsday. (2) will have to come
first (reverse zsh logic).
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author