zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: read timeout argument || completion of a function
Date: Mon, 12 Aug 2002 15:12:23 +0000	[thread overview]
Message-ID: <1020812151223.ZM29332@candle.brasslantern.com> (raw)
In-Reply-To: <87n0rsxsqr.fsf@julie.debian-fr.org>
In-Reply-To: <11500.1029152497@csr.com>

On Aug 12, 12:43pm, Bruno Bonfils wrote:
}
} "Bart Schaefer" <schaefer@brasslantern.com> 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<arg>' and other places which only
} accept `-X <arg>'.  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   


  reply	other threads:[~2002-08-12 15:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-11 20:54 Bruno Bonfils
2002-08-12  5:45 ` Bart Schaefer
2002-08-12 10:43   ` Bruno Bonfils
2002-08-12 11:13     ` Oliver Kiddle
2002-08-12 11:41       ` Peter Stephenson
2002-08-12 15:12         ` Bart Schaefer [this message]
2002-08-12 15:21     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1020812151223.ZM29332@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).