Commit 796190dd authored by Eric Blake's avatar Eric Blake

Tweak x*printf documentation.

* lib/xprintf.c (xprintf, xvprintf, xfprintf, xvfprintf): Adjust
variable name and comments.
Suggested by Bruno Haible.
Signed-off-by: default avatarEric Blake <ebb9@byu.net>
parent 681a475b
2007-10-22 Eric Blake <ebb9@byu.net>
Tweak x*printf documentation.
* lib/xprintf.c (xprintf, xvprintf, xfprintf, xvfprintf): Adjust
variable name and comments.
Suggested by Bruno Haible.
2007-10-22 Bruno Haible <bruno@clisp.org> 2007-10-22 Bruno Haible <bruno@clisp.org>
* lib/acl.c (copy_acl): Fix file name in comment. * lib/acl.c (copy_acl): Fix file name in comment.
...@@ -26,54 +26,54 @@ ...@@ -26,54 +26,54 @@
/* written by Jim Meyering */ /* written by Jim Meyering */
/* Just like printf, but call error if it fails without setting /* Just like printf, but call error if it fails without setting the
the error indicator. */ stream's error indicator. */
int int
xprintf (char const *restrict format, ...) xprintf (char const *restrict format, ...)
{ {
va_list args; va_list args;
int err; int retval;
va_start (args, format); va_start (args, format);
err = xvprintf (format, args); retval = xvprintf (format, args);
va_end (args); va_end (args);
return err; return retval;
} }
/* Just like vprintf, but call error if it fails without setting /* Just like vprintf, but call error if it fails without setting the
the error indicator. */ stream's error indicator. */
int int
xvprintf (char const *restrict format, va_list args) xvprintf (char const *restrict format, va_list args)
{ {
int err = vprintf (format, args); int retval = vprintf (format, args);
if (err < 0 && ! ferror (stdout)) if (retval < 0 && ! ferror (stdout))
error (exit_failure, errno, gettext ("cannot perform formatted output")); error (exit_failure, errno, gettext ("cannot perform formatted output"));
return err; return retval;
} }
/* Just like fprintf, but call error if it fails without setting /* Just like fprintf, but call error if it fails without setting the
the error indicator. */ stream's error indicator. */
int int
xfprintf (FILE *restrict stream, char const *restrict format, ...) xfprintf (FILE *restrict stream, char const *restrict format, ...)
{ {
va_list args; va_list args;
int err; int retval;
va_start (args, format); va_start (args, format);
err = xvfprintf (stream, format, args); retval = xvfprintf (stream, format, args);
va_end (args); va_end (args);
return err; return retval;
} }
/* Just like vfprintf, but call error if it fails without setting /* Just like vfprintf, but call error if it fails without setting the
the error indicator. */ stream's error indicator. */
int int
xvfprintf (FILE *restrict stream, char const *restrict format, va_list args) xvfprintf (FILE *restrict stream, char const *restrict format, va_list args)
{ {
int err = vfprintf (stream, format, args); int retval = vfprintf (stream, format, args);
if (err < 0 && ! ferror (stream)) if (retval < 0 && ! ferror (stream))
error (exit_failure, errno, gettext ("cannot perform formatted output")); error (exit_failure, errno, gettext ("cannot perform formatted output"));
return err; return retval;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment