summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doio.c46
-rw-r--r--mathoms.c46
2 files changed, 46 insertions, 46 deletions
diff --git a/doio.c b/doio.c
index 63866ba12a..21bf98c381 100644
--- a/doio.c
+++ b/doio.c
@@ -937,52 +937,6 @@ Perl_nextargv(pTHX_ register GV *gv)
return Nullfp;
}
-#ifdef HAS_PIPE
-void
-Perl_do_pipe(pTHX_ SV *sv, GV *rgv, GV *wgv)
-{
- register IO *rstio;
- register IO *wstio;
- int fd[2];
-
- if (!rgv)
- goto badexit;
- if (!wgv)
- goto badexit;
-
- rstio = GvIOn(rgv);
- wstio = GvIOn(wgv);
-
- if (IoIFP(rstio))
- do_close(rgv,FALSE);
- if (IoIFP(wstio))
- do_close(wgv,FALSE);
-
- if (PerlProc_pipe(fd) < 0)
- goto badexit;
- IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE);
- IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE);
- IoOFP(rstio) = IoIFP(rstio);
- IoIFP(wstio) = IoOFP(wstio);
- IoTYPE(rstio) = IoTYPE_RDONLY;
- IoTYPE(wstio) = IoTYPE_WRONLY;
- if (!IoIFP(rstio) || !IoOFP(wstio)) {
- if (IoIFP(rstio)) PerlIO_close(IoIFP(rstio));
- else PerlLIO_close(fd[0]);
- if (IoOFP(wstio)) PerlIO_close(IoOFP(wstio));
- else PerlLIO_close(fd[1]);
- goto badexit;
- }
-
- sv_setsv(sv,&PL_sv_yes);
- return;
-
-badexit:
- sv_setsv(sv,&PL_sv_undef);
- return;
-}
-#endif
-
/* explicit renamed to avoid C++ conflict -- kja */
bool
Perl_do_close(pTHX_ GV *gv, bool not_implicit)
diff --git a/mathoms.c b/mathoms.c
index 8a42e63927..3c92a423f6 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -652,6 +652,52 @@ Perl_do_exec(pTHX_ const char *cmd)
}
#endif
+#ifdef HAS_PIPE
+void
+Perl_do_pipe(pTHX_ SV *sv, GV *rgv, GV *wgv)
+{
+ register IO *rstio;
+ register IO *wstio;
+ int fd[2];
+
+ if (!rgv)
+ goto badexit;
+ if (!wgv)
+ goto badexit;
+
+ rstio = GvIOn(rgv);
+ wstio = GvIOn(wgv);
+
+ if (IoIFP(rstio))
+ do_close(rgv,FALSE);
+ if (IoIFP(wstio))
+ do_close(wgv,FALSE);
+
+ if (PerlProc_pipe(fd) < 0)
+ goto badexit;
+ IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE);
+ IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE);
+ IoOFP(rstio) = IoIFP(rstio);
+ IoIFP(wstio) = IoOFP(wstio);
+ IoTYPE(rstio) = IoTYPE_RDONLY;
+ IoTYPE(wstio) = IoTYPE_WRONLY;
+ if (!IoIFP(rstio) || !IoOFP(wstio)) {
+ if (IoIFP(rstio)) PerlIO_close(IoIFP(rstio));
+ else PerlLIO_close(fd[0]);
+ if (IoOFP(wstio)) PerlIO_close(IoOFP(wstio));
+ else PerlLIO_close(fd[1]);
+ goto badexit;
+ }
+
+ sv_setsv(sv,&PL_sv_yes);
+ return;
+
+badexit:
+ sv_setsv(sv,&PL_sv_undef);
+ return;
+}
+#endif
+
/*
* Local variables:
* c-indentation-style: bsd