This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: new package offering: zsh
- From: "Peter A. Castro" <doctor at fruitbat dot org>
- To: Charles Wilson <cwilson at ece dot gatech dot edu>
- Cc: Matthew Smith <matts at bluesguitar dot org>, cygwin-apps at cygwin dot com
- Date: Fri, 24 May 2002 13:02:27 -0700 (PDT)
- Subject: Re: new package offering: zsh
On Thu, 23 May 2002, Charles Wilson wrote:
> Peter A. Castro wrote:
>
> > On Wed, 22 May 2002, Charles Wilson wrote:
> >
> >>No -- if zsh can handle cr+lf internally, then let it do so. Explicitly
> >>open function files in binary mode -- this will override the "textmode
> >>mount" which sets the default read mode.
> >
> > zsh uses the open() call, not fopen(). There is no "binary" vs. "text"
> > mode to specify. Theoretically, open() should be opening the file in
> > binary mode already (ie: no text translation/interpretation), yet the
> > data read in clearly is being cooked under some scenarios. No, if I
> > understand how things are work here, I believe the carriage control
> > processing is being done at the filesystem level, which is below open()
> > and beyond my control.
> > But, like I said, if this causes enough trouble for people, I'll update
> > the code to be more relaxed on the size checking.
>
> You can use the "O_BINARY" flag in open() calls -- but since some
> platforms don't define it, you must include something like
>
> #ifndef O_BINARY
> #define O_BINARY 0
> #endif
>
> somewhere in zsh's header files....
>
> open() will still obey the default mount mode settings of the underlying
> cygwin system; that is, if the file is on a text mount, it will be
> opened using CR/LF-->LF translation. If the file is on a binary mount,
> it will be opened in O_BINARY mode.
>
> include O_BINARY in your open call to force binary mode on the file.
I'll give this a try, as it has the virtue of making the stream read in
as-is and is an attribute of the open() call. Also, Egor Duda suggested
using setmode(), but I don't see a manpage for this function (but did
find the prototype in io.h).
> But, an ounce of experience is worth a pound of theory...all I've got is
> theory. :-)
You are wise beyond your ears :-)
> --Chuck
--
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
"Cats are just autistic Dogs" -- Dr. Tony Attwood