Re: End-of-line on the Mac?



Alf P. Steinbach wrote:
I don't have a Mac (I'm going to, it's the future, but not for now).

I've seen end-of-line on the Mac described as '\r' (C syntax).

But now, with OS/X being *nix-based, is it still that way, or is it now
'\n'?

The issue is that some C compilers will use \r and \n as abstractions,
others treat them to mean 0d and 0a. Even different ports of the same
compiler do different things.

On Macs EOL is traditionally carriage return ie 0d.
On *nix EOL is line feed 0a.
On Windows EOL is 0d 0a (this is the oldest convention)

Mappings are different though. In the *nix parts of MacOS X EOL is
0x0a I think.

In Cygwin line endings are normally also 0a, there is an option at
install time to set the line ending type. On Windows C compilers
though \n is translated to 0d 0a, even on GCC using Mingw.

To make things even more confusing many *nix and Mac programs will
accept Windows line ending because they are so common. Some Windows
programs accept *nix line endings too.

Really silly things have happened because of this. Some drivers in
Linux 1 kernels were found to have Windows line endings for example.
Similarly Perl source files written with mac line endings don't work on
the version of perl shipped in OS X.

.



Relevant Pages

  • [Full-Disclosure] FW: Mail delivery failed: returning message to sender
    ... I think something we are also forgetting is that statistically *nix ... from Best buy pre-loaded with windows XP and has no clue how to install ... By that I mean that previous Mac OSes weren't as ... The real key to prevalence of malware, IMNSHO, is the ease of attack ...
    (Full-Disclosure)
  • RE: Linux (in)security (Was: Re: [Full-Disclosure] Re: No Subject)
    ... I think something we are also forgetting is that statistically *nix ... from Best buy pre-loaded with windows XP and has no clue how to install ... By that I mean that previous Mac OSes weren't as ... The real key to prevalence of malware, IMNSHO, is the ease of attack ...
    (Full-Disclosure)
  • Re: OT: LINUX on home PC
    ... I have been using both XP and Linux. ... better off getting a Mac, which is Virus proof and you will ... windows without a heavy Geek background, as any of the *nix can be ... Windows XP, you can still run Windows Only programs. ...
    (rec.games.pinball)
  • Re: java and OS
    ... Usage on supercomputers, servers, business computers, or home computers? ... In the last two categories, the dominant OS is Windows XP, followed by Windows Vista, with a combined Windows total of somewhere in the mid-to-upper ... The first category is dominated by *nix computers in either the upper 80s or the low 90s, while the second category is the one I know the least about. ... By *nix I refer to pretty much anything not Windows or Mac. ...
    (comp.lang.java.programmer)
  • Re: to convert txt readable with simpletext@os9
    ... don't know why conversion would be necessary. ... Because Windows, Mac and Linux all have different ways of marking line ... If your file ONLY contains Mac Line Endings try the following ...
    (Ubuntu)