View Single Post
  #3  
Old November 9th, 2000, 11:41 AM
Vroomfondel Vroomfondel is offline
Registered User
 
Join Date: Oct 2000
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Vroomfondel is on a distinguished road
Exclamation

My glib 'use vi' remark made me think of a can o' worms waiting to pounce
on unwary MacOS X users: Classic uses ^M as the end of line while BSD use
^J. I..e, there are two flavors of text files on your system and half the tools
aren't ready to deal with the text files created by the other half.

Is there a tool on MacOS X to convert the end-of-line characters one way
or the other? I don't even have Classic installed, so everything I'm doing
uses the Unix flavor text format (unless I download something from on
of my other Macs over the net). I've got a little command-line app I
wrote similar to

#include <stdio.h>
void main( void )
{
int x;
while ( ( x = getchar() ) != EOF )
{
switch( x ) {
case '\r': x = '\n'; break;
case '\n': x = '\r'; break;
}
putchar( x );
}
}

to deal with the situation (note: I typed the above code in off-the-cuff and
haven't compiled it; it seems OK, but it may not work).

This problem is yet another indication of the half-baked nature of MacOS X.
Reply With Quote