X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=lib%2Fstdio.in.h;h=4cd3ce136d4eaa3b05e509ef458bc10bcccc3487;hp=434fa8e7793a25de8879982c5b458cbc5704e886;hb=cb555a94fa5188122569ed3803c463f27ccd0261;hpb=2e2ac6ad2fc90eaf46ae5fee0bc4f61dd97b4284 diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 434fa8e7..4cd3ce13 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + #if defined __need_FILE || defined __need___FILE /* Special invocation convention inside glibc header files. */ @@ -71,6 +75,10 @@ extern "C" { extern int fprintf (FILE *fp, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); # endif +#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# define fprintf rpl_fprintf +extern int fprintf (FILE *fp, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); #elif defined GNULIB_POSIXCHECK # undef fprintf # define fprintf \ @@ -86,6 +94,10 @@ extern int fprintf (FILE *fp, const char *format, ...) extern int vfprintf (FILE *fp, const char *format, va_list args) __attribute__ ((__format__ (__printf__, 2, 0))); # endif +#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# define vfprintf rpl_vfprintf +extern int vfprintf (FILE *fp, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); #elif defined GNULIB_POSIXCHECK # undef vfprintf # define vfprintf(s,f,a) \ @@ -102,6 +114,11 @@ extern int vfprintf (FILE *fp, const char *format, va_list args) extern int printf (const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2))); # endif +#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +/* Don't break __attribute__((format(printf,M,N))). */ +# define printf __printf__ +extern int printf (const char *format, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); #elif defined GNULIB_POSIXCHECK # undef printf # define printf \ @@ -124,6 +141,10 @@ extern int printf (const char *format, ...) extern int vprintf (const char *format, va_list args) __attribute__ ((__format__ (__printf__, 1, 0))); # endif +#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# define vprintf rpl_vprintf +extern int vprintf (const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 1, 0))); #elif defined GNULIB_POSIXCHECK # undef vprintf # define vprintf(f,a) \ @@ -195,6 +216,38 @@ extern int vsprintf (char *str, const char *format, va_list args) vsprintf (b, f, a)) #endif +#if @GNULIB_DPRINTF@ +# if @REPLACE_DPRINTF@ +# define dprintf rpl_dprintf +# endif +# if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@ +extern int dprintf (int fd, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef dprintf +# define dprintf(d,f,a) \ + (GL_LINK_WARNING ("dprintf is unportable - " \ + "use gnulib module dprintf for portability"), \ + dprintf (d, f, a)) +#endif + +#if @GNULIB_VDPRINTF@ +# if @REPLACE_VDPRINTF@ +# define vdprintf rpl_vdprintf +# endif +# if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@ +extern int vdprintf (int fd, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vdprintf +# define vdprintf(d,f,a) \ + (GL_LINK_WARNING ("vdprintf is unportable - " \ + "use gnulib module vdprintf for portability"), \ + vdprintf (d, f, a)) +#endif + #if @GNULIB_VASPRINTF@ # if @REPLACE_VASPRINTF@ # define asprintf rpl_asprintf @@ -212,8 +265,29 @@ extern int vsprintf (char *str, const char *format, va_list args) # endif #endif +#if @GNULIB_OBSTACK_PRINTF@ +# if @REPLACE_OBSTACK_PRINTF@ +# define obstack_printf rpl_osbtack_printf +# define obstack_vprintf rpl_obstack_vprintf +# endif +# if @REPLACE_OBSTACK_PRINTF@ || !@HAVE_DECL_OBSTACK_PRINTF@ + struct obstack; + /* Grow an obstack with formatted output. Return the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. Upon + memory allocation error, call obstack_alloc_failed_handler. Upon + other error, return -1. */ + extern int obstack_printf (struct obstack *obs, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int obstack_vprintf (struct obstack *obs, const char *format, + va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + #if @GNULIB_FOPEN@ # if @REPLACE_FOPEN@ +# undef fopen # define fopen rpl_fopen extern FILE * fopen (const char *filename, const char *mode); # endif @@ -227,6 +301,7 @@ extern FILE * fopen (const char *filename, const char *mode); #if @GNULIB_FREOPEN@ # if @REPLACE_FREOPEN@ +# undef freopen # define freopen rpl_freopen extern FILE * freopen (const char *filename, const char *mode, FILE *stream); # endif @@ -332,6 +407,92 @@ extern long rpl_ftell (FILE *fp); fflush (f)) #endif +#if @GNULIB_FPURGE@ +# if @REPLACE_FPURGE@ +# define fpurge rpl_fpurge +# endif +# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@ + /* Discard all pending buffered I/O data on STREAM. + STREAM must not be wide-character oriented. + When discarding pending output, the file position is set back to where it + was before the write calls. When discarding pending input, the file + position is advanced to match the end of the previously read input. + Return 0 if successful. Upon error, return -1 and set errno. */ + extern int fpurge (FILE *gl_stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fpurge +# define fpurge(f) \ + (GL_LINK_WARNING ("fpurge is not always present - " \ + "use gnulib module fpurge for portability"), \ + fpurge (f)) +#endif + +#if @GNULIB_FCLOSE@ +# if @REPLACE_FCLOSE@ +# define fclose rpl_fclose + /* Close STREAM and its underlying file descriptor. */ +extern int fclose (FILE *stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fclose +# define fclose(f) \ + (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \ + "use gnulib module fclose for portable " \ + "POSIX compliance"), \ + fclose (f)) +#endif + +#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef fputc +# define fputc rpl_fputc +extern int fputc (int c, FILE *stream); +#endif + +#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef putc +# define putc rpl_fputc +extern int putc (int c, FILE *stream); +#endif + +#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef putchar +# define putchar rpl_putchar +extern int putchar (int c); +#endif + +#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef fputs +# define fputs rpl_fputs +extern int fputs (const char *string, FILE *stream); +#endif + +#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef puts +# define puts rpl_puts +extern int puts (const char *string); +#endif + +#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@ +# undef fwrite +# define fwrite rpl_fwrite +extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream); +#endif + +#if @GNULIB_POPEN@ +# if @REPLACE_POPEN@ +# undef popen +# define popen rpl_popen +extern FILE *popen (const char *cmd, const char *mode); +# endif +#elif defined GNULIB_POSIXCHECK +# undef popen +# define popen(c,m) \ + (GL_LINK_WARNING ("popen is buggy on some platforms - " \ + "use gnulib module popen or pipe for more portability"), \ + popen (c, m)) +#endif + #if @GNULIB_GETDELIM@ # if !@HAVE_DECL_GETDELIM@ /* Read input, up to (and including) the next occurrence of DELIMITER, from @@ -373,6 +534,22 @@ extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream); getline (l, s, f)) #endif +#if @GNULIB_PERROR@ +# if @REPLACE_PERROR@ +# define perror rpl_perror +/* Print a message to standard error, describing the value of ERRNO, + (if STRING is not NULL and not empty) prefixed with STRING and ": ", + and terminated with a newline. */ +extern void perror (const char *string); +# endif +#elif defined GNULIB_POSIXCHECK +# undef perror +# define perror(s) \ + (GL_LINK_WARNING ("perror is not always POSIX compliant - " \ + "use gnulib module perror for portability"), \ + perror (s)) +#endif + #ifdef __cplusplus } #endif