From: Bruno Haible <bruno@clisp.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnulib@gnu.org, noloader@gmail.com
Subject: Re: RFC: add a string-desc module
Date: Wed, 29 Mar 2023 00:40:37 +0200 [thread overview]
Message-ID: <5162856.2IRrRt1zHL@nimes> (raw)
In-Reply-To: <18abc687-c310-0ece-ea50-c514d080c282@cs.ucla.edu>
Paul Eggert wrote:
> > I'll add a comment regarding printf with the "%.*s" directive.
>
> That works only if the string lacks NULs
Ouch, indeed.
> and its length fits into int,
> and one must also convert the idx_t length to int (e.g., via a cast
> which I find tricky).
I've now documented that "%.*s" is NOT the solution.
> Although these limitations could be documented, it
> might also be good to have an API like quotearg to generate a quoted or
> quotable string that can be printed with plain %s.
Good point. I've added wrappers around the quotearg functions. Fortunately,
most of the quotearg functions already have a *_mem variant that was designed
precisely for this case.
Bruno
next prev parent reply other threads:[~2023-03-28 22:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 21:50 RFC: add a string-desc module Bruno Haible
2023-03-24 22:32 ` Paul Eggert
2023-03-25 11:39 ` Bruno Haible
2023-03-24 23:20 ` Jeffrey Walton
2023-03-25 6:25 ` Vivien Kraus
2023-03-25 11:49 ` Bruno Haible
2023-03-25 15:51 ` Paul Eggert
2023-03-28 22:40 ` Bruno Haible [this message]
2023-03-25 6:21 ` Vivien Kraus
2023-03-25 11:56 ` Bruno Haible
2023-03-27 10:15 ` Simon Josefsson via Gnulib discussion list
2023-03-28 22:49 ` Bruno Haible
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5162856.2IRrRt1zHL@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=noloader@gmail.com \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).