Change 11747 by nick@camel-linux on 2001/08/25 14:52:33

        Subject:  [PATCH] (was Re: PerlIO regerssion tests?)
        From:  Nicholas Clark <[EMAIL PROTECTED]>
        Date:  Wed, 22 Aug 2001 23:29:06 +0100
        Message-Id:  <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/perlio.c#117 edit
... //depot/perl/pod/perlfunc.pod#254 edit
... //depot/perl/t/io/binmode.t#1 add

Differences ...

==== //depot/perl/perlio.c#117 (text) ====
Index: perl/perlio.c
--- perl/perlio.c.~1~   Sat Aug 25 09:00:05 2001
+++ perl/perlio.c       Sat Aug 25 09:00:05 2001
@@ -1968,7 +1968,10 @@
   {
    PerlIOUnix *s = PerlIOSelf(f,PerlIOUnix);
    s->fd     = PerlIO_fileno(PerlIONext(f));
-   s->oflags = PerlIOUnix_oflags(mode);
+   /* XXX could (or should) we retrieve the oflags from the open file handle
+      rather than believing the "mode" we are passed in?
+      XXX Should the value on NULL mode be 0 or -1?  */
+   s->oflags = mode ? PerlIOUnix_oflags(mode) : -1;
   }
  PerlIOBase(f)->flags |= PERLIO_F_OPEN;
  return code;

==== //depot/perl/pod/perlfunc.pod#254 (text) ====
Index: perl/pod/perlfunc.pod
--- perl/pod/perlfunc.pod.~1~   Sat Aug 25 09:00:05 2001
+++ perl/pod/perlfunc.pod       Sat Aug 25 09:00:05 2001
@@ -450,13 +450,12 @@
 text files.  If FILEHANDLE is an expression, the value is taken as the
 name of the filehandle.  DISCIPLINE can be either of C<":raw"> for
 binary mode or C<":crlf"> for "text" mode.  If the DISCIPLINE is
-omitted, it defaults to C<":raw">.
+omitted, it defaults to C<":raw">.  Returns true on success, C<undef> on
+failure.
 
 binmode() should be called after open() but before any I/O is done on
 the filehandle.
 
-On many systems binmode() currently has no effect, but in future, it
-will be extended to support user-defined input and output disciplines.
 On some systems binmode() is necessary when you're not working with a
 text file.  For the sake of portability it is a good idea to always use
 it when appropriate, and to never use it when it isn't appropriate.

==== //depot/perl/t/io/binmode.t#1 (text) ====
Index: perl/t/io/binmode.t
--- perl/t/io/binmode.t.~1~     Sat Aug 25 09:00:05 2001
+++ perl/t/io/binmode.t Sat Aug 25 09:00:05 2001
@@ -0,0 +1,20 @@
+#!./perl -w
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+
+use Test::More tests => 8;
+
+ok( binmode(STDERR),            'STDERR made binary' );
+ok( binmode(STDERR, ":unix"),   '  with unix discipline' );
+ok( binmode(STDERR, ":raw"),    '  raw' );
+ok( binmode(STDERR, ":crlf"),   '  and crlf' );
+
+# If this one fails, we're in trouble.  So we just bail out.
+ok( binmode(STDOUT),            'STDOUT made binary' )      || exit(1);
+ok( binmode(STDOUT, ":unix"),   '  with unix discipline' );
+ok( binmode(STDERR, ":raw"),    '  raw' );
+ok( binmode(STDERR, ":crlf"),   '  and crlf' );
End of Patch.

Reply via email to