From dfcdce8eec30d61743cefa0edc001a79bc3e29d6 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Wed, 4 Aug 2010 03:43:55 +0200 Subject: arm: add common clkdev Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Andrea GALLO Cc: Gael SALLES Signed-off-by: Sascha Hauer --- lib/vsprintf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/vsprintf.c') diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 91ad613c70..6066845c5b 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -514,6 +514,31 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) } EXPORT_SYMBOL(vsnprintf); +/** + * vscnprintf - Format a string and place it in a buffer + * @buf: The buffer to place the result into + * @size: The size of the buffer, including the trailing null space + * @fmt: The format string to use + * @args: Arguments for the format string + * + * The return value is the number of characters which have been written into + * the @buf not including the trailing '\0'. If @size is <= 0 the function + * returns 0. + * + * Call this function if you are already dealing with a va_list. + * You probably want scnprintf() instead. + * + * See the vsnprintf() documentation for format string extensions over C99. + */ +int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) +{ + int i; + + i=vsnprintf(buf,size,fmt,args); + return (i >= size) ? (size - 1) : i; +} +EXPORT_SYMBOL(vscnprintf); + /** * vsprintf - Format a string and place it in a buffer * @buf: The buffer to place the result into -- cgit v1.2.3