Tizen 2.0 Release
[external/tizen-coreutils.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 #ifndef __attribute__
35 /* This feature is available in gcc versions 2.5 and later.  */
36 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
37 #  define __attribute__(Spec) /* empty */
38 # endif
39 /* The __-protected variants of `format' and `printf' attributes
40    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
41 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
42 #  define __format__ format
43 #  define __printf__ printf
44 # endif
45 #endif
46
47
48 /* The definition of GL_LINK_WARNING is copied here.  */
49
50
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54
55
56 #if @GNULIB_FPRINTF_POSIX@
57 # if @REPLACE_FPRINTF@
58 #  define fprintf rpl_fprintf
59 extern int fprintf (FILE *fp, const char *format, ...)
60        __attribute__ ((__format__ (__printf__, 2, 3)));
61 # endif
62 #elif defined GNULIB_POSIXCHECK
63 # undef fprintf
64 # define fprintf \
65     (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
66                       "use gnulib module fprintf-posix for portable " \
67                       "POSIX compliance"), \
68      fprintf)
69 #endif
70
71 #if @GNULIB_VFPRINTF_POSIX@
72 # if @REPLACE_VFPRINTF@
73 #  define vfprintf rpl_vfprintf
74 extern int vfprintf (FILE *fp, const char *format, va_list args)
75        __attribute__ ((__format__ (__printf__, 2, 0)));
76 # endif
77 #elif defined GNULIB_POSIXCHECK
78 # undef vfprintf
79 # define vfprintf(s,f,a) \
80     (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
81                       "use gnulib module vfprintf-posix for portable " \
82                       "POSIX compliance"), \
83      vfprintf (s, f, a))
84 #endif
85
86 #if @GNULIB_PRINTF_POSIX@
87 # if @REPLACE_PRINTF@
88 /* Don't break __attribute__((format(printf,M,N))).  */
89 #  define printf __printf__
90 extern int printf (const char *format, ...)
91        __attribute__ ((__format__ (__printf__, 1, 2)));
92 # endif
93 #elif defined GNULIB_POSIXCHECK
94 # undef printf
95 # define printf \
96     (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
97                       "use gnulib module printf-posix for portable " \
98                       "POSIX compliance"), \
99      printf)
100 /* Don't break __attribute__((format(printf,M,N))).  */
101 # define format(kind,m,n) format (__##kind##__, m, n)
102 # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
103 # define ____printf____ __printf__
104 # define ____scanf____ __scanf__
105 # define ____strftime____ __strftime__
106 # define ____strfmon____ __strfmon__
107 #endif
108
109 #if @GNULIB_VPRINTF_POSIX@
110 # if @REPLACE_VPRINTF@
111 #  define vprintf rpl_vprintf
112 extern int vprintf (const char *format, va_list args)
113        __attribute__ ((__format__ (__printf__, 1, 0)));
114 # endif
115 #elif defined GNULIB_POSIXCHECK
116 # undef vprintf
117 # define vprintf(f,a) \
118     (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
119                       "use gnulib module vprintf-posix for portable " \
120                       "POSIX compliance"), \
121      vprintf (f, a))
122 #endif
123
124 #if @GNULIB_SNPRINTF@
125 # if @REPLACE_SNPRINTF@
126 #  define snprintf rpl_snprintf
127 # endif
128 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
129 extern int snprintf (char *str, size_t size, const char *format, ...)
130        __attribute__ ((__format__ (__printf__, 3, 4)));
131 # endif
132 #elif defined GNULIB_POSIXCHECK
133 # undef snprintf
134 # define snprintf \
135     (GL_LINK_WARNING ("snprintf is unportable - " \
136                       "use gnulib module snprintf for portability"), \
137      snprintf)
138 #endif
139
140 #if @GNULIB_VSNPRINTF@
141 # if @REPLACE_VSNPRINTF@
142 #  define vsnprintf rpl_vsnprintf
143 # endif
144 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
145 extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
146        __attribute__ ((__format__ (__printf__, 3, 0)));
147 # endif
148 #elif defined GNULIB_POSIXCHECK
149 # undef vsnprintf
150 # define vsnprintf(b,s,f,a) \
151     (GL_LINK_WARNING ("vsnprintf is unportable - " \
152                       "use gnulib module vsnprintf for portability"), \
153      vsnprintf (b, s, f, a))
154 #endif
155
156 #if @GNULIB_SPRINTF_POSIX@
157 # if @REPLACE_SPRINTF@
158 #  define sprintf rpl_sprintf
159 extern int sprintf (char *str, const char *format, ...)
160        __attribute__ ((__format__ (__printf__, 2, 3)));
161 # endif
162 #elif defined GNULIB_POSIXCHECK
163 # undef sprintf
164 # define sprintf \
165     (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
166                       "use gnulib module sprintf-posix for portable " \
167                       "POSIX compliance"), \
168      sprintf)
169 #endif
170
171 #if @GNULIB_VSPRINTF_POSIX@
172 # if @REPLACE_VSPRINTF@
173 #  define vsprintf rpl_vsprintf
174 extern int vsprintf (char *str, const char *format, va_list args)
175        __attribute__ ((__format__ (__printf__, 2, 0)));
176 # endif
177 #elif defined GNULIB_POSIXCHECK
178 # undef vsprintf
179 # define vsprintf(b,f,a) \
180     (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
181                       "use gnulib module vsprintf-posix for portable " \
182                       "POSIX compliance"), \
183      vsprintf (b, f, a))
184 #endif
185
186
187 #ifdef __cplusplus
188 }
189 #endif
190
191 #endif /* _GL_STDIO_H */
192 #endif