18d422a11dc33d1287185b23306178c4f38920ea
[gnulib.git] / lib / stdio_.h
1 /* A GNU-like <stdio.h>.
2
3    Copyright (C) 2004, 2007 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 #if defined __need_FILE || defined __need___FILE
20 /* Special invocation convention inside glibc header files.  */
21
22 #include @ABSOLUTE_STDIO_H@
23
24 #else
25 /* Normal invocation convention.  */
26 #ifndef _GL_STDIO_H
27 #define _GL_STDIO_H
28
29 #include @ABSOLUTE_STDIO_H@
30
31 #include <stdarg.h>
32 #include <stddef.h>
33
34
35 /* The definition of GL_LINK_WARNING is copied here.  */
36
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42
43 #if @GNULIB_FPRINTF_POSIX@
44 # if @REPLACE_FPRINTF@
45 #  define fprintf rpl_fprintf
46 extern int fprintf (FILE *fp, const char *format, ...);
47 # endif
48 #elif defined GNULIB_POSIXCHECK
49 # undef fprintf
50 # define fprintf \
51     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
52                       "use gnulib module fprintf-posix for portable " \
53                       "POSIX compliance"), \
54      fprintf)
55 #endif
56
57 #if @GNULIB_VFPRINTF_POSIX@
58 # if @REPLACE_VFPRINTF@
59 #  define vfprintf rpl_vfprintf
60 extern int vfprintf (FILE *fp, const char *format, va_list args);
61 # endif
62 #elif defined GNULIB_POSIXCHECK
63 # undef vfprintf
64 # define vfprintf(s,f,a) \
65     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
66                       "use gnulib module vfprintf-posix for portable " \
67                       "POSIX compliance"), \
68      vfprintf (s, f, a))
69 #endif
70
71 #if @GNULIB_PRINTF_POSIX@
72 # if @REPLACE_PRINTF@
73 /* Don't break __attribute__((format(printf,M,N))).  */
74 #  define printf __printf__
75 extern int printf (const char *format, ...);
76 # endif
77 #elif defined GNULIB_POSIXCHECK
78 # undef printf
79 # define printf \
80     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
81                       "use gnulib module printf-posix for portable " \
82                       "POSIX compliance"), \
83      printf)
84 /* Don't break __attribute__((format(printf,M,N))).  */
85 # define format(kind,m,n) format (__##kind##__, m, n)
86 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
87 # define ____printf____ __printf__
88 # define ____scanf____ __scanf__
89 #endif
90
91 #if @GNULIB_VPRINTF_POSIX@
92 # if @REPLACE_VPRINTF@
93 #  define vprintf rpl_vprintf
94 extern int vprintf (const char *format, va_list args);
95 # endif
96 #elif defined GNULIB_POSIXCHECK
97 # undef vprintf
98 # define vprintf(f,a) \
99     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
100                       "use gnulib module vprintf-posix for portable " \
101                       "POSIX compliance"), \
102      vprintf (f, a))
103 #endif
104
105 #if @GNULIB_SNPRINTF@
106 # if @REPLACE_SNPRINTF@
107 #  define snprintf rpl_snprintf
108 # endif
109 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
110 extern int snprintf (char *str, size_t size, const char *format, ...);
111 # endif
112 #elif defined GNULIB_POSIXCHECK
113 # undef snprintf
114 # define snprintf \
115     (GL_LINK_WARNING ("snprintf is unportable - " \
116                       "use gnulib module snprintf for portability"), \
117      snprintf)
118 #endif
119
120 #if @GNULIB_VSNPRINTF@
121 # if @REPLACE_VSNPRINTF@
122 #  define vsnprintf rpl_vsnprintf
123 # endif
124 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
125 extern int vsnprintf (char *str, size_t size, const char *format, va_list args);
126 # endif
127 #elif defined GNULIB_POSIXCHECK
128 # undef vsnprintf
129 # define vsnprintf(b,s,f,a) \
130     (GL_LINK_WARNING ("vsnprintf is unportable - " \
131                       "use gnulib module vsnprintf for portability"), \
132      vsnprintf (b, s, f, a))
133 #endif
134
135 #if @GNULIB_SPRINTF_POSIX@
136 # if @REPLACE_SPRINTF@
137 #  define sprintf rpl_sprintf
138 extern int sprintf (char *str, const char *format, ...);
139 # endif
140 #elif defined GNULIB_POSIXCHECK
141 # undef sprintf
142 # define sprintf \
143     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
144                       "use gnulib module sprintf-posix for portable " \
145                       "POSIX compliance"), \
146      sprintf)
147 #endif
148
149 #if @GNULIB_VSPRINTF_POSIX@
150 # if @REPLACE_VSPRINTF@
151 #  define vsprintf rpl_vsprintf
152 extern int vsprintf (char *str, const char *format, va_list args);
153 # endif
154 #elif defined GNULIB_POSIXCHECK
155 # undef vsprintf
156 # define vsprintf(b,f,a) \
157     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
158                       "use gnulib module vsprintf-posix for portable " \
159                       "POSIX compliance"), \
160      vsprintf (b, f, a))
161 #endif
162
163
164 #ifdef __cplusplus
165 }
166 #endif
167
168 #endif /* _GL_STDIO_H */
169 #endif