delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/05/15:53:14

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <009901c2548f$bd68be50$ba98a5d8@msrv>
From: "Joe Hagen" <jdhagen AT chorus DOT net>
To: <cygwin AT cygwin DOT com>
References: <200209041400 DOT g84E0T2H015234 AT im1 DOT sec DOT tds DOT net> <3D7625E2 DOT 8040109 AT DeFaria DOT com> <3D7661BE DOT 3000903 AT Salira DOT com>
Subject: Re: File reading problem with -mno-cygwin
Date: Wed, 4 Sep 2002 22:53:03 -0500
MIME-Version: 1.0
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/

- Raw text -


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