nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] strncpy(3), die, die, die.

2016-10-24 16:18:49
On Mon, 24 Oct 2016 22:10:46 +0100, Ralph Corderoy wrote:

Yes, asprintf(3) is very handy.  Unfortunately, it's not standardised; C
nor POSIX.  And rolling your own version around vsnprintf(3) can mean
doing the formatting twice;  the first time to get the length.  You've
then a malloc'd pointer to track.  So it's a more of a change than I
want to tackle now.  This is the kind of thing I've been doing.
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=9b3fc4790b2473b23c69c0e70
710e1e66a038f28&context=1

For what it's worth, you are welcome to use the BSD-licensed
asprintf() sudo uses when the host system lacks it.  It is based
on the BSD vfprintf.c so you only need to do the formatting once.
The only caveat is that it doesn't support floating point by default.

I can certainly understand not wanting to make radical changes at
this point.  If you do find in the future that it would be useful,
please let me know.

 - todd

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>