diff options
author | imp <imp@FreeBSD.org> | 2001-06-05 23:39:45 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2001-06-05 23:39:45 +0000 |
commit | a54c77f56c1a66e1d5e062eb8a751e9e1580f95c (patch) | |
tree | 495908f55a5b9c1c4ce5ce62fe0e00ee27c973d6 /lib/libc | |
parent | 5b01407669b9d70f31dff2859916d53990b286ba (diff) | |
download | FreeBSD-src-a54c77f56c1a66e1d5e062eb8a751e9e1580f95c.zip FreeBSD-src-a54c77f56c1a66e1d5e062eb8a751e9e1580f95c.tar.gz |
Back out my changes describing how snprintf nul terminates. It
was from the iso standard. Keep the sentence that says it is always
NUL terminated to make sure that people understand that.
Requested by: bde
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/printf.3 | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3 index ead6fae..362c4cb 100644 --- a/lib/libc/stdio/printf.3 +++ b/lib/libc/stdio/printf.3 @@ -150,15 +150,17 @@ to be a NULL pointer. .Fn Snprintf and .Fn vsnprintf -return the number of characters -that would have been written had -.Fa size -been sufficiently large, not counting the terminating -.Ql \e0 -character, or a negative value if an encoding error occurred. -Thus, the null-terminated output has been completely written if and only if -the returned value is nonnegative and less than -.Fa size . +will write at most +.Fa size Ns \-1 +of the characters printed into the output string +(the +.Fa size Ns 'th +character then gets the terminating +.Ql \e0 ) ; +if the return value is greater than or equal to the +.Fa size +argument, the string was too short +and some of the printed characters were discarded. The output is always null-terminated. .Pp .Fn Sprintf |