Zsh Mailing List Archive
Messages sorted by:
Re: posixism and unrelated spellcheck editing
- X-seq: zsh-workers 8861
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: posixism and unrelated spellcheck editing
- Date: Thu, 2 Dec 1999 18:16:50 +0000
- In-reply-to: <19991130182221.A474@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19991130182221.A474@xxxxxxxx>
On Nov 30, 6:22pm, Clint Adams wrote:
} Subject: posixism and unrelated spellcheck editing
} The first is POSIX options to the "command" builtin, basically
} overloading it with a modified "whence" under EMULATE_SH or
} perhaps when POSIX_BUILTINS is set and not otherwise.
I don't think there's any way to "overload" in this way. Precommand
modifiers are handled significantly differently; you can have either
the zsh behavior or the POSIX behavior, but not both.
} It would be easier to differentiate the two meanings into
} BINF_COMMAND and something else while parsing, but that doesn't
} seem possible without some special handling.
No, I don't recommend messing with this.
} So should BINF_COMMAND check to see if it's followed by
} '-p', '-V', or '-v' and then modify its own cflags?
No, definitely not. That would require hacking up exec.c, which is the
wrong place to be dealing with this.
I suggest that you handle this by creating a "posix_command" module 
which, when zmodload'd, removes the "command" precommand modifier and
replaces it with its own "command" builtin. (I think that's possible;
if it isn't I don't know why it shouldn't be.)
If you want to have the builtin from this module attempt to emulate the
zsh behavior in the case where none of '-p', '-V', or '-v' is set, it's
a bit harder. I already struggled with this in eval_autoload() and came
up with a brute-force solution that won't work in the "command" case.
What's needed is a utility function to convert an argv directly into a
LinkNode list that could be stuffed into the `args' field of a Cmd.
 Maybe there's even reason enough to create a "posix" module that
does all sorts of posix-shell-compliant stuff.
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: