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

Re: Printf builtin missing v flag support



On Jan 1, 11:12pm, Sebastian Gniazdowski wrote:
} Subject: Re: Printf builtin missing v flag support
}
} On 1 January 2016 at 22:52, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} >
} > To make it work with -x, -X, -C, etc. would require moving the memstream
} > code to the top of the function, plus some related fiddling around later.
} 
} Could you implement that? The move of memstream code seems like a
} cleanup, print would have full control of whether do memstream or not.

I looked at it, but it's more messy than I thought, because the printf
branch keeps a running count of the number of bytes printed, which is
then needed for handling the result.  No sub-part of the print branch
maintains that byte count, so a lot of fiddly little changes are needed.

Also the print branch does some extra work to detect write errors on
redirection -- which it looks like might actually be buggy in the
-z/-s case when HAVE_OPEN_MEMSTREAM is not defined, and which have to
be rewritten for the -v case -- so this is not going to happen quickly.



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