delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/21/08:30:11

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Apparently-From: <earnie?boyd AT yahoo DOT com>
Message-ID: <3AB8ACA7.B58AAC75@yahoo.com>
Date: Wed, 21 Mar 2001 08:29:11 -0500
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
Reply-To: cygwin AT sources DOT redhat DOT com
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Mark Allan Young <myoung AT intrinsic DOT com>
CC: cygwin AT sources DOT redhat DOT com
Subject: Re: Perl: Textmode vs. Binary mode...
References: <BMEKKMFHJODGNCJOKKBFKEJHCJAA DOT myoung AT intrinsic DOT com>

Mark Allan Young wrote:
> 
> if I open a open a file using the perl command:
> 
>      unless(open(CONFIG, "<$config")) {
>          print("Error: Can't open fglg file, \"$config\".\n");
>          exit(-1);
>      }
> 
> on a file system mounted with textmode:
> 
>     Device              Directory           Type         Flags
>     C:\cygwin\bin       /usr/bin            system       textmode
>     C:\cygwin\lib       /usr/lib            system       textmode
>     C:\cygwin           /                   system       textmode
> 
> should I expect the line read with perl command:
> 
>     while($line = <CONFIG>) {
> 
> to be terminated with a "\r\n" or just a "\n".  I assumed that I would
> get a "\n", but for some reason, after updating my cygwin today on one
> of my systems to 1.1.8, I started getting "\r\n".  I used to use a single
> "chop($line)" to get rid of the newline then process the remaining string
> as a filename...but now I have that nagging "\r" at the end of the string
> screwing everything up...
> 
> what part of this equation am I missing...
> 

The textmode mount produces files with \r\n line endings unless the
program specifically opens the file in or resets the fd to binary
processing mode.  The binmode mount produces files with \n line endings
unless the program specifically opens the file in or resets the fd to
text processing mode.

Earnie.

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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