Re: DOS Newline Character

From: Lawrence DčOliveiro (ldo_at_geek-central.gen.new_zealand)
Date: 12/05/04


Date: Sun, 05 Dec 2004 17:54:03 +1300

In article <slrncr2p40.mr9.mcsuper5@jaguar.softshoppe.net>,
 "Michael C." <mcsuper5@usol.com> wrote:

>["Followup-To:" header set to alt.os.linux.]
>On Sat, 04 Dec 2004 15:00:55 +1300,
>Lawrence D1Oliveiro <ldo@geek-central.gen.new_zealand> wrote:
>> In article <slrncq355i.br9.sybrenUSE@sybren.thirdtower.com>,
>> Sybren Stuvel <sybrenUSE@YOURthirdtower.com.imagination> wrote:
>>
>> >ANSI C only tells us about "the OS-specific newline". Nowhere does it
>> >specify that "the newline specific to another OS" should be translated
>> >to a '\n'.
>> >
>> >If I'm wrong, please proove it, instead of repeating the same thing
>> >over and over again. Show us which lines of the ANSI C standard.
>>
>> It doesn't say "newline convention specific to the _current_ OS", does
>> it? It only says "OS-specific newline". Therefore _all_ OS-specific
>> newlines should be translated to \n, not just those specific to the
>> _current_ OS.
>
>Please tell me that you don't teach logic. Using that logic, I
>could write an OS that ended lines with a \b and any
>implementation of the standard would have to handle that
>correctly as well.

In practical terms, only if it got into common use. Then yes, we would
certainly have to deal with it. Otherwise we would just ignore you. :)

>It's unfortunate that we have three standards for EOL, but
>there's no reason that ANSI C should have to concern itself with
>handling cross-platform files.

It's a cross-platform world nowadays, like it or not.

For those who were putting up POSIX as an excuse for Linux not to have
to deal with this, it's worth pointing out that the Windows NT family is
officially POSIX-compliant, whereas as far as I know, Linux has not
passed POSIX compliance, nor is it likely ever to. So the idea that
POSIX compliance means that you musn't cope with line ending conventions
other than LF-only is a load of hogwash.

>It isn't too difficult to work around...

Agreed, but at present _every_ application has to reinvent the solution.
It's not too difficult to solve the problem in stdio once and for all.



Relevant Pages

  • Re: DOS Newline Character
    ... >> newlines should be translated to \n, not just those specific to the ... >handling cross-platform files. ... For those who were putting up POSIX as an excuse for Linux not to have ... POSIX compliance means that you musn't cope with line ending conventions ...
    (comp.os.linux.misc)
  • Re: DOS Newline Character
    ... to justify only treating linefeeds as newlines is that the Windows ... NT/200x/XP family has officially passed POSIX compliance, ... conventions other than LF-only, why can't Linux? ...
    (alt.os.linux)
  • Re: DOS Newline Character
    ... to justify only treating linefeeds as newlines is that the Windows ... NT/200x/XP family has officially passed POSIX compliance, ... conventions other than LF-only, why can't Linux? ...
    (comp.os.linux.misc)
  • Re: Free UNIX for non-commerical use.
    ... "Unix" are interchangeable in regular conversation, but if you get picky most ... People think linux is an idealistic system. ... POSIX compliance is certainly an ... allowed to call gets, ever, no matter what the POSIX standards say. ...
    (comp.unix.solaris)
  • Re: Free UNIX for non-commerical use.
    ... "Unix" are interchangeable in regular conversation, but if you get picky most ... People think linux is an idealistic system. ... POSIX compliance is certainly an ... allowed to call gets, ever, no matter what the POSIX standards say. ...
    (comp.sys.hp.hpux)

Loading