delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/21/12:31:56

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
Message-ID: <11503095.985195863961.JavaMail.imail@spike.excite.com>
Date: Wed, 21 Mar 2001 09:31:00 -0800 (PST)
From: Bob Heckel <BHeckel AT excite DOT com>
Reply-To: <bheckel AT _PROCESSEDMEAT_excite DOT com>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: Perl: Textmode vs. Binary mode...
Mime-Version: 1.0
X-Mailer: Excite Inbox
X-Sender-Ip: 47.234.0.51

I don't think this is a Cygwin issue but it will probably
occur more frequently in a Cygwin environment.

If CONFIG was written on a Unix machine, the records will
terminate with <LF> and "chomp" will remove it.

If CONFIG was written on a Windows machine, the records will
terminate with <CR><LF> and "chomp" will take the <LF>
out and leave the <CR>.

Use this instead of "chomp" so that you don't have to
worry about it:

  s/[\r\n]+$//;	# remove <CR> and/or <LF> from the end of $_

Bob Heckel

On Tue, 20 Mar 2001 23:29:10 -0800 Mark Allan Young writes:
> 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 =3D <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... 





_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



--
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