[PATCH 3/5] fprintf() returns an int
Sascha Hauer
s.hauer at pengutronix.de
Fri Oct 14 03:04:14 EDT 2011
On Fri, Oct 14, 2011 at 12:06:39AM +0200, Loïc Minier wrote:
> For consistency, let fprintf return an int just like it's regular libc
> implementation and all the other printf variations barebox has. This
> also fixes a warning on variable i being never read in the function.
>
> Signed-off-by: Loïc Minier <loic.minier at linaro.org>
> ---
> common/console.c | 4 +++-
> include/stdio.h | 2 +-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/common/console.c b/common/console.c
> index 06e9c29..0d2a33b 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -327,7 +327,7 @@ void console_flush(void)
> }
> EXPORT_SYMBOL(console_flush);
>
> -void fprintf (int file, const char *fmt, ...)
> +int fprintf (int file, const char *fmt, ...)
> {
> va_list args;
> uint i;
> @@ -343,6 +343,8 @@ void fprintf (int file, const char *fmt, ...)
>
> /* Print the string */
> fputs (file, printbuffer);
> +
> + return i;
> }
> EXPORT_SYMBOL(fprintf);
fprintf is supposed to return the number of characters printed, that is
the return value of fputs. I know that fputs currently returns a wrong
value, but maybe we can fix this with the following:
More information about the barebox
mailing list