X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fxprintf.c;h=edb97ebf1272936f8a40b22c3655b96b83999492;hb=1d71dc7c690b5fe61e3e0c06303ffb59434bba4b;hp=7738cc4ee38a70ce36806bc92a9707cf8efd03a6;hpb=7c0971900b114a82fc362b5178ec9a4a2865dbbf;p=gnulib.git diff --git a/lib/xprintf.c b/lib/xprintf.c index 7738cc4ee..edb97ebf1 100644 --- a/lib/xprintf.c +++ b/lib/xprintf.c @@ -1,5 +1,5 @@ /* printf wrappers that fail immediately for non-file-related errors - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,54 +26,54 @@ /* written by Jim Meyering */ -/* Just like printf, but call error if it fails without setting - the error indicator. */ +/* Just like printf, but call error if it fails without setting the + stream's error indicator. */ int xprintf (char const *restrict format, ...) { va_list args; - int err; + int retval; va_start (args, format); - err = xvprintf (format, args); + retval = xvprintf (format, args); va_end (args); - return err; + return retval; } -/* Just like vprintf, but call error if it fails without setting - the error indicator. */ +/* Just like vprintf, but call error if it fails without setting the + stream's error indicator. */ int xvprintf (char const *restrict format, va_list args) { - int err = vprintf (format, args); - if (err < 0 && ! ferror (stdout)) + int retval = vprintf (format, args); + if (retval < 0 && ! ferror (stdout)) error (exit_failure, errno, gettext ("cannot perform formatted output")); - return err; + return retval; } -/* Just like fprintf, but call error if it fails without setting - the error indicator. */ +/* Just like fprintf, but call error if it fails without setting the + stream's error indicator. */ int xfprintf (FILE *restrict stream, char const *restrict format, ...) { va_list args; - int err; + int retval; va_start (args, format); - err = xvfprintf (stream, format, args); + retval = xvfprintf (stream, format, args); va_end (args); - return err; + return retval; } -/* Just like vfprintf, but call error if it fails without setting - the error indicator. */ +/* Just like vfprintf, but call error if it fails without setting the + stream's error indicator. */ int xvfprintf (FILE *restrict stream, char const *restrict format, va_list args) { - int err = vfprintf (stream, format, args); - if (err < 0 && ! ferror (stream)) + int retval = vfprintf (stream, format, args); + if (retval < 0 && ! ferror (stream)) error (exit_failure, errno, gettext ("cannot perform formatted output")); - return err; + return retval; }