Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com From: "Gerrit P. Haase" Organization: Esse keine toten Tiere To: cygwin-apps AT cygwin DOT com Date: Sat, 25 Aug 2001 22:58:17 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: perl + automode.o Reply-to: gp AT familiehaase DOT de Message-ID: <3B882D89.13672.DA694A2@localhost> In-reply-to: <20010825142856.Q21709@redhat.com> References: <3B87E775 DOT 8080100 AT ece DOT gatech DOT edu>; from cwilson AT ece DOT gatech DOT edu on Sat, Aug 25, 2001 at 01:59:17PM -0400 X-mailer: Pegasus Mail for Win32 (v3.12cDE) X-Hops: 1 X-Sender: 320081107336-0001 AT t-dialin DOT net Charles Wilson schrieb am 2001-08-25, 13:59: >(1) Using Unix-line-endings on Unix(binary) mounts: > no problem >(2) Using DOS-line-endings on DOS(text) mounts > no problem? Seems to work. >(3) Using Unix-line-endings on DOS(text) mounts > no problems reading, but output files get extraneous ^M's on disk. > That's okay though, because perl can still read them in (case >2 above) Seems to work o.k. >(4) Using DOS-line-endings on binary mounts > main problem. Huh, could you provide an example? I thought the main problem is using everything on textmounts, because at the outputs are '\r' attached, everytime an output is made, thats also a kind of automode, but in the wrong direction. It seems to me, that the perl interpreter looks what mount type it is on and then automagically writes in that format, but it does it wrong. If a file has '\r\n' at the end of a line, there is another '\r' attached and again if the same procedure is repeated, so you get '\n\r\r\r\r\r\r\r' someday. I see no problems with the automode.o built in. I read in dosfiles on text and binary mounts and perl wrote them back as they are, in 'binary' mode, yes, but perl don't care about mount options no more, if it reads in '\n\r' in it puts the same out again, nothing additional attached, just like it should be. Christopher Faylor schrieb am 2001-08-25, 14:28: >On Sat, Aug 25, 2001 at 01:59:17PM -0400, Charles Wilson wrote: >>Maybe Chris' chomp() suggestion is the right thing. > >Except for the scripts that are still using chop(), of course. If i want to use such a script like it was posted, there should be no need to use chomp(), this works with automode.o and no chomps, no matter if file2.txt is text- or binmode, no matter if i'm on a text- or binmount. #!/usr/bin/perl # cr.lf.pl - testscript rename("file2.txt","file1.txt"); open(F1,"file1.txt"); open(F2,">file2.txt"); while() { # have to use chomp; chop; print F2 $_ . "\n"; to get it to work print F2; } close(F1); close(F2); Gerrit -- =^..^=