Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Thoughts on designing a file format.

by jonadab (Parson)
on Sep 13, 2005 at 17:30 UTC ( [id://491642]=note: print w/replies, xml ) Need Help??


in reply to Re: Thoughts on designing a file format.
in thread Thoughts on designing a file format.

I read a paper once that explained very clearly why the two character line endings (CR, LF) in DOS was a mistake

Now, let me explain why two-character line endings in DOS was *not* a mistake...

First, you have to understand where the CRLF came from. It was not invented for DOS. It actually comes from a strict interpretation of the ASCII standard; CR returns the carraige to the left, but does not feed a line. LF feeds a line, but does not return to the left. Granted, the notion of wanting just a CR or just an LF in a text file is fairly absurd, but ASCII was not designed *just* for files; it was designed to also be suitable for communicating with devices such as terminals and character printers. (Most thermal receipt printers today are still charset printers like this (ASCII printers are still quite common in the US), and many impact printers as well.)

Now, DOS *could* have used one-character line endings for text files on disk, sure. But then the files would have needed to be translated by a driver for sending to printers. This means running a daemon on the system. Bear in mind, DOS was a single-tasking system. It was possible to run something like a daemon (these were usually called TSRs by DOS users, after an API call ("interrupt routine" in DOS terminology) that many of them used), but it was undesirable to have very many. Hardware drivers of this nature were particularly undesirable.

So DOS was designed to use *exactly* the same standards in its text files as the text printers used, as per the ASCII standard. This means that vtab and htab, CR and LF, and also pagefeed, needed to have the same semantics that the ASCII standard gave them for printers. One upshot of this is that printing is as simple as chucking the file in the general direction of the parallel port.

  • Comment on Re: Thoughts on designing a file format.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://491642]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-18 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found