summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-11-23 19:46:23 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-11-23 19:46:23 +0000
commit60382766f71ec2a2d8e34a951c5c77b494bd86bb (patch)
tree3301dd4ff8ec6f8c55a06624af02d30bb5bf26be /pp_sys.c
parent99efab1281ccea6f7df2a4d0affc5479291e2350 (diff)
downloadperl-60382766f71ec2a2d8e34a951c5c77b494bd86bb.tar.gz
Implement PerlIO_binmode()
Fix PerlIOCrlf_unread() (*--ptr rather than *ptr-- ...) Test on UNIX with PERLIO="perlio crlf" to mimic Win32, make binmode in t/lib/io_tell.t unconditional so that works. Checkin just so Win32 machine can see these changes. p4raw-id: //depot/perlio@7842
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 2194653a1f..88ce86c1c0 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -687,11 +687,14 @@ PP(pp_binmode)
PerlIO *fp;
MAGIC *mg;
SV *discp = Nullsv;
+ STRLEN len = 0;
+ char *names = NULL;
if (MAXARG < 1)
RETPUSHUNDEF;
- if (MAXARG > 1)
+ if (MAXARG > 1) {
discp = POPs;
+ }
gv = (GV*)POPs;
@@ -712,7 +715,12 @@ PP(pp_binmode)
if (!(io = GvIO(gv)) || !(fp = IoIFP(io)))
RETPUSHUNDEF;
- if (do_binmode(fp,IoTYPE(io),mode_from_discipline(discp)))
+ if (discp) {
+ names = SvPV(discp,len);
+ }
+
+ if (PerlIO_binmode(aTHX_ fp,IoTYPE(io),mode_from_discipline(discp),
+ (discp) ? SvPV_nolen(discp) : Nullch))
RETPUSHYES;
else
RETPUSHUNDEF;
@@ -3137,7 +3145,7 @@ PP(pp_fttext)
(void)PerlIO_close(fp);
RETPUSHUNDEF;
}
- do_binmode(fp, '<', O_BINARY);
+ PerlIO_binmode(aTHX_ fp, '<', O_BINARY, Nullch);
len = PerlIO_read(fp, tbuf, sizeof(tbuf));
(void)PerlIO_close(fp);
if (len <= 0) {