diff options
author | Peter Prymmer <PPrymmer@factset.com> | 2001-06-22 12:08:23 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-23 03:29:04 +0000 |
commit | 493ba88a837f5a6b31674dce8a7f80c8b594af17 (patch) | |
tree | be319a87819e628d687ac7c4dc53b2703846ed5a /vms/ext/Stdio | |
parent | 91e5ac1f8a0d22b86589cdd756c0172cc6d41af6 (diff) | |
download | perl-493ba88a837f5a6b31674dce8a7f80c8b594af17.tar.gz |
build (and test!) VMS::Stdio on VMS
Message-ID: <Pine.OSF.4.10.10106221903270.24012-100000@aspara.forte.com>
p4raw-id: //depot/perl@10850
Diffstat (limited to 'vms/ext/Stdio')
-rw-r--r-- | vms/ext/Stdio/Stdio.xs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/vms/ext/Stdio/Stdio.xs b/vms/ext/Stdio/Stdio.xs index 9b61c590c0..64bd75017a 100644 --- a/vms/ext/Stdio/Stdio.xs +++ b/vms/ext/Stdio/Stdio.xs @@ -128,12 +128,16 @@ binmode(fh) SV * fh PROTOTYPE: $ CODE: - IO *io = sv_2io(fh); - PerlIO *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; + 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; } @@ -169,7 +173,7 @@ binmode(fh) acmode = "rb+"; } /* appearances to the contrary, this is an freopen substitute */ - SV *name = sv_2mortal(newSVpvn(filespec,strlen(filespec))); + name = sv_2mortal(newSVpvn(filespec,strlen(filespec))); if (PerlIO_openn(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); } @@ -291,6 +295,7 @@ 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; @@ -344,8 +349,8 @@ vmsopen(spec,...) } if (fp != Null(FILE*)) { pio_fp = PerlIO_importFILE(fp,0); - SV *fh = newFH(pio_fp,(mode[1] ? '+' : (mode[0] == 'r' ? '<' : (mode[0] == 'a' ? 'a' : '>')))); - ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); + 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; } @@ -404,8 +409,8 @@ vmssysopen(spec,mode,perm,...) if (fd >= 0 && ((fp = fdopen(fd, &("r\000w\000r+"[2*i]))) != Null(FILE*))) { pio_fp = PerlIO_importFILE(fp,0); - SV *fh = newFH(pio_fp,"<>++"[i]); - ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); + fh = newFH(pio_fp,"<>++"[i]); + ST(0) = (fh ? sv_2mortal(fh) : &PL_sv_undef); } else { ST(0) = &PL_sv_undef; } |