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

Re: a way to get the value of the -c option



On Thu, 3 Dec 2015 14:23:55 +0000
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> I'm wondering about that "restricted", too (defined just below).  It's
> only there as a flag between option parsing and init_misc() where the
> option is actually set.  This raises the question of what should we do
> when when parseopts is called from emulate and any "restricted" setting
> currently disappears into the ether.  That can't be right, can it?  Do
> we honour it, or we do we print an error?

Ah, wait, it's deliberate --- the test for !nam after the test for
restricted means it doesn't get passed on, and instead we drop through
to normal option setting, which already handles attempts to change this.
It's just a bit obscure.

I might turn the static into an argument, pass a pointer here, and test
for the pointer, rather than !nam, and then I might know what's going
on...

		} else if (optno == RESTRICTED && !nam) {
		    restricted = action;
...
		} else {
		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
			WARN_OPTION("can't change option: %s", *argv);

pws



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