This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin perl not understanding textmode
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Mike Spertus <mike dot spertus at veritas dot com>
- Cc: cygwin at cygwin dot com
- Date: Tue, 30 Mar 2004 14:17:01 -0500 (EST)
- Subject: Re: Cygwin perl not understanding textmode
- References: <4069B183.90902@veritas.com>
- Reply-to: cygwin at cygwin dot com
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@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@MPS-2000 ~
> $ cat ~/foo.txt | perl -e 'while (<>) {print;}' >bar.txt
>
> MPS@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@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
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.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/