fixes bug 20000508.004
[p5sagit/p5-mst-13.2.git] / perlio.c
index 7a5924a..a88daa5 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -1,16 +1,19 @@
 /*    perlio.c
  *
- *    Copyright (c) 1996-1999, Nick Ing-Simmons
+ *    Copyright (c) 1996-2000, Nick Ing-Simmons
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
  *
  */
 
-#if !defined(PERL_IMPLICIT_SYS)
 
 #define VOIDUSED 1
-#include "config.h"
+#ifdef PERL_MICRO
+#   include "uconfig.h"
+#else
+#   include "config.h"
+#endif
 
 #define PERLIO_NOT_STDIO 0 
 #if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO)
@@ -26,6 +29,8 @@
 #define PERL_IN_PERLIO_C
 #include "perl.h"
 
+#if !defined(PERL_IMPLICIT_SYS)
+
 #ifdef PERLIO_IS_STDIO 
 
 void
@@ -385,14 +390,22 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap)
 Off_t
 PerlIO_tell(PerlIO *f)
 {
+#if defined(USE_64_BIT_STDIO) && defined(HAS_FTELLO) && !defined(USE_FTELL64)
+ return ftello(f);
+#else
  return ftell(f);
+#endif
 }
 
 #undef PerlIO_seek
 int
 PerlIO_seek(PerlIO *f, Off_t offset, int whence)
 {
+#if defined(USE_64_BIT_STDIO) && defined(HAS_FSEEKO) && !defined(USE_FSEEK64)
+ return fseeko(f,offset,whence);
+#else
  return fseek(f,offset,whence);
+#endif
 }
 
 #undef PerlIO_rewind
@@ -545,11 +558,9 @@ PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap)
   {
    if (strlen(s) >= (STRLEN)n)
     {
-     PerlIO_puts(PerlIO_stderr(),"panic: sprintf overflow - memory corrupted!\n");
-     {
-      dTHX;
-      my_exit(1);
-     }
+     dTHX;
+     PerlIO_puts(Perl_error_log,"panic: sprintf overflow - memory corrupted!\n");
+     my_exit(1);
     }
   }
  return val;