347ed894645fa0df07d0978b19d445b0cd3913b4
[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_VPRINTF_POSIX@
72 # if @REPLACE_VPRINTF@
73 #  define vprintf rpl_vprintf
74 extern int vprintf (const char *format, va_list args);
75 # endif
76 #elif defined GNULIB_POSIXCHECK
77 # undef vprintf
78 # define vprintf(f,a) \
79     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
80                       "use gnulib module vprintf-posix for portable " \
81                       "POSIX compliance"), \
82      vprintf (f, a))
83 #endif
84
85 #if @GNULIB_SNPRINTF@
86 # if @REPLACE_SNPRINTF@
87 #  define snprintf rpl_snprintf
88 # endif
89 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
90 extern int snprintf (char *str, size_t size, const char *format, ...);
91 # endif
92 #elif defined GNULIB_POSIXCHECK
93 # undef snprintf
94 # define snprintf \
95     (GL_LINK_WARNING ("snprintf is unportable - " \
96                       "use gnulib module snprintf for portability"), \
97      snprintf)
98 #endif
99
100 #if @GNULIB_VSNPRINTF@
101 # if @REPLACE_VSNPRINTF@
102 #  define vsnprintf rpl_vsnprintf
103 # endif
104 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
105 extern int vsnprintf (char *str, size_t size, const char *format, va_list args);
106 # endif
107 #elif defined GNULIB_POSIXCHECK
108 # undef vsnprintf
109 # define vsnprintf(b,s,f,a) \
110     (GL_LINK_WARNING ("vsnprintf is unportable - " \
111                       "use gnulib module vsnprintf for portability"), \
112      vsnprintf (b, s, f, a))
113 #endif
114
115 #if @GNULIB_SPRINTF_POSIX@
116 # if @REPLACE_SPRINTF@
117 #  define sprintf rpl_sprintf
118 extern int sprintf (char *str, const char *format, ...);
119 # endif
120 #elif defined GNULIB_POSIXCHECK
121 # undef sprintf
122 # define sprintf \
123     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
124                       "use gnulib module sprintf-posix for portable " \
125                       "POSIX compliance"), \
126      sprintf)
127 #endif
128
129 #if @GNULIB_VSPRINTF_POSIX@
130 # if @REPLACE_VSPRINTF@
131 #  define vsprintf rpl_vsprintf
132 extern int vsprintf (char *str, const char *format, va_list args);
133 # endif
134 #elif defined GNULIB_POSIXCHECK
135 # undef vsprintf
136 # define vsprintf(b,f,a) \
137     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
138                       "use gnulib module vsprintf-posix for portable " \
139                       "POSIX compliance"), \
140      vsprintf (b, f, a))
141 #endif
142
143
144 #ifdef __cplusplus
145 }
146 #endif
147
148 #endif /* _GL_STDIO_H */
149 #endif