diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-26 11:55:59 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-26 11:55:59 +0000 |
commit | 2b96b0a587f7ad8b6305181755f2d821e8a640ff (patch) | |
tree | 4fa292494ffb6e8f53d5584008e5ba23e6fe8cd6 | |
parent | 8dbfbba0c55b52c9acc258d9a3522ce8b76c3497 (diff) | |
download | perl-2b96b0a587f7ad8b6305181755f2d821e8a640ff.tar.gz |
DJGPP patches from Laszlo Molnar.
p4raw-id: //depot/perl@10951
-rw-r--r-- | djgpp/djgpp.c | 5 | ||||
-rw-r--r-- | perl.c | 4 | ||||
-rw-r--r-- | util.c | 31 |
3 files changed, 33 insertions, 7 deletions
diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c index 4e390cfc59..f235421ae3 100644 --- a/djgpp/djgpp.c +++ b/djgpp/djgpp.c @@ -1,3 +1,4 @@ +#define PERLIO_NOT_STDIO 0 #include <libc/stubs.h> #include <io.h> #include <errno.h> @@ -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 */ @@ -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 } @@ -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; } |