This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Carriage Returns

> -----Original Message-----
> From: cygwin-owner On Behalf Of John Kramer
> Sent: 18 June 2004 17:33
> To: cygwin
> Subject: Carriage Returns

> To whom it may concern:
> I have a real problem with the way that cygwin/cygwin's 
> version of perl 
> handles carriage returns (\r).

  No, you have a problem with Cygwin, Unix, Linux, and every other POSIX
compliant system in the world.  

>  I stripped newlines from the input, 

  What on earth persuaded you to remove vital end-of-line characters from
your UNIX-formatted text files?  I mean, surely you wouldn't write a post
here saying "I stripped the alphabetic characters from the input and
suddenly all my text disappeared!  Cygwin sux0rs!"

> Eventually I 
> figured out that cygwin takes the carriage return 
> *literally*.  It really 
> goes back to the beginning of the same line if there is no 
> newline.  Does 
> that really make sense?  

  Well of course it does.  That's why it's *called* carriage return.  It
does exactly what it says on the tin.  The reason it goes back to the
beginning of the line "as if there is no newline" is because there is,
indeed, no newline.  You stripped them all out, remember?

> Shouldn't it just treat the carriage 
> return as a 
> newline?  

  What would be the point of having separate carriage returns and line feeds
only to treat them as if they were the same thing?

> I ran the same program with the (dos formatted) 
> input files on a 
> redhat linux machine.  The carriage returns are completely 
> ignored (which 
> would be reasonable behavior for cygwin, too). 

  But if you had stripped all the linefeeds out on the redhat machine, you'd
still have garbled output.  If it was ignoring them completely, everything
would be printed as one long long line with no breaks.  Then you would have
written to redhat complaining?

> If there are 
> good reasons 
> for the way cygwin handles carriage returns, let me know.  

  Because that's how they work.  Because that's what's conformant with
POSIX.  Because Cygwin is a posix-emulation layer, and if you want windows
behaviour, that already came installed on your machine, and making cygwin
emulate windows would be pretty pointless.

> Else, I suggest 
> that you change this behavior for the next release.

  I suggest you do some research into the subject.  CR and LF are two
different things and it's daft to complain that they don't both do the same
thing just because you personally want to have the ability to use the wrong
one for a given situation!  Googling for "unix vs. dos line endings" should
find you something informative.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]