From: Wayne Davison <wayned@users.sourceforge.net>
To: Thorsten Dahlheimer <tdahlheim@gmx.net>
Cc: zsh-workers@sunsite.dk
Subject: Re: PATCH: Slightly improve printf %s
Date: Mon, 8 Aug 2005 16:09:02 -0700 [thread overview]
Message-ID: <20050808230902.GC2986@blorf.net> (raw)
In-Reply-To: <024501c59c46$2ae19dc0$cc74fea9@pcdahl4201>
On Mon, Aug 08, 2005 at 08:21:28PM +0200, Thorsten Dahlheimer wrote:
> After I made this change, the test suite uncovered a bug (which I
> introduced) in the handling of %b (and now %s) when no argument is
> left, so the patch includes a fix for that, too.
I didn't see that fix in the patch. I assume you're talking about
this line (which is executed when the arg is missing):
count += fprintf(fout, "%*c", width, ' ');
... since that would output a single space, even when "width" is 0. I
changed the "else" that is in front of that line to "else if (width)",
and it fixes the problem (I could have also changed the line to use
fprintf(fout, "%*s", width, ""), but the former seems a litle more
optimal).
As for the change to how %s is handled, can you show me an example where
this is needed? In my simple tests, if a variable has a literal null in
it, using either %b or %s to print it out with printf truncates the
variable at the null (and, of course, a backslash-zero can be passed to
%b to get a real null, but %s doesn't evaluate backslashes).
..wayne..
next prev parent reply other threads:[~2005-08-08 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-08 18:21 Thorsten Dahlheimer
2005-08-08 23:09 ` Wayne Davison [this message]
2005-08-09 14:03 ` Thorsten Dahlheimer
2005-08-09 17:31 ` Wayne Davison
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050808230902.GC2986@blorf.net \
--to=wayned@users.sourceforge.net \
--cc=tdahlheim@gmx.net \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).