summaryrefslogtreecommitdiff
path: root/ext/POSIX
diff options
context:
space:
mode:
Diffstat (limited to 'ext/POSIX')
-rw-r--r--ext/POSIX/Makefile.PL1
-rw-r--r--ext/POSIX/POSIX.pm104
-rw-r--r--ext/POSIX/POSIX.pod142
-rw-r--r--ext/POSIX/POSIX.xs80
4 files changed, 18 insertions, 309 deletions
diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL
index 4a7eb9af73..68bce135f8 100644
--- a/ext/POSIX/Makefile.PL
+++ b/ext/POSIX/Makefile.PL
@@ -3,4 +3,5 @@ WriteMakefile(
LIBS => ["-lm -lposix -lcposix"],
MAN3PODS => ' ', # Pods will be built by installman.
XSPROTOARG => '-noprototypes', # XXX remove later?
+ VERSION_FROM => 'POSIX.pm',
);
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm
index ee35ea20fb..ab309cc609 100644
--- a/ext/POSIX/POSIX.pm
+++ b/ext/POSIX/POSIX.pm
@@ -1,12 +1,16 @@
package POSIX;
use Carp;
-require Exporter;
use AutoLoader;
-require DynaLoader;
require Config;
+use Symbol;
+
+require Exporter;
+require DynaLoader;
@ISA = qw(Exporter DynaLoader);
+$VERSION = $VERSION = "1.00" ;
+
%EXPORT_TAGS = (
assert_h => [qw(assert NDEBUG)],
@@ -78,8 +82,8 @@ require Config;
stddef_h => [qw(NULL offsetof)],
stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid
- L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET STREAM_MAX
- TMP_MAX stderr stdin stdout _IOFBF _IOLBF _IONBF
+ L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET
+ STREAM_MAX TMP_MAX stderr stdin stdout
clearerr fclose fdopen feof ferror fflush fgetc fgetpos
fgets fopen fprintf fputc fputs fread freopen
fscanf fseek fsetpos ftell fwrite getchar gets
@@ -206,30 +210,21 @@ sub AUTOLOAD {
}
sub usage {
- local ($mess) = @_;
+ my ($mess) = @_;
croak "Usage: POSIX::$mess";
}
sub redef {
- local ($mess) = @_;
+ my ($mess) = @_;
croak "Use method $mess instead";
}
sub unimpl {
- local ($mess) = @_;
+ my ($mess) = @_;
$mess =~ s/xxx//;
croak "Unimplemented: POSIX::$mess";
}
-sub gensym {
- my $pkg = @_ ? ref($_[0]) || $_[0] : "";
- local *{$pkg . "::GLOB" . ++$seq};
- \delete ${$pkg . "::"}{'GLOB' . $seq};
-}
-
-sub ungensym {
-}
-
############################
package POSIX::SigAction;
@@ -238,75 +233,6 @@ sub new {
}
############################
-package FileHandle;
-
-sub new {
- POSIX::usage "FileHandle->new(filename, posixmode)" if @_ != 3;
- local($class,$filename,$mode) = @_;
- local($sym) = $class->POSIX::gensym;
- $mode =~ s/a.*/>>/ ||
- $mode =~ s/w.*/>/ ||
- ($mode = '<');
- open($sym, "$mode $filename") and
- bless $sym => $class;
-}
-
-sub new_from_fd {
- POSIX::usage "FileHandle->new_from_fd(fd,mode)" if @_ != 3;
- local($class,$fd,$mode) = @_;
- local($sym) = $class->POSIX::gensym;
- $mode =~ s/a.*/>>/ ||
- $mode =~ s/w.*/>/ ||
- ($mode = '<');
- open($sym, "$mode&=$fd") and
- bless $sym => $class;
-}
-
-sub clearerr {
- POSIX::usage "clearerr(filehandle)" if @_ != 1;
- seek($_[0], 0, 1);
-}
-
-sub close {
- POSIX::usage "close(filehandle)" if @_ != 1;
- close($_[0]);
-}
-
-sub DESTROY {
- close($_[0]);
-}
-
-sub eof {
- POSIX::usage "eof(filehandle)" if @_ != 1;
- eof($_[0]);
-}
-
-sub getc {
- POSIX::usage "getc(filehandle)" if @_ != 1;
- getc($_[0]);
-}
-
-sub gets {
- POSIX::usage "gets(filehandle)" if @_ != 1;
- local($handle) = @_;
- scalar <$handle>;
-}
-
-sub fileno {
- POSIX::usage "fileno(filehandle)" if @_ != 1;
- fileno($_[0]);
-}
-
-sub seek {
- POSIX::usage "seek(filehandle,pos,whence)" if @_ != 3;
- seek($_[0], $_[1], $_[2]);
-}
-
-sub tell {
- POSIX::usage "tell(filehandle)" if @_ != 1;
- tell($_[0]);
-}
-############################
package POSIX; # return to package POSIX so AutoSplit is happy
1;
__END__
@@ -335,7 +261,7 @@ sub closedir {
sub opendir {
usage "opendir(directory)" if @_ != 1;
- local($dirhandle) = POSIX->gensym;
+ my $dirhandle = gensym;
opendir($dirhandle, $_[0])
? $dirhandle
: undef;
@@ -807,9 +733,9 @@ sub chmod {
sub fstat {
usage "fstat(fd)" if @_ != 1;
- local(*TMP);
+ local *TMP;
open(TMP, "<&$_[0]"); # Gross.
- local(@l) = stat(TMP);
+ my @l = stat(TMP);
close(TMP);
@l;
}
@@ -922,7 +848,7 @@ sub getgid {
sub getgroups {
usage "getgroups()" if @_ != 0;
- local(%seen) = ();
+ my %seen;
grep(!$seen{$_}++, split(' ', $) ));
}
diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod
index 2549a613ac..4b7585117c 100644
--- a/ext/POSIX/POSIX.pod
+++ b/ext/POSIX/POSIX.pod
@@ -1230,144 +1230,6 @@ Returns C<undef> on failure.
=head1 CLASSES
-=head2 FileHandle
-
-=over 8
-
-=item new
-
-Open a file and return a Perl filehandle. The first parameter is the
-filename and the second parameter is the mode. The mode should be specified
-as C<a> for append, C<w> for write, and E<lt> or C<""> for read.
-
-Open a file for reading.
-
- $fh = FileHandle->new( "foo", "" );
- die "Unable to open foo for reading" unless $fh;
-
-Open a file for writing.
-
- $fh = FileHandle->new( "foo", "w" );
- die "Unable to open foo for writing" unless $fh;
-
-Use C<FileHandle::close()> to close the file or let the FileHandle object's
-destructor perform the close.
-
-=item clearerr
-
-Resets the error indicator and EOF indicator to zero.
-
- $fh->clearerr;
-
-=item close
-
-Close the file.
-
- $fh->close;
-
-=item eof
-
-Tests for end of file.
-
- if( $fh->eof ){
- print "end of file\n";
- }
-
-=item error
-
-Returns non-zero if there has been an error while reading or writing a file.
-
- if( $fh->error ){
- print "error\n";
- }
-
-=item fileno
-
-Returns the integer file descriptor associated with the file.
-
- $fileno = $fh->fileno;
-
-=item flush
-
-Flush the stream.
-
- $fh->flush;
-
-Returns C<undef> on failure.
-
-=item getc
-
-Get a character from the stream.
-
- $ch = $fh->getc;
-
-=item getpos
-
-Retrieve the file pointer position. The returned value can be used as an
-argument to C<setpos()>.
-
- $pos = $fh->getpos;
-
-=item gets
-
-Retrieve a line from the open file.
-
- $line = $fh->gets;
-
-=item new_from_fd
-
-Open a file using a file descriptor. Return a Perl filehandle. The first
-parameter should be a file descriptor, which can come from C<POSIX::open()>.
-The second parameter, the mode, should be C<a> for append, C<w> for write,
-and E<lt> or C<""> for read. The mode should match the mode which was used
-when the file descriptor was created.
-
- $fd = POSIX::open( "typemap" );
- $fh = FileHandle->new_from_fd( $fd, "<" );
- die "FileHandle failed" unless $fh;
-
-=item new_tmpfile
-
-Creates a temporary file, opens it for writing, and returns a Perl
-filehandle. Consult your system's C<tmpfile()> manpage for details.
-
- $fh = FileHandle->new_tmpfile;
- die "FileHandle failed" unless $fh;
-
-=item seek
-
-Reposition file pointer.
-
- $fh->seek( 2, &POSIX::SEEK_SET );
-
-=item setbuf
-
-
-=item setpos
-
-Set the file pointer position.
-
- $pos = $fh->getpos;
- $fh->setpos( $pos );
-
-Returns C<undef> on failure.
-
-=item setvbuf
-
-
-Returns C<undef> on failure.
-
-=item tell
-
-Returns the current file position, in bytes.
-
- $pos = $fh->tell;
-
-=item ungetc
-
-
-=back
-
=head2 POSIX::SigAction
=over 8
@@ -1733,7 +1595,7 @@ EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
=item Constants
-BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX _IOFBF _IOLBF _IONBF
+BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid L_tmpname TMP_MAX
=back
@@ -1773,5 +1635,5 @@ WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG
=head1 CREATION
-This document generated by ./mkposixman.PL version 19951212.
+This document generated by ./mkposixman.PL version 19960129.
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 2a6244a752..69db228b33 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -52,8 +52,6 @@
#include <utime.h>
#endif
-typedef FILE * InputStream;
-typedef FILE * OutputStream;
typedef int SysRet;
typedef long SysRetLong;
typedef sigset_t* POSIX__SigSet;
@@ -2123,25 +2121,6 @@ int arg;
#endif
break;
}
- if (strEQ(name, "_IOFBF"))
-#ifdef _IOFBF
- return _IOFBF;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "_IOLBF"))
-#ifdef _IOLBF
- return _IOLBF;
-#else
- goto not_there;
-#endif
- if (strEQ(name, "_IONBF"))
-#ifdef _IONBF
- return _IONBF;
-#else
- goto not_there;
-#endif
- break;
}
errno = EINVAL;
return 0;
@@ -2382,65 +2361,6 @@ setcc(termios_ref, ccix, cc)
#endif
-
-MODULE = FileHandle PACKAGE = FileHandle PREFIX = f
-
-SV *
-fgetpos(handle)
- InputStream handle
- CODE:
- {
- Fpos_t pos;
- fgetpos(handle, &pos);
- ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
- }
-
-SysRet
-fsetpos(handle, pos)
- InputStream handle
- SV * pos
- CODE:
- RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
- OUTPUT:
- RETVAL
-
-int
-ungetc(handle, c)
- InputStream handle
- int c
- CODE:
- RETVAL = ungetc(c, handle);
- OUTPUT:
- RETVAL
-
-OutputStream
-new_tmpfile(packname = "FileHandle")
- char * packname
- CODE:
- RETVAL = tmpfile();
- OUTPUT:
- RETVAL
-
-int
-ferror(handle)
- InputStream handle
-
-SysRet
-fflush(handle)
- OutputStream handle
-
-void
-setbuf(handle, buf)
- OutputStream handle
- char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0;
-
-SysRet
-setvbuf(handle, buf, type, size)
- OutputStream handle
- char * buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
- int type
- int size
-
MODULE = POSIX PACKAGE = POSIX
double