develooper Front page | perl.perl5.porters | Postings from August 2003

[PATCH] maint / blead tweaks in perlio.c for Cygwin

Thread Next
From:
Gerrit P. Haase
Date:
August 27, 2003 23:13
Subject:
[PATCH] maint / blead tweaks in perlio.c for Cygwin
Message ID:
4157199551.20030828081851@familiehaase.de
Hallo Jarkko,

currently I'm applying one additional patch to the perl sources when
building for Cygwin.  There seems to be a problem with binmode() since
I removed Cygwin from the DOSISH platforms, see e.g. this bug report:
http://www.cygwin.com/ml/cygwin/2003-08/msg01409.html

The patch is 'donated' by Don Slutz which he found during his research
he did because of a bug which he also reported:
http://rt.perl.org/rt2/Ticket/Display.html?id=10007

He also donated a little testsuite to test different perlio
settings on Cygwin textmode and binmode mounts and it works pretty
well with his patch applied.

Though, would be interesting to hear from NIS about this change, if it
makes sense and what it does at all since I cannot claim to understand
this and most of the rest of perlio.

If this patch gets applied, RT #10007 can be closed.

--- perl-5.8.1/perlio.c~        2003-07-13 02:51:57.000000000 +0200
+++ perl-5.8.1/perlio.c 2003-07-13 02:55:48.000000000 +0200
@@ -2484,7 +2484,7 @@ PerlIOStdio_mode(const char *mode, char 
     while (*mode) {
        *tmode++ = *mode++;
     }
-#ifdef PERLIO_USING_CRLF
+#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
     *tmode++ = 'b';
 #endif
     *tmode = '\0';
@@ -2585,15 +2585,23 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *sel
                fd = PerlLIO_open3(path, imode, perm);
            }
            else {
+#ifdef __CYGWIN__
+        FILE *stdio = PerlSIO_fopen(path, (mode = PerlIOStdio_mode(mode, tmode)));
+#else
                FILE *stdio = PerlSIO_fopen(path, mode);
+#endif
                if (stdio) {
                    PerlIOStdio *s;
                    if (!f) {
                        f = PerlIO_allocate(aTHX);
                    }
+#ifdef __CYGWIN__
+            if ((f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) {
+#else
                    if ((f = PerlIO_push(aTHX_ f, self,
                                    (mode = PerlIOStdio_mode(mode, tmode)),
                                    PerlIOArg))) {
+#endif
                        s = PerlIOSelf(f, PerlIOStdio);
                        s->stdio = stdio;
                        PerlIOUnix_refcnt_inc(fileno(s->stdio));

# END

  
Gerrit
-- 
=^..^=


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About