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

Re: PATCH Re: 5.3: printf -



Peter Stephenson wrote on Wed, Dec 14, 2016 at 09:39:22 +0000:
> On Tue, 13 Dec 2016 20:48:15 -0800
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > Apparently this was introduced in 37467 when I changed "printf" from
> > having no options at all to having the -v option for print-to-variable.
> > 
> > There's some documentation saying that ideally we would not create any
> > new builtins with BINF_SKIPINVALID but I don't see any other way to get
> > back the old behavior.
> 
> This was in any case ignoring the vagaries of traditional shell
> behaviour, which demand inconsistency.  Supporting printf -v but
> treating a - without a following alphanumeric as part of the string,
> which seem to be the requirements we're faced with, aren't really
> consistent.  So I think anything that works goes here.

The grandparent patch fixes all the cases given so far in this thread,
except that «printf --» and «printf -- -» yield an error and "-",
respectively — whereas in sh mode they should both print "--".

I'd tried to split the printf logic out of bin_print() [lines 4648
through end of function] in order to pave the way for a separate
bin_printf(), but with little success.

Thanks,

Daniel



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