[Patch] Minor documentation clarification

Jeff Law law@redhat.com
Mon Aug 13 17:08:00 GMT 2012


It's been reported that the documentation for snprintf is a bit unclear 
as to if/when the output string is NULL terminated.

As far as I was able to tell, the output string is always NULL 
terminated unless SIZE is zero.

This patch adds that clarification to the glibc manual.

-------------- next part --------------
2012-08-13  Jeff Law <law@redhat.com>

	* manual/stdio.texi (snprintf): Clarify handling of the trailing
	null byte in the output string.

diff --git a/manual/stdio.texi b/manual/stdio.texi
index c58ca22..605096e 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2342,6 +2342,8 @@ the @var{size} argument specifies the maximum number of characters to
 produce.  The trailing null character is counted towards this limit, so
 you should allocate at least @var{size} characters for the string @var{s}.
 
+The trailing null byte is added to @var{s}, unless @var{size} is zero.
+
 The return value is the number of characters which would be generated
 for the given input, excluding the trailing null.  If this value is
 greater or equal to @var{size}, not all characters from the result have


More information about the Libc-alpha mailing list