From 1771866f7afe018493c12f00d922f47bd58a664e Mon Sep 17 00:00:00 2001 From: Nick Ing-Simmons Date: Thu, 6 Jun 2002 07:26:11 +0000 Subject: doio.c tweaks - see SV passed to dup type open "looks_like__number" - apply layers to pipe opens. p4raw-id: //depot/perlio@17030 --- doio.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'doio.c') diff --git a/doio.c b/doio.c index decd1885a4..0be42df8c1 100644 --- a/doio.c +++ b/doio.c @@ -254,10 +254,6 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, name = type; len = tend-type; } - else { - if (*type) - goto unknown_desr; - } if (*name == '\0') { /* command is missing 19990114 */ if (ckWARN(WARN_PIPE)) @@ -285,6 +281,13 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, else { fp = PerlProc_popen(name,mode); } + if (num_svs) { + if (*type) { + if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) { + goto say_false; + } + } + } } else if (*type == IoTYPE_WRONLY) { TAINT_PROPER("open"); @@ -320,7 +323,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if (num_svs > 1) { Perl_croak(aTHX_ "More than one argument to '%c&' open",IoTYPE(io)); } - if (num_svs && SvIOK(*svp)) { + if (num_svs && (SvIOK(*svp) || (SvPOK(*svp) && looks_like_number(*svp)))) { fd = SvUV(*svp); } else if (isDIGIT(*type)) { @@ -487,6 +490,14 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, fp = PerlProc_popen(name,mode); } IoTYPE(io) = IoTYPE_PIPE; + if (num_svs) { + for (; isSPACE(*type); type++) ; + if (*type) { + if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) { + goto say_false; + } + } + } } else { if (num_svs) -- cgit v1.2.1