Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [half-patch][feedback?] exec compatibility

Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
>        - exec [ -c ] [ -a name ] [ arg ... ]
> Bash implements this, and the -l option too.
> I've started implementing the compatibility; I've documented all
> three, implemented -l and -a.  I'd like feedback before continuing:
>  (1) is this worth doing at all, or should I stop?

Yes, it's probably a good thing to have.  If bash is treating exec in
that fashion there's little gain in sticking strictly to the "precommand
modifiers don't have options" rule.

>  (2) to implement -c, is it best to change the interface to execute()?
>      Are there any compability issues with modules if I do that?  I
>      was thinking of changing the second parameter from "dash" to
> "flags" and using the same BINF_ option-space, but with a
> BINF_CLEARENV flag added; just clear the env _after_ checking for
> ARGV0 and it looks valid to me.

Should be fine... I think there's just the one call to execute(),
and in the current set up it could be static.  You could change it
to that just to be sure.

>  (3) am I going about all this the wrong way?

Ideally munging of options should be done by the builtin handler, with
the options defined by the entry in builtins[] in builtin.c.  For normal
builtins that's in execbuiltin().  However, it's not currently
implemented for precommand modifiers.  One reason for that is probably
that usually the word following is to be treated like a command even if
it looks like an option.  Still, it would be neater to have a general
option parser of some sort in this case.  However, it may be overkill
just for this one use.

Send me a Sourceforge user name if you want commit access.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview

Messages sorted by: Reverse Date, Date, Thread, Author