Re: [HACKERS] *printf and zero size

2005-12-05 Thread Kurt Roeckx
On Mon, Dec 05, 2005 at 04:35:31PM -0500, Bruce Momjian wrote: > > but it seems this is some BSD'ism that we don't need to support if the > standard doesn't say so. I think the Linux manpage is more informative about this: The functions snprintf and vsnprintf do not write more than

Re: [HACKERS] *printf and zero size

2005-12-05 Thread Tom Lane
Kurt Roeckx <[EMAIL PROTECTED]> writes: > Concerning the return value of snprintf(), the SUSv2 and the C99 stan- > dard contradict each other: Is that where the problem comes from? Anyway, I've added some text to snprintf.c explaining what we do. Since the calling code has to be prepa

Re: [HACKERS] *printf and zero size

2005-12-05 Thread Tom Lane
Bruce Momjian writes: > Upon successful completion snprintf() and vsnprintf() return the number > of characters that would have been written to a sufficiently sized str, > excluding the terminating NUL character. > but it seems this is some BSD'ism that we don't need to support

Re: [HACKERS] *printf and zero size

2005-12-05 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Tom, did you implement this functionality in *printf? > > The size may be given as zero to find out how many characters are > > needed; in this case, the str argument is ignored. Sprintf() and > > vsprintf() effectively assume an infinite siz

Re: [HACKERS] *printf and zero size

2005-12-05 Thread Tom Lane
Bruce Momjian writes: > Tom, did you implement this functionality in *printf? > The size may be given as zero to find out how many characters are > needed; in this case, the str argument is ignored. Sprintf() and > vsprintf() effectively assume an infinite size. Where do you rea

[HACKERS] *printf and zero size

2005-12-05 Thread Bruce Momjian
Tom, did you implement this functionality in *printf? The size may be given as zero to find out how many characters are needed; in this case, the str argument is ignored. Sprintf() and vsprintf() effectively assume an infinite size. Looking at the code it doesn't seem supp