diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-20 19:42:30 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-01-20 19:42:30 +0000 |
commit | a567e93b903bc9849952c06533059c2f2e2fb226 (patch) | |
tree | a93a49d4b98bf39c527f7d33fb2568de0fc2c201 /doio.c | |
parent | 3b6eb69b03afe7feeb11252d06d9daecc9c262f1 (diff) | |
download | perl-a567e93b903bc9849952c06533059c2f2e2fb226.tar.gz |
Infrastructure to allow:
open($fh,"|-",@array);
to be implemented
i.e. mark pp_open as needing a stack mark, and make pp_open
process its args in that style (and pass them _all_ to tied handles OPEN).
Invent do_openn() which takes SV ** at allow it to see multiple args.
Note this does not _do_ anything yet.
p4raw-id: //depot/perlio@8484
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -55,8 +55,8 @@ bool Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp) { - return do_open9(gv, name, len, as_raw, rawmode, rawperm, - supplied_fp, Nullsv, 0); + return do_openn(gv, name, len, as_raw, rawmode, rawperm, + supplied_fp, (SV **) NULL, 0); } bool @@ -64,6 +64,15 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs, I32 num_svs) { + return do_openn(gv, name, len, as_raw, rawmode, rawperm, + supplied_fp, &svs, 1); +} + +bool +Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw, + int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, + I32 num_svs) +{ register IO *io = GvIOn(gv); PerlIO *saveifp = Nullfp; PerlIO *saveofp = Nullfp; @@ -77,6 +86,7 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, char *type = NULL; char *deftype = NULL; char mode[4]; /* stdio file mode ("r\0", "rb\0", "r+b\0" etc.) */ + SV *svs = (num_svs) ? *svp : Nullsv; Zero(mode,sizeof(mode),char); PL_forkprocess = 1; /* assume true if no fork */ @@ -529,6 +539,7 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, if (type) { while (isSPACE(*type)) type++; if (*type) { + errno = 0; if (PerlIO_apply_layers(aTHX_ IoIFP(io),mode,type) != 0) { goto say_false; } |