comparison lib/xprintf.h @ 9398:9d8f7facb7a6

Also wrap vf?printf. * lib/xprintf.h (xvprintf, xvfprintf): New declarations. * lib/xprintf.c (xprintf, xfprintf): Work for C89. (xvprintf, xvfprintf): New functions. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 22 Oct 2007 14:09:16 -0600
parents 559ef0e161fe
children c4fa39bf5223
comparison
equal deleted inserted replaced
9397:c61be62e7c72 9398:9d8f7facb7a6
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 16
17 #ifndef _XPRINTF_H 17 #ifndef _XPRINTF_H
18 #define _XPRINTF_H 18 #define _XPRINTF_H
19 19
20 #include <stdarg.h>
20 #include <stdio.h> 21 #include <stdio.h>
21 22
22 #ifndef __attribute__ 23 #ifndef __attribute__
23 /* This feature is available in gcc versions 2.5 and later. */ 24 /* This feature is available in gcc versions 2.5 and later. */
24 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ 25 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
32 # endif 33 # endif
33 #endif 34 #endif
34 35
35 extern int xprintf (char const *restrict format, ...) 36 extern int xprintf (char const *restrict format, ...)
36 __attribute__ ((__format__ (__printf__, 1, 2))); 37 __attribute__ ((__format__ (__printf__, 1, 2)));
38 extern int xvprintf (char const *restrict format, va_list args)
39 __attribute__ ((__format__ (__printf__, 1, 0)));
37 extern int xfprintf (FILE *restrict stream, char const *restrict format, ...) 40 extern int xfprintf (FILE *restrict stream, char const *restrict format, ...)
38 __attribute__ ((__format__ (__printf__, 2, 3))); 41 __attribute__ ((__format__ (__printf__, 2, 3)));
42 extern int xvfprintf (FILE *restrict stream, char const *restrict format,
43 va_list args)
44 __attribute__ ((__format__ (__printf__, 2, 0)));
39 45
40 #endif 46 #endif