Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH misc. cleanup in bin_print()
Bart Schaefer wrote on Mon, Jan 04, 2016 at 22:47:49 -0800:
> Is there any objection to making some of these incompatible combinations
> of print options into errors, instead of either implicit precedences or
> bugs waiting to happen? The one I left commented out has an explicit
> Test/B03* check so I'm guessing maybe there's a reason for it.
>
+1 (concept): I think invalid flag combinations should result in
errors, but I haven't reviewed the patch in detail.
> +++ b/Src/builtin.c
> @@ -4036,10 +4036,46 @@ bin_print(char *name, char **args, Options ops, int func)
> zulong zulongval;
> char *stringval;
>
> - if (OPT_ISSET(ops, 'z') + OPT_ISSET(ops, 's') + OPT_ISSET(ops, 'v') > 1) {
> - zwarnnam(name, "only one of -z, -s, or -v allowed");
Should -p be in this set too?
> + /* Error check option combinations and option arguments */
> +
> + if (OPT_ISSET(ops, 'z') +
> + OPT_ISSET(ops, 's') + OPT_ISSET(ops, 'S') +
> + OPT_ISSET(ops, 'v') > 1) {
> + zwarnnam(name, "only one of -s, -S, -v, or -z allowed");
> + return 1;
> + }
In retrospect it might've been better to have a single '-x foo' output
that could be '-x zle_buffer_stack', '-x parameter=foo' (sets $foo), '-x
history', etc.. (Or, come to think of it, all these should have been
exposed as things that can be |ed or >ed to, so that other things beside
'print' could write to them.) But that train has left the station :-(
Messages sorted by:
Reverse Date,
Date,
Thread,
Author