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

Re: PATCH: printf builtin



Bart Schaefer wrote:
> 
> On Sep 20,  8:10pm, Oliver Kiddle wrote:
> }
> } Ksh and bash both have a printf builtin. This adds one to zsh.
> 
> Did you also notice that "print -f" in ksh is the same as printf?

Oh dear. I didn't notice that. print was one of the things which David
Korn was keen to have in the standard and without the -f, ksh's print
would be little more than echo. It's also quite a nice feature.

> This raises the question of whether it should be possible to combine
> print -f with all the other print options, which would imply quite a
> different implementation from what's in this patch, and would likely
> preclude it from being a module.

ksh allows -s, -p and -u to be combined with print -f. What you say
about this precluding it from being a module is certainly true. What I
think I'll do is commit this as it is for now. I also think this could
be safely committed to the stable branch so unless anyone says otherwise
I'll do that. My argument for this being that it doesn't touch any
existing functionality and just does something where we didn't do
anything useful before - so it is similar to us allowing new completion
functions to be added to 4.0.

I'll put the ksh print -f functionality on my todo list though. It makes
sense to combine the -b, -m, -s, -o, -O, -i, -u, -p, -z, -D and -P
options with -f. -r, -R, -n, -l, -N and -c would make no sense to
combine. -l and -N would be fairly redundant because it would be better
to use a format of "%s\n" or "%s\0" so they should perhaps then be
declared obsolete. -P (and maybe -D) is also perhaps slightly
unfortunate because a %P format specification might be better.

Oliver


_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp



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