delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/04/27/23:15:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
From: Chris Faylor <cgf AT cygnus DOT com>
Date: Fri, 28 Apr 2000 00:15:56 -0400
To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: How is textmode/binmode determined in Cygwin 1.1.0 net releas e for pipes?
Message-ID: <20000428001556.A1356@cygnus.com>
Reply-To: cygwin AT sourceware DOT cygnus DOT com
Mail-Followup-To: cgf AT cygnus DOT com,
"'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
References: <1DB8BA4BAC88D3118B2300508B5A552C0C8CDB AT mail DOT fitlinxx DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.1.12i
In-Reply-To: <1DB8BA4BAC88D3118B2300508B5A552C0C8CDB@mail.fitlinxx.com>; from db3l@fitlinxx.com on Thu, Apr 27, 2000 at 11:51:50PM -0400
Note-from-DJ: This may be spam

On Thu, Apr 27, 2000 at 11:51:50PM -0400, David Bolen wrote:
>I suppose my question can be rephrased as whether or not 1.1.0 changed
>the default behavior for pipes from b20.1 (without any CYGWIN
>environment setting)?  It was my understanding that the default should
>be binary, and that's how my previous b20.1 seemed to be working.  But
>1.1.0 seems to instead be defaulting to text.  This would be for pipes
>opened via the pipe() call, thus without any particular O_* flags.

The test below indicates that pipes are being opened in binmode by
default.

And, here's another observation.  The best way to answer a question like
"How does xxx work" is to write a test case which exercises 'xxx'.  This
is even better than reading the source for 'xxx'.

cgf

#include <time.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include <sys/times.h>

main(int argc, char **argv)
{
  int pipes[2];
  char buf[80];
  pipe(pipes);
  setmode(pipes[1], O_BINARY);
  write(pipes[1], "hello\r\n", 7);
  printf ("%d = read(%d...)\n", read(pipes[0], buf, 80), pipes[0]);
}

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019