This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix DATA leaks; reword documentation about the DATA filehandle
[perl5.git] / perlsdio.h
index 9825f8e..71a9e75 100644 (file)
 #define PerlIO_clearerr(f)             clearerr(f)
 #define PerlIO_flush(f)                        Fflush(f)
 #define PerlIO_tell(f)                 ftell(f)
-#define PerlIO_seek(f,o,w)             fseek(f,o,w)
+#if defined(USE_64_BIT_STDIO) && defined(HAS_FTELLO) && !defined(USE_FTELL64)
+#define ftell ftello
+#endif
+#if defined(VMS) && !defined(__DECC)
+   /* Old VAXC RTL doesn't reset EOF on seek; Perl folk seem to expect this */
+#  define PerlIO_seek(f,o,w)   (((f) && (*f) && ((*f)->_flag &= ~_IOEOF)),fseek(f,o,w))
+#else
+#  define PerlIO_seek(f,o,w)           fseek(f,o,w)
+#endif
+#if defined(USE_64_BIT_STDIO) && defined(HAS_FSEEKO) && !defined(USE_FSEEK64)
+#define fseek fseeko
+#endif
 #ifdef HAS_FGETPOS
 #define PerlIO_getpos(f,p)             fgetpos(f,p)
 #endif
 #ifdef HAS_SETLINEBUF
 #define PerlIO_setlinebuf(f)           setlinebuf(f);
 #else
-#define PerlIO_setlinebuf(f)           setvbuf(f, Nullch, _IOLBF, 0);
+# ifdef CYGWIN
+#  define PerlIO_setlinebuf(f)
+# else
+#  define PerlIO_setlinebuf(f)         setvbuf(f, Nullch, _IOLBF, 0);
+# endif
 #endif
 
 /* Now our interface to Configure's FILE_xxx macros */
 #define fputc(c,f)             PerlIO_putc(f,c)
 #define fputs(s,f)             PerlIO_puts(f,s)
 #define getc(f)                        PerlIO_getc(f)
+#ifdef getc_unlocked
+#undef getc_unlocked
+#endif
 #define getc_unlocked(f)       PerlIO_getc(f)
 #define putc(c,f)              PerlIO_putc(f,c)
+#ifdef putc_unlocked
+#undef putc_unlocked
+#endif
 #define putc_unlocked(c,f)     PerlIO_putc(c,f)
 #define ungetc(c,f)            PerlIO_ungetc(f,c)
 #if 0