1 /* -*- buffer-read-only: t -*- vi: set ro: */ 2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3 /* A GNU-like <stdio.h>. 4 5 Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 3, or (at your option) 10 any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 20 21 #if __GNUC__ >= 3 22 @PRAGMA_SYSTEM_HEADER@ 23 #endif 24 25 #if defined __need_FILE || defined __need___FILE 26 /* Special invocation convention inside glibc header files. */ 27 28 #@INCLUDE_NEXT@ @NEXT_STDIO_H@ 29 30 #else 31 /* Normal invocation convention. */ 32 33 #ifndef _GL_STDIO_H 34 35 /* The include_next requires a split double-inclusion guard. */ 36 #@INCLUDE_NEXT@ @NEXT_STDIO_H@ 37 38 #ifndef _GL_STDIO_H 39 #define _GL_STDIO_H 40 41 #include <stdarg.h> 42 #include <stddef.h> 43 44 #if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \ 45 || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \ 46 || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \ 47 || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@)) 48 /* Get off_t and ssize_t. */ 49 # include <sys/types.h> 50 #endif 51 52 #ifndef __attribute__ 53 /* This feature is available in gcc versions 2.5 and later. */ 54 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) 55 # define __attribute__(Spec) /* empty */ 56 # endif 57 /* The __-protected variants of `format' and `printf' attributes 58 are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ 59 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) 60 # define __format__ format 61 # define __printf__ printf 62 # endif 63 #endif 64 65 66 /* The definition of GL_LINK_WARNING is copied here. */ 67 68 69 #ifdef __cplusplus 70 extern "C" { 71 #endif 72 73 74 #if @GNULIB_FPRINTF_POSIX@ 75 # if @REPLACE_FPRINTF@ 76 # define fprintf rpl_fprintf 77 extern int fprintf (FILE *fp, const char *format, ...) 78 __attribute__ ((__format__ (__printf__, 2, 3))); 79 # endif 80 #elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 81 # define fprintf rpl_fprintf 82 extern int fprintf (FILE *fp, const char *format, ...) 83 __attribute__ ((__format__ (__printf__, 2, 3))); 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 93 #if @GNULIB_VFPRINTF_POSIX@ 94 # if @REPLACE_VFPRINTF@ 95 # define vfprintf rpl_vfprintf 96 extern int vfprintf (FILE *fp, const char *format, va_list args) 97 __attribute__ ((__format__ (__printf__, 2, 0))); 98 # endif 99 #elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 100 # define vfprintf rpl_vfprintf 101 extern int vfprintf (FILE *fp, const char *format, va_list args) 102 __attribute__ ((__format__ (__printf__, 2, 0))); 103 #elif defined GNULIB_POSIXCHECK 104 # undef vfprintf 105 # define vfprintf(s,f,a) \ 106 (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \ 107 "use gnulib module vfprintf-posix for portable " \ 108 "POSIX compliance"), \ 109 vfprintf (s, f, a)) 110 #endif 111 112 #if @GNULIB_PRINTF_POSIX@ 113 # if @REPLACE_PRINTF@ 114 /* Don't break __attribute__((format(printf,M,N))). */ 115 # define printf __printf__ 116 extern int printf (const char *format, ...) 117 __attribute__ ((__format__ (__printf__, 1, 2))); 118 # endif 119 #elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 120 /* Don't break __attribute__((format(printf,M,N))). */ 121 # define printf __printf__ 122 extern int printf (const char *format, ...) 123 __attribute__ ((__format__ (__printf__, 1, 2))); 124 #elif defined GNULIB_POSIXCHECK 125 # undef printf 126 # define printf \ 127 (GL_LINK_WARNING ("printf is not always POSIX compliant - " \ 128 "use gnulib module printf-posix for portable " \ 129 "POSIX compliance"), \ 130 printf) 131 /* Don't break __attribute__((format(printf,M,N))). */ 132 # define format(kind,m,n) format (__##kind##__, m, n) 133 # define __format__(kind,m,n) __format__ (__##kind##__, m, n) 134 # define ____printf____ __printf__ 135 # define ____scanf____ __scanf__ 136 # define ____strftime____ __strftime__ 137 # define ____strfmon____ __strfmon__ 138 #endif 139 140 #if @GNULIB_VPRINTF_POSIX@ 141 # if @REPLACE_VPRINTF@ 142 # define vprintf rpl_vprintf 143 extern int vprintf (const char *format, va_list args) 144 __attribute__ ((__format__ (__printf__, 1, 0))); 145 # endif 146 #elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 147 # define vprintf rpl_vprintf 148 extern int vprintf (const char *format, va_list args) 149 __attribute__ ((__format__ (__printf__, 1, 0))); 150 #elif defined GNULIB_POSIXCHECK 151 # undef vprintf 152 # define vprintf(f,a) \ 153 (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \ 154 "use gnulib module vprintf-posix for portable " \ 155 "POSIX compliance"), \ 156 vprintf (f, a)) 157 #endif 158 159 #if @GNULIB_SNPRINTF@ 160 # if @REPLACE_SNPRINTF@ 161 # define snprintf rpl_snprintf 162 # endif 163 # if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@ 164 extern int snprintf (char *str, size_t size, const char *format, ...) 165 __attribute__ ((__format__ (__printf__, 3, 4))); 166 # endif 167 #elif defined GNULIB_POSIXCHECK 168 # undef snprintf 169 # define snprintf \ 170 (GL_LINK_WARNING ("snprintf is unportable - " \ 171 "use gnulib module snprintf for portability"), \ 172 snprintf) 173 #endif 174 175 #if @GNULIB_VSNPRINTF@ 176 # if @REPLACE_VSNPRINTF@ 177 # define vsnprintf rpl_vsnprintf 178 # endif 179 # if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@ 180 extern int vsnprintf (char *str, size_t size, const char *format, va_list args) 181 __attribute__ ((__format__ (__printf__, 3, 0))); 182 # endif 183 #elif defined GNULIB_POSIXCHECK 184 # undef vsnprintf 185 # define vsnprintf(b,s,f,a) \ 186 (GL_LINK_WARNING ("vsnprintf is unportable - " \ 187 "use gnulib module vsnprintf for portability"), \ 188 vsnprintf (b, s, f, a)) 189 #endif 190 191 #if @GNULIB_SPRINTF_POSIX@ 192 # if @REPLACE_SPRINTF@ 193 # define sprintf rpl_sprintf 194 extern int sprintf (char *str, const char *format, ...) 195 __attribute__ ((__format__ (__printf__, 2, 3))); 196 # endif 197 #elif defined GNULIB_POSIXCHECK 198 # undef sprintf 199 # define sprintf \ 200 (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \ 201 "use gnulib module sprintf-posix for portable " \ 202 "POSIX compliance"), \ 203 sprintf) 204 #endif 205 206 #if @GNULIB_VSPRINTF_POSIX@ 207 # if @REPLACE_VSPRINTF@ 208 # define vsprintf rpl_vsprintf 209 extern int vsprintf (char *str, const char *format, va_list args) 210 __attribute__ ((__format__ (__printf__, 2, 0))); 211 # endif 212 #elif defined GNULIB_POSIXCHECK 213 # undef vsprintf 214 # define vsprintf(b,f,a) \ 215 (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \ 216 "use gnulib module vsprintf-posix for portable " \ 217 "POSIX compliance"), \ 218 vsprintf (b, f, a)) 219 #endif 220 221 #if @GNULIB_DPRINTF@ 222 # if @REPLACE_DPRINTF@ 223 # define dprintf rpl_dprintf 224 # endif 225 # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@ 226 extern int dprintf (int fd, const char *format, ...) 227 __attribute__ ((__format__ (__printf__, 2, 3))); 228 # endif 229 #elif defined GNULIB_POSIXCHECK 230 # undef dprintf 231 # define dprintf(d,f,a) \ 232 (GL_LINK_WARNING ("dprintf is unportable - " \ 233 "use gnulib module dprintf for portability"), \ 234 dprintf (d, f, a)) 235 #endif 236 237 #if @GNULIB_VDPRINTF@ 238 # if @REPLACE_VDPRINTF@ 239 # define vdprintf rpl_vdprintf 240 # endif 241 # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@ 242 extern int vdprintf (int fd, const char *format, va_list args) 243 __attribute__ ((__format__ (__printf__, 2, 0))); 244 # endif 245 #elif defined GNULIB_POSIXCHECK 246 # undef vdprintf 247 # define vdprintf(d,f,a) \ 248 (GL_LINK_WARNING ("vdprintf is unportable - " \ 249 "use gnulib module vdprintf for portability"), \ 250 vdprintf (d, f, a)) 251 #endif 252 253 #if @GNULIB_VASPRINTF@ 254 # if @REPLACE_VASPRINTF@ 255 # define asprintf rpl_asprintf 256 # define vasprintf rpl_vasprintf 257 # endif 258 # if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ 259 /* Write formatted output to a string dynamically allocated with malloc(). 260 If the memory allocation succeeds, store the address of the string in 261 *RESULT and return the number of resulting bytes, excluding the trailing 262 NUL. Upon memory allocation error, or some other error, return -1. */ 263 extern int asprintf (char **result, const char *format, ...) 264 __attribute__ ((__format__ (__printf__, 2, 3))); 265 extern int vasprintf (char **result, const char *format, va_list args) 266 __attribute__ ((__format__ (__printf__, 2, 0))); 267 # endif 268 #endif 269 270 #if @GNULIB_OBSTACK_PRINTF@ 271 # if @REPLACE_OBSTACK_PRINTF@ 272 # define obstack_printf rpl_osbtack_printf 273 # define obstack_vprintf rpl_obstack_vprintf 274 # endif 275 # if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@ 276 struct obstack; 277 /* Grow an obstack with formatted output. Return the number of 278 bytes added to OBS. No trailing nul byte is added, and the 279 object should be closed with obstack_finish before use. Upon 280 memory allocation error, call obstack_alloc_failed_handler. Upon 281 other error, return -1. */ 282 extern int obstack_printf (struct obstack *obs, const char *format, ...) 283 __attribute__ ((__format__ (__printf__, 2, 3))); 284 extern int obstack_vprintf (struct obstack *obs, const char *format, 285 va_list args) 286 __attribute__ ((__format__ (__printf__, 2, 0))); 287 # endif 288 #endif 289 290 #if @GNULIB_FOPEN@ 291 # if @REPLACE_FOPEN@ 292 # undef fopen 293 # define fopen rpl_fopen 294 extern FILE * fopen (const char *filename, const char *mode); 295 # endif 296 #elif defined GNULIB_POSIXCHECK 297 # undef fopen 298 # define fopen(f,m) \ 299 (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \ 300 "use gnulib module fopen for portability"), \ 301 fopen (f, m)) 302 #endif 303 304 #if @GNULIB_FREOPEN@ 305 # if @REPLACE_FREOPEN@ 306 # undef freopen 307 # define freopen rpl_freopen 308 extern FILE * freopen (const char *filename, const char *mode, FILE *stream); 309 # endif 310 #elif defined GNULIB_POSIXCHECK 311 # undef freopen 312 # define freopen(f,m,s) \ 313 (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \ 314 "use gnulib module freopen for portability"), \ 315 freopen (f, m, s)) 316 #endif 317 318 #if @GNULIB_FSEEKO@ 319 # if @REPLACE_FSEEKO@ 320 /* Provide fseek, fseeko functions that are aware of a preceding 321 fflush(), and which detect pipes. */ 322 # define fseeko rpl_fseeko 323 extern int fseeko (FILE *fp, off_t offset, int whence); 324 # define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) 325 # endif 326 #elif defined GNULIB_POSIXCHECK 327 # undef fseeko 328 # define fseeko(f,o,w) \ 329 (GL_LINK_WARNING ("fseeko is unportable - " \ 330 "use gnulib module fseeko for portability"), \ 331 fseeko (f, o, w)) 332 #endif 333 334 #if @GNULIB_FSEEK@ && @REPLACE_FSEEK@ 335 extern int rpl_fseek (FILE *fp, long offset, int whence); 336 # undef fseek 337 # if defined GNULIB_POSIXCHECK 338 # define fseek(f,o,w) \ 339 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ 340 "on 32-bit platforms - " \ 341 "use fseeko function for handling of large files"), \ 342 rpl_fseek (f, o, w)) 343 # else 344 # define fseek rpl_fseek 345 # endif 346 #elif defined GNULIB_POSIXCHECK 347 # ifndef fseek 348 # define fseek(f,o,w) \ 349 (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ 350 "on 32-bit platforms - " \ 351 "use fseeko function for handling of large files"), \ 352 fseek (f, o, w)) 353 # endif 354 #endif 355 356 #if @GNULIB_FTELLO@ 357 # if @REPLACE_FTELLO@ 358 # define ftello rpl_ftello 359 extern off_t ftello (FILE *fp); 360 # define ftell(fp) ftello (fp) 361 # endif 362 #elif defined GNULIB_POSIXCHECK 363 # undef ftello 364 # define ftello(f) \ 365 (GL_LINK_WARNING ("ftello is unportable - " \ 366 "use gnulib module ftello for portability"), \ 367 ftello (f)) 368 #endif 369 370 #if @GNULIB_FTELL@ && @REPLACE_FTELL@ 371 extern long rpl_ftell (FILE *fp); 372 # undef ftell 373 # if GNULIB_POSIXCHECK 374 # define ftell(f) \ 375 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ 376 "on 32-bit platforms - " \ 377 "use ftello function for handling of large files"), \ 378 rpl_ftell (f)) 379 # else 380 # define ftell rpl_ftell 381 # endif 382 #elif defined GNULIB_POSIXCHECK 383 # ifndef ftell 384 # define ftell(f) \ 385 (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ 386 "on 32-bit platforms - " \ 387 "use ftello function for handling of large files"), \ 388 ftell (f)) 389 # endif 390 #endif 391 392 #if @GNULIB_FFLUSH@ 393 # if @REPLACE_FFLUSH@ 394 # define fflush rpl_fflush 395 /* Flush all pending data on STREAM according to POSIX rules. Both 396 output and seekable input streams are supported. 397 Note! LOSS OF DATA can occur if fflush is applied on an input stream 398 that is _not_seekable_ or on an update stream that is _not_seekable_ 399 and in which the most recent operation was input. Seekability can 400 be tested with lseek(fileno(fp),0,SEEK_CUR). */ 401 extern int fflush (FILE *gl_stream); 402 # endif 403 #elif defined GNULIB_POSIXCHECK 404 # undef fflush 405 # define fflush(f) \ 406 (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ 407 "use gnulib module fflush for portable " \ 408 "POSIX compliance"), \ 409 fflush (f)) 410 #endif 411 412 #if @GNULIB_FPURGE@ 413 # if @REPLACE_FPURGE@ 414 # define fpurge rpl_fpurge 415 # endif 416 # if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@ 417 /* Discard all pending buffered I/O data on STREAM. 418 STREAM must not be wide-character oriented. 419 Return 0 if successful. Upon error, return -1 and set errno. */ 420 extern int fpurge (FILE *gl_stream); 421 # endif 422 #elif defined GNULIB_POSIXCHECK 423 # undef fpurge 424 # define fpurge(f) \ 425 (GL_LINK_WARNING ("fpurge is not always present - " \ 426 "use gnulib module fpurge for portability"), \ 427 fpurge (f)) 428 #endif 429 430 #if @GNULIB_FCLOSE@ 431 # if @REPLACE_FCLOSE@ 432 # define fclose rpl_fclose 433 /* Close STREAM and its underlying file descriptor. */ 434 extern int fclose (FILE *stream); 435 # endif 436 #elif defined GNULIB_POSIXCHECK 437 # undef fclose 438 # define fclose(f) \ 439 (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \ 440 "use gnulib module fclose for portable " \ 441 "POSIX compliance"), \ 442 fclose (f)) 443 #endif 444 445 #if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 446 # undef fputc 447 # define fputc rpl_fputc 448 extern int fputc (int c, FILE *stream); 449 #endif 450 451 #if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 452 # undef putc 453 # define putc rpl_fputc 454 extern int putc (int c, FILE *stream); 455 #endif 456 457 #if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 458 # undef putchar 459 # define putchar rpl_putchar 460 extern int putchar (int c); 461 #endif 462 463 #if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 464 # undef fputs 465 # define fputs rpl_fputs 466 extern int fputs (const char *string, FILE *stream); 467 #endif 468 469 #if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 470 # undef puts 471 # define puts rpl_puts 472 extern int puts (const char *string); 473 #endif 474 475 #if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ 476 # undef fwrite 477 # define fwrite rpl_fwrite 478 extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream); 479 #endif 480 481 #if @GNULIB_GETDELIM@ 482 # if !@HAVE_DECL_GETDELIM@ 483 /* Read input, up to (and including) the next occurrence of DELIMITER, from 484 STREAM, store it in *LINEPTR (and NUL-terminate it). 485 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 486 bytes of space. It is realloc'd as necessary. 487 Return the number of bytes read and stored at *LINEPTR (not including the 488 NUL terminator), or -1 on error or EOF. */ 489 extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter, 490 FILE *stream); 491 # endif 492 #elif defined GNULIB_POSIXCHECK 493 # undef getdelim 494 # define getdelim(l, s, d, f) \ 495 (GL_LINK_WARNING ("getdelim is unportable - " \ 496 "use gnulib module getdelim for portability"), \ 497 getdelim (l, s, d, f)) 498 #endif 499 500 #if @GNULIB_GETLINE@ 501 # if @REPLACE_GETLINE@ 502 # undef getline 503 # define getline rpl_getline 504 # endif 505 # if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@ 506 /* Read a line, up to (and including) the next newline, from STREAM, store it 507 in *LINEPTR (and NUL-terminate it). 508 *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE 509 bytes of space. It is realloc'd as necessary. 510 Return the number of bytes read and stored at *LINEPTR (not including the 511 NUL terminator), or -1 on error or EOF. */ 512 extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); 513 # endif 514 #elif defined GNULIB_POSIXCHECK 515 # undef getline 516 # define getline(l, s, f) \ 517 (GL_LINK_WARNING ("getline is unportable - " \ 518 "use gnulib module getline for portability"), \ 519 getline (l, s, f)) 520 #endif 521 522 #if @GNULIB_PERROR@ 523 # if @REPLACE_PERROR@ 524 # define perror rpl_perror 525 /* Print a message to standard error, describing the value of ERRNO, 526 (if STRING is not NULL and not empty) prefixed with STRING and ": ", 527 and terminated with a newline. */ 528 extern void perror (const char *string); 529 # endif 530 #elif defined GNULIB_POSIXCHECK 531 # undef perror 532 # define perror(s) \ 533 (GL_LINK_WARNING ("perror is not always POSIX compliant - " \ 534 "use gnulib module perror for portability"), \ 535 perror (s)) 536 #endif 537 538 #ifdef __cplusplus 539 } 540 #endif 541 542 #endif /* _GL_STDIO_H */ 543 #endif /* _GL_STDIO_H */ 544 #endif 545