summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-06-26 11:55:59 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-26 11:55:59 +0000
commit2b96b0a587f7ad8b6305181755f2d821e8a640ff (patch)
tree4fa292494ffb6e8f53d5584008e5ba23e6fe8cd6 /util.c
parent8dbfbba0c55b52c9acc258d9a3522ce8b76c3497 (diff)
downloadperl-2b96b0a587f7ad8b6305181755f2d821e8a640ff.tar.gz
DJGPP patches from Laszlo Molnar.
p4raw-id: //depot/perl@10951
Diffstat (limited to 'util.c')
-rw-r--r--util.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/util.c b/util.c
index 1cab029d6e..ab8356eab7 100644
--- a/util.c
+++ b/util.c
@@ -2051,7 +2051,7 @@ Perl_my_popen(pTHX_ char *cmd, char *mode)
return PerlIO_fdopen(p[This], mode);
}
#else
-#if defined(atarist) || defined(DJGPP)
+#if defined(atarist)
FILE *popen();
PerlIO *
Perl_my_popen(pTHX_ char *cmd, char *mode)
@@ -2063,6 +2063,20 @@ Perl_my_popen(pTHX_ char *cmd, char *mode)
*/
return PerlIO_importFILE(popen(cmd, mode), 0);
}
+#else
+#if defined(DJGPP)
+FILE *djgpp_popen();
+PerlIO *
+Perl_my_popen(pTHX_ char *cmd, char *mode)
+{
+ PERL_FLUSHALL_FOR_CHILD;
+ /* Call system's popen() to get a FILE *, then import it.
+ used 0 for 2nd parameter to PerlIO_importFILE;
+ apparently not used
+ */
+ return PerlIO_importFILE(djgpp_popen(cmd, mode), 0);
+}
+#endif
#endif
#endif /* !DOSISH */
@@ -2367,7 +2381,7 @@ Perl_pidgone(pTHX_ Pid_t pid, int status)
return;
}
-#if defined(atarist) || defined(OS2) || defined(DJGPP)
+#if defined(atarist) || defined(OS2)
int pclose();
#ifdef HAS_FORK
int /* Cannot prototype with I32
@@ -2381,9 +2395,20 @@ Perl_my_pclose(pTHX_ PerlIO *ptr)
/* Needs work for PerlIO ! */
FILE *f = PerlIO_findFILE(ptr);
I32 result = pclose(f);
+ PerlIO_releaseFILE(ptr,f);
+ return result;
+}
+#endif
+
#if defined(DJGPP)
+int djgpp_pclose();
+I32
+Perl_my_pclose(pTHX_ PerlIO *ptr)
+{
+ /* Needs work for PerlIO ! */
+ FILE *f = PerlIO_findFILE(ptr);
+ I32 result = djgpp_pclose(f);
result = (result << 8) & 0xff00;
-#endif
PerlIO_releaseFILE(ptr,f);
return result;
}