diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:25:41 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-10-27 22:25:41 +0000 |
commit | d85c2f57f17d991a6ca78d3e1c9f3308a2bbb271 (patch) | |
tree | 8c9a359433cbb3488b0a848e99bd869c76295dfd /gnu/usr.bin/perl/vms/ext | |
parent | 74cfb115ac810480c0000dc742b20383c1578bac (diff) |
Resolve conflicts, remove old files, merge local changes
Diffstat (limited to 'gnu/usr.bin/perl/vms/ext')
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/DCLsym/DCLsym.pm | 6 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/Filespec.pm | 3 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/Stdio/Stdio.pm | 12 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/Stdio/Stdio.xs | 83 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/filespec.t | 167 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/vmsish.pm | 97 | ||||
-rw-r--r-- | gnu/usr.bin/perl/vms/ext/vmsish.t | 146 |
7 files changed, 137 insertions, 377 deletions
diff --git a/gnu/usr.bin/perl/vms/ext/DCLsym/DCLsym.pm b/gnu/usr.bin/perl/vms/ext/DCLsym/DCLsym.pm index 99adb94522e..884e35783e7 100644 --- a/gnu/usr.bin/perl/vms/ext/DCLsym/DCLsym.pm +++ b/gnu/usr.bin/perl/vms/ext/DCLsym/DCLsym.pm @@ -7,7 +7,7 @@ use strict; # Package globals @ISA = ( 'DynaLoader' ); -$VERSION = '1.01'; +$VERSION = '1.02'; my(%Locsyms) = ( ':ID' => 'LOCAL' ); my(%Gblsyms) = ( ':ID' => 'GLOBAL'); my $DoCache = 1; @@ -201,7 +201,7 @@ can also call methods directly to manipulate individual symbols. In some cases, this allows you finer control than using a tied hash aggregate. The following methods are supported: -=over +=over 4 =item new @@ -254,6 +254,8 @@ This method is a stopgap until we can incorporate code into this extension to traverse the process' symbol table directly, so it may disappear in a future version of this package. +=back + =head1 AUTHOR Charles Bailey bailey@newman.upenn.edu diff --git a/gnu/usr.bin/perl/vms/ext/Filespec.pm b/gnu/usr.bin/perl/vms/ext/Filespec.pm index 375e962c67a..42c15c2a3cc 100644 --- a/gnu/usr.bin/perl/vms/ext/Filespec.pm +++ b/gnu/usr.bin/perl/vms/ext/Filespec.pm @@ -1,7 +1,7 @@ # Perl hooks into the routines in vms.c for interconversion # of VMS and Unix file specification syntax. # -# Version: 1.1 +# Version: see $VERSION below # Author: Charles Bailey bailey@newman.upenn.edu # Revised: 08-Mar-1995 @@ -128,6 +128,7 @@ This document was last revised 22-Feb-1996, for Perl 5.002. package VMS::Filespec; require 5.002; +our $VERSION = '1.1'; # If you want to use this package on a non-VMS system, # uncomment the following line. diff --git a/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.pm b/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.pm index 446b0785e15..a68e796f3a3 100644 --- a/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.pm +++ b/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.pm @@ -13,7 +13,7 @@ use Carp '&croak'; use DynaLoader (); use Exporter (); -$VERSION = '2.2'; +$VERSION = '2.3'; @ISA = qw( Exporter DynaLoader IO::File ); @EXPORT = qw( &O_APPEND &O_CREAT &O_EXCL &O_NDELAY &O_NOWAIT &O_RDONLY &O_RDWR &O_TRUNC &O_WRONLY ); @@ -146,7 +146,7 @@ VMS::Stdio function. This compatibility interface will be removed in a future release of this extension, so please update your code to use the new routines. -=over +=over 4 =item binmode @@ -240,9 +240,7 @@ as a normal Perl file handle only. When the scalar containing a VMS::Stdio file handle is overwritten, C<undef>d, or goes out of scope, the associated file is closed automatically. -=over 4 - -=head2 File characteristic options +File characteristic options: =over 2 @@ -605,8 +603,6 @@ I/O timeout value =back -=back - =item vmssysopen This function bears the same relationship to the CORE function @@ -634,6 +630,8 @@ subprocess through a pipe opened for writing without closing the pipe. It returns a true value if successful, and C<undef> if it encounters an error. +=back + =head1 REVISION This document was last revised on 13-Oct-1998, for Perl 5.004, 5.005, and diff --git a/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.xs b/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.xs index d82b17dbfa0..d7259234eee 100644 --- a/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.xs +++ b/gnu/usr.bin/perl/vms/ext/Stdio/Stdio.xs @@ -81,7 +81,7 @@ IV *pval; static SV * -newFH(FILE *fp, char type) { +newFH(PerlIO *fp, char type) { SV *rv; GV **stashp, *gv = (GV *)NEWSV(0,0); HV *stash; @@ -128,16 +128,20 @@ binmode(fh) SV * fh PROTOTYPE: $ CODE: - IO *io = sv_2io(fh); - FILE *fp = io ? IoOFP(io) : NULL; - char iotype = io ? IoTYPE(io) : '\0'; - char filespec[NAM$C_MAXRSS], *acmode, *s, *colon, *dirend = Nullch; - int ret = 0, saverrno = errno, savevmserrno = vaxc$errno; - fpos_t pos; + SV *name; + IO *io; + char iotype; + char filespec[NAM$C_MAXRSS], *acmode, *s, *colon, *dirend = Nullch; + int ret = 0, saverrno = errno, savevmserrno = vaxc$errno; + SV pos; + PerlIO *fp; + io = sv_2io(fh); + fp = io ? IoOFP(io) : NULL; + iotype = io ? IoTYPE(io) : '\0'; if (fp == NULL || strchr(">was+-|",iotype) == Nullch) { set_errno(EBADF); set_vaxc_errno(SS$_IVCHAN); XSRETURN_UNDEF; } - if (!fgetname(fp,filespec)) XSRETURN_UNDEF; + if (!PerlIO_getname(fp,filespec)) XSRETURN_UNDEF; for (s = filespec; *s; s++) { if (*s == ':') colon = s; else if (*s == ']' || *s == '>') dirend = s; @@ -149,7 +153,7 @@ binmode(fh) /* If we've got a non-file-structured device, clip off the trailing * junk, and don't lose sleep if we can't get a stream position. */ if (dirend == Nullch) *(colon+1) = '\0'; - if (iotype != '-' && (ret = fgetpos(fp, &pos)) == -1 && dirend) + if (iotype != '-' && (ret = PerlIO_getpos(fp, &pos)) == -1 && dirend) XSRETURN_UNDEF; switch (iotype) { case '<': case 'r': acmode = "rb"; break; @@ -158,7 +162,7 @@ binmode(fh) fsetpos below will take care of restoring file position */ case 'a': acmode = "ab"; break; case '+': case 's': acmode = "rb+"; break; - case '-': acmode = fileno(fp) ? "ab" : "rb"; break; + case '-': acmode = PerlIO_fileno(fp) ? "ab" : "rb"; break; /* iotype'll be null for the SYS$INPUT:/SYS$OUTPUT:/SYS$ERROR: files */ /* since we didn't really open them and can't really */ /* reopen them */ @@ -168,35 +172,41 @@ binmode(fh) iotype, filespec); acmode = "rb+"; } - if (freopen(filespec,acmode,fp) == NULL) XSRETURN_UNDEF; - if (iotype != '-' && ret != -1 && fsetpos(fp,&pos) == -1) XSRETURN_UNDEF; + /* appearances to the contrary, this is an freopen substitute */ + name = sv_2mortal(newSVpvn(filespec,strlen(filespec))); + if (PerlIO_openn(aTHX_ Nullch,acmode,-1,0,0,fp,1,&name) == Nullfp) XSRETURN_UNDEF; + if (iotype != '-' && ret != -1 && PerlIO_setpos(fp,&pos) == -1) XSRETURN_UNDEF; if (ret == -1) { set_errno(saverrno); set_vaxc_errno(savevmserrno); } XSRETURN_YES; void flush(fp) - FILE * fp + PerlIO * fp PROTOTYPE: $ CODE: - if (fflush(fp)) { ST(0) = &PL_sv_undef; } - else { clearerr(fp); ST(0) = &PL_sv_yes; } + FILE *stdio = PerlIO_exportFILE(fp,0); + if (fflush(stdio)) { ST(0) = &PL_sv_undef; } + else { clearerr(stdio); ST(0) = &PL_sv_yes; } + PerlIO_releaseFILE(fp,stdio); char * getname(fp) - FILE * fp + PerlIO * fp PROTOTYPE: $ CODE: char fname[NAM$C_MAXRSS+1]; ST(0) = sv_newmortal(); - if (fgetname(fp,fname) != NULL) sv_setpv(ST(0),fname); + if (PerlIO_getname(fp,fname) != NULL) sv_setpv(ST(0),fname); void rewind(fp) - FILE * fp + PerlIO * fp PROTOTYPE: $ CODE: - ST(0) = rewind(fp) ? &PL_sv_undef : &PL_sv_yes; + FILE *stdio = PerlIO_exportFILE(fp,0); + ST(0) = rewind(stdio) ? &PL_sv_undef : &PL_sv_yes; + PerlIO_releaseFILE(fp,stdio); void remove(name) @@ -261,11 +271,13 @@ setdef(...) void sync(fp) - FILE * fp + PerlIO * fp PROTOTYPE: $ CODE: - if (fsync(fileno(fp))) { ST(0) = &PL_sv_undef; } - else { clearerr(fp); ST(0) = &PL_sv_yes; } + FILE *stdio = PerlIO_exportFILE(fp,0); + if (fsync(fileno(stdio))) { ST(0) = &PL_sv_undef; } + else { clearerr(stdio); ST(0) = &PL_sv_yes; } + PerlIO_releaseFILE(fp,stdio); char * tmpnam() @@ -283,6 +295,8 @@ vmsopen(spec,...) char *args[8],mode[3] = {'r','\0','\0'}, type = '<'; register int i, myargc; FILE *fp; + SV *fh; + PerlIO *pio_fp; STRLEN n_a; if (!spec || !*spec) { @@ -333,9 +347,10 @@ vmsopen(spec,...) fp = fopen(spec,mode,args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]); break; } - if (fp != Nullfp) { - SV *fh = newFH(fp,(mode[1] ? '+' : (mode[0] == 'r' ? '<' : (mode[0] == 'a' ? 'a' : '>')))); - ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); + if (fp != Null(FILE*)) { + pio_fp = PerlIO_importFILE(fp,mode); + fh = newFH(pio_fp,(mode[1] ? '+' : (mode[0] == 'r' ? '<' : (mode[0] == 'a' ? 'a' : '>')))); + ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); } else { ST(0) = &PL_sv_undef; } @@ -349,6 +364,7 @@ vmssysopen(spec,mode,perm,...) char *args[8]; int i, myargc, fd; FILE *fp; + PerlIO *pio_fp; SV *fh; STRLEN n_a; if (!spec || !*spec) { @@ -391,18 +407,21 @@ vmssysopen(spec,mode,perm,...) } i = mode & 3; if (fd >= 0 && - ((fp = fdopen(fd, &("r\000w\000r+"[2*i]))) != Nullfp)) { - SV *fh = newFH(fp,"<>++"[i]); - ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); + ((fp = fdopen(fd, &("r\000w\000r+"[2*i]))) != Null(FILE*))) { + pio_fp = PerlIO_importFILE(fp,&("r\000w\000r+"[2*i])); + fh = newFH(pio_fp,"<>++"[i]); + ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); } else { ST(0) = &PL_sv_undef; } void waitfh(fp) - FILE * fp + PerlIO * fp PROTOTYPE: $ CODE: - ST(0) = fwait(fp) ? &PL_sv_undef : &PL_sv_yes; + FILE *stdio = PerlIO_exportFILE(fp,0); + ST(0) = fwait(stdio) ? &PL_sv_undef : &PL_sv_yes; + PerlIO_releaseFILE(fp,stdio); void writeof(mysv) @@ -413,11 +432,11 @@ writeof(mysv) unsigned long int chan, iosb[2], retsts, retsts2; struct dsc$descriptor devdsc = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, devnam}; IO *io = sv_2io(mysv); - FILE *fp = io ? IoOFP(io) : NULL; + PerlIO *fp = io ? IoOFP(io) : NULL; if (fp == NULL || strchr(">was+-|",IoTYPE(io)) == Nullch) { set_errno(EBADF); set_vaxc_errno(SS$_IVCHAN); XSRETURN_UNDEF; } - if (fgetname(fp,devnam) == Nullch) { ST(0) = &PL_sv_undef; XSRETURN(1); } + if (PerlIO_getname(fp,devnam) == Nullch) { ST(0) = &PL_sv_undef; XSRETURN(1); } if ((cp = strrchr(devnam,':')) != NULL) *(cp+1) = '\0'; devdsc.dsc$w_length = strlen(devnam); retsts = sys$assign(&devdsc,&chan,0,0); diff --git a/gnu/usr.bin/perl/vms/ext/filespec.t b/gnu/usr.bin/perl/vms/ext/filespec.t index 779396be731..7123ffc51ce 100644 --- a/gnu/usr.bin/perl/vms/ext/filespec.t +++ b/gnu/usr.bin/perl/vms/ext/filespec.t @@ -3,6 +3,7 @@ BEGIN { unshift(@INC,'../lib') if -d '../lib'; } use VMS::Filespec; +use File::Spec; foreach (<DATA>) { chomp; @@ -10,19 +11,16 @@ foreach (<DATA>) { next if /^\s*$/; push(@tests,$_); } -print '1..',scalar(@tests)+6,"\n"; + +require './test.pl'; +plan(tests => scalar(2*@tests)+6); foreach $test (@tests) { - ($arg,$func,$expect) = split(/\t+/,$test); - $idx++; + ($arg,$func,$expect) = split(/\s+/,$test); + $rslt = eval "$func('$arg')"; - if ($@) { print "not ok $idx : eval error: $@\n"; next; } - else { - if ($rslt ne $expect) { - print "not ok $idx : $func('$arg') expected |$expect|, got |$rslt|\n"; - } - else { print "ok $idx\n"; } - } + is($@, '', "eval func('$arg')"); + is($rslt, $expect, " result"); } $defwarn = <<'EOW'; @@ -32,66 +30,48 @@ $defwarn = <<'EOW'; # file specifications shwn above are in fact equivalent. EOW -if (rmsexpand('[]') eq "\U$ENV{DEFAULT}") { print 'ok ',++$idx,"\n"; } -else { - print 'not ok ', ++$idx, ": rmsexpand('[]') = |", rmsexpand('[]'), - "|, \$ENV{DEFAULT} = |\U$ENV{DEFAULT}|\n$defwarn"; -} -if (rmsexpand('from.here') eq "\L$ENV{DEFAULT}from.here") { - print 'ok ', ++$idx, "\n"; -} -else { - print 'not ok ', ++$idx, ": rmsexpand('from.here') = |", - rmsexpand('from.here'), - "|, \$ENV{DEFAULT}from.here = |\L$ENV{DEFAULT}from.here|\n$defwarn"; -} -if (rmsexpand('from') eq "\L$ENV{DEFAULT}from") { - print 'ok ', ++$idx, "\n"; -} -else { - print 'not ok ', ++$idx, ": rmsexpand('from') = |", - rmsexpand('from'), - "|, \$ENV{DEFAULT}from = |\L$ENV{DEFAULT}from|\n$defwarn"; -} -if (rmsexpand('from.here','cant:[get.there];2') eq - 'cant:[get.there]from.here;2') { print 'ok ',++$idx,"\n"; } -else { - print 'not ok ', ++$idx, ': expected |cant:[get.there]from.here;2|, got |', - rmsexpand('from.here','cant:[get.there];2'),"|\n"; -} +is(uc(rmsexpand('[]')), "\U$ENV{DEFAULT}", 'rmsexpand()') || print $defwarn; +is(rmsexpand('from.here'),"\L$ENV{DEFAULT}from.here") || print $defwarn; +is(rmsexpand('from'), "\L$ENV{DEFAULT}from") || print $defwarn; + +is(rmsexpand('from.here','cant:[get.there];2'), + 'cant:[get.there]from.here;2') || print $defwarn; + # Make sure we're using redirected mkdir, which strips trailing '/', since # the CRTL's mkdir can't handle this. -print +(mkdir('testdir/',0777) ? 'ok ' : 'not ok '),++$idx,"\n"; -print +(rmdir('testdir/') ? 'ok ' : 'not ok '),++$idx,"\n"; +ok(mkdir('testdir/',0777), 'using redirected mkdir()'); +ok(rmdir('testdir/'), ' rmdir()'); __DATA__ +# lots of underscores used to minimize collision with existing logical names + # Basic VMS to Unix filespecs -some:[where.over]the.rainbow unixify /some/where/over/the.rainbow -[.some.where.over]the.rainbow unixify some/where/over/the.rainbow -[-.some.where.over]the.rainbow unixify ../some/where/over/the.rainbow -[.some.--.where.over]the.rainbow unixify some/../../where/over/the.rainbow -[.some...where.over]the.rainbow unixify some/.../where/over/the.rainbow -[...some.where.over]the.rainbow unixify .../some/where/over/the.rainbow -[.some.where.over...]the.rainbow unixify some/where/over/.../the.rainbow -[.some.where.over...] unixify some/where/over/.../ -[.some.where.over.-] unixify some/where/over/../ +__some_:[__where_.__over_]__the_.__rainbow_ unixify /__some_/__where_/__over_/__the_.__rainbow_ +[.__some_.__where_.__over_]__the_.__rainbow_ unixify __some_/__where_/__over_/__the_.__rainbow_ +[-.__some_.__where_.__over_]__the_.__rainbow_ unixify ../__some_/__where_/__over_/__the_.__rainbow_ +[.__some_.--.__where_.__over_]__the_.__rainbow_ unixify __some_/../../__where_/__over_/__the_.__rainbow_ +[.__some_...__where_.__over_]__the_.__rainbow_ unixify __some_/.../__where_/__over_/__the_.__rainbow_ +[...__some_.__where_.__over_]__the_.__rainbow_ unixify .../__some_/__where_/__over_/__the_.__rainbow_ +[.__some_.__where_.__over_...]__the_.__rainbow_ unixify __some_/__where_/__over_/.../__the_.__rainbow_ +[.__some_.__where_.__over_...] unixify __some_/__where_/__over_/.../ +[.__some_.__where_.__over_.-] unixify __some_/__where_/__over_/../ [] unixify ./ [-] unixify ../ [--] unixify ../../ [...] unixify .../ # and back again -/some/where/over/the.rainbow vmsify some:[where.over]the.rainbow -some/where/over/the.rainbow vmsify [.some.where.over]the.rainbow -../some/where/over/the.rainbow vmsify [-.some.where.over]the.rainbow -some/../../where/over/the.rainbow vmsify [-.where.over]the.rainbow -.../some/where/over/the.rainbow vmsify [...some.where.over]the.rainbow -some/.../where/over/the.rainbow vmsify [.some...where.over]the.rainbow -/some/.../where/over/the.rainbow vmsify some:[...where.over]the.rainbow -some/where/... vmsify [.some.where...] -/where/... vmsify where:[...] +/__some_/__where_/__over_/__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_ +__some_/__where_/__over_/__the_.__rainbow_ vmsify [.__some_.__where_.__over_]__the_.__rainbow_ +../__some_/__where_/__over_/__the_.__rainbow_ vmsify [-.__some_.__where_.__over_]__the_.__rainbow_ +__some_/../../__where_/__over_/__the_.__rainbow_ vmsify [-.__where_.__over_]__the_.__rainbow_ +.../__some_/__where_/__over_/__the_.__rainbow_ vmsify [...__some_.__where_.__over_]__the_.__rainbow_ +__some_/.../__where_/__over_/__the_.__rainbow_ vmsify [.__some_...__where_.__over_]__the_.__rainbow_ +/__some_/.../__where_/__over_/__the_.__rainbow_ vmsify __some_:[...__where_.__over_]__the_.__rainbow_ +__some_/__where_/... vmsify [.__some_.__where_...] +/__where_/... vmsify __where_:[...] . vmsify [] .. vmsify [-] ../.. vmsify [--] @@ -99,49 +79,52 @@ some/where/... vmsify [.some.where...] / vmsify sys$disk:[000000] # Fileifying directory specs -down:[the.garden.path] fileify down:[the.garden]path.dir;1 -[.down.the.garden.path] fileify [.down.the.garden]path.dir;1 -/down/the/garden/path fileify /down/the/garden/path.dir;1 -/down/the/garden/path/ fileify /down/the/garden/path.dir;1 -down/the/garden/path fileify down/the/garden/path.dir;1 -down:[the.garden]path fileify down:[the.garden]path.dir;1 -down:[the.garden]path. fileify # N.B. trailing . ==> null type -down:[the]garden.path fileify -/down/the/garden/path. fileify # N.B. trailing . ==> null type -/down/the/garden.path fileify +__down_:[__the_.__garden_.__path_] fileify __down_:[__the_.__garden_]__path_.dir;1 +[.__down_.__the_.__garden_.__path_] fileify [.__down_.__the_.__garden_]__path_.dir;1 +/__down_/__the_/__garden_/__path_ fileify /__down_/__the_/__garden_/__path_.dir;1 +/__down_/__the_/__garden_/__path_/ fileify /__down_/__the_/__garden_/__path_.dir;1 +__down_/__the_/__garden_/__path_ fileify __down_/__the_/__garden_/__path_.dir;1 +__down_:[__the_.__garden_]__path_ fileify __down_:[__the_.__garden_]__path_.dir;1 +__down_:[__the_.__garden_]__path_. fileify # N.B. trailing . ==> null type +__down_:[__the_]__garden_.__path_ fileify +/__down_/__the_/__garden_/__path_. fileify # N.B. trailing . ==> null type +/__down_/__the_/__garden_.__path_ fileify # and pathifying them -down:[the.garden]path.dir;1 pathify down:[the.garden.path] -[.down.the.garden]path.dir pathify [.down.the.garden.path] -/down/the/garden/path.dir pathify /down/the/garden/path/ -down/the/garden/path.dir pathify down/the/garden/path/ -down:[the.garden]path pathify down:[the.garden.path] -down:[the.garden]path. pathify # N.B. trailing . ==> null type -down:[the]garden.path pathify -/down/the/garden/path. pathify # N.B. trailing . ==> null type -/down/the/garden.path pathify -down:[the.garden]path.dir;2 pathify #N.B. ;2 -path pathify path/ -/down/the/garden/. pathify /down/the/garden/./ -/down/the/garden/.. pathify /down/the/garden/../ -/down/the/garden/... pathify /down/the/garden/.../ -path.notdir pathify +__down_:[__the_.__garden_]__path_.dir;1 pathify __down_:[__the_.__garden_.__path_] +[.__down_.__the_.__garden_]__path_.dir pathify [.__down_.__the_.__garden_.__path_] +/__down_/__the_/__garden_/__path_.dir pathify /__down_/__the_/__garden_/__path_/ +__down_/__the_/__garden_/__path_.dir pathify __down_/__the_/__garden_/__path_/ +__down_:[__the_.__garden_]__path_ pathify __down_:[__the_.__garden_.__path_] +__down_:[__the_.__garden_]__path_. pathify # N.B. trailing . ==> null type +__down_:[__the_]__garden_.__path_ pathify +/__down_/__the_/__garden_/__path_. pathify # N.B. trailing . ==> null type +/__down_/__the_/__garden_.__path_ pathify +__down_:[__the_.__garden_]__path_.dir;2 pathify #N.B. ;2 +__path_ pathify __path_/ +/__down_/__the_/__garden_/. pathify /__down_/__the_/__garden_/./ +/__down_/__the_/__garden_/.. pathify /__down_/__the_/__garden_/../ +/__down_/__the_/__garden_/... pathify /__down_/__the_/__garden_/.../ +__path_.notdir pathify # Both VMS/Unix and file/path conversions -down:[the.garden]path.dir;1 unixpath /down/the/garden/path/ -/down/the/garden/path vmspath down:[the.garden.path] -down:[the.garden.path] unixpath /down/the/garden/path/ -down:[the.garden.path...] unixpath /down/the/garden/path/.../ -/down/the/garden/path.dir vmspath down:[the.garden.path] -[.down.the.garden]path.dir unixpath down/the/garden/path/ -down/the/garden/path vmspath [.down.the.garden.path] -path vmspath [.path] +__down_:[__the_.__garden_]__path_.dir;1 unixpath /__down_/__the_/__garden_/__path_/ +/__down_/__the_/__garden_/__path_ vmspath __down_:[__the_.__garden_.__path_] +__down_:[__the_.__garden_.__path_] unixpath /__down_/__the_/__garden_/__path_/ +__down_:[__the_.__garden_.__path_...] unixpath /__down_/__the_/__garden_/__path_/.../ +/__down_/__the_/__garden_/__path_.dir vmspath __down_:[__the_.__garden_.__path_] +[.__down_.__the_.__garden_]__path_.dir unixpath __down_/__the_/__garden_/__path_/ +__down_/__the_/__garden_/__path_ vmspath [.__down_.__the_.__garden_.__path_] +__path_ vmspath [.__path_] / vmspath sys$disk:[000000] # Redundant characters in Unix paths -//some/where//over/../the.rainbow vmsify some:[where]the.rainbow -/some/where//over/./the.rainbow vmsify some:[where.over]the.rainbow +//__some_/__where_//__over_/../__the_.__rainbow_ vmsify __some_:[__where_]__the_.__rainbow_ +/__some_/__where_//__over_/./__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_ ..//../ vmspath [--] ./././ vmspath [] ./../. vmsify [-] +# Our override of File::Spec->canonpath can do some strange things +__dev:[__dir.000000]__foo File::Spec->canonpath __dev:[__dir]__foo +__dev:[__dir.][000000]__foo File::Spec->canonpath __dev:[__dir]__foo diff --git a/gnu/usr.bin/perl/vms/ext/vmsish.pm b/gnu/usr.bin/perl/vms/ext/vmsish.pm deleted file mode 100644 index 2fc48530c09..00000000000 --- a/gnu/usr.bin/perl/vms/ext/vmsish.pm +++ /dev/null @@ -1,97 +0,0 @@ -package vmsish; - -=head1 NAME - -vmsish - Perl pragma to control VMS-specific language features - -=head1 SYNOPSIS - - use vmsish; - - use vmsish 'status'; # or '$?' - use vmsish 'exit'; - use vmsish 'time'; - use vmsish 'hushed'; - - use vmsish; - no vmsish 'time'; - -=head1 DESCRIPTION - -If no import list is supplied, all possible VMS-specific features are -assumed. Currently, there are four VMS-specific features available: -'status' (a.k.a '$?'), 'exit', 'time' and 'hushed'. - -=over 6 - -=item C<vmsish status> - -This makes C<$?> and C<system> return the native VMS exit status -instead of emulating the POSIX exit status. - -=item C<vmsish exit> - -This makes C<exit 1> produce a successful exit (with status SS$_NORMAL), -instead of emulating UNIX exit(), which considers C<exit 1> to indicate -an error. As with the CRTL's exit() function, C<exit 0> is also mapped -to an exit status of SS$_NORMAL, and any other argument to exit() is -used directly as Perl's exit status. - -=item C<vmsish time> - -This makes all times relative to the local time zone, instead of the -default of Universal Time (a.k.a Greenwich Mean Time, or GMT). - -=item C<vmsish hushed> - -This supresses printing of VMS status messages to SYS$OUTPUT and SYS$ERROR -if Perl terminates with an error status. This primarily effects error -exits from things like compiler errors or "standard Perl" runtime errors, -where text error messages are also generated by Perl. - -The error exits from inside VMS.C are generally more serious, and are -not supressed. - -=back - -See L<perlmod/Pragmatic Modules>. - -=cut - -if ($^O ne 'VMS') { - require Carp; - Carp::croak("This isn't VMS"); -} - -sub bits { - my $bits = 0; - my $sememe; - foreach $sememe (@_) { - $bits |= 0x20000000, next if $sememe eq 'hushed'; - $bits |= 0x40000000, next if $sememe eq 'status' || $sememe eq '$?'; - $bits |= 0x80000000, next if $sememe eq 'time'; - } - $bits; -} - -sub import { - shift; - $^H |= bits(@_ ? @_ : qw(status time hushed)); - my $sememe; - - foreach $sememe (@_ ? @_ : qw(exit)) { - $^H{'vmsish_exit'} = 1 if $sememe eq 'exit'; - } -} - -sub unimport { - shift; - $^H &= ~ bits(@_ ? @_ : qw(status time hushed)); - my $sememe; - - foreach $sememe (@_ ? @_ : qw(exit)) { - $^H{'vmsish_exit'} = 0 if $sememe eq 'exit'; - } -} - -1; diff --git a/gnu/usr.bin/perl/vms/ext/vmsish.t b/gnu/usr.bin/perl/vms/ext/vmsish.t deleted file mode 100644 index d63da57235d..00000000000 --- a/gnu/usr.bin/perl/vms/ext/vmsish.t +++ /dev/null @@ -1,146 +0,0 @@ - -BEGIN { unshift @INC, '[-.lib]'; } - -my $Invoke_Perl = qq(MCR $^X "-I[-.lib]"); - -print "1..17\n"; - -#========== vmsish status ========== -`$Invoke_Perl -e 1`; # Avoid system() from a pipe from harness. Mutter. -if ($?) { print "not ok 1 # POSIX status is $?\n"; } -else { print "ok 1\n"; } -{ - use vmsish qw(status); - if (not ($? & 1)) { print "not ok 2 # vmsish status is $?\n"; } - else { print "ok 2\n"; } - { - no vmsish '$?'; # check unimport function - if ($?) { print "not ok 3 # POSIX status is $?\n"; } - else { print "ok 3\n"; } - } - # and lexical scoping - if (not ($? & 1)) { print "not ok 4 # vmsish status is $?\n"; } - else { print "ok 4\n"; } -} -if ($?) { print "not ok 5 # POSIX status is $?\n"; } -else { print "ok 5\n"; } -{ - use vmsish qw(exit); # check import function - if ($?) { print "not ok 6 # POSIX status is $?\n"; } - else { print "ok 6\n"; } -} - -#========== vmsish exit, messages ========== -{ - use vmsish qw(status); - - $msg = do_a_perl('-e "exit 1"'); - if ($msg !~ /ABORT/) { - $msg =~ s/\n/\\n/g; # keep output on one line - print "not ok 7 # subprocess output: |$msg|\n"; - } - else { print "ok 7\n"; } - if ($? & 1) { print "not ok 8 # subprocess VMS status: $?\n"; } - else { print "ok 8\n"; } - - $msg = do_a_perl('-e "use vmsish qw(exit); exit 1"'); - if (length $msg) { - $msg =~ s/\n/\\n/g; # keep output on one line - print "not ok 9 # subprocess output: |$msg|\n"; - } - else { print "ok 9\n"; } - if (not ($? & 1)) { print "not ok 10 # subprocess VMS status: $?\n"; } - else { print "ok 10\n"; } - - $msg = do_a_perl('-e "use vmsish qw(exit); exit 44"'); - if ($msg !~ /ABORT/) { - $msg =~ s/\n/\\n/g; # keep output on one line - print "not ok 11 # subprocess output: |$msg|\n"; - } - else { print "ok 11\n"; } - if ($? & 1) { print "not ok 12 # subprocess VMS status: $?\n"; } - else { print "ok 12\n"; } - - $msg = do_a_perl('-e "use vmsish qw(exit hushed); exit 44"'); - if ($msg =~ /ABORT/) { - $msg =~ s/\n/\\n/g; # keep output on one line - print "not ok 13 # subprocess output: |$msg|\n"; - } - else { print "ok 13\n"; } - -} - - -#========== vmsish time ========== -{ - my($utctime, @utclocal, @utcgmtime, $utcmtime, - $vmstime, @vmslocal, @vmsgmtime, $vmsmtime, - $utcval, $vmaval, $offset); - # Make sure apparent local time isn't GMT - if (not $ENV{'SYS$TIMEZONE_DIFFERENTIAL'}) { - $oldtz = $ENV{'SYS$TIMEZONE_DIFFERENTIAL'}; - $ENV{'SYS$TIMEZONE_DIFFERENTIAL'} = 3600; - eval "END { \$ENV{'SYS\$TIMEZONE_DIFFERENTIAL'} = $oldtz; }"; - gmtime(0); # Force reset of tz offset - } - { - use vmsish qw(time); - $vmstime = time; - @vmslocal = localtime($vmstime); - @vmsgmtime = gmtime($vmstime); - $vmsmtime = (stat $0)[9]; - } - $utctime = time; - @utclocal = localtime($vmstime); - @utcgmtime = gmtime($vmstime); - $utcmtime = (stat $0)[9]; - - $offset = $ENV{'SYS$TIMEZONE_DIFFERENTIAL'}; - - # We allow lots of leeway (10 sec) difference for these tests, - # since it's unlikely local time will differ from UTC by so small - # an amount, and it renders the test resistant to delays from - # things like stat() on a file mounted over a slow network link. - if ($utctime - $vmstime + $offset > 10) { - print "not ok 14 # (time) UTC: $utctime VMS: $vmstime\n"; - } - else { print "ok 14\n"; } - - $utcval = $utclocal[5] * 31536000 + $utclocal[7] * 86400 + - $utclocal[2] * 3600 + $utclocal[1] * 60 + $utclocal[0]; - $vmsval = $vmslocal[5] * 31536000 + $vmslocal[7] * 86400 + - $vmslocal[2] * 3600 + $vmslocal[1] * 60 + $vmslocal[0]; - if ($vmsval - $utcval + $offset > 10) { - print "not ok 15 # (localtime)\n# UTC: @utclocal\n# VMS: @vmslocal\n"; - } - else { print "ok 15\n"; } - - $utcval = $utcgmtime[5] * 31536000 + $utcgmtime[7] * 86400 + - $utcgmtime[2] * 3600 + $utcgmtime[1] * 60 + $utcgmtime[0]; - $vmsval = $vmsgmtime[5] * 31536000 + $vmsgmtime[7] * 86400 + - $vmsgmtime[2] * 3600 + $vmsgmtime[1] * 60 + $vmsgmtime[0]; - if ($vmsval - $utcval + $offset > 10) { - print "not ok 16 # (gmtime)\n# UTC: @utcgmtime\n# VMS: @vmsgmtime\n"; - } - else { print "ok 16\n"; } - - if ($vmsmtime - $utcmtime + $offset > 10) { - print "not ok 17 # (stat) UTC: $utcmtime VMS: $vmsmtime\n"; - } - else { print "ok 17\n"; } -} - -#====== need this to make sure error messages come out, even if -# they were turned off in invoking procedure -sub do_a_perl { - local *P; - open(P,'>vmsish_test.com') || die('not ok ?? : unable to open "vmsish_test.com" for writing'); - print P "\$ set message/facil/sever/ident/text\n"; - print P "\$ define/nolog/user sys\$error _nla0:\n"; - print P "\$ $Invoke_Perl @_\n"; - close P; - my $x = `\@vmsish_test.com`; - unlink 'vmsish_test.com'; - return $x; -} - |