diff options
author | Andrew Morton <akpm@osdl.org> | 2004-02-05 16:49:48 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-02-05 16:49:48 -0800 |
commit | dd382b3cdb99e0e4f754557df52d0300912c4c04 (patch) | |
tree | 563d34c1ef1bccbf7d26ebd6cc8ad83ab4ec3e74 /lib | |
parent | fd555edbc8de37f5d267f6afe9c734b6baeb9bc6 (diff) | |
download | history-dd382b3cdb99e0e4f754557df52d0300912c4c04.tar.gz |
[PATCH] snprintf() commentary
From: Paul Jackson <pj@sgi.com>
Explain the snprintf() return value.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vsprintf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index da4398a3a6885d..fdc2f19e241c24 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -234,6 +234,11 @@ static char * number(char * buf, char * end, unsigned long long num, int base, i * @fmt: The format string to use * @args: Arguments for the format string * +* The return value is the number of characters which would be +* generated for the given input, excluding the trailing null, +* as per ISO C99. If the return is greater than or equal to +* @size, the resulting string is truncated. +* * Call this function if you are already dealing with a va_list. * You probably want snprintf instead. */ @@ -482,6 +487,11 @@ EXPORT_SYMBOL(vsnprintf); * @size: The size of the buffer, including the trailing null space * @fmt: The format string to use * @...: Arguments for the format string + * + * The return value is the number of characters which would be + * generated for the given input, excluding the trailing null, + * as per ISO C99. If the return is greater than or equal to + * @size, the resulting string is truncated. */ int snprintf(char * buf, size_t size, const char *fmt, ...) { |