package IO;
-use IO::Handle;
-use IO::Seekable;
-use IO::File;
-use IO::Pipe;
-use IO::Socket;
-
-1;
-
=head1 NAME
IO - load various IO modules
C<IO> provides a simple mechanism to load all of the IO modules at one go.
Currently this includes:
- IO::Handle
- IO::Seekable
- IO::File
- IO::Pipe
- IO::Socket
+ IO::Handle
+ IO::Seekable
+ IO::File
+ IO::Pipe
+ IO::Socket
For more information on any of these modules, please see its respective
documentation.
=cut
+
+use IO::Handle;
+use IO::Seekable;
+use IO::File;
+use IO::Pipe;
+use IO::Socket;
+
+1;
+
# include <fcntl.h>
#endif
+#ifdef PerlIO
typedef int SysRet;
typedef PerlIO * InputStream;
typedef PerlIO * OutputStream;
+#else
+#define PERLIO_IS_STDIO 1
+typedef int SysRet;
+typedef FILE * InputStream;
+typedef FILE * OutputStream;
+#endif
static int
not_here(s)
CODE:
if (handle) {
Fpos_t pos;
+#ifdef PerlIO
PerlIO_getpos(handle, &pos);
+#else
+ fgetpos(handle, &pos);
+#endif
ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
}
else {
SV * pos
CODE:
if (handle)
+#ifdef PerlIO
RETVAL = PerlIO_setpos(handle, (Fpos_t*)SvPVX(pos));
+#else
+ RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
+#endif
else {
RETVAL = -1;
errno = EINVAL;
new_tmpfile(packname = "IO::File")
char * packname
CODE:
+#ifdef PerlIO
RETVAL = PerlIO_tmpfile();
+#else
+ RETVAL = tmpfile();
+#endif
OUTPUT:
RETVAL
int c
CODE:
if (handle)
+#ifdef PerlIO
RETVAL = PerlIO_ungetc(handle, c);
+#else
+ RETVAL = ungetc(c, handle);
+#endif
else {
RETVAL = -1;
errno = EINVAL;
InputStream handle
CODE:
if (handle)
+#ifdef PerlIO
RETVAL = PerlIO_error(handle);
+#else
+ RETVAL = ferror(handle);
+#endif
+ else {
+ RETVAL = -1;
+ errno = EINVAL;
+ }
+ OUTPUT:
+ RETVAL
+
+int
+clearerr(handle)
+ InputStream handle
+ CODE:
+ if (handle) {
+#ifdef PerlIO
+ PerlIO_clearerr(handle);
+#else
+ clearerr(handle);
+#endif
+ RETVAL = 0;
+ }
else {
RETVAL = -1;
errno = EINVAL;
OutputStream handle
CODE:
if (handle)
+#ifdef PerlIO
RETVAL = PerlIO_flush(handle);
+#else
+ RETVAL = Fflush(handle);
+#endif
else {
RETVAL = -1;
errno = EINVAL;