This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How is textmode/binmode determined in Cygwin 1.1.0 net releas e for pipes?


Hmm, that does seem to run locally properly (although of course you've got
to take out the setmode to actually test "default" behavior) - perplexing
since I know that adding CYGWIN=binmode resolved the behavior that I
previously saw.  I'll have to look more closely at the remote system (since
that's where the writing was going on) to see if I can figure out what was
up when the pipe was used within the larger application.

In terms of your observation, I should point out that the best way to handle
things is to find a reference (someone or something) that already has the
answer, and thus minimize the amount of work you have to do - laziness being
one of a developer's hallmarks.

However, that doesn't mean just replacing your effort with someone else's,
so I appreciate your taking the time to check this out.  Thanks.

-- David 

-----Original Message-----
From: Chris Faylor [mailto:cgf@cygnus.com]
Sent: Friday, April 28, 2000 12:16 AM
To: 'cygwin@sourceware.cygnus.com'
Subject: Re: How is textmode/binmode determined in Cygwin 1.1.0 net
releas e for pipes?


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@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]