stdio.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* A GNU-like <stdio.h>.
  3. Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software Foundation,
  14. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #if defined __need_FILE || defined __need___FILE
  16. /* Special invocation convention inside glibc header files. */
  17. #include_next <stdio.h>
  18. #else
  19. /* Normal invocation convention. */
  20. #ifndef _GL_STDIO_H
  21. /* The include_next requires a split double-inclusion guard. */
  22. #include_next <stdio.h>
  23. #ifndef _GL_STDIO_H
  24. #define _GL_STDIO_H
  25. #include <stdarg.h>
  26. #include <stddef.h>
  27. #if (0 && 0) \
  28. || (0 && 0) \
  29. || (0 && !1) \
  30. || (0 && (!1 || 0))
  31. /* Get off_t and ssize_t. */
  32. # include <sys/types.h>
  33. #endif
  34. #ifndef __attribute__
  35. /* This feature is available in gcc versions 2.5 and later. */
  36. # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
  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. /* The definition of GL_LINK_WARNING is copied here. */
  47. /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
  48. a linker warning on most glibc systems.
  49. We use a linker warning rather than a preprocessor warning, because
  50. #warning cannot be used inside macros. */
  51. #ifndef GL_LINK_WARNING
  52. /* This works on platforms with GNU ld and ELF object format.
  53. Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
  54. Testing __ELF__ guarantees the ELF object format.
  55. Testing __GNUC__ is necessary for the compound expression syntax. */
  56. # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
  57. # define GL_LINK_WARNING(message) \
  58. GL_LINK_WARNING1 (__FILE__, __LINE__, message)
  59. # define GL_LINK_WARNING1(file, line, message) \
  60. GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
  61. # define GL_LINK_WARNING2(file, line, message) \
  62. GL_LINK_WARNING3 (file ":" #line ": warning: " message)
  63. # define GL_LINK_WARNING3(message) \
  64. ({ static const char warning[sizeof (message)] \
  65. __attribute__ ((__unused__, \
  66. __section__ (".gnu.warning"), \
  67. __aligned__ (1))) \
  68. = message "\n"; \
  69. (void)0; \
  70. })
  71. # else
  72. # define GL_LINK_WARNING(message) ((void) 0)
  73. # endif
  74. #endif
  75. #ifdef __cplusplus
  76. extern "C" {
  77. #endif
  78. #if 0
  79. # if 0
  80. # define fprintf rpl_fprintf
  81. extern int fprintf (FILE *fp, const char *format, ...)
  82. __attribute__ ((__format__ (__printf__, 2, 3)));
  83. # endif
  84. #elif defined GNULIB_POSIXCHECK
  85. # undef fprintf
  86. # define fprintf \
  87. (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
  88. "use gnulib module fprintf-posix for portable " \
  89. "POSIX compliance"), \
  90. fprintf)
  91. #endif
  92. #if 0
  93. # if 0
  94. # define vfprintf rpl_vfprintf
  95. extern int vfprintf (FILE *fp, const char *format, va_list args)
  96. __attribute__ ((__format__ (__printf__, 2, 0)));
  97. # endif
  98. #elif defined GNULIB_POSIXCHECK
  99. # undef vfprintf
  100. # define vfprintf(s,f,a) \
  101. (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
  102. "use gnulib module vfprintf-posix for portable " \
  103. "POSIX compliance"), \
  104. vfprintf (s, f, a))
  105. #endif
  106. #if 0
  107. # if 0
  108. /* Don't break __attribute__((format(printf,M,N))). */
  109. # define printf __printf__
  110. extern int printf (const char *format, ...)
  111. __attribute__ ((__format__ (__printf__, 1, 2)));
  112. # endif
  113. #elif defined GNULIB_POSIXCHECK
  114. # undef printf
  115. # define printf \
  116. (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
  117. "use gnulib module printf-posix for portable " \
  118. "POSIX compliance"), \
  119. printf)
  120. /* Don't break __attribute__((format(printf,M,N))). */
  121. # define format(kind,m,n) format (__##kind##__, m, n)
  122. # define __format__(kind,m,n) __format__ (__##kind##__, m, n)
  123. # define ____printf____ __printf__
  124. # define ____scanf____ __scanf__
  125. # define ____strftime____ __strftime__
  126. # define ____strfmon____ __strfmon__
  127. #endif
  128. #if 0
  129. # if 0
  130. # define vprintf rpl_vprintf
  131. extern int vprintf (const char *format, va_list args)
  132. __attribute__ ((__format__ (__printf__, 1, 0)));
  133. # endif
  134. #elif defined GNULIB_POSIXCHECK
  135. # undef vprintf
  136. # define vprintf(f,a) \
  137. (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
  138. "use gnulib module vprintf-posix for portable " \
  139. "POSIX compliance"), \
  140. vprintf (f, a))
  141. #endif
  142. #if 1
  143. # if 0
  144. # define snprintf rpl_snprintf
  145. # endif
  146. # if 0 || !1
  147. extern int snprintf (char *str, size_t size, const char *format, ...)
  148. __attribute__ ((__format__ (__printf__, 3, 4)));
  149. # endif
  150. #elif defined GNULIB_POSIXCHECK
  151. # undef snprintf
  152. # define snprintf \
  153. (GL_LINK_WARNING ("snprintf is unportable - " \
  154. "use gnulib module snprintf for portability"), \
  155. snprintf)
  156. #endif
  157. #if 1
  158. # if 0
  159. # define vsnprintf rpl_vsnprintf
  160. # endif
  161. # if 0 || !1
  162. extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
  163. __attribute__ ((__format__ (__printf__, 3, 0)));
  164. # endif
  165. #elif defined GNULIB_POSIXCHECK
  166. # undef vsnprintf
  167. # define vsnprintf(b,s,f,a) \
  168. (GL_LINK_WARNING ("vsnprintf is unportable - " \
  169. "use gnulib module vsnprintf for portability"), \
  170. vsnprintf (b, s, f, a))
  171. #endif
  172. #if 0
  173. # if 0
  174. # define sprintf rpl_sprintf
  175. extern int sprintf (char *str, const char *format, ...)
  176. __attribute__ ((__format__ (__printf__, 2, 3)));
  177. # endif
  178. #elif defined GNULIB_POSIXCHECK
  179. # undef sprintf
  180. # define sprintf \
  181. (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
  182. "use gnulib module sprintf-posix for portable " \
  183. "POSIX compliance"), \
  184. sprintf)
  185. #endif
  186. #if 0
  187. # if 0
  188. # define vsprintf rpl_vsprintf
  189. extern int vsprintf (char *str, const char *format, va_list args)
  190. __attribute__ ((__format__ (__printf__, 2, 0)));
  191. # endif
  192. #elif defined GNULIB_POSIXCHECK
  193. # undef vsprintf
  194. # define vsprintf(b,f,a) \
  195. (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
  196. "use gnulib module vsprintf-posix for portable " \
  197. "POSIX compliance"), \
  198. vsprintf (b, f, a))
  199. #endif
  200. #if 1
  201. # if 0
  202. # define asprintf rpl_asprintf
  203. # define vasprintf rpl_vasprintf
  204. # endif
  205. # if 0 || !1
  206. /* Write formatted output to a string dynamically allocated with malloc().
  207. If the memory allocation succeeds, store the address of the string in
  208. *RESULT and return the number of resulting bytes, excluding the trailing
  209. NUL. Upon memory allocation error, or some other error, return -1. */
  210. extern int asprintf (char **result, const char *format, ...)
  211. __attribute__ ((__format__ (__printf__, 2, 3)));
  212. extern int vasprintf (char **result, const char *format, va_list args)
  213. __attribute__ ((__format__ (__printf__, 2, 0)));
  214. # endif
  215. #endif
  216. #if 0
  217. # if 0
  218. # define fopen rpl_fopen
  219. extern FILE * fopen (const char *filename, const char *mode);
  220. # endif
  221. #elif defined GNULIB_POSIXCHECK
  222. # undef fopen
  223. # define fopen(f,m) \
  224. (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
  225. "use gnulib module fopen for portability"), \
  226. fopen (f, m))
  227. #endif
  228. #if 0
  229. # if 0
  230. # define freopen rpl_freopen
  231. extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
  232. # endif
  233. #elif defined GNULIB_POSIXCHECK
  234. # undef freopen
  235. # define freopen(f,m,s) \
  236. (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
  237. "use gnulib module freopen for portability"), \
  238. freopen (f, m, s))
  239. #endif
  240. #if 0
  241. # if 0
  242. /* Provide fseek, fseeko functions that are aware of a preceding
  243. fflush(), and which detect pipes. */
  244. # define fseeko rpl_fseeko
  245. extern int fseeko (FILE *fp, off_t offset, int whence);
  246. # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
  247. # endif
  248. #elif defined GNULIB_POSIXCHECK
  249. # undef fseeko
  250. # define fseeko(f,o,w) \
  251. (GL_LINK_WARNING ("fseeko is unportable - " \
  252. "use gnulib module fseeko for portability"), \
  253. fseeko (f, o, w))
  254. #endif
  255. #if 0 && 0
  256. extern int rpl_fseek (FILE *fp, long offset, int whence);
  257. # undef fseek
  258. # if defined GNULIB_POSIXCHECK
  259. # define fseek(f,o,w) \
  260. (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
  261. "on 32-bit platforms - " \
  262. "use fseeko function for handling of large files"), \
  263. rpl_fseek (f, o, w))
  264. # else
  265. # define fseek rpl_fseek
  266. # endif
  267. #elif defined GNULIB_POSIXCHECK
  268. # ifndef fseek
  269. # define fseek(f,o,w) \
  270. (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
  271. "on 32-bit platforms - " \
  272. "use fseeko function for handling of large files"), \
  273. fseek (f, o, w))
  274. # endif
  275. #endif
  276. #if 0
  277. # if 0
  278. # define ftello rpl_ftello
  279. extern off_t ftello (FILE *fp);
  280. # define ftell(fp) ftello (fp)
  281. # endif
  282. #elif defined GNULIB_POSIXCHECK
  283. # undef ftello
  284. # define ftello(f) \
  285. (GL_LINK_WARNING ("ftello is unportable - " \
  286. "use gnulib module ftello for portability"), \
  287. ftello (f))
  288. #endif
  289. #if 0 && 0
  290. extern long rpl_ftell (FILE *fp);
  291. # undef ftell
  292. # if GNULIB_POSIXCHECK
  293. # define ftell(f) \
  294. (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
  295. "on 32-bit platforms - " \
  296. "use ftello function for handling of large files"), \
  297. rpl_ftell (f))
  298. # else
  299. # define ftell rpl_ftell
  300. # endif
  301. #elif defined GNULIB_POSIXCHECK
  302. # ifndef ftell
  303. # define ftell(f) \
  304. (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
  305. "on 32-bit platforms - " \
  306. "use ftello function for handling of large files"), \
  307. ftell (f))
  308. # endif
  309. #endif
  310. #if 0
  311. # if 0
  312. # define fflush rpl_fflush
  313. /* Flush all pending data on STREAM according to POSIX rules. Both
  314. output and seekable input streams are supported.
  315. Note! LOSS OF DATA can occur if fflush is applied on an input stream
  316. that is _not_seekable_ or on an update stream that is _not_seekable_
  317. and in which the most recent operation was input. Seekability can
  318. be tested with lseek(fileno(fp),0,SEEK_CUR). */
  319. extern int fflush (FILE *gl_stream);
  320. # endif
  321. #elif defined GNULIB_POSIXCHECK
  322. # undef fflush
  323. # define fflush(f) \
  324. (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
  325. "use gnulib module fflush for portable " \
  326. "POSIX compliance"), \
  327. fflush (f))
  328. #endif
  329. #if 0
  330. # if !1
  331. /* Read input, up to (and including) the next occurrence of DELIMITER, from
  332. STREAM, store it in *LINEPTR (and NUL-terminate it).
  333. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  334. bytes of space. It is realloc'd as necessary.
  335. Return the number of bytes read and stored at *LINEPTR (not including the
  336. NUL terminator), or -1 on error or EOF. */
  337. extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
  338. FILE *stream);
  339. # endif
  340. #elif defined GNULIB_POSIXCHECK
  341. # undef getdelim
  342. # define getdelim(l, s, d, f) \
  343. (GL_LINK_WARNING ("getdelim is unportable - " \
  344. "use gnulib module getdelim for portability"), \
  345. getdelim (l, s, d, f))
  346. #endif
  347. #if 0
  348. # if 0
  349. # undef getline
  350. # define getline rpl_getline
  351. # endif
  352. # if !1 || 0
  353. /* Read a line, up to (and including) the next newline, from STREAM, store it
  354. in *LINEPTR (and NUL-terminate it).
  355. *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
  356. bytes of space. It is realloc'd as necessary.
  357. Return the number of bytes read and stored at *LINEPTR (not including the
  358. NUL terminator), or -1 on error or EOF. */
  359. extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
  360. # endif
  361. #elif defined GNULIB_POSIXCHECK
  362. # undef getline
  363. # define getline(l, s, f) \
  364. (GL_LINK_WARNING ("getline is unportable - " \
  365. "use gnulib module getline for portability"), \
  366. getline (l, s, f))
  367. #endif
  368. #ifdef __cplusplus
  369. }
  370. #endif
  371. #endif /* _GL_STDIO_H */
  372. #endif /* _GL_STDIO_H */
  373. #endif