Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <009901c2548f$bd68be50$ba98a5d8@msrv>
From: "Joe Hagen" <jdhagen@chorus.net>
To: <cygwin@cygwin.com>
References: <200209041400.g84E0T2H015234@im1.sec.tds.net> <3D7625E2.8040109@DeFaria.com> <3D7661BE.3000903@Salira.com>
Subject: Re: File reading problem with -mno-cygwin
Date: Wed, 4 Sep 2002 22:53:03 -0500
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Andrew DeFaria wrote:
> 
> One question remains however and that is why would it work in Cygwin
> but not in -mno-cygwin? My theory is that opening a file with "r"
> under Cygwin is equivalent to "rb".

Andrew,

Using the -mno-cygwin option directs the code to link
against MSVCRT.DLL, so Cygwin is bypassed completely.

If you examine the Microsoft C runtime source, you'll see that
they explicitly check for a CTRL-Z as an end-of-file marker
if a file is opened in text mode.  I think this behavior, along with
the LF to CRLF conversions, is an extension that is done by
Microsoft if you're in text mode.  

I don't believe the Cygwin runtime treats CTRL-Z as a special case,
which explains the difference.

The CTRL-Z as EOF was a leftover from CP/M, but got propgated
into MSDOS/Windows.


Joe


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

