From: Jarkko Hietaniemi Date: Tue, 26 Jun 2001 11:55:59 +0000 (+0000) Subject: DJGPP patches from Laszlo Molnar. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b96b0a587f7ad8b6305181755f2d821e8a640ff;p=p5sagit%2Fp5-mst-13.2.git DJGPP patches from Laszlo Molnar. p4raw-id: //depot/perl@10951 --- diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c index 4e390cf..f235421 100644 --- a/djgpp/djgpp.c +++ b/djgpp/djgpp.c @@ -1,3 +1,4 @@ +#define PERLIO_NOT_STDIO 0 #include #include #include @@ -27,7 +28,7 @@ struct pipe_list { static struct pipe_list *pl = NULL; FILE * -popen (const char *cm, const char *md) /* program name, pipe mode */ +djgpp_popen (const char *cm, const char *md) /* program name, pipe mode */ { struct pipe_list *l1; int fd; @@ -75,7 +76,7 @@ popen (const char *cm, const char *md) /* program name, pipe mode */ } int -pclose (FILE *pp) +djgpp_pclose (FILE *pp) { struct pipe_list *l1, **l2; /* list pointers */ int retval=-1; /* function return value */ diff --git a/perl.c b/perl.c index 34da642..7bb7dee 100644 --- a/perl.c +++ b/perl.c @@ -226,8 +226,8 @@ perl_construct(pTHXx) * space. The other alternative would be to provide STDAUX and STDPRN * filehandles. */ - (void)fclose(stdaux); - (void)fclose(stdprn); + (void)PerlIO_close(PerlIO_importFILE(stdaux, 0)); + (void)PerlIO_close(PerlIO_importFILE(stdprn, 0)); #endif } diff --git a/util.c b/util.c index 1cab029..ab8356e 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; }