From: Paul Jackson Explain the snprintf() return value. --- lib/vsprintf.c | 10 ++++++++++ 1 files changed, 10 insertions(+) diff -puN lib/vsprintf.c~snprintf-commentary lib/vsprintf.c --- 25/lib/vsprintf.c~snprintf-commentary 2004-02-04 00:31:58.000000000 -0800 +++ 25-akpm/lib/vsprintf.c 2004-02-04 00:31:58.000000000 -0800 @@ -234,6 +234,11 @@ static char * number(char * buf, char * * @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, ...) { _