X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstdio_.h;h=66311be852ad6c2cde8321b87d873958158e465b;hb=6c9fb07ea3ac9139eac342691335bd13aa822eb4;hp=441c0d5cdffcca648a95dc7d110e54785910eb37;hpb=6d21a8b599a6fe02592f8a862767e1b73f8d31dc;p=gnulib.git diff --git a/lib/stdio_.h b/lib/stdio_.h index 441c0d5cd..66311be85 100644 --- a/lib/stdio_.h +++ b/lib/stdio_.h @@ -23,14 +23,26 @@ #else /* Normal invocation convention. */ + +#if defined __DECC && __DECC_VER >= 60000000 +# include_next +#endif + #ifndef _GL_STDIO_H #define _GL_STDIO_H -#include @ABSOLUTE_STDIO_H@ +#if !(defined __DECC && __DECC_VER >= 60000000) +# include @ABSOLUTE_STDIO_H@ +#endif #include #include +#if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) || (@GNULIB_FSEEKO@ && !@HAVE_FSEEKO@) || (@GNULIB_FTELLO@ && !@HAVE_FTELLO@) +/* Get off_t. */ +# include +#endif + #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ @@ -183,6 +195,91 @@ extern int vsprintf (char *str, const char *format, va_list args) vsprintf (b, f, a)) #endif +#if @GNULIB_VASPRINTF@ +# if @REPLACE_VASPRINTF@ +# define asprintf rpl_asprintf +# define vasprintf rpl_vasprintf +# endif +# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@ + /* Write formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, store the address of the string in + *RESULT and return the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, return -1. */ + extern int asprintf (char **result, const char *format, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); + extern int vasprintf (char **result, const char *format, va_list args) + __attribute__ ((__format__ (__printf__, 2, 0))); +# endif +#endif + +#if @GNULIB_FFLUSH@ && @REPLACE_FFLUSH@ +/* Provide fseek, fseeko functions that are aware of a preceding fflush(). */ +# define fseeko rpl_fseeko +extern int fseeko (FILE *fp, off_t offset, int whence); +# define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence) +#elif @GNULIB_FSEEKO@ +# if !@HAVE_FSEEKO@ +/* Assume 'off_t' is the same type as 'long'. */ +typedef int verify_fseeko_types[2 * (sizeof (off_t) == sizeof (long)) - 1]; +# define fseeko fseek +# endif +#else +# undef fseeko +# define fseeko(f,o,w) \ + (GL_LINK_WARNING ("fseeko is unportable - " \ + "use gnulib module fseeko for portability"), \ + fseeko (f, o, w)) +#endif + +#if defined GNULIB_POSIXCHECK +# ifndef fseek +# define fseek(f,o,w) \ + (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use fseeko function for handling of large files"), \ + fseek (f, o, w)) +# endif +#endif + +#if @GNULIB_FTELLO@ +# if !@HAVE_FTELLO@ +/* Assume 'off_t' is the same type as 'long'. */ +typedef int verify_ftello_types[2 * (sizeof (off_t) == sizeof (long)) - 1]; +# define ftello ftell +# endif +#else +# undef ftello +# define ftello(f) \ + (GL_LINK_WARNING ("ftello is unportable - " \ + "use gnulib module ftello for portability"), \ + ftello (f)) +#endif + +#if defined GNULIB_POSIXCHECK +# ifndef ftell +# define ftell(f) \ + (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \ + "on 32-bit platforms - " \ + "use ftello function for handling of large files"), \ + ftell (f)) +# endif +#endif + +#if @GNULIB_FFLUSH@ +# if @REPLACE_FFLUSH@ +# define fflush rpl_fflush + /* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. */ + extern int fflush (FILE *gl_stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fflush +# define fflush(f) \ + (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \ + "use gnulib module fflush for portable " \ + "POSIX compliance"), \ + fflush (f)) +#endif #ifdef __cplusplus }