delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/30/14:55:53

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
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 30 Mar 2004 14:54:31 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Mike Spertus <Mike DOT Spertus AT veritas DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Cygwin perl not understanding textmode
In-Reply-To: <4069CAB5.2000603@veritas.com>
Message-ID: <Pine.GSO.4.56.0403301441410.1185@slinky.cs.nyu.edu>
References: <4069CAB5 DOT 2000603 AT veritas DOT com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

Mike,

Please make sure your mailer respects the "Reply-To" header -- I set it
for a reason.

All Cygwin-related correspondence should be sent to the appropriate Cygwin
mailing list (see <http://cygwin.com/lists.html>, or use alternate access
mechanisms, such as the gmane.org mail-to-news gateway).  Sending personal
e-mail is frowned upon unless specifically requested.  Not only will using
the mailing lists get you access to more expertise than any one person can
provide, but all posts are actually archived to serve as reference for
future users with similar problems.

More below.

On Tue, 30 Mar 2004, Mike Spertus wrote:

> Igor Pechtchanski wrote:
> > On Tue, 30 Mar 2004, Mike Spertus wrote:
> >
> >> I have installed Cygwin with DOS linebreaks (i.e., disks mounted in
> >> textmode). However, Cygwin perl doesn't seem to understand this as shown
> >> below. How do I tell Cygwin perl to respect textmode?:
> >>
> >> MPS AT MPS-2000 ~
> >> $ od -t x1 foo.txt
> >> 0000000 66 6f 6f 62 61 72 0d 0a 66 6f 6f 62 61 7a 0d 0a
> >> 0000020 66 6f 6f 62 61 74 0d 0a 0d 0a
> >> 0000032
> >>
> >> MPS AT MPS-2000 ~
> >> $ cat ~/foo.txt | perl -e 'while (<>) {print;}' >bar.txt
> >>
> >> MPS AT MPS-2000 ~
> >> $ od -t x1 bar.txt
> >> 0000000 66 6f 6f 62 61 72 0d 0d 0a 66 6f 6f 62 61 7a 0d
> >> 0000020 0d 0a 66 6f 6f 62 61 74 0d 0d 0a 0d 0d 0a
> >> 0000036
> >>
> >> MPS AT MPS-2000 ~
> >> $ mount
> >> C:\cygwin\bin on /usr/bin type system (textmode)
> >> C:\cygwin\lib on /usr/lib type system (textmode)
> >> C:\cygwin on / type system (textmode)
> >> c: on /cygdrive/c type user (textmode,noumount)
> >> g: on /cygdrive/g type user (textmode,noumount)
> >> r: on /cygdrive/r type user (textmode,noumount)
> >>
> >> Is this a bug? Any suggestions?
> >>
> >> Thanks,
> >> Mike
> >
> > When you use pipes, you lose the mount mode information.  Try running
> >
> > $ perl -e 'while (<>) {print;}' <~/foo.txt >bar.txt
> >
> > instead.  For controlling the mode of pipes, read about the "(no)binmode"
> > option at <http://cygwin.com/cygwin-ug-net/using-cygwinenv.html>.
> >	Igor
>
> I tried running your command, and exactly the same problem occurred :(
> In fact, my original perl script that I simplified in the post actually
> got the filename from the command line.
>
> Mike

IIRC, this was remedied by setting PERLIO="crlf" in your environment.
IOW, I was able to reproduce your problem, but running

$ PERLIO=crlf perl -pe '' <foo.txt > bar.txt

worked.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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