www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/05/23/05:01:20

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
Message-ID: <3CECAFE4.4090703@ece.gatech.edu>
Date: Thu, 23 May 2002 05:01:24 -0400
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
X-Accept-Language: en-us
MIME-Version: 1.0
To: "Peter A. Castro" <doctor AT fruitbat DOT org>
CC: Matthew Smith <matts AT bluesguitar DOT org>, cygwin-apps AT cygwin DOT com
Subject: Re: new package offering: zsh
References: <Pine DOT LNX DOT 4 DOT 21 DOT 0205222346480 DOT 12767-100000 AT gremlin DOT fruitbat DOT org>

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.

But, an ounce of experience is worth a pound of theory...all I've got is 
theory. :-)


--Chuck




- Raw text -


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